From f83bc80d2d76d587a2f0bd63a1a07e6f07d0341a Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 09:51:54 +0000 Subject: [PATCH 1/2] feat: support regapic LRO Use gapic-generator-typescript v2.15.1. PiperOrigin-RevId: 456946341 Source-Link: https://github.com/googleapis/googleapis/commit/88fd18d9d3b872b3d06a3d9392879f50b5bf3ce5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/accfa371f667439313335c64042b063c1c53102e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWNjZmEzNzFmNjY3NDM5MzEzMzM1YzY0MDQyYjA2M2MxYzUzMTAyZSJ9 --- owl-bot-staging/v1/.eslintignore | 7 + owl-bot-staging/v1/.eslintrc.json | 3 + owl-bot-staging/v1/.gitignore | 14 + owl-bot-staging/v1/.jsdoc.js | 55 + owl-bot-staging/v1/.mocharc.js | 33 + owl-bot-staging/v1/.prettierrc.js | 22 + owl-bot-staging/v1/README.md | 1 + owl-bot-staging/v1/linkinator.config.json | 16 + owl-bot-staging/v1/package.json | 64 + .../cloud/video/transcoder/v1/resources.proto | 1095 ++++++++++++++ .../cloud/video/transcoder/v1/services.proto | 281 ++++ ...data.google.cloud.video.transcoder.v1.json | 387 +++++ .../v1/transcoder_service.create_job.js | 64 + .../transcoder_service.create_job_template.js | 72 + .../v1/transcoder_service.delete_job.js | 64 + .../transcoder_service.delete_job_template.js | 64 + .../v1/transcoder_service.get_job.js | 59 + .../v1/transcoder_service.get_job_template.js | 60 + .../transcoder_service.list_job_templates.js | 80 + .../v1/transcoder_service.list_jobs.js | 79 + owl-bot-staging/v1/src/index.ts | 25 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 111 ++ owl-bot-staging/v1/src/v1/index.ts | 19 + .../v1/src/v1/transcoder_service_client.ts | 1303 ++++++++++++++++ .../v1/transcoder_service_client_config.json | 66 + .../src/v1/transcoder_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 + .../v1/test/gapic_transcoder_service_v1.ts | 1343 +++++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + 32 files changed, 5582 insertions(+) create mode 100644 owl-bot-staging/v1/.eslintignore create mode 100644 owl-bot-staging/v1/.eslintrc.json create mode 100644 owl-bot-staging/v1/.gitignore create mode 100644 owl-bot-staging/v1/.jsdoc.js create mode 100644 owl-bot-staging/v1/.mocharc.js create mode 100644 owl-bot-staging/v1/.prettierrc.js create mode 100644 owl-bot-staging/v1/README.md create mode 100644 owl-bot-staging/v1/linkinator.config.json create mode 100644 owl-bot-staging/v1/package.json create mode 100644 owl-bot-staging/v1/protos/google/cloud/video/transcoder/v1/resources.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/video/transcoder/v1/services.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.video.transcoder.v1.json create mode 100644 owl-bot-staging/v1/samples/generated/v1/transcoder_service.create_job.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/transcoder_service.create_job_template.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/transcoder_service.delete_job.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/transcoder_service.delete_job_template.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/transcoder_service.get_job.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/transcoder_service.get_job_template.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/transcoder_service.list_job_templates.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/transcoder_service.list_jobs.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/transcoder_service_client.ts create mode 100644 owl-bot-staging/v1/src/v1/transcoder_service_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/transcoder_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_transcoder_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..1c49b86 --- /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/video-transcoder', + 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..16c2e41 --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Transcoder: 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..0a8aeb4 --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/video-transcoder", + "version": "0.1.0", + "description": "Transcoder client for Node.js", + "repository": "googleapis/nodejs-transcoder", + "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 transcoder", + "transcoder", + "transcoder service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.1.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/video/transcoder/v1/resources.proto b/owl-bot-staging/v1/protos/google/cloud/video/transcoder/v1/resources.proto new file mode 100644 index 0000000..ce3824b --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/video/transcoder/v1/resources.proto @@ -0,0 +1,1095 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.video.transcoder.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/status.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1;transcoder"; +option java_multiple_files = true; +option java_outer_classname = "ResourcesProto"; +option java_package = "com.google.cloud.video.transcoder.v1"; + +// Transcoding job resource. +message Job { + option (google.api.resource) = { + type: "transcoder.googleapis.com/Job" + pattern: "projects/{project}/locations/{location}/jobs/{job}" + }; + + // The current state of the job. + enum ProcessingState { + // The processing state is not specified. + PROCESSING_STATE_UNSPECIFIED = 0; + + // The job is enqueued and will be picked up for processing soon. + PENDING = 1; + + // The job is being processed. + RUNNING = 2; + + // The job has been completed successfully. + SUCCEEDED = 3; + + // The job has failed. For additional information, see `failure_reason` and + // `failure_details` + FAILED = 4; + } + + // The resource name of the job. + // Format: `projects/{project_number}/locations/{location}/jobs/{job}` + string name = 1; + + // Input only. Specify the `input_uri` to populate empty `uri` fields in each element of + // `Job.config.inputs` or `JobTemplate.config.inputs` when using template. + // URI of the media. Input files must be at least 5 seconds in duration and + // stored in Cloud Storage (for example, `gs://bucket/inputs/file.mp4`). See + // [Supported input and output + // formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + string input_uri = 2 [(google.api.field_behavior) = INPUT_ONLY]; + + // Input only. Specify the `output_uri` to populate an empty `Job.config.output.uri` or + // `JobTemplate.config.output.uri` when using template. + // URI for the output file(s). For example, `gs://my-bucket/outputs/`. See + // [Supported input and output + // formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + string output_uri = 3 [(google.api.field_behavior) = INPUT_ONLY]; + + // Specify the `job_config` for the transcoding job. If you don't specify the + // `job_config`, the API selects `templateId`; this template ID is set to + // `preset/web-hd` by default. When you use a `template_id` to create a job, + // the `Job.config` is populated by the `JobTemplate.config`.
+ oneof job_config { + // Input only. Specify the `template_id` to use for populating `Job.config`. The default + // is `preset/web-hd`. + // + // Preset Transcoder templates: + // - `preset/{preset_id}` + // + // - User defined JobTemplate: + // `{job_template_id}` + string template_id = 4 [(google.api.field_behavior) = INPUT_ONLY]; + + // The configuration for this job. + JobConfig config = 5; + } + + // Output only. The current state of the job. + ProcessingState state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the job was created. + google.protobuf.Timestamp create_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the transcoding started. + google.protobuf.Timestamp start_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the transcoding finished. + google.protobuf.Timestamp end_time = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Job time to live value in days, which will be effective after job + // completion. Job should be deleted automatically after the given TTL. Enter + // a value between 1 and 90. The default is 30. + int32 ttl_after_completion_days = 15; + + // The labels associated with this job. You can use these to organize and + // group your jobs. + map labels = 16; + + // Output only. An error object that describes the reason for the failure. + // This property is always present when `state` is `FAILED`. + google.rpc.Status error = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Transcoding job template resource. +message JobTemplate { + option (google.api.resource) = { + type: "transcoder.googleapis.com/JobTemplate" + pattern: "projects/{project}/locations/{location}/jobTemplates/{job_template}" + }; + + // The resource name of the job template. + // Format: + // `projects/{project_number}/locations/{location}/jobTemplates/{job_template}` + string name = 1; + + // The configuration for this template. + JobConfig config = 2; + + // The labels associated with this job template. You can use these to organize + // and group your job templates. + map labels = 3; +} + +// Job configuration +message JobConfig { + // List of input assets stored in Cloud Storage. + repeated Input inputs = 1; + + // List of `Edit atom`s. Defines the ultimate timeline of the resulting + // file or manifest. + repeated EditAtom edit_list = 2; + + // List of elementary streams. + repeated ElementaryStream elementary_streams = 3; + + // List of multiplexing settings for output streams. + repeated MuxStream mux_streams = 4; + + // List of output manifests. + repeated Manifest manifests = 5; + + // Output configuration. + Output output = 6; + + // List of ad breaks. Specifies where to insert ad break tags in the output + // manifests. + repeated AdBreak ad_breaks = 7; + + // Destination on Pub/Sub. + PubsubDestination pubsub_destination = 8; + + // List of output sprite sheets. + // Spritesheets require at least one VideoStream in the Jobconfig. + repeated SpriteSheet sprite_sheets = 9; + + // List of overlays on the output video, in descending Z-order. + repeated Overlay overlays = 10; +} + +// Input asset. +message Input { + // A unique key for this input. Must be specified when using advanced + // mapping and edit lists. + string key = 1; + + // URI of the media. Input files must be at least 5 seconds in duration and + // stored in Cloud Storage (for example, `gs://bucket/inputs/file.mp4`). + // If empty, the value is populated from `Job.input_uri`. See + // [Supported input and output + // formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + string uri = 2; + + // Preprocessing configurations. + PreprocessingConfig preprocessing_config = 3; +} + +// Location of output file(s) in a Cloud Storage bucket. +message Output { + // URI for the output file(s). For example, `gs://my-bucket/outputs/`. + // If empty, the value is populated from `Job.output_uri`. See + // [Supported input and output + // formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). + string uri = 1; +} + +// Edit atom. +message EditAtom { + // A unique key for this atom. Must be specified when using advanced + // mapping. + string key = 1; + + // List of `Input.key`s identifying files that should be used in this atom. + // The listed `inputs` must have the same timeline. + repeated string inputs = 2; + + // End time in seconds for the atom, relative to the input file timeline. + // When `end_time_offset` is not specified, the `inputs` are used until + // the end of the atom. + google.protobuf.Duration end_time_offset = 3; + + // Start time in seconds for the atom, relative to the input file timeline. + // The default is `0s`. + google.protobuf.Duration start_time_offset = 4; +} + +// Ad break. +message AdBreak { + // Start time in seconds for the ad break, relative to the output file + // timeline. The default is `0s`. + google.protobuf.Duration start_time_offset = 1; +} + +// Encoding of an input file such as an audio, video, or text track. +// Elementary streams must be packaged before +// mapping and sharing between different output formats. +message ElementaryStream { + // A unique key for this elementary stream. + string key = 4; + + // Encoding of an audio, video, or text track. + oneof elementary_stream { + // Encoding of a video stream. + VideoStream video_stream = 1; + + // Encoding of an audio stream. + AudioStream audio_stream = 2; + + // Encoding of a text stream. For example, closed captions or subtitles. + TextStream text_stream = 3; + } +} + +// Multiplexing settings for output stream. +message MuxStream { + // A unique key for this multiplexed stream. HLS media manifests will be + // named `MuxStream.key` with the `.m3u8` extension suffix. + string key = 1; + + // The name of the generated file. The default is `MuxStream.key` with the + // extension suffix corresponding to the `MuxStream.container`. + // + // Individual segments also have an incremental 10-digit zero-padded suffix + // starting from 0 before the extension, such as `mux_stream0000000123.ts`. + string file_name = 2; + + // The container format. The default is `mp4` + // + // Supported container formats: + // + // - `ts` + // - `fmp4`- the corresponding file extension is `.m4s` + // - `mp4` + // - `vtt` + // + // See also: + // [Supported input and output + // formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats) + string container = 3; + + // List of `ElementaryStream.key`s multiplexed in this stream. + repeated string elementary_streams = 4; + + // Segment settings for `ts`, `fmp4` and `vtt`. + SegmentSettings segment_settings = 5; +} + +// Manifest configuration. +message Manifest { + // The manifest type can be either `HLS` or `DASH`. + enum ManifestType { + // The manifest type is not specified. + MANIFEST_TYPE_UNSPECIFIED = 0; + + // Create `HLS` manifest. The corresponding file extension is `.m3u8`. + HLS = 1; + + // Create `DASH` manifest. The corresponding file extension is `.mpd`. + DASH = 2; + } + + // The name of the generated file. The default is `manifest` with the + // extension suffix corresponding to the `Manifest.type`. + string file_name = 1; + + // Required. Type of the manifest, can be `HLS` or `DASH`. + ManifestType type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. List of user given `MuxStream.key`s that should appear in this manifest. + // + // When `Manifest.type` is `HLS`, a media manifest with name `MuxStream.key` + // and `.m3u8` extension is generated for each element of the + // `Manifest.mux_streams`. + repeated string mux_streams = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// A Pub/Sub destination. +message PubsubDestination { + // The name of the Pub/Sub topic to publish job completion notification + // to. For example: `projects/{project}/topics/{topic}`. + string topic = 1; +} + +// Sprite sheet configuration. +message SpriteSheet { + // Format type. The default is `jpeg`. + // + // Supported formats: + // + // - `jpeg` + string format = 1; + + // Required. File name prefix for the generated sprite sheets. + // + // Each sprite sheet has an incremental 10-digit zero-padded suffix starting + // from 0 before the extension, such as `sprite_sheet0000000123.jpeg`. + string file_prefix = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The width of sprite in pixels. Must be an even integer. To preserve the + // source aspect ratio, set the [SpriteSheet.sprite_width_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_width_pixels] field or + // the [SpriteSheet.sprite_height_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_height_pixels] field, but not both (the API will + // automatically calculate the missing field). + int32 sprite_width_pixels = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The height of sprite in pixels. Must be an even integer. To preserve the + // source aspect ratio, set the [SpriteSheet.sprite_height_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_height_pixels] field or + // the [SpriteSheet.sprite_width_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_width_pixels] field, but not both (the API will + // automatically calculate the missing field). + int32 sprite_height_pixels = 4 [(google.api.field_behavior) = REQUIRED]; + + // The maximum number of sprites per row in a sprite sheet. The default is 0, + // which indicates no maximum limit. + int32 column_count = 5; + + // The maximum number of rows per sprite sheet. When the sprite sheet is full, + // a new sprite sheet is created. The default is 0, which indicates no maximum + // limit. + int32 row_count = 6; + + // Start time in seconds, relative to the output file timeline. Determines the + // first sprite to pick. The default is `0s`. + google.protobuf.Duration start_time_offset = 7; + + // End time in seconds, relative to the output file timeline. When + // `end_time_offset` is not specified, the sprites are generated until the end + // of the output file. + google.protobuf.Duration end_time_offset = 8; + + // Specify either total number of sprites or interval to create sprites. + oneof extraction_strategy { + // Total number of sprites. Create the specified number of sprites + // distributed evenly across the timeline of the output media. The default + // is 100. + int32 total_count = 9; + + // Starting from `0s`, create sprites at regular intervals. Specify the + // interval value in seconds. + google.protobuf.Duration interval = 10; + } + + // The quality of the generated sprite sheet. Enter a value between 1 + // and 100, where 1 is the lowest quality and 100 is the highest quality. + // The default is 100. A high quality value corresponds to a low image data + // compression ratio. + int32 quality = 11; +} + +// Overlay configuration. +message Overlay { + // 2D normalized coordinates. Default: `{0.0, 0.0}` + message NormalizedCoordinate { + // Normalized x coordinate. + double x = 1; + + // Normalized y coordinate. + double y = 2; + } + + // Overlaid jpeg image. + message Image { + // Required. URI of the JPEG image in Cloud Storage. For example, + // `gs://bucket/inputs/image.jpeg`. JPEG is the only supported image type. + string uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Normalized image resolution, based on output video resolution. Valid + // values: `0.0`–`1.0`. To respect the original image aspect ratio, set + // either `x` or `y` to `0.0`. To use the original image resolution, set + // both `x` and `y` to `0.0`. + NormalizedCoordinate resolution = 2; + + // Target image opacity. Valid values are from `1.0` (solid, default) to + // `0.0` (transparent), exclusive. Set this to a value greater than `0.0`. + double alpha = 3; + } + + // Display static overlay object. + message AnimationStatic { + // Normalized coordinates based on output video resolution. Valid + // values: `0.0`–`1.0`. `xy` is the upper-left coordinate of the overlay + // object. For example, use the x and y coordinates {0,0} to position the + // top-left corner of the overlay animation in the top-left corner of the + // output video. + NormalizedCoordinate xy = 1; + + // The time to start displaying the overlay object, in seconds. Default: 0 + google.protobuf.Duration start_time_offset = 2; + } + + // Fade type for the overlay: `FADE_IN` or `FADE_OUT`. + enum FadeType { + // The fade type is not specified. + FADE_TYPE_UNSPECIFIED = 0; + + // Fade the overlay object into view. + FADE_IN = 1; + + // Fade the overlay object out of view. + FADE_OUT = 2; + } + + // Display overlay object with fade animation. + message AnimationFade { + // Required. Type of fade animation: `FADE_IN` or `FADE_OUT`. + FadeType fade_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Normalized coordinates based on output video resolution. Valid + // values: `0.0`–`1.0`. `xy` is the upper-left coordinate of the overlay + // object. For example, use the x and y coordinates {0,0} to position the + // top-left corner of the overlay animation in the top-left corner of the + // output video. + NormalizedCoordinate xy = 2; + + // The time to start the fade animation, in seconds. Default: 0 + google.protobuf.Duration start_time_offset = 3; + + // The time to end the fade animation, in seconds. Default: + // `start_time_offset` + 1s + google.protobuf.Duration end_time_offset = 4; + } + + // End previous overlay animation from the video. Without AnimationEnd, the + // overlay object will keep the state of previous animation until the end of + // the video. + message AnimationEnd { + // The time to end overlay object, in seconds. Default: 0 + google.protobuf.Duration start_time_offset = 1; + } + + // Animation types. + message Animation { + // Animations can be static or fade, or they can end the previous animation. + oneof animation_type { + // Display static overlay object. + AnimationStatic animation_static = 1; + + // Display overlay object with fade animation. + AnimationFade animation_fade = 2; + + // End previous animation. + AnimationEnd animation_end = 3; + } + } + + // Image overlay. + Image image = 1; + + // List of Animations. The list should be chronological, without any time + // overlap. + repeated Animation animations = 2; +} + +// Preprocessing configurations. +message PreprocessingConfig { + // Color preprocessing configuration. + // + // **Note:** This configuration is not supported. + message Color { + // Control color saturation of the video. Enter a value between -1 and 1, + // where -1 is fully desaturated and 1 is maximum saturation. 0 is no + // change. The default is 0. + double saturation = 1; + + // Control black and white contrast of the video. Enter a value between -1 + // and 1, where -1 is minimum contrast and 1 is maximum contrast. 0 is no + // change. The default is 0. + double contrast = 2; + + // Control brightness of the video. Enter a value between -1 and 1, where -1 + // is minimum brightness and 1 is maximum brightness. 0 is no change. The + // default is 0. + double brightness = 3; + } + + // Denoise preprocessing configuration. + // + // **Note:** This configuration is not supported. + message Denoise { + // Set strength of the denoise. Enter a value between 0 and 1. The higher + // the value, the smoother the image. 0 is no denoising. The default is 0. + double strength = 1; + + // Set the denoiser mode. The default is `standard`. + // + // Supported denoiser modes: + // + // - `standard` + // - `grain` + string tune = 2; + } + + // Deblock preprocessing configuration. + // + // **Note:** This configuration is not supported. + message Deblock { + // Set strength of the deblocker. Enter a value between 0 and 1. The higher + // the value, the stronger the block removal. 0 is no deblocking. The + // default is 0. + double strength = 1; + + // Enable deblocker. The default is `false`. + bool enabled = 2; + } + + // Audio preprocessing configuration. + message Audio { + // Specify audio loudness normalization in loudness units relative to full + // scale (LUFS). Enter a value between -24 and 0 (the default), where: + // + // * -24 is the Advanced Television Systems Committee (ATSC A/85) standard + // * -23 is the EU R128 broadcast standard + // * -19 is the prior standard for online mono audio + // * -18 is the ReplayGain standard + // * -16 is the prior standard for stereo audio + // * -14 is the new online audio standard recommended by Spotify, as well + // as Amazon Echo + // * 0 disables normalization + double lufs = 1; + + // Enable boosting high frequency components. The default is `false`. + // + // **Note:** This field is not supported. + bool high_boost = 2; + + // Enable boosting low frequency components. The default is `false`. + // + // **Note:** This field is not supported. + bool low_boost = 3; + } + + // Video cropping configuration for the input video. The cropped input video + // is scaled to match the output resolution. + message Crop { + // The number of pixels to crop from the top. The default is 0. + int32 top_pixels = 1; + + // The number of pixels to crop from the bottom. The default is 0. + int32 bottom_pixels = 2; + + // The number of pixels to crop from the left. The default is 0. + int32 left_pixels = 3; + + // The number of pixels to crop from the right. The default is 0. + int32 right_pixels = 4; + } + + // Pad filter configuration for the input video. The padded input video + // is scaled after padding with black to match the output resolution. + message Pad { + // The number of pixels to add to the top. The default is 0. + int32 top_pixels = 1; + + // The number of pixels to add to the bottom. The default is 0. + int32 bottom_pixels = 2; + + // The number of pixels to add to the left. The default is 0. + int32 left_pixels = 3; + + // The number of pixels to add to the right. The default is 0. + int32 right_pixels = 4; + } + + // Color preprocessing configuration. + Color color = 1; + + // Denoise preprocessing configuration. + Denoise denoise = 2; + + // Deblock preprocessing configuration. + Deblock deblock = 3; + + // Audio preprocessing configuration. + Audio audio = 4; + + // Specify the video cropping configuration. + Crop crop = 5; + + // Specify the video pad filter configuration. + Pad pad = 6; +} + +// Video stream resource. +message VideoStream { + // H264 codec settings. + message H264CodecSettings { + // The width of the video in pixels. Must be an even integer. + // When not specified, the width is adjusted to match the specified height + // and input aspect ratio. If both are omitted, the input width is used. + int32 width_pixels = 1; + + // The height of the video in pixels. Must be an even integer. + // When not specified, the height is adjusted to match the specified width + // and input aspect ratio. If both are omitted, the input height is used. + int32 height_pixels = 2; + + // Required. The target video frame rate in frames per second (FPS). Must be less than + // or equal to 120. Will default to the input frame rate if larger than the + // input frame rate. The API will generate an output FPS that is divisible + // by the input FPS, and smaller or equal to the target FPS. See + // [Calculating frame + // rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + // more information. + double frame_rate = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The video bitrate in bits per second. The minimum value is 1,000. + // The maximum value is 800,000,000. + int32 bitrate_bps = 4 [(google.api.field_behavior) = REQUIRED]; + + // Pixel format to use. The default is `yuv420p`. + // + // Supported pixel formats: + // + // - `yuv420p` pixel format + // - `yuv422p` pixel format + // - `yuv444p` pixel format + // - `yuv420p10` 10-bit HDR pixel format + // - `yuv422p10` 10-bit HDR pixel format + // - `yuv444p10` 10-bit HDR pixel format + // - `yuv420p12` 12-bit HDR pixel format + // - `yuv422p12` 12-bit HDR pixel format + // - `yuv444p12` 12-bit HDR pixel format + string pixel_format = 5; + + // Specify the `rate_control_mode`. The default is `vbr`. + // + // Supported rate control modes: + // + // - `vbr` - variable bitrate + // - `crf` - constant rate factor + string rate_control_mode = 6; + + // Target CRF level. Must be between 10 and 36, where 10 is the highest + // quality and 36 is the most efficient compression. The default is 21. + int32 crf_level = 7; + + // Specifies whether an open Group of Pictures (GOP) structure should be + // allowed or not. The default is `false`. + bool allow_open_gop = 8; + + // GOP mode can be either by frame count or duration. + oneof gop_mode { + // Select the GOP size based on the specified frame count. Must be greater + // than zero. + int32 gop_frame_count = 9; + + // Select the GOP size based on the specified duration. The default is + // `3s`. Note that `gopDuration` must be less than or equal to + // [`segmentDuration`](#SegmentSettings), and + // [`segmentDuration`](#SegmentSettings) must be divisible by + // `gopDuration`. + google.protobuf.Duration gop_duration = 10; + } + + // Use two-pass encoding strategy to achieve better video quality. + // `VideoStream.rate_control_mode` must be `vbr`. The default is `false`. + bool enable_two_pass = 11; + + // Size of the Video Buffering Verifier (VBV) buffer in bits. Must be + // greater than zero. The default is equal to `VideoStream.bitrate_bps`. + int32 vbv_size_bits = 12; + + // Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. + // Must be greater than zero. The default is equal to 90% of + // `VideoStream.vbv_size_bits`. + int32 vbv_fullness_bits = 13; + + // The entropy coder to use. The default is `cabac`. + // + // Supported entropy coders: + // + // - `cavlc` + // - `cabac` + string entropy_coder = 14; + + // Allow B-pyramid for reference frame selection. This may not be supported + // on all decoders. The default is `false`. + bool b_pyramid = 15; + + // The number of consecutive B-frames. Must be greater than or equal to + // zero. Must be less than `VideoStream.gop_frame_count` if set. The default + // is 0. + int32 b_frame_count = 16; + + // Specify the intensity of the adaptive quantizer (AQ). Must be between 0 + // and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A + // higher value equals a lower bitrate but smoother image. The default is 0. + double aq_strength = 17; + + // Enforces the specified codec profile. The following profiles are + // supported: + // + // * `baseline` + // * `main` + // * `high` (default) + // + // The available options are + // [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). + // Note that certain values for this field may cause the + // transcoder to override other fields you set in the `H264CodecSettings` + // message. + string profile = 18; + + // Enforces the specified codec tune. The available options are + // [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). + // Note that certain values for this field may cause the + // transcoder to override other fields you set in the `H264CodecSettings` + // message. + string tune = 19; + + // Enforces the specified codec preset. The default is `veryfast`. The + // available options are + // [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Preset). + // Note that certain values for this field may cause the + // transcoder to override other fields you set in the `H264CodecSettings` + // message. + string preset = 20; + } + + // H265 codec settings. + message H265CodecSettings { + // The width of the video in pixels. Must be an even integer. + // When not specified, the width is adjusted to match the specified height + // and input aspect ratio. If both are omitted, the input width is used. + int32 width_pixels = 1; + + // The height of the video in pixels. Must be an even integer. + // When not specified, the height is adjusted to match the specified width + // and input aspect ratio. If both are omitted, the input height is used. + int32 height_pixels = 2; + + // Required. The target video frame rate in frames per second (FPS). Must be less than + // or equal to 120. Will default to the input frame rate if larger than the + // input frame rate. The API will generate an output FPS that is divisible + // by the input FPS, and smaller or equal to the target FPS. See + // [Calculating frame + // rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + // more information. + double frame_rate = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The video bitrate in bits per second. The minimum value is 1,000. + // The maximum value is 800,000,000. + int32 bitrate_bps = 4 [(google.api.field_behavior) = REQUIRED]; + + // Pixel format to use. The default is `yuv420p`. + // + // Supported pixel formats: + // + // - `yuv420p` pixel format + // - `yuv422p` pixel format + // - `yuv444p` pixel format + // - `yuv420p10` 10-bit HDR pixel format + // - `yuv422p10` 10-bit HDR pixel format + // - `yuv444p10` 10-bit HDR pixel format + // - `yuv420p12` 12-bit HDR pixel format + // - `yuv422p12` 12-bit HDR pixel format + // - `yuv444p12` 12-bit HDR pixel format + string pixel_format = 5; + + // Specify the `rate_control_mode`. The default is `vbr`. + // + // Supported rate control modes: + // + // - `vbr` - variable bitrate + // - `crf` - constant rate factor + string rate_control_mode = 6; + + // Target CRF level. Must be between 10 and 36, where 10 is the highest + // quality and 36 is the most efficient compression. The default is 21. + int32 crf_level = 7; + + // Specifies whether an open Group of Pictures (GOP) structure should be + // allowed or not. The default is `false`. + bool allow_open_gop = 8; + + // GOP mode can be either by frame count or duration. + oneof gop_mode { + // Select the GOP size based on the specified frame count. Must be greater + // than zero. + int32 gop_frame_count = 9; + + // Select the GOP size based on the specified duration. The default is + // `3s`. Note that `gopDuration` must be less than or equal to + // [`segmentDuration`](#SegmentSettings), and + // [`segmentDuration`](#SegmentSettings) must be divisible by + // `gopDuration`. + google.protobuf.Duration gop_duration = 10; + } + + // Use two-pass encoding strategy to achieve better video quality. + // `VideoStream.rate_control_mode` must be `vbr`. The default is `false`. + bool enable_two_pass = 11; + + // Size of the Video Buffering Verifier (VBV) buffer in bits. Must be + // greater than zero. The default is equal to `VideoStream.bitrate_bps`. + int32 vbv_size_bits = 12; + + // Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. + // Must be greater than zero. The default is equal to 90% of + // `VideoStream.vbv_size_bits`. + int32 vbv_fullness_bits = 13; + + // Allow B-pyramid for reference frame selection. This may not be supported + // on all decoders. The default is `false`. + bool b_pyramid = 14; + + // The number of consecutive B-frames. Must be greater than or equal to + // zero. Must be less than `VideoStream.gop_frame_count` if set. The default + // is 0. + int32 b_frame_count = 15; + + // Specify the intensity of the adaptive quantizer (AQ). Must be between 0 + // and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A + // higher value equals a lower bitrate but smoother image. The default is 0. + double aq_strength = 16; + + // Enforces the specified codec profile. The following profiles are + // supported: + // + // * 8-bit profiles + // * `main` (default) + // * `main-intra` + // * `mainstillpicture` + // * 10-bit profiles + // * `main10` (default) + // * `main10-intra` + // * `main422-10` + // * `main422-10-intra` + // * `main444-10` + // * `main444-10-intra` + // * 12-bit profiles + // * `main12` (default) + // * `main12-intra` + // * `main422-12` + // * `main422-12-intra` + // * `main444-12` + // * `main444-12-intra` + // + // The available options are + // [FFmpeg-compatible](https://x265.readthedocs.io/). + // Note that certain values for this field may cause the + // transcoder to override other fields you set in the `H265CodecSettings` + // message. + string profile = 17; + + // Enforces the specified codec tune. The available options are + // [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.265). + // Note that certain values for this field may cause the + // transcoder to override other fields you set in the `H265CodecSettings` + // message. + string tune = 18; + + // Enforces the specified codec preset. The default is `veryfast`. The + // available options are + // [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.265). + // Note that certain values for this field may cause the + // transcoder to override other fields you set in the `H265CodecSettings` + // message. + string preset = 19; + } + + // VP9 codec settings. + message Vp9CodecSettings { + // The width of the video in pixels. Must be an even integer. + // When not specified, the width is adjusted to match the specified height + // and input aspect ratio. If both are omitted, the input width is used. + int32 width_pixels = 1; + + // The height of the video in pixels. Must be an even integer. + // When not specified, the height is adjusted to match the specified width + // and input aspect ratio. If both are omitted, the input height is used. + int32 height_pixels = 2; + + // Required. The target video frame rate in frames per second (FPS). Must be less than + // or equal to 120. Will default to the input frame rate if larger than the + // input frame rate. The API will generate an output FPS that is divisible + // by the input FPS, and smaller or equal to the target FPS. See + // [Calculating frame + // rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for + // more information. + double frame_rate = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The video bitrate in bits per second. The minimum value is 1,000. + // The maximum value is 480,000,000. + int32 bitrate_bps = 4 [(google.api.field_behavior) = REQUIRED]; + + // Pixel format to use. The default is `yuv420p`. + // + // Supported pixel formats: + // + // - `yuv420p` pixel format + // - `yuv422p` pixel format + // - `yuv444p` pixel format + // - `yuv420p10` 10-bit HDR pixel format + // - `yuv422p10` 10-bit HDR pixel format + // - `yuv444p10` 10-bit HDR pixel format + // - `yuv420p12` 12-bit HDR pixel format + // - `yuv422p12` 12-bit HDR pixel format + // - `yuv444p12` 12-bit HDR pixel format + string pixel_format = 5; + + // Specify the `rate_control_mode`. The default is `vbr`. + // + // Supported rate control modes: + // + // - `vbr` - variable bitrate + string rate_control_mode = 6; + + // Target CRF level. Must be between 10 and 36, where 10 is the highest + // quality and 36 is the most efficient compression. The default is 21. + // + // **Note:** This field is not supported. + int32 crf_level = 7; + + // GOP mode can be either by frame count or duration. + oneof gop_mode { + // Select the GOP size based on the specified frame count. Must be greater + // than zero. + int32 gop_frame_count = 8; + + // Select the GOP size based on the specified duration. The default is + // `3s`. Note that `gopDuration` must be less than or equal to + // [`segmentDuration`](#SegmentSettings), and + // [`segmentDuration`](#SegmentSettings) must be divisible by + // `gopDuration`. + google.protobuf.Duration gop_duration = 9; + } + + // Enforces the specified codec profile. The following profiles are + // supported: + // + // * `profile0` (default) + // * `profile1` + // * `profile2` + // * `profile3` + // + // The available options are + // [WebM-compatible](https://www.webmproject.org/vp9/profiles/). + // Note that certain values for this field may cause the + // transcoder to override other fields you set in the `Vp9CodecSettings` + // message. + string profile = 10; + } + + // Codec settings can be h264, h265, or vp9. + oneof codec_settings { + // H264 codec settings. + H264CodecSettings h264 = 1; + + // H265 codec settings. + H265CodecSettings h265 = 2; + + // VP9 codec settings. + Vp9CodecSettings vp9 = 3; + } +} + +// Audio stream resource. +message AudioStream { + // The mapping for the `Job.edit_list` atoms with audio `EditAtom.inputs`. + message AudioMapping { + // Required. The `EditAtom.key` that references the atom with audio inputs in the + // `Job.edit_list`. + string atom_key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The `Input.key` that identifies the input file. + string input_key = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The zero-based index of the track in the input file. + int32 input_track = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The zero-based index of the channel in the input audio stream. + int32 input_channel = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. The zero-based index of the channel in the output audio stream. + int32 output_channel = 5 [(google.api.field_behavior) = REQUIRED]; + + // Audio volume control in dB. Negative values decrease volume, + // positive values increase. The default is 0. + double gain_db = 6; + } + + // The codec for this audio stream. The default is `aac`. + // + // Supported audio codecs: + // + // - `aac` + // - `aac-he` + // - `aac-he-v2` + // - `mp3` + // - `ac3` + // - `eac3` + string codec = 1; + + // Required. Audio bitrate in bits per second. Must be between 1 and 10,000,000. + int32 bitrate_bps = 2 [(google.api.field_behavior) = REQUIRED]; + + // Number of audio channels. Must be between 1 and 6. The default is 2. + int32 channel_count = 3; + + // A list of channel names specifying layout of the audio channels. + // This only affects the metadata embedded in the container headers, if + // supported by the specified format. The default is `["fl", "fr"]`. + // + // Supported channel names: + // + // - `fl` - Front left channel + // - `fr` - Front right channel + // - `sl` - Side left channel + // - `sr` - Side right channel + // - `fc` - Front center channel + // - `lfe` - Low frequency + repeated string channel_layout = 4; + + // The mapping for the `Job.edit_list` atoms with audio `EditAtom.inputs`. + repeated AudioMapping mapping = 5; + + // The audio sample rate in Hertz. The default is 48000 Hertz. + int32 sample_rate_hertz = 6; +} + +// Encoding of a text stream. For example, closed captions or subtitles. +message TextStream { + // The mapping for the `Job.edit_list` atoms with text `EditAtom.inputs`. + message TextMapping { + // Required. The `EditAtom.key` that references atom with text inputs in the + // `Job.edit_list`. + string atom_key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The `Input.key` that identifies the input file. + string input_key = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The zero-based index of the track in the input file. + int32 input_track = 3 [(google.api.field_behavior) = REQUIRED]; + } + + // The codec for this text stream. The default is `webvtt`. + // + // Supported text codecs: + // + // - `srt` + // - `ttml` + // - `cea608` + // - `cea708` + // - `webvtt` + string codec = 1; + + // The mapping for the `Job.edit_list` atoms with text `EditAtom.inputs`. + repeated TextMapping mapping = 3; +} + +// Segment settings for `ts`, `fmp4` and `vtt`. +message SegmentSettings { + // Duration of the segments in seconds. The default is `6.0s`. Note that + // `segmentDuration` must be greater than or equal to + // [`gopDuration`](#videostream), and `segmentDuration` must be divisible by + // [`gopDuration`](#videostream). + google.protobuf.Duration segment_duration = 1; + + // Required. Create an individual segment file. The default is `false`. + bool individual_segments = 3 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/video/transcoder/v1/services.proto b/owl-bot-staging/v1/protos/google/cloud/video/transcoder/v1/services.proto new file mode 100644 index 0000000..4d400c3 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/video/transcoder/v1/services.proto @@ -0,0 +1,281 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.video.transcoder.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/video/transcoder/v1/resources.proto"; +import "google/protobuf/empty.proto"; + +option csharp_namespace = "Google.Cloud.Video.Transcoder.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1;transcoder"; +option java_multiple_files = true; +option java_outer_classname = "ServicesProto"; +option java_package = "com.google.cloud.video.transcoder.v1"; +option php_namespace = "Google\\Cloud\\Video\\Transcoder\\V1"; +option ruby_package = "Google::Cloud::Video::Transcoder::V1"; + +// Using the Transcoder API, you can queue asynchronous jobs for transcoding +// media into various output formats. Output formats may include different +// streaming standards such as HTTP Live Streaming (HLS) and Dynamic Adaptive +// Streaming over HTTP (DASH). You can also customize jobs using advanced +// features such as Digital Rights Management (DRM), audio equalization, content +// concatenation, and digital ad-stitch ready content generation. +service TranscoderService { + option (google.api.default_host) = "transcoder.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a job in the specified region. + rpc CreateJob(CreateJobRequest) returns (Job) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/jobs" + body: "job" + }; + option (google.api.method_signature) = "parent,job"; + } + + // Lists jobs in the specified region. + rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/jobs" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns the job data. + rpc GetJob(GetJobRequest) returns (Job) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/jobs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a job. + rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/jobs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a job template in the specified region. + rpc CreateJobTemplate(CreateJobTemplateRequest) returns (JobTemplate) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/jobTemplates" + body: "job_template" + }; + option (google.api.method_signature) = "parent,job_template,job_template_id"; + } + + // Lists job templates in the specified region. + rpc ListJobTemplates(ListJobTemplatesRequest) returns (ListJobTemplatesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/jobTemplates" + }; + option (google.api.method_signature) = "parent"; + } + + // Returns the job template data. + rpc GetJobTemplate(GetJobTemplateRequest) returns (JobTemplate) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/jobTemplates/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a job template. + rpc DeleteJobTemplate(DeleteJobTemplateRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/jobTemplates/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// Request message for `TranscoderService.CreateJob`. +message CreateJobRequest { + // Required. The parent location to create and process this job. + // Format: `projects/{project}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Parameters for creating transcoding job. + Job job = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `TranscoderService.ListJobs`. +// The parent location from which to retrieve the collection of jobs. +message ListJobsRequest { + // Required. Format: `projects/{project}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The `next_page_token` value returned from a previous List request, if + // any. + string page_token = 3; + + // The filter expression, following the syntax outlined in + // https://google.aip.dev/160. + string filter = 4; + + // One or more fields to compare and use to sort the output. + // See https://google.aip.dev/132#ordering. + string order_by = 5; +} + +// Request message for `TranscoderService.GetJob`. +message GetJobRequest { + // Required. The name of the job to retrieve. + // Format: `projects/{project}/locations/{location}/jobs/{job}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "transcoder.googleapis.com/Job" + } + ]; +} + +// Request message for `TranscoderService.DeleteJob`. +message DeleteJobRequest { + // Required. The name of the job to delete. + // Format: `projects/{project}/locations/{location}/jobs/{job}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "transcoder.googleapis.com/Job" + } + ]; + + // If set to true, and the job is not found, the request will succeed but no + // action will be taken on the server. + bool allow_missing = 2; +} + +// Response message for `TranscoderService.ListJobs`. +message ListJobsResponse { + // List of jobs in the specified region. + repeated Job jobs = 1; + + // The pagination token. + string next_page_token = 2; + + // List of regions that could not be reached. + repeated string unreachable = 3; +} + +// Request message for `TranscoderService.CreateJobTemplate`. +message CreateJobTemplateRequest { + // Required. The parent location to create this job template. + // Format: `projects/{project}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Parameters for creating job template. + JobTemplate job_template = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID to use for the job template, which will become the final component + // of the job template's resource name. + // + // This value should be 4-63 characters, and valid characters must match the + // regular expression `[a-zA-Z][a-zA-Z0-9_-]*`. + string job_template_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `TranscoderService.ListJobTemplates`. +message ListJobTemplatesRequest { + // Required. The parent location from which to retrieve the collection of job templates. + // Format: `projects/{project}/locations/{location}` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of items to return. + int32 page_size = 2; + + // The `next_page_token` value returned from a previous List request, if + // any. + string page_token = 3; + + // The filter expression, following the syntax outlined in + // https://google.aip.dev/160. + string filter = 4; + + // One or more fields to compare and use to sort the output. + // See https://google.aip.dev/132#ordering. + string order_by = 5; +} + +// Request message for `TranscoderService.GetJobTemplate`. +message GetJobTemplateRequest { + // Required. The name of the job template to retrieve. + // Format: + // `projects/{project}/locations/{location}/jobTemplates/{job_template}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "transcoder.googleapis.com/JobTemplate" + } + ]; +} + +// Request message for `TranscoderService.DeleteJobTemplate`. +message DeleteJobTemplateRequest { + // Required. The name of the job template to delete. + // `projects/{project}/locations/{location}/jobTemplates/{job_template}` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "transcoder.googleapis.com/JobTemplate" + } + ]; + + // If set to true, and the job template is not found, the request will succeed + // but no action will be taken on the server. + bool allow_missing = 2; +} + +// Response message for `TranscoderService.ListJobTemplates`. +message ListJobTemplatesResponse { + // List of job templates in the specified region. + repeated JobTemplate job_templates = 1; + + // The pagination token. + string next_page_token = 2; + + // List of regions that could not be reached. + repeated string unreachable = 3; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.video.transcoder.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.video.transcoder.v1.json new file mode 100644 index 0000000..7478ec8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.video.transcoder.v1.json @@ -0,0 +1,387 @@ +{ + "clientLibrary": { + "name": "nodejs-transcoder", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.video.transcoder.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "transcoder_v1_generated_TranscoderService_CreateJob_async", + "title": "TranscoderService createJob Sample", + "origin": "API_DEFINITION", + "description": " Creates a job in the specified region.", + "canonical": true, + "file": "transcoder_service.create_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateJob", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService.CreateJob", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "job", + "type": ".google.cloud.video.transcoder.v1.Job" + } + ], + "resultType": ".google.cloud.video.transcoder.v1.Job", + "client": { + "shortName": "TranscoderServiceClient", + "fullName": "google.cloud.video.transcoder.v1.TranscoderServiceClient" + }, + "method": { + "shortName": "CreateJob", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService.CreateJob", + "service": { + "shortName": "TranscoderService", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService" + } + } + } + }, + { + "regionTag": "transcoder_v1_generated_TranscoderService_ListJobs_async", + "title": "TranscoderService listJobs Sample", + "origin": "API_DEFINITION", + "description": " Lists jobs in the specified region.", + "canonical": true, + "file": "transcoder_service.list_jobs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListJobs", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService.ListJobs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.video.transcoder.v1.ListJobsResponse", + "client": { + "shortName": "TranscoderServiceClient", + "fullName": "google.cloud.video.transcoder.v1.TranscoderServiceClient" + }, + "method": { + "shortName": "ListJobs", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService.ListJobs", + "service": { + "shortName": "TranscoderService", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService" + } + } + } + }, + { + "regionTag": "transcoder_v1_generated_TranscoderService_GetJob_async", + "title": "TranscoderService getJob Sample", + "origin": "API_DEFINITION", + "description": " Returns the job data.", + "canonical": true, + "file": "transcoder_service.get_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 51, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetJob", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService.GetJob", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.video.transcoder.v1.Job", + "client": { + "shortName": "TranscoderServiceClient", + "fullName": "google.cloud.video.transcoder.v1.TranscoderServiceClient" + }, + "method": { + "shortName": "GetJob", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService.GetJob", + "service": { + "shortName": "TranscoderService", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService" + } + } + } + }, + { + "regionTag": "transcoder_v1_generated_TranscoderService_DeleteJob_async", + "title": "TranscoderService deleteJob Sample", + "origin": "API_DEFINITION", + "description": " Deletes a job.", + "canonical": true, + "file": "transcoder_service.delete_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteJob", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService.DeleteJob", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "TranscoderServiceClient", + "fullName": "google.cloud.video.transcoder.v1.TranscoderServiceClient" + }, + "method": { + "shortName": "DeleteJob", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService.DeleteJob", + "service": { + "shortName": "TranscoderService", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService" + } + } + } + }, + { + "regionTag": "transcoder_v1_generated_TranscoderService_CreateJobTemplate_async", + "title": "TranscoderService createJobTemplate Sample", + "origin": "API_DEFINITION", + "description": " Creates a job template in the specified region.", + "canonical": true, + "file": "transcoder_service.create_job_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateJobTemplate", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService.CreateJobTemplate", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "job_template", + "type": ".google.cloud.video.transcoder.v1.JobTemplate" + }, + { + "name": "job_template_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.video.transcoder.v1.JobTemplate", + "client": { + "shortName": "TranscoderServiceClient", + "fullName": "google.cloud.video.transcoder.v1.TranscoderServiceClient" + }, + "method": { + "shortName": "CreateJobTemplate", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService.CreateJobTemplate", + "service": { + "shortName": "TranscoderService", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService" + } + } + } + }, + { + "regionTag": "transcoder_v1_generated_TranscoderService_ListJobTemplates_async", + "title": "TranscoderService listJobTemplates Sample", + "origin": "API_DEFINITION", + "description": " Lists job templates in the specified region.", + "canonical": true, + "file": "transcoder_service.list_job_templates.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListJobTemplates", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService.ListJobTemplates", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.video.transcoder.v1.ListJobTemplatesResponse", + "client": { + "shortName": "TranscoderServiceClient", + "fullName": "google.cloud.video.transcoder.v1.TranscoderServiceClient" + }, + "method": { + "shortName": "ListJobTemplates", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService.ListJobTemplates", + "service": { + "shortName": "TranscoderService", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService" + } + } + } + }, + { + "regionTag": "transcoder_v1_generated_TranscoderService_GetJobTemplate_async", + "title": "TranscoderService getJobTemplate Sample", + "origin": "API_DEFINITION", + "description": " Returns the job template data.", + "canonical": true, + "file": "transcoder_service.get_job_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetJobTemplate", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService.GetJobTemplate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.video.transcoder.v1.JobTemplate", + "client": { + "shortName": "TranscoderServiceClient", + "fullName": "google.cloud.video.transcoder.v1.TranscoderServiceClient" + }, + "method": { + "shortName": "GetJobTemplate", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService.GetJobTemplate", + "service": { + "shortName": "TranscoderService", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService" + } + } + } + }, + { + "regionTag": "transcoder_v1_generated_TranscoderService_DeleteJobTemplate_async", + "title": "TranscoderService deleteJobTemplate Sample", + "origin": "API_DEFINITION", + "description": " Deletes a job template.", + "canonical": true, + "file": "transcoder_service.delete_job_template.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteJobTemplate", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService.DeleteJobTemplate", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "allow_missing", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "TranscoderServiceClient", + "fullName": "google.cloud.video.transcoder.v1.TranscoderServiceClient" + }, + "method": { + "shortName": "DeleteJobTemplate", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService.DeleteJobTemplate", + "service": { + "shortName": "TranscoderService", + "fullName": "google.cloud.video.transcoder.v1.TranscoderService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1/samples/generated/v1/transcoder_service.create_job.js b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.create_job.js new file mode 100644 index 0000000..47a3d4d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.create_job.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, job) { + // [START transcoder_v1_generated_TranscoderService_CreateJob_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent location to create and process this job. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + /** + * Required. Parameters for creating transcoding job. + */ + // const job = {} + + // Imports the Transcoder library + const {TranscoderServiceClient} = require('@google-cloud/video-transcoder').v1; + + // Instantiates a client + const transcoderClient = new TranscoderServiceClient(); + + async function callCreateJob() { + // Construct request + const request = { + parent, + job, + }; + + // Run request + const response = await transcoderClient.createJob(request); + console.log(response); + } + + callCreateJob(); + // [END transcoder_v1_generated_TranscoderService_CreateJob_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/transcoder_service.create_job_template.js b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.create_job_template.js new file mode 100644 index 0000000..d1deee0 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.create_job_template.js @@ -0,0 +1,72 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, jobTemplate, jobTemplateId) { + // [START transcoder_v1_generated_TranscoderService_CreateJobTemplate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent location to create this job template. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + /** + * Required. Parameters for creating job template. + */ + // const jobTemplate = {} + /** + * Required. The ID to use for the job template, which will become the final component + * of the job template's resource name. + * This value should be 4-63 characters, and valid characters must match the + * regular expression `[a-zA-Z][a-zA-Z0-9_-]*`. + */ + // const jobTemplateId = 'abc123' + + // Imports the Transcoder library + const {TranscoderServiceClient} = require('@google-cloud/video-transcoder').v1; + + // Instantiates a client + const transcoderClient = new TranscoderServiceClient(); + + async function callCreateJobTemplate() { + // Construct request + const request = { + parent, + jobTemplate, + jobTemplateId, + }; + + // Run request + const response = await transcoderClient.createJobTemplate(request); + console.log(response); + } + + callCreateJobTemplate(); + // [END transcoder_v1_generated_TranscoderService_CreateJobTemplate_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/transcoder_service.delete_job.js b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.delete_job.js new file mode 100644 index 0000000..46fd9e3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.delete_job.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 transcoder_v1_generated_TranscoderService_DeleteJob_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the job to delete. + * Format: `projects/{project}/locations/{location}/jobs/{job}` + */ + // const name = 'abc123' + /** + * If set to true, and the job is not found, the request will succeed but no + * action will be taken on the server. + */ + // const allowMissing = true + + // Imports the Transcoder library + const {TranscoderServiceClient} = require('@google-cloud/video-transcoder').v1; + + // Instantiates a client + const transcoderClient = new TranscoderServiceClient(); + + async function callDeleteJob() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await transcoderClient.deleteJob(request); + console.log(response); + } + + callDeleteJob(); + // [END transcoder_v1_generated_TranscoderService_DeleteJob_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/transcoder_service.delete_job_template.js b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.delete_job_template.js new file mode 100644 index 0000000..a1ebefe --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.delete_job_template.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 transcoder_v1_generated_TranscoderService_DeleteJobTemplate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the job template to delete. + * `projects/{project}/locations/{location}/jobTemplates/{job_template}` + */ + // const name = 'abc123' + /** + * If set to true, and the job template is not found, the request will succeed + * but no action will be taken on the server. + */ + // const allowMissing = true + + // Imports the Transcoder library + const {TranscoderServiceClient} = require('@google-cloud/video-transcoder').v1; + + // Instantiates a client + const transcoderClient = new TranscoderServiceClient(); + + async function callDeleteJobTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await transcoderClient.deleteJobTemplate(request); + console.log(response); + } + + callDeleteJobTemplate(); + // [END transcoder_v1_generated_TranscoderService_DeleteJobTemplate_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/transcoder_service.get_job.js b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.get_job.js new file mode 100644 index 0000000..8f8eb07 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.get_job.js @@ -0,0 +1,59 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START transcoder_v1_generated_TranscoderService_GetJob_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the job to retrieve. + * Format: `projects/{project}/locations/{location}/jobs/{job}` + */ + // const name = 'abc123' + + // Imports the Transcoder library + const {TranscoderServiceClient} = require('@google-cloud/video-transcoder').v1; + + // Instantiates a client + const transcoderClient = new TranscoderServiceClient(); + + async function callGetJob() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await transcoderClient.getJob(request); + console.log(response); + } + + callGetJob(); + // [END transcoder_v1_generated_TranscoderService_GetJob_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/transcoder_service.get_job_template.js b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.get_job_template.js new file mode 100644 index 0000000..4a3baa4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.get_job_template.js @@ -0,0 +1,60 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START transcoder_v1_generated_TranscoderService_GetJobTemplate_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the job template to retrieve. + * Format: + * `projects/{project}/locations/{location}/jobTemplates/{job_template}` + */ + // const name = 'abc123' + + // Imports the Transcoder library + const {TranscoderServiceClient} = require('@google-cloud/video-transcoder').v1; + + // Instantiates a client + const transcoderClient = new TranscoderServiceClient(); + + async function callGetJobTemplate() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await transcoderClient.getJobTemplate(request); + console.log(response); + } + + callGetJobTemplate(); + // [END transcoder_v1_generated_TranscoderService_GetJobTemplate_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/transcoder_service.list_job_templates.js b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.list_job_templates.js new file mode 100644 index 0000000..d6891c5 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.list_job_templates.js @@ -0,0 +1,80 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START transcoder_v1_generated_TranscoderService_ListJobTemplates_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent location from which to retrieve the collection of job templates. + * Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The `next_page_token` value returned from a previous List request, if + * any. + */ + // const pageToken = 'abc123' + /** + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + */ + // const filter = 'abc123' + /** + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Transcoder library + const {TranscoderServiceClient} = require('@google-cloud/video-transcoder').v1; + + // Instantiates a client + const transcoderClient = new TranscoderServiceClient(); + + async function callListJobTemplates() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await transcoderClient.listJobTemplatesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListJobTemplates(); + // [END transcoder_v1_generated_TranscoderService_ListJobTemplates_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/transcoder_service.list_jobs.js b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.list_jobs.js new file mode 100644 index 0000000..0c0755b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.list_jobs.js @@ -0,0 +1,79 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START transcoder_v1_generated_TranscoderService_ListJobs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Format: `projects/{project}/locations/{location}` + */ + // const parent = 'abc123' + /** + * The maximum number of items to return. + */ + // const pageSize = 1234 + /** + * The `next_page_token` value returned from a previous List request, if + * any. + */ + // const pageToken = 'abc123' + /** + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + */ + // const filter = 'abc123' + /** + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Transcoder library + const {TranscoderServiceClient} = require('@google-cloud/video-transcoder').v1; + + // Instantiates a client + const transcoderClient = new TranscoderServiceClient(); + + async function callListJobs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await transcoderClient.listJobsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListJobs(); + // [END transcoder_v1_generated_TranscoderService_ListJobs_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..7ca135a --- /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 TranscoderServiceClient = v1.TranscoderServiceClient; +type TranscoderServiceClient = v1.TranscoderServiceClient; +export {v1, TranscoderServiceClient}; +export default {v1, TranscoderServiceClient}; +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..5898b0e --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,111 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.video.transcoder.v1", + "libraryPackage": "@google-cloud/video-transcoder", + "services": { + "TranscoderService": { + "clients": { + "grpc": { + "libraryClient": "TranscoderServiceClient", + "rpcs": { + "CreateJob": { + "methods": [ + "createJob" + ] + }, + "GetJob": { + "methods": [ + "getJob" + ] + }, + "DeleteJob": { + "methods": [ + "deleteJob" + ] + }, + "CreateJobTemplate": { + "methods": [ + "createJobTemplate" + ] + }, + "GetJobTemplate": { + "methods": [ + "getJobTemplate" + ] + }, + "DeleteJobTemplate": { + "methods": [ + "deleteJobTemplate" + ] + }, + "ListJobs": { + "methods": [ + "listJobs", + "listJobsStream", + "listJobsAsync" + ] + }, + "ListJobTemplates": { + "methods": [ + "listJobTemplates", + "listJobTemplatesStream", + "listJobTemplatesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "TranscoderServiceClient", + "rpcs": { + "CreateJob": { + "methods": [ + "createJob" + ] + }, + "GetJob": { + "methods": [ + "getJob" + ] + }, + "DeleteJob": { + "methods": [ + "deleteJob" + ] + }, + "CreateJobTemplate": { + "methods": [ + "createJobTemplate" + ] + }, + "GetJobTemplate": { + "methods": [ + "getJobTemplate" + ] + }, + "DeleteJobTemplate": { + "methods": [ + "deleteJobTemplate" + ] + }, + "ListJobs": { + "methods": [ + "listJobs", + "listJobsStream", + "listJobsAsync" + ] + }, + "ListJobTemplates": { + "methods": [ + "listJobTemplates", + "listJobTemplatesStream", + "listJobTemplatesAsync" + ] + } + } + } + } + } + } +} 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..2f52b1a --- /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 {TranscoderServiceClient} from './transcoder_service_client'; diff --git a/owl-bot-staging/v1/src/v1/transcoder_service_client.ts b/owl-bot-staging/v1/src/v1/transcoder_service_client.ts new file mode 100644 index 0000000..2bedfd5 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/transcoder_service_client.ts @@ -0,0 +1,1303 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/transcoder_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './transcoder_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Using the Transcoder API, you can queue asynchronous jobs for transcoding + * media into various output formats. Output formats may include different + * streaming standards such as HTTP Live Streaming (HLS) and Dynamic Adaptive + * Streaming over HTTP (DASH). You can also customize jobs using advanced + * features such as Digital Rights Management (DRM), audio equalization, content + * concatenation, and digital ad-stitch ready content generation. + * @class + * @memberof v1 + */ +export class TranscoderServiceClient { + 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}; + transcoderServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of TranscoderServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof TranscoderServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + jobPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/jobs/{job}' + ), + jobTemplatePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/jobTemplates/{job_template}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listJobs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs'), + listJobTemplates: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobTemplates') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.video.transcoder.v1.TranscoderService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.transcoderServiceStub) { + return this.transcoderServiceStub; + } + + // Put together the "service stub" for + // google.cloud.video.transcoder.v1.TranscoderService. + this.transcoderServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.video.transcoder.v1.TranscoderService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.video.transcoder.v1.TranscoderService, + 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 transcoderServiceStubMethods = + ['createJob', 'listJobs', 'getJob', 'deleteJob', 'createJobTemplate', 'listJobTemplates', 'getJobTemplate', 'deleteJobTemplate']; + for (const methodName of transcoderServiceStubMethods) { + const callPromise = this.transcoderServiceStub.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] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.transcoderServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'transcoder.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 'transcoder.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 -- + // ------------------- +/** + * Creates a job in the specified region. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location to create and process this job. + * Format: `projects/{project}/locations/{location}` + * @param {google.cloud.video.transcoder.v1.Job} request.job + * Required. Parameters for creating transcoding 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 [Job]{@link google.cloud.video.transcoder.v1.Job}. + * 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/transcoder_service.create_job.js + * region_tag:transcoder_v1_generated_TranscoderService_CreateJob_async + */ + createJob( + request?: protos.google.cloud.video.transcoder.v1.ICreateJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.video.transcoder.v1.IJob, + protos.google.cloud.video.transcoder.v1.ICreateJobRequest|undefined, {}|undefined + ]>; + createJob( + request: protos.google.cloud.video.transcoder.v1.ICreateJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.video.transcoder.v1.IJob, + protos.google.cloud.video.transcoder.v1.ICreateJobRequest|null|undefined, + {}|null|undefined>): void; + createJob( + request: protos.google.cloud.video.transcoder.v1.ICreateJobRequest, + callback: Callback< + protos.google.cloud.video.transcoder.v1.IJob, + protos.google.cloud.video.transcoder.v1.ICreateJobRequest|null|undefined, + {}|null|undefined>): void; + createJob( + request?: protos.google.cloud.video.transcoder.v1.ICreateJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.video.transcoder.v1.IJob, + protos.google.cloud.video.transcoder.v1.ICreateJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.video.transcoder.v1.IJob, + protos.google.cloud.video.transcoder.v1.ICreateJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.video.transcoder.v1.IJob, + protos.google.cloud.video.transcoder.v1.ICreateJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createJob(request, options, callback); + } +/** + * Returns the job data. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the job to retrieve. + * Format: `projects/{project}/locations/{location}/jobs/{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 [Job]{@link google.cloud.video.transcoder.v1.Job}. + * 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/transcoder_service.get_job.js + * region_tag:transcoder_v1_generated_TranscoderService_GetJob_async + */ + getJob( + request?: protos.google.cloud.video.transcoder.v1.IGetJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.video.transcoder.v1.IJob, + protos.google.cloud.video.transcoder.v1.IGetJobRequest|undefined, {}|undefined + ]>; + getJob( + request: protos.google.cloud.video.transcoder.v1.IGetJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.video.transcoder.v1.IJob, + protos.google.cloud.video.transcoder.v1.IGetJobRequest|null|undefined, + {}|null|undefined>): void; + getJob( + request: protos.google.cloud.video.transcoder.v1.IGetJobRequest, + callback: Callback< + protos.google.cloud.video.transcoder.v1.IJob, + protos.google.cloud.video.transcoder.v1.IGetJobRequest|null|undefined, + {}|null|undefined>): void; + getJob( + request?: protos.google.cloud.video.transcoder.v1.IGetJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.video.transcoder.v1.IJob, + protos.google.cloud.video.transcoder.v1.IGetJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.video.transcoder.v1.IJob, + protos.google.cloud.video.transcoder.v1.IGetJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.video.transcoder.v1.IJob, + protos.google.cloud.video.transcoder.v1.IGetJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getJob(request, options, callback); + } +/** + * Deletes a job. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the job to delete. + * Format: `projects/{project}/locations/{location}/jobs/{job}` + * @param {boolean} request.allowMissing + * If set to true, and the job is not found, the request will succeed but no + * action will be taken on the server. + * @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/transcoder_service.delete_job.js + * region_tag:transcoder_v1_generated_TranscoderService_DeleteJob_async + */ + deleteJob( + request?: protos.google.cloud.video.transcoder.v1.IDeleteJobRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.video.transcoder.v1.IDeleteJobRequest|undefined, {}|undefined + ]>; + deleteJob( + request: protos.google.cloud.video.transcoder.v1.IDeleteJobRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.video.transcoder.v1.IDeleteJobRequest|null|undefined, + {}|null|undefined>): void; + deleteJob( + request: protos.google.cloud.video.transcoder.v1.IDeleteJobRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.video.transcoder.v1.IDeleteJobRequest|null|undefined, + {}|null|undefined>): void; + deleteJob( + request?: protos.google.cloud.video.transcoder.v1.IDeleteJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.video.transcoder.v1.IDeleteJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.video.transcoder.v1.IDeleteJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.video.transcoder.v1.IDeleteJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteJob(request, options, callback); + } +/** + * Creates a job template in the specified region. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location to create this job template. + * Format: `projects/{project}/locations/{location}` + * @param {google.cloud.video.transcoder.v1.JobTemplate} request.jobTemplate + * Required. Parameters for creating job template. + * @param {string} request.jobTemplateId + * Required. The ID to use for the job template, which will become the final component + * of the job template's resource name. + * + * This value should be 4-63 characters, and valid characters must match the + * regular expression `{@link a-zA-Z0-9_-|a-zA-Z}*`. + * @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 [JobTemplate]{@link google.cloud.video.transcoder.v1.JobTemplate}. + * 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/transcoder_service.create_job_template.js + * region_tag:transcoder_v1_generated_TranscoderService_CreateJobTemplate_async + */ + createJobTemplate( + request?: protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.video.transcoder.v1.IJobTemplate, + protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest|undefined, {}|undefined + ]>; + createJobTemplate( + request: protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.video.transcoder.v1.IJobTemplate, + protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest|null|undefined, + {}|null|undefined>): void; + createJobTemplate( + request: protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest, + callback: Callback< + protos.google.cloud.video.transcoder.v1.IJobTemplate, + protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest|null|undefined, + {}|null|undefined>): void; + createJobTemplate( + request?: protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.video.transcoder.v1.IJobTemplate, + protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.video.transcoder.v1.IJobTemplate, + protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.video.transcoder.v1.IJobTemplate, + protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createJobTemplate(request, options, callback); + } +/** + * Returns the job template data. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the job template to retrieve. + * Format: + * `projects/{project}/locations/{location}/jobTemplates/{job_template}` + * @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 [JobTemplate]{@link google.cloud.video.transcoder.v1.JobTemplate}. + * 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/transcoder_service.get_job_template.js + * region_tag:transcoder_v1_generated_TranscoderService_GetJobTemplate_async + */ + getJobTemplate( + request?: protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.video.transcoder.v1.IJobTemplate, + protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest|undefined, {}|undefined + ]>; + getJobTemplate( + request: protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.video.transcoder.v1.IJobTemplate, + protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest|null|undefined, + {}|null|undefined>): void; + getJobTemplate( + request: protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest, + callback: Callback< + protos.google.cloud.video.transcoder.v1.IJobTemplate, + protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest|null|undefined, + {}|null|undefined>): void; + getJobTemplate( + request?: protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.video.transcoder.v1.IJobTemplate, + protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.video.transcoder.v1.IJobTemplate, + protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.video.transcoder.v1.IJobTemplate, + protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getJobTemplate(request, options, callback); + } +/** + * Deletes a job template. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the job template to delete. + * `projects/{project}/locations/{location}/jobTemplates/{job_template}` + * @param {boolean} request.allowMissing + * If set to true, and the job template is not found, the request will succeed + * but no action will be taken on the server. + * @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/transcoder_service.delete_job_template.js + * region_tag:transcoder_v1_generated_TranscoderService_DeleteJobTemplate_async + */ + deleteJobTemplate( + request?: protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest|undefined, {}|undefined + ]>; + deleteJobTemplate( + request: protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest|null|undefined, + {}|null|undefined>): void; + deleteJobTemplate( + request: protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest|null|undefined, + {}|null|undefined>): void; + deleteJobTemplate( + request?: protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteJobTemplate(request, options, callback); + } + + /** + * Lists jobs in the specified region. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous List request, if + * any. + * @param {string} request.filter + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * @param {string} request.orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 [Job]{@link google.cloud.video.transcoder.v1.Job}. + * 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 `listJobsAsync()` + * 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. + */ + listJobs( + request?: protos.google.cloud.video.transcoder.v1.IListJobsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.video.transcoder.v1.IJob[], + protos.google.cloud.video.transcoder.v1.IListJobsRequest|null, + protos.google.cloud.video.transcoder.v1.IListJobsResponse + ]>; + listJobs( + request: protos.google.cloud.video.transcoder.v1.IListJobsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.video.transcoder.v1.IListJobsRequest, + protos.google.cloud.video.transcoder.v1.IListJobsResponse|null|undefined, + protos.google.cloud.video.transcoder.v1.IJob>): void; + listJobs( + request: protos.google.cloud.video.transcoder.v1.IListJobsRequest, + callback: PaginationCallback< + protos.google.cloud.video.transcoder.v1.IListJobsRequest, + protos.google.cloud.video.transcoder.v1.IListJobsResponse|null|undefined, + protos.google.cloud.video.transcoder.v1.IJob>): void; + listJobs( + request?: protos.google.cloud.video.transcoder.v1.IListJobsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.video.transcoder.v1.IListJobsRequest, + protos.google.cloud.video.transcoder.v1.IListJobsResponse|null|undefined, + protos.google.cloud.video.transcoder.v1.IJob>, + callback?: PaginationCallback< + protos.google.cloud.video.transcoder.v1.IListJobsRequest, + protos.google.cloud.video.transcoder.v1.IListJobsResponse|null|undefined, + protos.google.cloud.video.transcoder.v1.IJob>): + Promise<[ + protos.google.cloud.video.transcoder.v1.IJob[], + protos.google.cloud.video.transcoder.v1.IListJobsRequest|null, + protos.google.cloud.video.transcoder.v1.IListJobsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listJobs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous List request, if + * any. + * @param {string} request.filter + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * @param {string} request.orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 [Job]{@link google.cloud.video.transcoder.v1.Job} 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 `listJobsAsync()` + * 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. + */ + listJobsStream( + request?: protos.google.cloud.video.transcoder.v1.IListJobsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listJobs.createStream( + this.innerApiCalls.listJobs as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listJobs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous List request, if + * any. + * @param {string} request.filter + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * @param {string} request.orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 + * [Job]{@link google.cloud.video.transcoder.v1.Job}. 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/transcoder_service.list_jobs.js + * region_tag:transcoder_v1_generated_TranscoderService_ListJobs_async + */ + listJobsAsync( + request?: protos.google.cloud.video.transcoder.v1.IListJobsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listJobs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listJobs.asyncIterate( + this.innerApiCalls['listJobs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists job templates in the specified region. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location from which to retrieve the collection of job templates. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous List request, if + * any. + * @param {string} request.filter + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * @param {string} request.orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 [JobTemplate]{@link google.cloud.video.transcoder.v1.JobTemplate}. + * 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 `listJobTemplatesAsync()` + * 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. + */ + listJobTemplates( + request?: protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.video.transcoder.v1.IJobTemplate[], + protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest|null, + protos.google.cloud.video.transcoder.v1.IListJobTemplatesResponse + ]>; + listJobTemplates( + request: protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, + protos.google.cloud.video.transcoder.v1.IListJobTemplatesResponse|null|undefined, + protos.google.cloud.video.transcoder.v1.IJobTemplate>): void; + listJobTemplates( + request: protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, + callback: PaginationCallback< + protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, + protos.google.cloud.video.transcoder.v1.IListJobTemplatesResponse|null|undefined, + protos.google.cloud.video.transcoder.v1.IJobTemplate>): void; + listJobTemplates( + request?: protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, + protos.google.cloud.video.transcoder.v1.IListJobTemplatesResponse|null|undefined, + protos.google.cloud.video.transcoder.v1.IJobTemplate>, + callback?: PaginationCallback< + protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, + protos.google.cloud.video.transcoder.v1.IListJobTemplatesResponse|null|undefined, + protos.google.cloud.video.transcoder.v1.IJobTemplate>): + Promise<[ + protos.google.cloud.video.transcoder.v1.IJobTemplate[], + protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest|null, + protos.google.cloud.video.transcoder.v1.IListJobTemplatesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listJobTemplates(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location from which to retrieve the collection of job templates. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous List request, if + * any. + * @param {string} request.filter + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * @param {string} request.orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 [JobTemplate]{@link google.cloud.video.transcoder.v1.JobTemplate} 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 `listJobTemplatesAsync()` + * 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. + */ + listJobTemplatesStream( + request?: protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listJobTemplates']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listJobTemplates.createStream( + this.innerApiCalls.listJobTemplates as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listJobTemplates`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent location from which to retrieve the collection of job templates. + * Format: `projects/{project}/locations/{location}` + * @param {number} request.pageSize + * The maximum number of items to return. + * @param {string} request.pageToken + * The `next_page_token` value returned from a previous List request, if + * any. + * @param {string} request.filter + * The filter expression, following the syntax outlined in + * https://google.aip.dev/160. + * @param {string} request.orderBy + * One or more fields to compare and use to sort the output. + * See https://google.aip.dev/132#ordering. + * @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 + * [JobTemplate]{@link google.cloud.video.transcoder.v1.JobTemplate}. 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/transcoder_service.list_job_templates.js + * region_tag:transcoder_v1_generated_TranscoderService_ListJobTemplates_async + */ + listJobTemplatesAsync( + request?: protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listJobTemplates']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listJobTemplates.asyncIterate( + this.innerApiCalls['listJobTemplates'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified job resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} job + * @returns {string} Resource name string. + */ + jobPath(project:string,location:string,job:string) { + return this.pathTemplates.jobPathTemplate.render({ + project: project, + location: location, + job: job, + }); + } + + /** + * Parse the project from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the project. + */ + matchProjectFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).project; + } + + /** + * Parse the location from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the location. + */ + matchLocationFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).location; + } + + /** + * Parse the job from Job resource. + * + * @param {string} jobName + * A fully-qualified path representing Job resource. + * @returns {string} A string representing the job. + */ + matchJobFromJobName(jobName: string) { + return this.pathTemplates.jobPathTemplate.match(jobName).job; + } + + /** + * Return a fully-qualified jobTemplate resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} job_template + * @returns {string} Resource name string. + */ + jobTemplatePath(project:string,location:string,jobTemplate:string) { + return this.pathTemplates.jobTemplatePathTemplate.render({ + project: project, + location: location, + job_template: jobTemplate, + }); + } + + /** + * Parse the project from JobTemplate resource. + * + * @param {string} jobTemplateName + * A fully-qualified path representing JobTemplate resource. + * @returns {string} A string representing the project. + */ + matchProjectFromJobTemplateName(jobTemplateName: string) { + return this.pathTemplates.jobTemplatePathTemplate.match(jobTemplateName).project; + } + + /** + * Parse the location from JobTemplate resource. + * + * @param {string} jobTemplateName + * A fully-qualified path representing JobTemplate resource. + * @returns {string} A string representing the location. + */ + matchLocationFromJobTemplateName(jobTemplateName: string) { + return this.pathTemplates.jobTemplatePathTemplate.match(jobTemplateName).location; + } + + /** + * Parse the job_template from JobTemplate resource. + * + * @param {string} jobTemplateName + * A fully-qualified path representing JobTemplate resource. + * @returns {string} A string representing the job_template. + */ + matchJobTemplateFromJobTemplateName(jobTemplateName: string) { + return this.pathTemplates.jobTemplatePathTemplate.match(jobTemplateName).job_template; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.transcoderServiceStub && !this._terminated) { + return this.transcoderServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/transcoder_service_client_config.json b/owl-bot-staging/v1/src/v1/transcoder_service_client_config.json new file mode 100644 index 0000000..0217861 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/transcoder_service_client_config.json @@ -0,0 +1,66 @@ +{ + "interfaces": { + "google.cloud.video.transcoder.v1.TranscoderService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateJob": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListJobs": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetJob": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteJob": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateJobTemplate": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListJobTemplates": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetJobTemplate": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteJobTemplate": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/transcoder_service_proto_list.json b/owl-bot-staging/v1/src/v1/transcoder_service_proto_list.json new file mode 100644 index 0000000..b948cd5 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/transcoder_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/video/transcoder/v1/resources.proto", + "../../protos/google/cloud/video/transcoder/v1/services.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..3581a53 --- /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 transcoder = require('@google-cloud/video-transcoder'); + +function main() { + const transcoderServiceClient = new transcoder.TranscoderServiceClient(); +} + +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..bb267c5 --- /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 {TranscoderServiceClient} from '@google-cloud/video-transcoder'; + +// check that the client class type name can be used +function doStuffWithTranscoderServiceClient(client: TranscoderServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const transcoderServiceClient = new TranscoderServiceClient(); + doStuffWithTranscoderServiceClient(transcoderServiceClient); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts new file mode 100644 index 0000000..8ec4522 --- /dev/null +++ b/owl-bot-staging/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1/test/gapic_transcoder_service_v1.ts b/owl-bot-staging/v1/test/gapic_transcoder_service_v1.ts new file mode 100644 index 0000000..b14d5cb --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_transcoder_service_v1.ts @@ -0,0 +1,1343 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 transcoderserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} 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 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.TranscoderServiceClient', () => { + it('has servicePath', () => { + const servicePath = transcoderserviceModule.v1.TranscoderServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = transcoderserviceModule.v1.TranscoderServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = transcoderserviceModule.v1.TranscoderServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.transcoderServiceStub, undefined); + await client.initialize(); + assert(client.transcoderServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.transcoderServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.transcoderServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + 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 transcoderserviceModule.v1.TranscoderServiceClient({ + 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('createJob', () => { + it('invokes createJob without error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.CreateJobRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()); + client.innerApiCalls.createJob = stubSimpleCall(expectedResponse); + const [response] = await client.createJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createJob without error using callback', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.CreateJobRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()); + client.innerApiCalls.createJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createJob( + request, + (err?: Error|null, result?: protos.google.cloud.video.transcoder.v1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createJob with error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.CreateJobRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createJob(request), expectedError); + assert((client.innerApiCalls.createJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createJob with closed client', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.CreateJobRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createJob(request), expectedError); + }); + }); + + describe('getJob', () => { + it('invokes getJob without error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.GetJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()); + client.innerApiCalls.getJob = stubSimpleCall(expectedResponse); + const [response] = await client.getJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getJob without error using callback', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.GetJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()); + client.innerApiCalls.getJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getJob( + request, + (err?: Error|null, result?: protos.google.cloud.video.transcoder.v1.IJob|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getJob with error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.GetJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getJob(request), expectedError); + assert((client.innerApiCalls.getJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getJob with closed client', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.GetJobRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getJob(request), expectedError); + }); + }); + + describe('deleteJob', () => { + it('invokes deleteJob without error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.DeleteJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteJob = stubSimpleCall(expectedResponse); + const [response] = await client.deleteJob(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteJob without error using callback', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.DeleteJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteJob( + 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.deleteJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteJob with error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.DeleteJobRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteJob(request), expectedError); + assert((client.innerApiCalls.deleteJob as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteJob with closed client', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.DeleteJobRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteJob(request), expectedError); + }); + }); + + describe('createJobTemplate', () => { + it('invokes createJobTemplate without error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.CreateJobTemplateRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()); + client.innerApiCalls.createJobTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.createJobTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createJobTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createJobTemplate without error using callback', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.CreateJobTemplateRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()); + client.innerApiCalls.createJobTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createJobTemplate( + request, + (err?: Error|null, result?: protos.google.cloud.video.transcoder.v1.IJobTemplate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createJobTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createJobTemplate with error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.CreateJobTemplateRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createJobTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createJobTemplate(request), expectedError); + assert((client.innerApiCalls.createJobTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createJobTemplate with closed client', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.CreateJobTemplateRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createJobTemplate(request), expectedError); + }); + }); + + describe('getJobTemplate', () => { + it('invokes getJobTemplate without error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.GetJobTemplateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()); + client.innerApiCalls.getJobTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.getJobTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getJobTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getJobTemplate without error using callback', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.GetJobTemplateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()); + client.innerApiCalls.getJobTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getJobTemplate( + request, + (err?: Error|null, result?: protos.google.cloud.video.transcoder.v1.IJobTemplate|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getJobTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getJobTemplate with error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.GetJobTemplateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getJobTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getJobTemplate(request), expectedError); + assert((client.innerApiCalls.getJobTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getJobTemplate with closed client', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.GetJobTemplateRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getJobTemplate(request), expectedError); + }); + }); + + describe('deleteJobTemplate', () => { + it('invokes deleteJobTemplate without error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.DeleteJobTemplateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteJobTemplate = stubSimpleCall(expectedResponse); + const [response] = await client.deleteJobTemplate(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteJobTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteJobTemplate without error using callback', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.DeleteJobTemplateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteJobTemplate = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteJobTemplate( + 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.deleteJobTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteJobTemplate with error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.DeleteJobTemplateRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteJobTemplate = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteJobTemplate(request), expectedError); + assert((client.innerApiCalls.deleteJobTemplate as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteJobTemplate with closed client', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.DeleteJobTemplateRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteJobTemplate(request), expectedError); + }); + }); + + describe('listJobs', () => { + it('invokes listJobs without error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), + ]; + client.innerApiCalls.listJobs = stubSimpleCall(expectedResponse); + const [response] = await client.listJobs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listJobs without error using callback', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), + ]; + client.innerApiCalls.listJobs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listJobs( + request, + (err?: Error|null, result?: protos.google.cloud.video.transcoder.v1.IJob[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listJobs with error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listJobs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listJobs(request), expectedError); + assert((client.innerApiCalls.listJobs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listJobsStream without error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), + ]; + client.descriptors.page.listJobs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.video.transcoder.v1.Job[] = []; + stream.on('data', (response: protos.google.cloud.video.transcoder.v1.Job) => { + 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.listJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); + assert.strictEqual( + (client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listJobsStream with error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listJobs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listJobsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.video.transcoder.v1.Job[] = []; + stream.on('data', (response: protos.google.cloud.video.transcoder.v1.Job) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); + assert.strictEqual( + (client.descriptors.page.listJobs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listJobs without error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), + ]; + client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.video.transcoder.v1.IJob[] = []; + const iterable = client.listJobsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listJobs with error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listJobsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.video.transcoder.v1.IJob[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listJobs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listJobTemplates', () => { + it('invokes listJobTemplates without error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobTemplatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), + ]; + client.innerApiCalls.listJobTemplates = stubSimpleCall(expectedResponse); + const [response] = await client.listJobTemplates(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listJobTemplates as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listJobTemplates without error using callback', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobTemplatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), + ]; + client.innerApiCalls.listJobTemplates = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listJobTemplates( + request, + (err?: Error|null, result?: protos.google.cloud.video.transcoder.v1.IJobTemplate[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listJobTemplates as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listJobTemplates with error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobTemplatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listJobTemplates = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listJobTemplates(request), expectedError); + assert((client.innerApiCalls.listJobTemplates as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listJobTemplatesStream without error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobTemplatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), + ]; + client.descriptors.page.listJobTemplates.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listJobTemplatesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.video.transcoder.v1.JobTemplate[] = []; + stream.on('data', (response: protos.google.cloud.video.transcoder.v1.JobTemplate) => { + 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.listJobTemplates.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobTemplates, request)); + assert.strictEqual( + (client.descriptors.page.listJobTemplates.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listJobTemplatesStream with error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobTemplatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listJobTemplates.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listJobTemplatesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.video.transcoder.v1.JobTemplate[] = []; + stream.on('data', (response: protos.google.cloud.video.transcoder.v1.JobTemplate) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listJobTemplates.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listJobTemplates, request)); + assert.strictEqual( + (client.descriptors.page.listJobTemplates.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listJobTemplates without error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobTemplatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), + generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), + ]; + client.descriptors.page.listJobTemplates.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.video.transcoder.v1.IJobTemplate[] = []; + const iterable = client.listJobTemplatesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listJobTemplates.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listJobTemplates.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listJobTemplates with error', async () => { + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobTemplatesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listJobTemplates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listJobTemplatesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.video.transcoder.v1.IJobTemplate[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listJobTemplates.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listJobTemplates.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('job', () => { + const fakePath = "/rendered/path/job"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + job: "jobValue", + }; + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.jobPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.jobPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('jobPath', () => { + const result = client.jobPath("projectValue", "locationValue", "jobValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.jobPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromJobName', () => { + const result = client.matchProjectFromJobName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromJobName', () => { + const result = client.matchLocationFromJobName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobFromJobName', () => { + const result = client.matchJobFromJobName(fakePath); + assert.strictEqual(result, "jobValue"); + assert((client.pathTemplates.jobPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('jobTemplate', () => { + const fakePath = "/rendered/path/jobTemplate"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + job_template: "jobTemplateValue", + }; + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.jobTemplatePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.jobTemplatePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('jobTemplatePath', () => { + const result = client.jobTemplatePath("projectValue", "locationValue", "jobTemplateValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.jobTemplatePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromJobTemplateName', () => { + const result = client.matchProjectFromJobTemplateName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.jobTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromJobTemplateName', () => { + const result = client.matchLocationFromJobTemplateName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.jobTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchJobTemplateFromJobTemplateName', () => { + const result = client.matchJobTemplateFromJobTemplateName(fakePath); + assert.strictEqual(result, "jobTemplateValue"); + assert((client.pathTemplates.jobTemplatePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new transcoderserviceModule.v1.TranscoderServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/v1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js new file mode 100644 index 0000000..1250fac --- /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: 'TranscoderService', + filename: './transcoder-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 e3756e91e454712319136b9296d6cc1701bc4ce5 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 09:53:38 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- owl-bot-staging/v1/.eslintignore | 7 - owl-bot-staging/v1/.eslintrc.json | 3 - owl-bot-staging/v1/.gitignore | 14 - owl-bot-staging/v1/.jsdoc.js | 55 - owl-bot-staging/v1/.mocharc.js | 33 - owl-bot-staging/v1/.prettierrc.js | 22 - owl-bot-staging/v1/README.md | 1 - owl-bot-staging/v1/linkinator.config.json | 16 - owl-bot-staging/v1/package.json | 64 - .../cloud/video/transcoder/v1/resources.proto | 1095 -------------- .../cloud/video/transcoder/v1/services.proto | 281 ---- ...data.google.cloud.video.transcoder.v1.json | 387 ----- .../v1/transcoder_service.create_job.js | 64 - .../transcoder_service.create_job_template.js | 72 - .../v1/transcoder_service.delete_job.js | 64 - .../transcoder_service.delete_job_template.js | 64 - .../v1/transcoder_service.get_job.js | 59 - .../v1/transcoder_service.get_job_template.js | 60 - .../transcoder_service.list_job_templates.js | 80 - .../v1/transcoder_service.list_jobs.js | 79 - owl-bot-staging/v1/src/index.ts | 25 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 111 -- owl-bot-staging/v1/src/v1/index.ts | 19 - .../v1/src/v1/transcoder_service_client.ts | 1303 ---------------- .../v1/transcoder_service_client_config.json | 66 - .../src/v1/transcoder_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 - .../v1/test/gapic_transcoder_service_v1.ts | 1343 ----------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - src/v1/transcoder_service_client.ts | 11 +- 33 files changed, 5 insertions(+), 5588 deletions(-) delete mode 100644 owl-bot-staging/v1/.eslintignore delete mode 100644 owl-bot-staging/v1/.eslintrc.json delete mode 100644 owl-bot-staging/v1/.gitignore delete mode 100644 owl-bot-staging/v1/.jsdoc.js delete mode 100644 owl-bot-staging/v1/.mocharc.js delete mode 100644 owl-bot-staging/v1/.prettierrc.js delete mode 100644 owl-bot-staging/v1/README.md delete mode 100644 owl-bot-staging/v1/linkinator.config.json delete mode 100644 owl-bot-staging/v1/package.json delete mode 100644 owl-bot-staging/v1/protos/google/cloud/video/transcoder/v1/resources.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/video/transcoder/v1/services.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.video.transcoder.v1.json delete mode 100644 owl-bot-staging/v1/samples/generated/v1/transcoder_service.create_job.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/transcoder_service.create_job_template.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/transcoder_service.delete_job.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/transcoder_service.delete_job_template.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/transcoder_service.get_job.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/transcoder_service.get_job_template.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/transcoder_service.list_job_templates.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/transcoder_service.list_jobs.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/transcoder_service_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/transcoder_service_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/transcoder_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_transcoder_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 1c49b86..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/video-transcoder', - 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 16c2e41..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Transcoder: 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 0a8aeb4..0000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/video-transcoder", - "version": "0.1.0", - "description": "Transcoder client for Node.js", - "repository": "googleapis/nodejs-transcoder", - "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 transcoder", - "transcoder", - "transcoder service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.1.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/video/transcoder/v1/resources.proto b/owl-bot-staging/v1/protos/google/cloud/video/transcoder/v1/resources.proto deleted file mode 100644 index ce3824b..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/video/transcoder/v1/resources.proto +++ /dev/null @@ -1,1095 +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.cloud.video.transcoder.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/status.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1;transcoder"; -option java_multiple_files = true; -option java_outer_classname = "ResourcesProto"; -option java_package = "com.google.cloud.video.transcoder.v1"; - -// Transcoding job resource. -message Job { - option (google.api.resource) = { - type: "transcoder.googleapis.com/Job" - pattern: "projects/{project}/locations/{location}/jobs/{job}" - }; - - // The current state of the job. - enum ProcessingState { - // The processing state is not specified. - PROCESSING_STATE_UNSPECIFIED = 0; - - // The job is enqueued and will be picked up for processing soon. - PENDING = 1; - - // The job is being processed. - RUNNING = 2; - - // The job has been completed successfully. - SUCCEEDED = 3; - - // The job has failed. For additional information, see `failure_reason` and - // `failure_details` - FAILED = 4; - } - - // The resource name of the job. - // Format: `projects/{project_number}/locations/{location}/jobs/{job}` - string name = 1; - - // Input only. Specify the `input_uri` to populate empty `uri` fields in each element of - // `Job.config.inputs` or `JobTemplate.config.inputs` when using template. - // URI of the media. Input files must be at least 5 seconds in duration and - // stored in Cloud Storage (for example, `gs://bucket/inputs/file.mp4`). See - // [Supported input and output - // formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). - string input_uri = 2 [(google.api.field_behavior) = INPUT_ONLY]; - - // Input only. Specify the `output_uri` to populate an empty `Job.config.output.uri` or - // `JobTemplate.config.output.uri` when using template. - // URI for the output file(s). For example, `gs://my-bucket/outputs/`. See - // [Supported input and output - // formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). - string output_uri = 3 [(google.api.field_behavior) = INPUT_ONLY]; - - // Specify the `job_config` for the transcoding job. If you don't specify the - // `job_config`, the API selects `templateId`; this template ID is set to - // `preset/web-hd` by default. When you use a `template_id` to create a job, - // the `Job.config` is populated by the `JobTemplate.config`.
- oneof job_config { - // Input only. Specify the `template_id` to use for populating `Job.config`. The default - // is `preset/web-hd`. - // - // Preset Transcoder templates: - // - `preset/{preset_id}` - // - // - User defined JobTemplate: - // `{job_template_id}` - string template_id = 4 [(google.api.field_behavior) = INPUT_ONLY]; - - // The configuration for this job. - JobConfig config = 5; - } - - // Output only. The current state of the job. - ProcessingState state = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the job was created. - google.protobuf.Timestamp create_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the transcoding started. - google.protobuf.Timestamp start_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the transcoding finished. - google.protobuf.Timestamp end_time = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Job time to live value in days, which will be effective after job - // completion. Job should be deleted automatically after the given TTL. Enter - // a value between 1 and 90. The default is 30. - int32 ttl_after_completion_days = 15; - - // The labels associated with this job. You can use these to organize and - // group your jobs. - map labels = 16; - - // Output only. An error object that describes the reason for the failure. - // This property is always present when `state` is `FAILED`. - google.rpc.Status error = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Transcoding job template resource. -message JobTemplate { - option (google.api.resource) = { - type: "transcoder.googleapis.com/JobTemplate" - pattern: "projects/{project}/locations/{location}/jobTemplates/{job_template}" - }; - - // The resource name of the job template. - // Format: - // `projects/{project_number}/locations/{location}/jobTemplates/{job_template}` - string name = 1; - - // The configuration for this template. - JobConfig config = 2; - - // The labels associated with this job template. You can use these to organize - // and group your job templates. - map labels = 3; -} - -// Job configuration -message JobConfig { - // List of input assets stored in Cloud Storage. - repeated Input inputs = 1; - - // List of `Edit atom`s. Defines the ultimate timeline of the resulting - // file or manifest. - repeated EditAtom edit_list = 2; - - // List of elementary streams. - repeated ElementaryStream elementary_streams = 3; - - // List of multiplexing settings for output streams. - repeated MuxStream mux_streams = 4; - - // List of output manifests. - repeated Manifest manifests = 5; - - // Output configuration. - Output output = 6; - - // List of ad breaks. Specifies where to insert ad break tags in the output - // manifests. - repeated AdBreak ad_breaks = 7; - - // Destination on Pub/Sub. - PubsubDestination pubsub_destination = 8; - - // List of output sprite sheets. - // Spritesheets require at least one VideoStream in the Jobconfig. - repeated SpriteSheet sprite_sheets = 9; - - // List of overlays on the output video, in descending Z-order. - repeated Overlay overlays = 10; -} - -// Input asset. -message Input { - // A unique key for this input. Must be specified when using advanced - // mapping and edit lists. - string key = 1; - - // URI of the media. Input files must be at least 5 seconds in duration and - // stored in Cloud Storage (for example, `gs://bucket/inputs/file.mp4`). - // If empty, the value is populated from `Job.input_uri`. See - // [Supported input and output - // formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). - string uri = 2; - - // Preprocessing configurations. - PreprocessingConfig preprocessing_config = 3; -} - -// Location of output file(s) in a Cloud Storage bucket. -message Output { - // URI for the output file(s). For example, `gs://my-bucket/outputs/`. - // If empty, the value is populated from `Job.output_uri`. See - // [Supported input and output - // formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats). - string uri = 1; -} - -// Edit atom. -message EditAtom { - // A unique key for this atom. Must be specified when using advanced - // mapping. - string key = 1; - - // List of `Input.key`s identifying files that should be used in this atom. - // The listed `inputs` must have the same timeline. - repeated string inputs = 2; - - // End time in seconds for the atom, relative to the input file timeline. - // When `end_time_offset` is not specified, the `inputs` are used until - // the end of the atom. - google.protobuf.Duration end_time_offset = 3; - - // Start time in seconds for the atom, relative to the input file timeline. - // The default is `0s`. - google.protobuf.Duration start_time_offset = 4; -} - -// Ad break. -message AdBreak { - // Start time in seconds for the ad break, relative to the output file - // timeline. The default is `0s`. - google.protobuf.Duration start_time_offset = 1; -} - -// Encoding of an input file such as an audio, video, or text track. -// Elementary streams must be packaged before -// mapping and sharing between different output formats. -message ElementaryStream { - // A unique key for this elementary stream. - string key = 4; - - // Encoding of an audio, video, or text track. - oneof elementary_stream { - // Encoding of a video stream. - VideoStream video_stream = 1; - - // Encoding of an audio stream. - AudioStream audio_stream = 2; - - // Encoding of a text stream. For example, closed captions or subtitles. - TextStream text_stream = 3; - } -} - -// Multiplexing settings for output stream. -message MuxStream { - // A unique key for this multiplexed stream. HLS media manifests will be - // named `MuxStream.key` with the `.m3u8` extension suffix. - string key = 1; - - // The name of the generated file. The default is `MuxStream.key` with the - // extension suffix corresponding to the `MuxStream.container`. - // - // Individual segments also have an incremental 10-digit zero-padded suffix - // starting from 0 before the extension, such as `mux_stream0000000123.ts`. - string file_name = 2; - - // The container format. The default is `mp4` - // - // Supported container formats: - // - // - `ts` - // - `fmp4`- the corresponding file extension is `.m4s` - // - `mp4` - // - `vtt` - // - // See also: - // [Supported input and output - // formats](https://cloud.google.com/transcoder/docs/concepts/supported-input-and-output-formats) - string container = 3; - - // List of `ElementaryStream.key`s multiplexed in this stream. - repeated string elementary_streams = 4; - - // Segment settings for `ts`, `fmp4` and `vtt`. - SegmentSettings segment_settings = 5; -} - -// Manifest configuration. -message Manifest { - // The manifest type can be either `HLS` or `DASH`. - enum ManifestType { - // The manifest type is not specified. - MANIFEST_TYPE_UNSPECIFIED = 0; - - // Create `HLS` manifest. The corresponding file extension is `.m3u8`. - HLS = 1; - - // Create `DASH` manifest. The corresponding file extension is `.mpd`. - DASH = 2; - } - - // The name of the generated file. The default is `manifest` with the - // extension suffix corresponding to the `Manifest.type`. - string file_name = 1; - - // Required. Type of the manifest, can be `HLS` or `DASH`. - ManifestType type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. List of user given `MuxStream.key`s that should appear in this manifest. - // - // When `Manifest.type` is `HLS`, a media manifest with name `MuxStream.key` - // and `.m3u8` extension is generated for each element of the - // `Manifest.mux_streams`. - repeated string mux_streams = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// A Pub/Sub destination. -message PubsubDestination { - // The name of the Pub/Sub topic to publish job completion notification - // to. For example: `projects/{project}/topics/{topic}`. - string topic = 1; -} - -// Sprite sheet configuration. -message SpriteSheet { - // Format type. The default is `jpeg`. - // - // Supported formats: - // - // - `jpeg` - string format = 1; - - // Required. File name prefix for the generated sprite sheets. - // - // Each sprite sheet has an incremental 10-digit zero-padded suffix starting - // from 0 before the extension, such as `sprite_sheet0000000123.jpeg`. - string file_prefix = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The width of sprite in pixels. Must be an even integer. To preserve the - // source aspect ratio, set the [SpriteSheet.sprite_width_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_width_pixels] field or - // the [SpriteSheet.sprite_height_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_height_pixels] field, but not both (the API will - // automatically calculate the missing field). - int32 sprite_width_pixels = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The height of sprite in pixels. Must be an even integer. To preserve the - // source aspect ratio, set the [SpriteSheet.sprite_height_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_height_pixels] field or - // the [SpriteSheet.sprite_width_pixels][google.cloud.video.transcoder.v1.SpriteSheet.sprite_width_pixels] field, but not both (the API will - // automatically calculate the missing field). - int32 sprite_height_pixels = 4 [(google.api.field_behavior) = REQUIRED]; - - // The maximum number of sprites per row in a sprite sheet. The default is 0, - // which indicates no maximum limit. - int32 column_count = 5; - - // The maximum number of rows per sprite sheet. When the sprite sheet is full, - // a new sprite sheet is created. The default is 0, which indicates no maximum - // limit. - int32 row_count = 6; - - // Start time in seconds, relative to the output file timeline. Determines the - // first sprite to pick. The default is `0s`. - google.protobuf.Duration start_time_offset = 7; - - // End time in seconds, relative to the output file timeline. When - // `end_time_offset` is not specified, the sprites are generated until the end - // of the output file. - google.protobuf.Duration end_time_offset = 8; - - // Specify either total number of sprites or interval to create sprites. - oneof extraction_strategy { - // Total number of sprites. Create the specified number of sprites - // distributed evenly across the timeline of the output media. The default - // is 100. - int32 total_count = 9; - - // Starting from `0s`, create sprites at regular intervals. Specify the - // interval value in seconds. - google.protobuf.Duration interval = 10; - } - - // The quality of the generated sprite sheet. Enter a value between 1 - // and 100, where 1 is the lowest quality and 100 is the highest quality. - // The default is 100. A high quality value corresponds to a low image data - // compression ratio. - int32 quality = 11; -} - -// Overlay configuration. -message Overlay { - // 2D normalized coordinates. Default: `{0.0, 0.0}` - message NormalizedCoordinate { - // Normalized x coordinate. - double x = 1; - - // Normalized y coordinate. - double y = 2; - } - - // Overlaid jpeg image. - message Image { - // Required. URI of the JPEG image in Cloud Storage. For example, - // `gs://bucket/inputs/image.jpeg`. JPEG is the only supported image type. - string uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // Normalized image resolution, based on output video resolution. Valid - // values: `0.0`–`1.0`. To respect the original image aspect ratio, set - // either `x` or `y` to `0.0`. To use the original image resolution, set - // both `x` and `y` to `0.0`. - NormalizedCoordinate resolution = 2; - - // Target image opacity. Valid values are from `1.0` (solid, default) to - // `0.0` (transparent), exclusive. Set this to a value greater than `0.0`. - double alpha = 3; - } - - // Display static overlay object. - message AnimationStatic { - // Normalized coordinates based on output video resolution. Valid - // values: `0.0`–`1.0`. `xy` is the upper-left coordinate of the overlay - // object. For example, use the x and y coordinates {0,0} to position the - // top-left corner of the overlay animation in the top-left corner of the - // output video. - NormalizedCoordinate xy = 1; - - // The time to start displaying the overlay object, in seconds. Default: 0 - google.protobuf.Duration start_time_offset = 2; - } - - // Fade type for the overlay: `FADE_IN` or `FADE_OUT`. - enum FadeType { - // The fade type is not specified. - FADE_TYPE_UNSPECIFIED = 0; - - // Fade the overlay object into view. - FADE_IN = 1; - - // Fade the overlay object out of view. - FADE_OUT = 2; - } - - // Display overlay object with fade animation. - message AnimationFade { - // Required. Type of fade animation: `FADE_IN` or `FADE_OUT`. - FadeType fade_type = 1 [(google.api.field_behavior) = REQUIRED]; - - // Normalized coordinates based on output video resolution. Valid - // values: `0.0`–`1.0`. `xy` is the upper-left coordinate of the overlay - // object. For example, use the x and y coordinates {0,0} to position the - // top-left corner of the overlay animation in the top-left corner of the - // output video. - NormalizedCoordinate xy = 2; - - // The time to start the fade animation, in seconds. Default: 0 - google.protobuf.Duration start_time_offset = 3; - - // The time to end the fade animation, in seconds. Default: - // `start_time_offset` + 1s - google.protobuf.Duration end_time_offset = 4; - } - - // End previous overlay animation from the video. Without AnimationEnd, the - // overlay object will keep the state of previous animation until the end of - // the video. - message AnimationEnd { - // The time to end overlay object, in seconds. Default: 0 - google.protobuf.Duration start_time_offset = 1; - } - - // Animation types. - message Animation { - // Animations can be static or fade, or they can end the previous animation. - oneof animation_type { - // Display static overlay object. - AnimationStatic animation_static = 1; - - // Display overlay object with fade animation. - AnimationFade animation_fade = 2; - - // End previous animation. - AnimationEnd animation_end = 3; - } - } - - // Image overlay. - Image image = 1; - - // List of Animations. The list should be chronological, without any time - // overlap. - repeated Animation animations = 2; -} - -// Preprocessing configurations. -message PreprocessingConfig { - // Color preprocessing configuration. - // - // **Note:** This configuration is not supported. - message Color { - // Control color saturation of the video. Enter a value between -1 and 1, - // where -1 is fully desaturated and 1 is maximum saturation. 0 is no - // change. The default is 0. - double saturation = 1; - - // Control black and white contrast of the video. Enter a value between -1 - // and 1, where -1 is minimum contrast and 1 is maximum contrast. 0 is no - // change. The default is 0. - double contrast = 2; - - // Control brightness of the video. Enter a value between -1 and 1, where -1 - // is minimum brightness and 1 is maximum brightness. 0 is no change. The - // default is 0. - double brightness = 3; - } - - // Denoise preprocessing configuration. - // - // **Note:** This configuration is not supported. - message Denoise { - // Set strength of the denoise. Enter a value between 0 and 1. The higher - // the value, the smoother the image. 0 is no denoising. The default is 0. - double strength = 1; - - // Set the denoiser mode. The default is `standard`. - // - // Supported denoiser modes: - // - // - `standard` - // - `grain` - string tune = 2; - } - - // Deblock preprocessing configuration. - // - // **Note:** This configuration is not supported. - message Deblock { - // Set strength of the deblocker. Enter a value between 0 and 1. The higher - // the value, the stronger the block removal. 0 is no deblocking. The - // default is 0. - double strength = 1; - - // Enable deblocker. The default is `false`. - bool enabled = 2; - } - - // Audio preprocessing configuration. - message Audio { - // Specify audio loudness normalization in loudness units relative to full - // scale (LUFS). Enter a value between -24 and 0 (the default), where: - // - // * -24 is the Advanced Television Systems Committee (ATSC A/85) standard - // * -23 is the EU R128 broadcast standard - // * -19 is the prior standard for online mono audio - // * -18 is the ReplayGain standard - // * -16 is the prior standard for stereo audio - // * -14 is the new online audio standard recommended by Spotify, as well - // as Amazon Echo - // * 0 disables normalization - double lufs = 1; - - // Enable boosting high frequency components. The default is `false`. - // - // **Note:** This field is not supported. - bool high_boost = 2; - - // Enable boosting low frequency components. The default is `false`. - // - // **Note:** This field is not supported. - bool low_boost = 3; - } - - // Video cropping configuration for the input video. The cropped input video - // is scaled to match the output resolution. - message Crop { - // The number of pixels to crop from the top. The default is 0. - int32 top_pixels = 1; - - // The number of pixels to crop from the bottom. The default is 0. - int32 bottom_pixels = 2; - - // The number of pixels to crop from the left. The default is 0. - int32 left_pixels = 3; - - // The number of pixels to crop from the right. The default is 0. - int32 right_pixels = 4; - } - - // Pad filter configuration for the input video. The padded input video - // is scaled after padding with black to match the output resolution. - message Pad { - // The number of pixels to add to the top. The default is 0. - int32 top_pixels = 1; - - // The number of pixels to add to the bottom. The default is 0. - int32 bottom_pixels = 2; - - // The number of pixels to add to the left. The default is 0. - int32 left_pixels = 3; - - // The number of pixels to add to the right. The default is 0. - int32 right_pixels = 4; - } - - // Color preprocessing configuration. - Color color = 1; - - // Denoise preprocessing configuration. - Denoise denoise = 2; - - // Deblock preprocessing configuration. - Deblock deblock = 3; - - // Audio preprocessing configuration. - Audio audio = 4; - - // Specify the video cropping configuration. - Crop crop = 5; - - // Specify the video pad filter configuration. - Pad pad = 6; -} - -// Video stream resource. -message VideoStream { - // H264 codec settings. - message H264CodecSettings { - // The width of the video in pixels. Must be an even integer. - // When not specified, the width is adjusted to match the specified height - // and input aspect ratio. If both are omitted, the input width is used. - int32 width_pixels = 1; - - // The height of the video in pixels. Must be an even integer. - // When not specified, the height is adjusted to match the specified width - // and input aspect ratio. If both are omitted, the input height is used. - int32 height_pixels = 2; - - // Required. The target video frame rate in frames per second (FPS). Must be less than - // or equal to 120. Will default to the input frame rate if larger than the - // input frame rate. The API will generate an output FPS that is divisible - // by the input FPS, and smaller or equal to the target FPS. See - // [Calculating frame - // rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for - // more information. - double frame_rate = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The video bitrate in bits per second. The minimum value is 1,000. - // The maximum value is 800,000,000. - int32 bitrate_bps = 4 [(google.api.field_behavior) = REQUIRED]; - - // Pixel format to use. The default is `yuv420p`. - // - // Supported pixel formats: - // - // - `yuv420p` pixel format - // - `yuv422p` pixel format - // - `yuv444p` pixel format - // - `yuv420p10` 10-bit HDR pixel format - // - `yuv422p10` 10-bit HDR pixel format - // - `yuv444p10` 10-bit HDR pixel format - // - `yuv420p12` 12-bit HDR pixel format - // - `yuv422p12` 12-bit HDR pixel format - // - `yuv444p12` 12-bit HDR pixel format - string pixel_format = 5; - - // Specify the `rate_control_mode`. The default is `vbr`. - // - // Supported rate control modes: - // - // - `vbr` - variable bitrate - // - `crf` - constant rate factor - string rate_control_mode = 6; - - // Target CRF level. Must be between 10 and 36, where 10 is the highest - // quality and 36 is the most efficient compression. The default is 21. - int32 crf_level = 7; - - // Specifies whether an open Group of Pictures (GOP) structure should be - // allowed or not. The default is `false`. - bool allow_open_gop = 8; - - // GOP mode can be either by frame count or duration. - oneof gop_mode { - // Select the GOP size based on the specified frame count. Must be greater - // than zero. - int32 gop_frame_count = 9; - - // Select the GOP size based on the specified duration. The default is - // `3s`. Note that `gopDuration` must be less than or equal to - // [`segmentDuration`](#SegmentSettings), and - // [`segmentDuration`](#SegmentSettings) must be divisible by - // `gopDuration`. - google.protobuf.Duration gop_duration = 10; - } - - // Use two-pass encoding strategy to achieve better video quality. - // `VideoStream.rate_control_mode` must be `vbr`. The default is `false`. - bool enable_two_pass = 11; - - // Size of the Video Buffering Verifier (VBV) buffer in bits. Must be - // greater than zero. The default is equal to `VideoStream.bitrate_bps`. - int32 vbv_size_bits = 12; - - // Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. - // Must be greater than zero. The default is equal to 90% of - // `VideoStream.vbv_size_bits`. - int32 vbv_fullness_bits = 13; - - // The entropy coder to use. The default is `cabac`. - // - // Supported entropy coders: - // - // - `cavlc` - // - `cabac` - string entropy_coder = 14; - - // Allow B-pyramid for reference frame selection. This may not be supported - // on all decoders. The default is `false`. - bool b_pyramid = 15; - - // The number of consecutive B-frames. Must be greater than or equal to - // zero. Must be less than `VideoStream.gop_frame_count` if set. The default - // is 0. - int32 b_frame_count = 16; - - // Specify the intensity of the adaptive quantizer (AQ). Must be between 0 - // and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A - // higher value equals a lower bitrate but smoother image. The default is 0. - double aq_strength = 17; - - // Enforces the specified codec profile. The following profiles are - // supported: - // - // * `baseline` - // * `main` - // * `high` (default) - // - // The available options are - // [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). - // Note that certain values for this field may cause the - // transcoder to override other fields you set in the `H264CodecSettings` - // message. - string profile = 18; - - // Enforces the specified codec tune. The available options are - // [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune). - // Note that certain values for this field may cause the - // transcoder to override other fields you set in the `H264CodecSettings` - // message. - string tune = 19; - - // Enforces the specified codec preset. The default is `veryfast`. The - // available options are - // [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.264#Preset). - // Note that certain values for this field may cause the - // transcoder to override other fields you set in the `H264CodecSettings` - // message. - string preset = 20; - } - - // H265 codec settings. - message H265CodecSettings { - // The width of the video in pixels. Must be an even integer. - // When not specified, the width is adjusted to match the specified height - // and input aspect ratio. If both are omitted, the input width is used. - int32 width_pixels = 1; - - // The height of the video in pixels. Must be an even integer. - // When not specified, the height is adjusted to match the specified width - // and input aspect ratio. If both are omitted, the input height is used. - int32 height_pixels = 2; - - // Required. The target video frame rate in frames per second (FPS). Must be less than - // or equal to 120. Will default to the input frame rate if larger than the - // input frame rate. The API will generate an output FPS that is divisible - // by the input FPS, and smaller or equal to the target FPS. See - // [Calculating frame - // rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for - // more information. - double frame_rate = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The video bitrate in bits per second. The minimum value is 1,000. - // The maximum value is 800,000,000. - int32 bitrate_bps = 4 [(google.api.field_behavior) = REQUIRED]; - - // Pixel format to use. The default is `yuv420p`. - // - // Supported pixel formats: - // - // - `yuv420p` pixel format - // - `yuv422p` pixel format - // - `yuv444p` pixel format - // - `yuv420p10` 10-bit HDR pixel format - // - `yuv422p10` 10-bit HDR pixel format - // - `yuv444p10` 10-bit HDR pixel format - // - `yuv420p12` 12-bit HDR pixel format - // - `yuv422p12` 12-bit HDR pixel format - // - `yuv444p12` 12-bit HDR pixel format - string pixel_format = 5; - - // Specify the `rate_control_mode`. The default is `vbr`. - // - // Supported rate control modes: - // - // - `vbr` - variable bitrate - // - `crf` - constant rate factor - string rate_control_mode = 6; - - // Target CRF level. Must be between 10 and 36, where 10 is the highest - // quality and 36 is the most efficient compression. The default is 21. - int32 crf_level = 7; - - // Specifies whether an open Group of Pictures (GOP) structure should be - // allowed or not. The default is `false`. - bool allow_open_gop = 8; - - // GOP mode can be either by frame count or duration. - oneof gop_mode { - // Select the GOP size based on the specified frame count. Must be greater - // than zero. - int32 gop_frame_count = 9; - - // Select the GOP size based on the specified duration. The default is - // `3s`. Note that `gopDuration` must be less than or equal to - // [`segmentDuration`](#SegmentSettings), and - // [`segmentDuration`](#SegmentSettings) must be divisible by - // `gopDuration`. - google.protobuf.Duration gop_duration = 10; - } - - // Use two-pass encoding strategy to achieve better video quality. - // `VideoStream.rate_control_mode` must be `vbr`. The default is `false`. - bool enable_two_pass = 11; - - // Size of the Video Buffering Verifier (VBV) buffer in bits. Must be - // greater than zero. The default is equal to `VideoStream.bitrate_bps`. - int32 vbv_size_bits = 12; - - // Initial fullness of the Video Buffering Verifier (VBV) buffer in bits. - // Must be greater than zero. The default is equal to 90% of - // `VideoStream.vbv_size_bits`. - int32 vbv_fullness_bits = 13; - - // Allow B-pyramid for reference frame selection. This may not be supported - // on all decoders. The default is `false`. - bool b_pyramid = 14; - - // The number of consecutive B-frames. Must be greater than or equal to - // zero. Must be less than `VideoStream.gop_frame_count` if set. The default - // is 0. - int32 b_frame_count = 15; - - // Specify the intensity of the adaptive quantizer (AQ). Must be between 0 - // and 1, where 0 disables the quantizer and 1 maximizes the quantizer. A - // higher value equals a lower bitrate but smoother image. The default is 0. - double aq_strength = 16; - - // Enforces the specified codec profile. The following profiles are - // supported: - // - // * 8-bit profiles - // * `main` (default) - // * `main-intra` - // * `mainstillpicture` - // * 10-bit profiles - // * `main10` (default) - // * `main10-intra` - // * `main422-10` - // * `main422-10-intra` - // * `main444-10` - // * `main444-10-intra` - // * 12-bit profiles - // * `main12` (default) - // * `main12-intra` - // * `main422-12` - // * `main422-12-intra` - // * `main444-12` - // * `main444-12-intra` - // - // The available options are - // [FFmpeg-compatible](https://x265.readthedocs.io/). - // Note that certain values for this field may cause the - // transcoder to override other fields you set in the `H265CodecSettings` - // message. - string profile = 17; - - // Enforces the specified codec tune. The available options are - // [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.265). - // Note that certain values for this field may cause the - // transcoder to override other fields you set in the `H265CodecSettings` - // message. - string tune = 18; - - // Enforces the specified codec preset. The default is `veryfast`. The - // available options are - // [FFmpeg-compatible](https://trac.ffmpeg.org/wiki/Encode/H.265). - // Note that certain values for this field may cause the - // transcoder to override other fields you set in the `H265CodecSettings` - // message. - string preset = 19; - } - - // VP9 codec settings. - message Vp9CodecSettings { - // The width of the video in pixels. Must be an even integer. - // When not specified, the width is adjusted to match the specified height - // and input aspect ratio. If both are omitted, the input width is used. - int32 width_pixels = 1; - - // The height of the video in pixels. Must be an even integer. - // When not specified, the height is adjusted to match the specified width - // and input aspect ratio. If both are omitted, the input height is used. - int32 height_pixels = 2; - - // Required. The target video frame rate in frames per second (FPS). Must be less than - // or equal to 120. Will default to the input frame rate if larger than the - // input frame rate. The API will generate an output FPS that is divisible - // by the input FPS, and smaller or equal to the target FPS. See - // [Calculating frame - // rate](https://cloud.google.com/transcoder/docs/concepts/frame-rate) for - // more information. - double frame_rate = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The video bitrate in bits per second. The minimum value is 1,000. - // The maximum value is 480,000,000. - int32 bitrate_bps = 4 [(google.api.field_behavior) = REQUIRED]; - - // Pixel format to use. The default is `yuv420p`. - // - // Supported pixel formats: - // - // - `yuv420p` pixel format - // - `yuv422p` pixel format - // - `yuv444p` pixel format - // - `yuv420p10` 10-bit HDR pixel format - // - `yuv422p10` 10-bit HDR pixel format - // - `yuv444p10` 10-bit HDR pixel format - // - `yuv420p12` 12-bit HDR pixel format - // - `yuv422p12` 12-bit HDR pixel format - // - `yuv444p12` 12-bit HDR pixel format - string pixel_format = 5; - - // Specify the `rate_control_mode`. The default is `vbr`. - // - // Supported rate control modes: - // - // - `vbr` - variable bitrate - string rate_control_mode = 6; - - // Target CRF level. Must be between 10 and 36, where 10 is the highest - // quality and 36 is the most efficient compression. The default is 21. - // - // **Note:** This field is not supported. - int32 crf_level = 7; - - // GOP mode can be either by frame count or duration. - oneof gop_mode { - // Select the GOP size based on the specified frame count. Must be greater - // than zero. - int32 gop_frame_count = 8; - - // Select the GOP size based on the specified duration. The default is - // `3s`. Note that `gopDuration` must be less than or equal to - // [`segmentDuration`](#SegmentSettings), and - // [`segmentDuration`](#SegmentSettings) must be divisible by - // `gopDuration`. - google.protobuf.Duration gop_duration = 9; - } - - // Enforces the specified codec profile. The following profiles are - // supported: - // - // * `profile0` (default) - // * `profile1` - // * `profile2` - // * `profile3` - // - // The available options are - // [WebM-compatible](https://www.webmproject.org/vp9/profiles/). - // Note that certain values for this field may cause the - // transcoder to override other fields you set in the `Vp9CodecSettings` - // message. - string profile = 10; - } - - // Codec settings can be h264, h265, or vp9. - oneof codec_settings { - // H264 codec settings. - H264CodecSettings h264 = 1; - - // H265 codec settings. - H265CodecSettings h265 = 2; - - // VP9 codec settings. - Vp9CodecSettings vp9 = 3; - } -} - -// Audio stream resource. -message AudioStream { - // The mapping for the `Job.edit_list` atoms with audio `EditAtom.inputs`. - message AudioMapping { - // Required. The `EditAtom.key` that references the atom with audio inputs in the - // `Job.edit_list`. - string atom_key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The `Input.key` that identifies the input file. - string input_key = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The zero-based index of the track in the input file. - int32 input_track = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The zero-based index of the channel in the input audio stream. - int32 input_channel = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. The zero-based index of the channel in the output audio stream. - int32 output_channel = 5 [(google.api.field_behavior) = REQUIRED]; - - // Audio volume control in dB. Negative values decrease volume, - // positive values increase. The default is 0. - double gain_db = 6; - } - - // The codec for this audio stream. The default is `aac`. - // - // Supported audio codecs: - // - // - `aac` - // - `aac-he` - // - `aac-he-v2` - // - `mp3` - // - `ac3` - // - `eac3` - string codec = 1; - - // Required. Audio bitrate in bits per second. Must be between 1 and 10,000,000. - int32 bitrate_bps = 2 [(google.api.field_behavior) = REQUIRED]; - - // Number of audio channels. Must be between 1 and 6. The default is 2. - int32 channel_count = 3; - - // A list of channel names specifying layout of the audio channels. - // This only affects the metadata embedded in the container headers, if - // supported by the specified format. The default is `["fl", "fr"]`. - // - // Supported channel names: - // - // - `fl` - Front left channel - // - `fr` - Front right channel - // - `sl` - Side left channel - // - `sr` - Side right channel - // - `fc` - Front center channel - // - `lfe` - Low frequency - repeated string channel_layout = 4; - - // The mapping for the `Job.edit_list` atoms with audio `EditAtom.inputs`. - repeated AudioMapping mapping = 5; - - // The audio sample rate in Hertz. The default is 48000 Hertz. - int32 sample_rate_hertz = 6; -} - -// Encoding of a text stream. For example, closed captions or subtitles. -message TextStream { - // The mapping for the `Job.edit_list` atoms with text `EditAtom.inputs`. - message TextMapping { - // Required. The `EditAtom.key` that references atom with text inputs in the - // `Job.edit_list`. - string atom_key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The `Input.key` that identifies the input file. - string input_key = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The zero-based index of the track in the input file. - int32 input_track = 3 [(google.api.field_behavior) = REQUIRED]; - } - - // The codec for this text stream. The default is `webvtt`. - // - // Supported text codecs: - // - // - `srt` - // - `ttml` - // - `cea608` - // - `cea708` - // - `webvtt` - string codec = 1; - - // The mapping for the `Job.edit_list` atoms with text `EditAtom.inputs`. - repeated TextMapping mapping = 3; -} - -// Segment settings for `ts`, `fmp4` and `vtt`. -message SegmentSettings { - // Duration of the segments in seconds. The default is `6.0s`. Note that - // `segmentDuration` must be greater than or equal to - // [`gopDuration`](#videostream), and `segmentDuration` must be divisible by - // [`gopDuration`](#videostream). - google.protobuf.Duration segment_duration = 1; - - // Required. Create an individual segment file. The default is `false`. - bool individual_segments = 3 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/video/transcoder/v1/services.proto b/owl-bot-staging/v1/protos/google/cloud/video/transcoder/v1/services.proto deleted file mode 100644 index 4d400c3..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/video/transcoder/v1/services.proto +++ /dev/null @@ -1,281 +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.cloud.video.transcoder.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/video/transcoder/v1/resources.proto"; -import "google/protobuf/empty.proto"; - -option csharp_namespace = "Google.Cloud.Video.Transcoder.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1;transcoder"; -option java_multiple_files = true; -option java_outer_classname = "ServicesProto"; -option java_package = "com.google.cloud.video.transcoder.v1"; -option php_namespace = "Google\\Cloud\\Video\\Transcoder\\V1"; -option ruby_package = "Google::Cloud::Video::Transcoder::V1"; - -// Using the Transcoder API, you can queue asynchronous jobs for transcoding -// media into various output formats. Output formats may include different -// streaming standards such as HTTP Live Streaming (HLS) and Dynamic Adaptive -// Streaming over HTTP (DASH). You can also customize jobs using advanced -// features such as Digital Rights Management (DRM), audio equalization, content -// concatenation, and digital ad-stitch ready content generation. -service TranscoderService { - option (google.api.default_host) = "transcoder.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a job in the specified region. - rpc CreateJob(CreateJobRequest) returns (Job) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/jobs" - body: "job" - }; - option (google.api.method_signature) = "parent,job"; - } - - // Lists jobs in the specified region. - rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/jobs" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns the job data. - rpc GetJob(GetJobRequest) returns (Job) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/jobs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a job. - rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/jobs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a job template in the specified region. - rpc CreateJobTemplate(CreateJobTemplateRequest) returns (JobTemplate) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/jobTemplates" - body: "job_template" - }; - option (google.api.method_signature) = "parent,job_template,job_template_id"; - } - - // Lists job templates in the specified region. - rpc ListJobTemplates(ListJobTemplatesRequest) returns (ListJobTemplatesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/jobTemplates" - }; - option (google.api.method_signature) = "parent"; - } - - // Returns the job template data. - rpc GetJobTemplate(GetJobTemplateRequest) returns (JobTemplate) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/jobTemplates/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a job template. - rpc DeleteJobTemplate(DeleteJobTemplateRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/jobTemplates/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request message for `TranscoderService.CreateJob`. -message CreateJobRequest { - // Required. The parent location to create and process this job. - // Format: `projects/{project}/locations/{location}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. Parameters for creating transcoding job. - Job job = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for `TranscoderService.ListJobs`. -// The parent location from which to retrieve the collection of jobs. -message ListJobsRequest { - // Required. Format: `projects/{project}/locations/{location}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of items to return. - int32 page_size = 2; - - // The `next_page_token` value returned from a previous List request, if - // any. - string page_token = 3; - - // The filter expression, following the syntax outlined in - // https://google.aip.dev/160. - string filter = 4; - - // One or more fields to compare and use to sort the output. - // See https://google.aip.dev/132#ordering. - string order_by = 5; -} - -// Request message for `TranscoderService.GetJob`. -message GetJobRequest { - // Required. The name of the job to retrieve. - // Format: `projects/{project}/locations/{location}/jobs/{job}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "transcoder.googleapis.com/Job" - } - ]; -} - -// Request message for `TranscoderService.DeleteJob`. -message DeleteJobRequest { - // Required. The name of the job to delete. - // Format: `projects/{project}/locations/{location}/jobs/{job}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "transcoder.googleapis.com/Job" - } - ]; - - // If set to true, and the job is not found, the request will succeed but no - // action will be taken on the server. - bool allow_missing = 2; -} - -// Response message for `TranscoderService.ListJobs`. -message ListJobsResponse { - // List of jobs in the specified region. - repeated Job jobs = 1; - - // The pagination token. - string next_page_token = 2; - - // List of regions that could not be reached. - repeated string unreachable = 3; -} - -// Request message for `TranscoderService.CreateJobTemplate`. -message CreateJobTemplateRequest { - // Required. The parent location to create this job template. - // Format: `projects/{project}/locations/{location}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. Parameters for creating job template. - JobTemplate job_template = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the job template, which will become the final component - // of the job template's resource name. - // - // This value should be 4-63 characters, and valid characters must match the - // regular expression `[a-zA-Z][a-zA-Z0-9_-]*`. - string job_template_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for `TranscoderService.ListJobTemplates`. -message ListJobTemplatesRequest { - // Required. The parent location from which to retrieve the collection of job templates. - // Format: `projects/{project}/locations/{location}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of items to return. - int32 page_size = 2; - - // The `next_page_token` value returned from a previous List request, if - // any. - string page_token = 3; - - // The filter expression, following the syntax outlined in - // https://google.aip.dev/160. - string filter = 4; - - // One or more fields to compare and use to sort the output. - // See https://google.aip.dev/132#ordering. - string order_by = 5; -} - -// Request message for `TranscoderService.GetJobTemplate`. -message GetJobTemplateRequest { - // Required. The name of the job template to retrieve. - // Format: - // `projects/{project}/locations/{location}/jobTemplates/{job_template}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "transcoder.googleapis.com/JobTemplate" - } - ]; -} - -// Request message for `TranscoderService.DeleteJobTemplate`. -message DeleteJobTemplateRequest { - // Required. The name of the job template to delete. - // `projects/{project}/locations/{location}/jobTemplates/{job_template}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "transcoder.googleapis.com/JobTemplate" - } - ]; - - // If set to true, and the job template is not found, the request will succeed - // but no action will be taken on the server. - bool allow_missing = 2; -} - -// Response message for `TranscoderService.ListJobTemplates`. -message ListJobTemplatesResponse { - // List of job templates in the specified region. - repeated JobTemplate job_templates = 1; - - // The pagination token. - string next_page_token = 2; - - // List of regions that could not be reached. - repeated string unreachable = 3; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.video.transcoder.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.video.transcoder.v1.json deleted file mode 100644 index 7478ec8..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.video.transcoder.v1.json +++ /dev/null @@ -1,387 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-transcoder", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.video.transcoder.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "transcoder_v1_generated_TranscoderService_CreateJob_async", - "title": "TranscoderService createJob Sample", - "origin": "API_DEFINITION", - "description": " Creates a job in the specified region.", - "canonical": true, - "file": "transcoder_service.create_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateJob", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService.CreateJob", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "job", - "type": ".google.cloud.video.transcoder.v1.Job" - } - ], - "resultType": ".google.cloud.video.transcoder.v1.Job", - "client": { - "shortName": "TranscoderServiceClient", - "fullName": "google.cloud.video.transcoder.v1.TranscoderServiceClient" - }, - "method": { - "shortName": "CreateJob", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService.CreateJob", - "service": { - "shortName": "TranscoderService", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService" - } - } - } - }, - { - "regionTag": "transcoder_v1_generated_TranscoderService_ListJobs_async", - "title": "TranscoderService listJobs Sample", - "origin": "API_DEFINITION", - "description": " Lists jobs in the specified region.", - "canonical": true, - "file": "transcoder_service.list_jobs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListJobs", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService.ListJobs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.video.transcoder.v1.ListJobsResponse", - "client": { - "shortName": "TranscoderServiceClient", - "fullName": "google.cloud.video.transcoder.v1.TranscoderServiceClient" - }, - "method": { - "shortName": "ListJobs", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService.ListJobs", - "service": { - "shortName": "TranscoderService", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService" - } - } - } - }, - { - "regionTag": "transcoder_v1_generated_TranscoderService_GetJob_async", - "title": "TranscoderService getJob Sample", - "origin": "API_DEFINITION", - "description": " Returns the job data.", - "canonical": true, - "file": "transcoder_service.get_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetJob", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService.GetJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.video.transcoder.v1.Job", - "client": { - "shortName": "TranscoderServiceClient", - "fullName": "google.cloud.video.transcoder.v1.TranscoderServiceClient" - }, - "method": { - "shortName": "GetJob", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService.GetJob", - "service": { - "shortName": "TranscoderService", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService" - } - } - } - }, - { - "regionTag": "transcoder_v1_generated_TranscoderService_DeleteJob_async", - "title": "TranscoderService deleteJob Sample", - "origin": "API_DEFINITION", - "description": " Deletes a job.", - "canonical": true, - "file": "transcoder_service.delete_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteJob", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService.DeleteJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "TranscoderServiceClient", - "fullName": "google.cloud.video.transcoder.v1.TranscoderServiceClient" - }, - "method": { - "shortName": "DeleteJob", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService.DeleteJob", - "service": { - "shortName": "TranscoderService", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService" - } - } - } - }, - { - "regionTag": "transcoder_v1_generated_TranscoderService_CreateJobTemplate_async", - "title": "TranscoderService createJobTemplate Sample", - "origin": "API_DEFINITION", - "description": " Creates a job template in the specified region.", - "canonical": true, - "file": "transcoder_service.create_job_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateJobTemplate", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService.CreateJobTemplate", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "job_template", - "type": ".google.cloud.video.transcoder.v1.JobTemplate" - }, - { - "name": "job_template_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.video.transcoder.v1.JobTemplate", - "client": { - "shortName": "TranscoderServiceClient", - "fullName": "google.cloud.video.transcoder.v1.TranscoderServiceClient" - }, - "method": { - "shortName": "CreateJobTemplate", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService.CreateJobTemplate", - "service": { - "shortName": "TranscoderService", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService" - } - } - } - }, - { - "regionTag": "transcoder_v1_generated_TranscoderService_ListJobTemplates_async", - "title": "TranscoderService listJobTemplates Sample", - "origin": "API_DEFINITION", - "description": " Lists job templates in the specified region.", - "canonical": true, - "file": "transcoder_service.list_job_templates.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListJobTemplates", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService.ListJobTemplates", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.video.transcoder.v1.ListJobTemplatesResponse", - "client": { - "shortName": "TranscoderServiceClient", - "fullName": "google.cloud.video.transcoder.v1.TranscoderServiceClient" - }, - "method": { - "shortName": "ListJobTemplates", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService.ListJobTemplates", - "service": { - "shortName": "TranscoderService", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService" - } - } - } - }, - { - "regionTag": "transcoder_v1_generated_TranscoderService_GetJobTemplate_async", - "title": "TranscoderService getJobTemplate Sample", - "origin": "API_DEFINITION", - "description": " Returns the job template data.", - "canonical": true, - "file": "transcoder_service.get_job_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetJobTemplate", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService.GetJobTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.video.transcoder.v1.JobTemplate", - "client": { - "shortName": "TranscoderServiceClient", - "fullName": "google.cloud.video.transcoder.v1.TranscoderServiceClient" - }, - "method": { - "shortName": "GetJobTemplate", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService.GetJobTemplate", - "service": { - "shortName": "TranscoderService", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService" - } - } - } - }, - { - "regionTag": "transcoder_v1_generated_TranscoderService_DeleteJobTemplate_async", - "title": "TranscoderService deleteJobTemplate Sample", - "origin": "API_DEFINITION", - "description": " Deletes a job template.", - "canonical": true, - "file": "transcoder_service.delete_job_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteJobTemplate", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService.DeleteJobTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "TranscoderServiceClient", - "fullName": "google.cloud.video.transcoder.v1.TranscoderServiceClient" - }, - "method": { - "shortName": "DeleteJobTemplate", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService.DeleteJobTemplate", - "service": { - "shortName": "TranscoderService", - "fullName": "google.cloud.video.transcoder.v1.TranscoderService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1/samples/generated/v1/transcoder_service.create_job.js b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.create_job.js deleted file mode 100644 index 47a3d4d..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/transcoder_service.create_job.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, job) { - // [START transcoder_v1_generated_TranscoderService_CreateJob_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent location to create and process this job. - * Format: `projects/{project}/locations/{location}` - */ - // const parent = 'abc123' - /** - * Required. Parameters for creating transcoding job. - */ - // const job = {} - - // Imports the Transcoder library - const {TranscoderServiceClient} = require('@google-cloud/video-transcoder').v1; - - // Instantiates a client - const transcoderClient = new TranscoderServiceClient(); - - async function callCreateJob() { - // Construct request - const request = { - parent, - job, - }; - - // Run request - const response = await transcoderClient.createJob(request); - console.log(response); - } - - callCreateJob(); - // [END transcoder_v1_generated_TranscoderService_CreateJob_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/transcoder_service.create_job_template.js b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.create_job_template.js deleted file mode 100644 index d1deee0..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/transcoder_service.create_job_template.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, jobTemplate, jobTemplateId) { - // [START transcoder_v1_generated_TranscoderService_CreateJobTemplate_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent location to create this job template. - * Format: `projects/{project}/locations/{location}` - */ - // const parent = 'abc123' - /** - * Required. Parameters for creating job template. - */ - // const jobTemplate = {} - /** - * Required. The ID to use for the job template, which will become the final component - * of the job template's resource name. - * This value should be 4-63 characters, and valid characters must match the - * regular expression `[a-zA-Z][a-zA-Z0-9_-]*`. - */ - // const jobTemplateId = 'abc123' - - // Imports the Transcoder library - const {TranscoderServiceClient} = require('@google-cloud/video-transcoder').v1; - - // Instantiates a client - const transcoderClient = new TranscoderServiceClient(); - - async function callCreateJobTemplate() { - // Construct request - const request = { - parent, - jobTemplate, - jobTemplateId, - }; - - // Run request - const response = await transcoderClient.createJobTemplate(request); - console.log(response); - } - - callCreateJobTemplate(); - // [END transcoder_v1_generated_TranscoderService_CreateJobTemplate_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/transcoder_service.delete_job.js b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.delete_job.js deleted file mode 100644 index 46fd9e3..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/transcoder_service.delete_job.js +++ /dev/null @@ -1,64 +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 transcoder_v1_generated_TranscoderService_DeleteJob_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the job to delete. - * Format: `projects/{project}/locations/{location}/jobs/{job}` - */ - // const name = 'abc123' - /** - * If set to true, and the job is not found, the request will succeed but no - * action will be taken on the server. - */ - // const allowMissing = true - - // Imports the Transcoder library - const {TranscoderServiceClient} = require('@google-cloud/video-transcoder').v1; - - // Instantiates a client - const transcoderClient = new TranscoderServiceClient(); - - async function callDeleteJob() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await transcoderClient.deleteJob(request); - console.log(response); - } - - callDeleteJob(); - // [END transcoder_v1_generated_TranscoderService_DeleteJob_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/transcoder_service.delete_job_template.js b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.delete_job_template.js deleted file mode 100644 index a1ebefe..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/transcoder_service.delete_job_template.js +++ /dev/null @@ -1,64 +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 transcoder_v1_generated_TranscoderService_DeleteJobTemplate_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the job template to delete. - * `projects/{project}/locations/{location}/jobTemplates/{job_template}` - */ - // const name = 'abc123' - /** - * If set to true, and the job template is not found, the request will succeed - * but no action will be taken on the server. - */ - // const allowMissing = true - - // Imports the Transcoder library - const {TranscoderServiceClient} = require('@google-cloud/video-transcoder').v1; - - // Instantiates a client - const transcoderClient = new TranscoderServiceClient(); - - async function callDeleteJobTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await transcoderClient.deleteJobTemplate(request); - console.log(response); - } - - callDeleteJobTemplate(); - // [END transcoder_v1_generated_TranscoderService_DeleteJobTemplate_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/transcoder_service.get_job.js b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.get_job.js deleted file mode 100644 index 8f8eb07..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/transcoder_service.get_job.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START transcoder_v1_generated_TranscoderService_GetJob_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the job to retrieve. - * Format: `projects/{project}/locations/{location}/jobs/{job}` - */ - // const name = 'abc123' - - // Imports the Transcoder library - const {TranscoderServiceClient} = require('@google-cloud/video-transcoder').v1; - - // Instantiates a client - const transcoderClient = new TranscoderServiceClient(); - - async function callGetJob() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await transcoderClient.getJob(request); - console.log(response); - } - - callGetJob(); - // [END transcoder_v1_generated_TranscoderService_GetJob_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/transcoder_service.get_job_template.js b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.get_job_template.js deleted file mode 100644 index 4a3baa4..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/transcoder_service.get_job_template.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START transcoder_v1_generated_TranscoderService_GetJobTemplate_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the job template to retrieve. - * Format: - * `projects/{project}/locations/{location}/jobTemplates/{job_template}` - */ - // const name = 'abc123' - - // Imports the Transcoder library - const {TranscoderServiceClient} = require('@google-cloud/video-transcoder').v1; - - // Instantiates a client - const transcoderClient = new TranscoderServiceClient(); - - async function callGetJobTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await transcoderClient.getJobTemplate(request); - console.log(response); - } - - callGetJobTemplate(); - // [END transcoder_v1_generated_TranscoderService_GetJobTemplate_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/transcoder_service.list_job_templates.js b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.list_job_templates.js deleted file mode 100644 index d6891c5..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/transcoder_service.list_job_templates.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START transcoder_v1_generated_TranscoderService_ListJobTemplates_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent location from which to retrieve the collection of job templates. - * Format: `projects/{project}/locations/{location}` - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - */ - // const pageSize = 1234 - /** - * The `next_page_token` value returned from a previous List request, if - * any. - */ - // const pageToken = 'abc123' - /** - * The filter expression, following the syntax outlined in - * https://google.aip.dev/160. - */ - // const filter = 'abc123' - /** - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - */ - // const orderBy = 'abc123' - - // Imports the Transcoder library - const {TranscoderServiceClient} = require('@google-cloud/video-transcoder').v1; - - // Instantiates a client - const transcoderClient = new TranscoderServiceClient(); - - async function callListJobTemplates() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await transcoderClient.listJobTemplatesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListJobTemplates(); - // [END transcoder_v1_generated_TranscoderService_ListJobTemplates_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/transcoder_service.list_jobs.js b/owl-bot-staging/v1/samples/generated/v1/transcoder_service.list_jobs.js deleted file mode 100644 index 0c0755b..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/transcoder_service.list_jobs.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START transcoder_v1_generated_TranscoderService_ListJobs_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Format: `projects/{project}/locations/{location}` - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - */ - // const pageSize = 1234 - /** - * The `next_page_token` value returned from a previous List request, if - * any. - */ - // const pageToken = 'abc123' - /** - * The filter expression, following the syntax outlined in - * https://google.aip.dev/160. - */ - // const filter = 'abc123' - /** - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - */ - // const orderBy = 'abc123' - - // Imports the Transcoder library - const {TranscoderServiceClient} = require('@google-cloud/video-transcoder').v1; - - // Instantiates a client - const transcoderClient = new TranscoderServiceClient(); - - async function callListJobs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await transcoderClient.listJobsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListJobs(); - // [END transcoder_v1_generated_TranscoderService_ListJobs_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 7ca135a..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 TranscoderServiceClient = v1.TranscoderServiceClient; -type TranscoderServiceClient = v1.TranscoderServiceClient; -export {v1, TranscoderServiceClient}; -export default {v1, TranscoderServiceClient}; -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 5898b0e..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.video.transcoder.v1", - "libraryPackage": "@google-cloud/video-transcoder", - "services": { - "TranscoderService": { - "clients": { - "grpc": { - "libraryClient": "TranscoderServiceClient", - "rpcs": { - "CreateJob": { - "methods": [ - "createJob" - ] - }, - "GetJob": { - "methods": [ - "getJob" - ] - }, - "DeleteJob": { - "methods": [ - "deleteJob" - ] - }, - "CreateJobTemplate": { - "methods": [ - "createJobTemplate" - ] - }, - "GetJobTemplate": { - "methods": [ - "getJobTemplate" - ] - }, - "DeleteJobTemplate": { - "methods": [ - "deleteJobTemplate" - ] - }, - "ListJobs": { - "methods": [ - "listJobs", - "listJobsStream", - "listJobsAsync" - ] - }, - "ListJobTemplates": { - "methods": [ - "listJobTemplates", - "listJobTemplatesStream", - "listJobTemplatesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "TranscoderServiceClient", - "rpcs": { - "CreateJob": { - "methods": [ - "createJob" - ] - }, - "GetJob": { - "methods": [ - "getJob" - ] - }, - "DeleteJob": { - "methods": [ - "deleteJob" - ] - }, - "CreateJobTemplate": { - "methods": [ - "createJobTemplate" - ] - }, - "GetJobTemplate": { - "methods": [ - "getJobTemplate" - ] - }, - "DeleteJobTemplate": { - "methods": [ - "deleteJobTemplate" - ] - }, - "ListJobs": { - "methods": [ - "listJobs", - "listJobsStream", - "listJobsAsync" - ] - }, - "ListJobTemplates": { - "methods": [ - "listJobTemplates", - "listJobTemplatesStream", - "listJobTemplatesAsync" - ] - } - } - } - } - } - } -} 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 2f52b1a..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 {TranscoderServiceClient} from './transcoder_service_client'; diff --git a/owl-bot-staging/v1/src/v1/transcoder_service_client.ts b/owl-bot-staging/v1/src/v1/transcoder_service_client.ts deleted file mode 100644 index 2bedfd5..0000000 --- a/owl-bot-staging/v1/src/v1/transcoder_service_client.ts +++ /dev/null @@ -1,1303 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/transcoder_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './transcoder_service_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Using the Transcoder API, you can queue asynchronous jobs for transcoding - * media into various output formats. Output formats may include different - * streaming standards such as HTTP Live Streaming (HLS) and Dynamic Adaptive - * Streaming over HTTP (DASH). You can also customize jobs using advanced - * features such as Digital Rights Management (DRM), audio equalization, content - * concatenation, and digital ad-stitch ready content generation. - * @class - * @memberof v1 - */ -export class TranscoderServiceClient { - 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}; - transcoderServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TranscoderServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof TranscoderServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - jobPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/jobs/{job}' - ), - jobTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/jobTemplates/{job_template}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs'), - listJobTemplates: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobTemplates') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.video.transcoder.v1.TranscoderService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.transcoderServiceStub) { - return this.transcoderServiceStub; - } - - // Put together the "service stub" for - // google.cloud.video.transcoder.v1.TranscoderService. - this.transcoderServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.video.transcoder.v1.TranscoderService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.video.transcoder.v1.TranscoderService, - 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 transcoderServiceStubMethods = - ['createJob', 'listJobs', 'getJob', 'deleteJob', 'createJobTemplate', 'listJobTemplates', 'getJobTemplate', 'deleteJobTemplate']; - for (const methodName of transcoderServiceStubMethods) { - const callPromise = this.transcoderServiceStub.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] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.transcoderServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'transcoder.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 'transcoder.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 -- - // ------------------- -/** - * Creates a job in the specified region. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location to create and process this job. - * Format: `projects/{project}/locations/{location}` - * @param {google.cloud.video.transcoder.v1.Job} request.job - * Required. Parameters for creating transcoding 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 [Job]{@link google.cloud.video.transcoder.v1.Job}. - * 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/transcoder_service.create_job.js - * region_tag:transcoder_v1_generated_TranscoderService_CreateJob_async - */ - createJob( - request?: protos.google.cloud.video.transcoder.v1.ICreateJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.video.transcoder.v1.IJob, - protos.google.cloud.video.transcoder.v1.ICreateJobRequest|undefined, {}|undefined - ]>; - createJob( - request: protos.google.cloud.video.transcoder.v1.ICreateJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.video.transcoder.v1.IJob, - protos.google.cloud.video.transcoder.v1.ICreateJobRequest|null|undefined, - {}|null|undefined>): void; - createJob( - request: protos.google.cloud.video.transcoder.v1.ICreateJobRequest, - callback: Callback< - protos.google.cloud.video.transcoder.v1.IJob, - protos.google.cloud.video.transcoder.v1.ICreateJobRequest|null|undefined, - {}|null|undefined>): void; - createJob( - request?: protos.google.cloud.video.transcoder.v1.ICreateJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.video.transcoder.v1.IJob, - protos.google.cloud.video.transcoder.v1.ICreateJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.video.transcoder.v1.IJob, - protos.google.cloud.video.transcoder.v1.ICreateJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.video.transcoder.v1.IJob, - protos.google.cloud.video.transcoder.v1.ICreateJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createJob(request, options, callback); - } -/** - * Returns the job data. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the job to retrieve. - * Format: `projects/{project}/locations/{location}/jobs/{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 [Job]{@link google.cloud.video.transcoder.v1.Job}. - * 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/transcoder_service.get_job.js - * region_tag:transcoder_v1_generated_TranscoderService_GetJob_async - */ - getJob( - request?: protos.google.cloud.video.transcoder.v1.IGetJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.video.transcoder.v1.IJob, - protos.google.cloud.video.transcoder.v1.IGetJobRequest|undefined, {}|undefined - ]>; - getJob( - request: protos.google.cloud.video.transcoder.v1.IGetJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.video.transcoder.v1.IJob, - protos.google.cloud.video.transcoder.v1.IGetJobRequest|null|undefined, - {}|null|undefined>): void; - getJob( - request: protos.google.cloud.video.transcoder.v1.IGetJobRequest, - callback: Callback< - protos.google.cloud.video.transcoder.v1.IJob, - protos.google.cloud.video.transcoder.v1.IGetJobRequest|null|undefined, - {}|null|undefined>): void; - getJob( - request?: protos.google.cloud.video.transcoder.v1.IGetJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.video.transcoder.v1.IJob, - protos.google.cloud.video.transcoder.v1.IGetJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.video.transcoder.v1.IJob, - protos.google.cloud.video.transcoder.v1.IGetJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.video.transcoder.v1.IJob, - protos.google.cloud.video.transcoder.v1.IGetJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getJob(request, options, callback); - } -/** - * Deletes a job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the job to delete. - * Format: `projects/{project}/locations/{location}/jobs/{job}` - * @param {boolean} request.allowMissing - * If set to true, and the job is not found, the request will succeed but no - * action will be taken on the server. - * @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/transcoder_service.delete_job.js - * region_tag:transcoder_v1_generated_TranscoderService_DeleteJob_async - */ - deleteJob( - request?: protos.google.cloud.video.transcoder.v1.IDeleteJobRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.video.transcoder.v1.IDeleteJobRequest|undefined, {}|undefined - ]>; - deleteJob( - request: protos.google.cloud.video.transcoder.v1.IDeleteJobRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.video.transcoder.v1.IDeleteJobRequest|null|undefined, - {}|null|undefined>): void; - deleteJob( - request: protos.google.cloud.video.transcoder.v1.IDeleteJobRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.video.transcoder.v1.IDeleteJobRequest|null|undefined, - {}|null|undefined>): void; - deleteJob( - request?: protos.google.cloud.video.transcoder.v1.IDeleteJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.video.transcoder.v1.IDeleteJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.video.transcoder.v1.IDeleteJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.video.transcoder.v1.IDeleteJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteJob(request, options, callback); - } -/** - * Creates a job template in the specified region. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location to create this job template. - * Format: `projects/{project}/locations/{location}` - * @param {google.cloud.video.transcoder.v1.JobTemplate} request.jobTemplate - * Required. Parameters for creating job template. - * @param {string} request.jobTemplateId - * Required. The ID to use for the job template, which will become the final component - * of the job template's resource name. - * - * This value should be 4-63 characters, and valid characters must match the - * regular expression `{@link a-zA-Z0-9_-|a-zA-Z}*`. - * @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 [JobTemplate]{@link google.cloud.video.transcoder.v1.JobTemplate}. - * 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/transcoder_service.create_job_template.js - * region_tag:transcoder_v1_generated_TranscoderService_CreateJobTemplate_async - */ - createJobTemplate( - request?: protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.video.transcoder.v1.IJobTemplate, - protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest|undefined, {}|undefined - ]>; - createJobTemplate( - request: protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.video.transcoder.v1.IJobTemplate, - protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest|null|undefined, - {}|null|undefined>): void; - createJobTemplate( - request: protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest, - callback: Callback< - protos.google.cloud.video.transcoder.v1.IJobTemplate, - protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest|null|undefined, - {}|null|undefined>): void; - createJobTemplate( - request?: protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.video.transcoder.v1.IJobTemplate, - protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.video.transcoder.v1.IJobTemplate, - protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.video.transcoder.v1.IJobTemplate, - protos.google.cloud.video.transcoder.v1.ICreateJobTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createJobTemplate(request, options, callback); - } -/** - * Returns the job template data. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the job template to retrieve. - * Format: - * `projects/{project}/locations/{location}/jobTemplates/{job_template}` - * @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 [JobTemplate]{@link google.cloud.video.transcoder.v1.JobTemplate}. - * 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/transcoder_service.get_job_template.js - * region_tag:transcoder_v1_generated_TranscoderService_GetJobTemplate_async - */ - getJobTemplate( - request?: protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.video.transcoder.v1.IJobTemplate, - protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest|undefined, {}|undefined - ]>; - getJobTemplate( - request: protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.video.transcoder.v1.IJobTemplate, - protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest|null|undefined, - {}|null|undefined>): void; - getJobTemplate( - request: protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest, - callback: Callback< - protos.google.cloud.video.transcoder.v1.IJobTemplate, - protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest|null|undefined, - {}|null|undefined>): void; - getJobTemplate( - request?: protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.video.transcoder.v1.IJobTemplate, - protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.video.transcoder.v1.IJobTemplate, - protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.video.transcoder.v1.IJobTemplate, - protos.google.cloud.video.transcoder.v1.IGetJobTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getJobTemplate(request, options, callback); - } -/** - * Deletes a job template. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the job template to delete. - * `projects/{project}/locations/{location}/jobTemplates/{job_template}` - * @param {boolean} request.allowMissing - * If set to true, and the job template is not found, the request will succeed - * but no action will be taken on the server. - * @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/transcoder_service.delete_job_template.js - * region_tag:transcoder_v1_generated_TranscoderService_DeleteJobTemplate_async - */ - deleteJobTemplate( - request?: protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest|undefined, {}|undefined - ]>; - deleteJobTemplate( - request: protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest|null|undefined, - {}|null|undefined>): void; - deleteJobTemplate( - request: protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest|null|undefined, - {}|null|undefined>): void; - deleteJobTemplate( - request?: protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.video.transcoder.v1.IDeleteJobTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteJobTemplate(request, options, callback); - } - - /** - * Lists jobs in the specified region. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Format: `projects/{project}/locations/{location}` - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous List request, if - * any. - * @param {string} request.filter - * The filter expression, following the syntax outlined in - * https://google.aip.dev/160. - * @param {string} request.orderBy - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 [Job]{@link google.cloud.video.transcoder.v1.Job}. - * 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 `listJobsAsync()` - * 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. - */ - listJobs( - request?: protos.google.cloud.video.transcoder.v1.IListJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.video.transcoder.v1.IJob[], - protos.google.cloud.video.transcoder.v1.IListJobsRequest|null, - protos.google.cloud.video.transcoder.v1.IListJobsResponse - ]>; - listJobs( - request: protos.google.cloud.video.transcoder.v1.IListJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.video.transcoder.v1.IListJobsRequest, - protos.google.cloud.video.transcoder.v1.IListJobsResponse|null|undefined, - protos.google.cloud.video.transcoder.v1.IJob>): void; - listJobs( - request: protos.google.cloud.video.transcoder.v1.IListJobsRequest, - callback: PaginationCallback< - protos.google.cloud.video.transcoder.v1.IListJobsRequest, - protos.google.cloud.video.transcoder.v1.IListJobsResponse|null|undefined, - protos.google.cloud.video.transcoder.v1.IJob>): void; - listJobs( - request?: protos.google.cloud.video.transcoder.v1.IListJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.video.transcoder.v1.IListJobsRequest, - protos.google.cloud.video.transcoder.v1.IListJobsResponse|null|undefined, - protos.google.cloud.video.transcoder.v1.IJob>, - callback?: PaginationCallback< - protos.google.cloud.video.transcoder.v1.IListJobsRequest, - protos.google.cloud.video.transcoder.v1.IListJobsResponse|null|undefined, - protos.google.cloud.video.transcoder.v1.IJob>): - Promise<[ - protos.google.cloud.video.transcoder.v1.IJob[], - protos.google.cloud.video.transcoder.v1.IListJobsRequest|null, - protos.google.cloud.video.transcoder.v1.IListJobsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listJobs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Format: `projects/{project}/locations/{location}` - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous List request, if - * any. - * @param {string} request.filter - * The filter expression, following the syntax outlined in - * https://google.aip.dev/160. - * @param {string} request.orderBy - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 [Job]{@link google.cloud.video.transcoder.v1.Job} 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 `listJobsAsync()` - * 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. - */ - listJobsStream( - request?: protos.google.cloud.video.transcoder.v1.IListJobsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listJobs.createStream( - this.innerApiCalls.listJobs as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listJobs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Format: `projects/{project}/locations/{location}` - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous List request, if - * any. - * @param {string} request.filter - * The filter expression, following the syntax outlined in - * https://google.aip.dev/160. - * @param {string} request.orderBy - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 - * [Job]{@link google.cloud.video.transcoder.v1.Job}. 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/transcoder_service.list_jobs.js - * region_tag:transcoder_v1_generated_TranscoderService_ListJobs_async - */ - listJobsAsync( - request?: protos.google.cloud.video.transcoder.v1.IListJobsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listJobs.asyncIterate( - this.innerApiCalls['listJobs'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists job templates in the specified region. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location from which to retrieve the collection of job templates. - * Format: `projects/{project}/locations/{location}` - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous List request, if - * any. - * @param {string} request.filter - * The filter expression, following the syntax outlined in - * https://google.aip.dev/160. - * @param {string} request.orderBy - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 [JobTemplate]{@link google.cloud.video.transcoder.v1.JobTemplate}. - * 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 `listJobTemplatesAsync()` - * 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. - */ - listJobTemplates( - request?: protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.video.transcoder.v1.IJobTemplate[], - protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest|null, - protos.google.cloud.video.transcoder.v1.IListJobTemplatesResponse - ]>; - listJobTemplates( - request: protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, - protos.google.cloud.video.transcoder.v1.IListJobTemplatesResponse|null|undefined, - protos.google.cloud.video.transcoder.v1.IJobTemplate>): void; - listJobTemplates( - request: protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, - callback: PaginationCallback< - protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, - protos.google.cloud.video.transcoder.v1.IListJobTemplatesResponse|null|undefined, - protos.google.cloud.video.transcoder.v1.IJobTemplate>): void; - listJobTemplates( - request?: protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, - protos.google.cloud.video.transcoder.v1.IListJobTemplatesResponse|null|undefined, - protos.google.cloud.video.transcoder.v1.IJobTemplate>, - callback?: PaginationCallback< - protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, - protos.google.cloud.video.transcoder.v1.IListJobTemplatesResponse|null|undefined, - protos.google.cloud.video.transcoder.v1.IJobTemplate>): - Promise<[ - protos.google.cloud.video.transcoder.v1.IJobTemplate[], - protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest|null, - protos.google.cloud.video.transcoder.v1.IListJobTemplatesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listJobTemplates(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location from which to retrieve the collection of job templates. - * Format: `projects/{project}/locations/{location}` - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous List request, if - * any. - * @param {string} request.filter - * The filter expression, following the syntax outlined in - * https://google.aip.dev/160. - * @param {string} request.orderBy - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 [JobTemplate]{@link google.cloud.video.transcoder.v1.JobTemplate} 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 `listJobTemplatesAsync()` - * 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. - */ - listJobTemplatesStream( - request?: protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listJobTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listJobTemplates.createStream( - this.innerApiCalls.listJobTemplates as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listJobTemplates`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent location from which to retrieve the collection of job templates. - * Format: `projects/{project}/locations/{location}` - * @param {number} request.pageSize - * The maximum number of items to return. - * @param {string} request.pageToken - * The `next_page_token` value returned from a previous List request, if - * any. - * @param {string} request.filter - * The filter expression, following the syntax outlined in - * https://google.aip.dev/160. - * @param {string} request.orderBy - * One or more fields to compare and use to sort the output. - * See https://google.aip.dev/132#ordering. - * @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 - * [JobTemplate]{@link google.cloud.video.transcoder.v1.JobTemplate}. 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/transcoder_service.list_job_templates.js - * region_tag:transcoder_v1_generated_TranscoderService_ListJobTemplates_async - */ - listJobTemplatesAsync( - request?: protos.google.cloud.video.transcoder.v1.IListJobTemplatesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listJobTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listJobTemplates.asyncIterate( - this.innerApiCalls['listJobTemplates'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified job resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} job - * @returns {string} Resource name string. - */ - jobPath(project:string,location:string,job:string) { - return this.pathTemplates.jobPathTemplate.render({ - project: project, - location: location, - job: job, - }); - } - - /** - * Parse the project from Job resource. - * - * @param {string} jobName - * A fully-qualified path representing Job resource. - * @returns {string} A string representing the project. - */ - matchProjectFromJobName(jobName: string) { - return this.pathTemplates.jobPathTemplate.match(jobName).project; - } - - /** - * Parse the location from Job resource. - * - * @param {string} jobName - * A fully-qualified path representing Job resource. - * @returns {string} A string representing the location. - */ - matchLocationFromJobName(jobName: string) { - return this.pathTemplates.jobPathTemplate.match(jobName).location; - } - - /** - * Parse the job from Job resource. - * - * @param {string} jobName - * A fully-qualified path representing Job resource. - * @returns {string} A string representing the job. - */ - matchJobFromJobName(jobName: string) { - return this.pathTemplates.jobPathTemplate.match(jobName).job; - } - - /** - * Return a fully-qualified jobTemplate resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} job_template - * @returns {string} Resource name string. - */ - jobTemplatePath(project:string,location:string,jobTemplate:string) { - return this.pathTemplates.jobTemplatePathTemplate.render({ - project: project, - location: location, - job_template: jobTemplate, - }); - } - - /** - * Parse the project from JobTemplate resource. - * - * @param {string} jobTemplateName - * A fully-qualified path representing JobTemplate resource. - * @returns {string} A string representing the project. - */ - matchProjectFromJobTemplateName(jobTemplateName: string) { - return this.pathTemplates.jobTemplatePathTemplate.match(jobTemplateName).project; - } - - /** - * Parse the location from JobTemplate resource. - * - * @param {string} jobTemplateName - * A fully-qualified path representing JobTemplate resource. - * @returns {string} A string representing the location. - */ - matchLocationFromJobTemplateName(jobTemplateName: string) { - return this.pathTemplates.jobTemplatePathTemplate.match(jobTemplateName).location; - } - - /** - * Parse the job_template from JobTemplate resource. - * - * @param {string} jobTemplateName - * A fully-qualified path representing JobTemplate resource. - * @returns {string} A string representing the job_template. - */ - matchJobTemplateFromJobTemplateName(jobTemplateName: string) { - return this.pathTemplates.jobTemplatePathTemplate.match(jobTemplateName).job_template; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.transcoderServiceStub && !this._terminated) { - return this.transcoderServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/transcoder_service_client_config.json b/owl-bot-staging/v1/src/v1/transcoder_service_client_config.json deleted file mode 100644 index 0217861..0000000 --- a/owl-bot-staging/v1/src/v1/transcoder_service_client_config.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.cloud.video.transcoder.v1.TranscoderService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateJob": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListJobs": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetJob": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteJob": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateJobTemplate": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListJobTemplates": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetJobTemplate": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteJobTemplate": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/transcoder_service_proto_list.json b/owl-bot-staging/v1/src/v1/transcoder_service_proto_list.json deleted file mode 100644 index b948cd5..0000000 --- a/owl-bot-staging/v1/src/v1/transcoder_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/video/transcoder/v1/resources.proto", - "../../protos/google/cloud/video/transcoder/v1/services.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 3581a53..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 transcoder = require('@google-cloud/video-transcoder'); - -function main() { - const transcoderServiceClient = new transcoder.TranscoderServiceClient(); -} - -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 bb267c5..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 {TranscoderServiceClient} from '@google-cloud/video-transcoder'; - -// check that the client class type name can be used -function doStuffWithTranscoderServiceClient(client: TranscoderServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const transcoderServiceClient = new TranscoderServiceClient(); - doStuffWithTranscoderServiceClient(transcoderServiceClient); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts deleted file mode 100644 index 8ec4522..0000000 --- a/owl-bot-staging/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1/test/gapic_transcoder_service_v1.ts b/owl-bot-staging/v1/test/gapic_transcoder_service_v1.ts deleted file mode 100644 index b14d5cb..0000000 --- a/owl-bot-staging/v1/test/gapic_transcoder_service_v1.ts +++ /dev/null @@ -1,1343 +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 transcoderserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} 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 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.TranscoderServiceClient', () => { - it('has servicePath', () => { - const servicePath = transcoderserviceModule.v1.TranscoderServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = transcoderserviceModule.v1.TranscoderServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = transcoderserviceModule.v1.TranscoderServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.transcoderServiceStub, undefined); - await client.initialize(); - assert(client.transcoderServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.transcoderServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.transcoderServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - 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 transcoderserviceModule.v1.TranscoderServiceClient({ - 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('createJob', () => { - it('invokes createJob without error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.CreateJobRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()); - client.innerApiCalls.createJob = stubSimpleCall(expectedResponse); - const [response] = await client.createJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createJob without error using callback', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.CreateJobRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()); - client.innerApiCalls.createJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createJob( - request, - (err?: Error|null, result?: protos.google.cloud.video.transcoder.v1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createJob with error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.CreateJobRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createJob(request), expectedError); - assert((client.innerApiCalls.createJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createJob with closed client', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.CreateJobRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createJob(request), expectedError); - }); - }); - - describe('getJob', () => { - it('invokes getJob without error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.GetJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()); - client.innerApiCalls.getJob = stubSimpleCall(expectedResponse); - const [response] = await client.getJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getJob without error using callback', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.GetJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()); - client.innerApiCalls.getJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getJob( - request, - (err?: Error|null, result?: protos.google.cloud.video.transcoder.v1.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getJob with error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.GetJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getJob(request), expectedError); - assert((client.innerApiCalls.getJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getJob with closed client', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.GetJobRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getJob(request), expectedError); - }); - }); - - describe('deleteJob', () => { - it('invokes deleteJob without error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.DeleteJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteJob = stubSimpleCall(expectedResponse); - const [response] = await client.deleteJob(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteJob without error using callback', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.DeleteJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteJob( - 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.deleteJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteJob with error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.DeleteJobRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteJob(request), expectedError); - assert((client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteJob with closed client', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.DeleteJobRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteJob(request), expectedError); - }); - }); - - describe('createJobTemplate', () => { - it('invokes createJobTemplate without error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.CreateJobTemplateRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()); - client.innerApiCalls.createJobTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.createJobTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createJobTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createJobTemplate without error using callback', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.CreateJobTemplateRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()); - client.innerApiCalls.createJobTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createJobTemplate( - request, - (err?: Error|null, result?: protos.google.cloud.video.transcoder.v1.IJobTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createJobTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createJobTemplate with error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.CreateJobTemplateRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createJobTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createJobTemplate(request), expectedError); - assert((client.innerApiCalls.createJobTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createJobTemplate with closed client', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.CreateJobTemplateRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createJobTemplate(request), expectedError); - }); - }); - - describe('getJobTemplate', () => { - it('invokes getJobTemplate without error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.GetJobTemplateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()); - client.innerApiCalls.getJobTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.getJobTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getJobTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getJobTemplate without error using callback', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.GetJobTemplateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()); - client.innerApiCalls.getJobTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getJobTemplate( - request, - (err?: Error|null, result?: protos.google.cloud.video.transcoder.v1.IJobTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getJobTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getJobTemplate with error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.GetJobTemplateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getJobTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getJobTemplate(request), expectedError); - assert((client.innerApiCalls.getJobTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getJobTemplate with closed client', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.GetJobTemplateRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getJobTemplate(request), expectedError); - }); - }); - - describe('deleteJobTemplate', () => { - it('invokes deleteJobTemplate without error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.DeleteJobTemplateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteJobTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.deleteJobTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteJobTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteJobTemplate without error using callback', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.DeleteJobTemplateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteJobTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteJobTemplate( - 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.deleteJobTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteJobTemplate with error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.DeleteJobTemplateRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteJobTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteJobTemplate(request), expectedError); - assert((client.innerApiCalls.deleteJobTemplate as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteJobTemplate with closed client', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.DeleteJobTemplateRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteJobTemplate(request), expectedError); - }); - }); - - describe('listJobs', () => { - it('invokes listJobs without error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), - ]; - client.innerApiCalls.listJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listJobs(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listJobs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listJobs without error using callback', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), - ]; - client.innerApiCalls.listJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listJobs( - request, - (err?: Error|null, result?: protos.google.cloud.video.transcoder.v1.IJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listJobs as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listJobs with error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listJobs(request), expectedError); - assert((client.innerApiCalls.listJobs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listJobsStream without error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), - ]; - client.descriptors.page.listJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.video.transcoder.v1.Job[] = []; - stream.on('data', (response: protos.google.cloud.video.transcoder.v1.Job) => { - 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.listJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); - assert.strictEqual( - (client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listJobsStream with error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.video.transcoder.v1.Job[] = []; - stream.on('data', (response: protos.google.cloud.video.transcoder.v1.Job) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); - assert.strictEqual( - (client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listJobs without error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.Job()), - ]; - client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.video.transcoder.v1.IJob[] = []; - const iterable = client.listJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listJobs with error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.video.transcoder.v1.IJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listJobTemplates', () => { - it('invokes listJobTemplates without error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobTemplatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), - ]; - client.innerApiCalls.listJobTemplates = stubSimpleCall(expectedResponse); - const [response] = await client.listJobTemplates(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listJobTemplates as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listJobTemplates without error using callback', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobTemplatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), - ]; - client.innerApiCalls.listJobTemplates = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listJobTemplates( - request, - (err?: Error|null, result?: protos.google.cloud.video.transcoder.v1.IJobTemplate[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listJobTemplates as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listJobTemplates with error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobTemplatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listJobTemplates = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listJobTemplates(request), expectedError); - assert((client.innerApiCalls.listJobTemplates as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listJobTemplatesStream without error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobTemplatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), - ]; - client.descriptors.page.listJobTemplates.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listJobTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.video.transcoder.v1.JobTemplate[] = []; - stream.on('data', (response: protos.google.cloud.video.transcoder.v1.JobTemplate) => { - 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.listJobTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobTemplates, request)); - assert.strictEqual( - (client.descriptors.page.listJobTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listJobTemplatesStream with error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobTemplatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listJobTemplates.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listJobTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.video.transcoder.v1.JobTemplate[] = []; - stream.on('data', (response: protos.google.cloud.video.transcoder.v1.JobTemplate) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listJobTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobTemplates, request)); - assert.strictEqual( - (client.descriptors.page.listJobTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listJobTemplates without error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobTemplatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), - generateSampleMessage(new protos.google.cloud.video.transcoder.v1.JobTemplate()), - ]; - client.descriptors.page.listJobTemplates.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.video.transcoder.v1.IJobTemplate[] = []; - const iterable = client.listJobTemplatesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listJobTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listJobTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listJobTemplates with error', async () => { - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.video.transcoder.v1.ListJobTemplatesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listJobTemplates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listJobTemplatesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.video.transcoder.v1.IJobTemplate[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listJobTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listJobTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('job', () => { - const fakePath = "/rendered/path/job"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - job: "jobValue", - }; - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.jobPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.jobPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('jobPath', () => { - const result = client.jobPath("projectValue", "locationValue", "jobValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.jobPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromJobName', () => { - const result = client.matchProjectFromJobName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.jobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromJobName', () => { - const result = client.matchLocationFromJobName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.jobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchJobFromJobName', () => { - const result = client.matchJobFromJobName(fakePath); - assert.strictEqual(result, "jobValue"); - assert((client.pathTemplates.jobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('jobTemplate', () => { - const fakePath = "/rendered/path/jobTemplate"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - job_template: "jobTemplateValue", - }; - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.jobTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.jobTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('jobTemplatePath', () => { - const result = client.jobTemplatePath("projectValue", "locationValue", "jobTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.jobTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromJobTemplateName', () => { - const result = client.matchProjectFromJobTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.jobTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromJobTemplateName', () => { - const result = client.matchLocationFromJobTemplateName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.jobTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchJobTemplateFromJobTemplateName', () => { - const result = client.matchJobTemplateFromJobTemplateName(fakePath); - assert.strictEqual(result, "jobTemplateValue"); - assert((client.pathTemplates.jobTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new transcoderserviceModule.v1.TranscoderServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js deleted file mode 100644 index 1250fac..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: 'TranscoderService', - filename: './transcoder-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/transcoder_service_client.ts b/src/v1/transcoder_service_client.ts index 90d3adf..448c06f 100644 --- a/src/v1/transcoder_service_client.ts +++ b/src/v1/transcoder_service_client.ts @@ -75,7 +75,7 @@ export class TranscoderServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] @@ -98,11 +98,10 @@ export class TranscoderServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields.