@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
852 lines • 29.6 kB
JavaScript
"use strict";
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Job = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Transcoding Job Resource
*
* To get more information about Job, see:
*
* * [API documentation](https://cloud.google.com/transcoder/docs/reference/rest/v1/projects.locations.jobs)
* * How-to Guides
* * [Transcoder](https://cloud.google.com/transcoder/docs/)
*
* ## Example Usage
*
* ### Transcoder Job Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.storage.Bucket("default", {
* name: "transcoder-job",
* location: "US",
* forceDestroy: true,
* uniformBucketLevelAccess: true,
* publicAccessPrevention: "enforced",
* });
* const exampleMp4 = new gcp.storage.BucketObject("example_mp4", {
* name: "example.mp4",
* source: new pulumi.asset.FileAsset("./test-fixtures/example.mp4"),
* bucket: _default.name,
* });
* const defaultJobTemplate = new gcp.transcoder.JobTemplate("default", {
* jobTemplateId: "example-job-template",
* location: "us-central1",
* config: {
* inputs: [{
* key: "input0",
* uri: pulumi.interpolate`gs://${_default.name}/${exampleMp4.name}`,
* }],
* output: {
* uri: pulumi.interpolate`gs://${_default.name}/outputs/`,
* },
* editLists: [{
* key: "atom0",
* inputs: ["input0"],
* startTimeOffset: "0s",
* }],
* elementaryStreams: [
* {
* key: "video-stream0",
* videoStream: {
* h264: {
* widthPixels: 640,
* heightPixels: 360,
* bitrateBps: 550000,
* frameRate: 60,
* pixelFormat: "yuv420p",
* rateControlMode: "vbr",
* crfLevel: 21,
* gopDuration: "3s",
* vbvSizeBits: 550000,
* vbvFullnessBits: 495000,
* entropyCoder: "cabac",
* profile: "high",
* preset: "veryfast",
* },
* },
* },
* {
* key: "video-stream1",
* videoStream: {
* h264: {
* widthPixels: 1280,
* heightPixels: 720,
* bitrateBps: 550000,
* frameRate: 60,
* pixelFormat: "yuv420p",
* rateControlMode: "vbr",
* crfLevel: 21,
* gopDuration: "3s",
* vbvSizeBits: 2500000,
* vbvFullnessBits: 2250000,
* entropyCoder: "cabac",
* profile: "high",
* preset: "veryfast",
* },
* },
* },
* {
* key: "audio-stream0",
* audioStream: {
* codec: "aac",
* bitrateBps: 64000,
* channelCount: 2,
* channelLayouts: [
* "fl",
* "fr",
* ],
* sampleRateHertz: 48000,
* },
* },
* ],
* muxStreams: [
* {
* key: "sd",
* fileName: "sd.mp4",
* container: "mp4",
* elementaryStreams: [
* "video-stream0",
* "audio-stream0",
* ],
* },
* {
* key: "hd",
* fileName: "hd.mp4",
* container: "mp4",
* elementaryStreams: [
* "video-stream1",
* "audio-stream0",
* ],
* },
* ],
* },
* labels: {
* label: "key",
* },
* });
* const defaultJob = new gcp.transcoder.Job("default", {
* templateId: defaultJobTemplate.name,
* location: "us-central1",
* labels: {
* label: "key",
* },
* });
* ```
* ### Transcoder Job Pubsub
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.storage.Bucket("default", {
* name: "transcoder-job",
* location: "US",
* forceDestroy: true,
* uniformBucketLevelAccess: true,
* publicAccessPrevention: "enforced",
* });
* const exampleMp4 = new gcp.storage.BucketObject("example_mp4", {
* name: "example.mp4",
* source: new pulumi.asset.FileAsset("./test-fixtures/example.mp4"),
* bucket: _default.name,
* });
* const transcoderNotifications = new gcp.pubsub.Topic("transcoder_notifications", {name: "transcoder-notifications"});
* const defaultJob = new gcp.transcoder.Job("default", {
* location: "us-central1",
* config: {
* inputs: [{
* key: "input0",
* uri: pulumi.interpolate`gs://${_default.name}/${exampleMp4.name}`,
* }],
* editLists: [{
* key: "atom0",
* inputs: ["input0"],
* startTimeOffset: "0s",
* }],
* adBreaks: [{
* startTimeOffset: "3.500s",
* }],
* elementaryStreams: [
* {
* key: "video-stream0",
* videoStream: {
* h264: {
* widthPixels: 640,
* heightPixels: 360,
* bitrateBps: 550000,
* frameRate: 60,
* pixelFormat: "yuv420p",
* rateControlMode: "vbr",
* crfLevel: 21,
* gopDuration: "3s",
* vbvSizeBits: 550000,
* vbvFullnessBits: 495000,
* entropyCoder: "cabac",
* profile: "high",
* preset: "veryfast",
* },
* },
* },
* {
* key: "video-stream1",
* videoStream: {
* h264: {
* widthPixels: 1280,
* heightPixels: 720,
* bitrateBps: 550000,
* frameRate: 60,
* pixelFormat: "yuv420p",
* rateControlMode: "vbr",
* crfLevel: 21,
* gopDuration: "3s",
* vbvSizeBits: 2500000,
* vbvFullnessBits: 2250000,
* entropyCoder: "cabac",
* profile: "high",
* preset: "veryfast",
* },
* },
* },
* {
* key: "audio-stream0",
* audioStream: {
* codec: "aac",
* bitrateBps: 64000,
* channelCount: 2,
* channelLayouts: [
* "fl",
* "fr",
* ],
* sampleRateHertz: 48000,
* },
* },
* ],
* muxStreams: [
* {
* key: "sd",
* fileName: "sd.mp4",
* container: "mp4",
* elementaryStreams: [
* "video-stream0",
* "audio-stream0",
* ],
* },
* {
* key: "hd",
* fileName: "hd.mp4",
* container: "mp4",
* elementaryStreams: [
* "video-stream1",
* "audio-stream0",
* ],
* },
* ],
* pubsubDestination: {
* topic: transcoderNotifications.id,
* },
* output: {
* uri: pulumi.interpolate`gs://${_default.name}/outputs/`,
* },
* },
* labels: {
* label: "key",
* },
* });
* ```
* ### Transcoder Job Encryptions
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.storage.Bucket("default", {
* name: "transcoder-job",
* location: "US",
* forceDestroy: true,
* uniformBucketLevelAccess: true,
* publicAccessPrevention: "enforced",
* });
* const exampleMp4 = new gcp.storage.BucketObject("example_mp4", {
* name: "example.mp4",
* source: new pulumi.asset.FileAsset("./test-fixtures/example.mp4"),
* bucket: _default.name,
* });
* const encryptionKey = new gcp.secretmanager.Secret("encryption_key", {
* secretId: "transcoder-encryption-key",
* replication: {
* auto: {},
* },
* });
* const encryptionKeySecretVersion = new gcp.secretmanager.SecretVersion("encryption_key", {
* secret: encryptionKey.name,
* secretData: "4A67F2C1B8E93A4F6D3E7890A1BC23DF",
* });
* const project = gcp.organizations.getProject({});
* // this is required to allow the transcoder service identity to access the secret
* const transcoder = new gcp.projects.ServiceIdentity("transcoder", {
* project: project.then(project => project.projectId),
* service: "transcoder.googleapis.com",
* });
* const transcoderEncryptionKeyAccessor = new gcp.secretmanager.SecretIamMember("transcoder_encryption_key_accessor", {
* secretId: encryptionKey.secretId,
* project: encryptionKey.project,
* role: "roles/secretmanager.secretAccessor",
* member: pulumi.interpolate`serviceAccount:${transcoder.email}`,
* });
* const defaultJob = new gcp.transcoder.Job("default", {
* location: "us-central1",
* config: {
* inputs: [{
* key: "input0",
* uri: pulumi.interpolate`gs://${_default.name}/${exampleMp4.name}`,
* }],
* elementaryStreams: [
* {
* key: "es_video",
* videoStream: {
* h264: {
* profile: "main",
* heightPixels: 600,
* widthPixels: 800,
* bitrateBps: 1000000,
* frameRate: 60,
* },
* },
* },
* {
* key: "es_audio",
* audioStream: {
* codec: "aac",
* channelCount: 2,
* bitrateBps: 160000,
* },
* },
* ],
* encryptions: [
* {
* id: "aes-128",
* secretManagerKeySource: {
* secretVersion: encryptionKeySecretVersion.name,
* },
* drmSystems: {
* clearkey: {},
* },
* aes128: {},
* },
* {
* id: "cenc",
* secretManagerKeySource: {
* secretVersion: encryptionKeySecretVersion.name,
* },
* drmSystems: {
* widevine: {},
* },
* mpegCenc: {
* scheme: "cenc",
* },
* },
* {
* id: "cbcs",
* secretManagerKeySource: {
* secretVersion: encryptionKeySecretVersion.name,
* },
* drmSystems: {
* widevine: {},
* },
* mpegCenc: {
* scheme: "cbcs",
* },
* },
* ],
* muxStreams: [
* {
* key: "ts_aes128",
* container: "ts",
* elementaryStreams: [
* "es_video",
* "es_audio",
* ],
* segmentSettings: {
* segmentDuration: "6s",
* },
* encryptionId: "aes-128",
* },
* {
* key: "fmp4_cenc_video",
* container: "fmp4",
* elementaryStreams: ["es_video"],
* segmentSettings: {
* segmentDuration: "6s",
* },
* encryptionId: "cenc",
* },
* {
* key: "fmp4_cenc_audio",
* container: "fmp4",
* elementaryStreams: ["es_audio"],
* segmentSettings: {
* segmentDuration: "6s",
* },
* encryptionId: "cenc",
* },
* {
* key: "fmp4_cbcs_video",
* container: "fmp4",
* elementaryStreams: ["es_video"],
* segmentSettings: {
* segmentDuration: "6s",
* },
* encryptionId: "cbcs",
* },
* {
* key: "fmp4_cbcs_audio",
* container: "fmp4",
* elementaryStreams: ["es_audio"],
* segmentSettings: {
* segmentDuration: "6s",
* },
* encryptionId: "cbcs",
* },
* ],
* manifests: [
* {
* fileName: "manifest_aes128.m3u8",
* type: "HLS",
* muxStreams: ["ts_aes128"],
* },
* {
* fileName: "manifest_cenc.mpd",
* type: "DASH",
* muxStreams: [
* "fmp4_cenc_video",
* "fmp4_cenc_audio",
* ],
* },
* {
* fileName: "manifest_cbcs.mpd",
* type: "DASH",
* muxStreams: [
* "fmp4_cbcs_video",
* "fmp4_cbcs_audio",
* ],
* },
* ],
* output: {
* uri: pulumi.interpolate`gs://${_default.name}/outputs/`,
* },
* },
* labels: {
* label: "key",
* },
* });
* ```
* ### Transcoder Job Overlays
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.storage.Bucket("default", {
* name: "transcoder-job",
* location: "US",
* forceDestroy: true,
* uniformBucketLevelAccess: true,
* publicAccessPrevention: "enforced",
* });
* const exampleMp4 = new gcp.storage.BucketObject("example_mp4", {
* name: "example.mp4",
* source: new pulumi.asset.FileAsset("./test-fixtures/example.mp4"),
* bucket: _default.name,
* });
* const overlayPng = new gcp.storage.BucketObject("overlay_png", {
* name: "overlay.png",
* source: new pulumi.asset.FileAsset("./test-fixtures/overlay.png"),
* bucket: _default.name,
* });
* const defaultJob = new gcp.transcoder.Job("default", {
* location: "us-central1",
* config: {
* inputs: [{
* key: "input0",
* uri: pulumi.interpolate`gs://${_default.name}/${exampleMp4.name}`,
* }],
* editLists: [{
* key: "atom0",
* inputs: ["input0"],
* startTimeOffset: "0s",
* }],
* adBreaks: [{
* startTimeOffset: "3.500s",
* }],
* overlays: [{
* animations: [{
* animationFade: {
* fadeType: "FADE_IN",
* startTimeOffset: "1.500s",
* endTimeOffset: "3.500s",
* xy: {
* x: 1,
* y: 0.5,
* },
* },
* }],
* image: {
* uri: pulumi.interpolate`gs://${_default.name}/${overlayPng.name}`,
* },
* }],
* elementaryStreams: [
* {
* key: "video-stream0",
* videoStream: {
* h264: {
* widthPixels: 640,
* heightPixels: 360,
* bitrateBps: 550000,
* frameRate: 60,
* pixelFormat: "yuv420p",
* rateControlMode: "vbr",
* crfLevel: 21,
* gopDuration: "3s",
* vbvSizeBits: 550000,
* vbvFullnessBits: 495000,
* entropyCoder: "cabac",
* profile: "high",
* preset: "veryfast",
* },
* },
* },
* {
* key: "video-stream1",
* videoStream: {
* h264: {
* widthPixels: 1280,
* heightPixels: 720,
* bitrateBps: 550000,
* frameRate: 60,
* pixelFormat: "yuv420p",
* rateControlMode: "vbr",
* crfLevel: 21,
* gopDuration: "3s",
* vbvSizeBits: 2500000,
* vbvFullnessBits: 2250000,
* entropyCoder: "cabac",
* profile: "high",
* preset: "veryfast",
* },
* },
* },
* {
* key: "audio-stream0",
* audioStream: {
* codec: "aac",
* bitrateBps: 64000,
* channelCount: 2,
* channelLayouts: [
* "fl",
* "fr",
* ],
* sampleRateHertz: 48000,
* },
* },
* ],
* muxStreams: [
* {
* key: "sd",
* fileName: "sd.mp4",
* container: "mp4",
* elementaryStreams: [
* "video-stream0",
* "audio-stream0",
* ],
* },
* {
* key: "hd",
* fileName: "hd.mp4",
* container: "mp4",
* elementaryStreams: [
* "video-stream1",
* "audio-stream0",
* ],
* },
* ],
* output: {
* uri: pulumi.interpolate`gs://${_default.name}/outputs/`,
* },
* },
* labels: {
* label: "key",
* },
* });
* ```
* ### Transcoder Job Manifests
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.storage.Bucket("default", {
* name: "transcoder-job",
* location: "US",
* forceDestroy: true,
* uniformBucketLevelAccess: true,
* publicAccessPrevention: "enforced",
* });
* const exampleMp4 = new gcp.storage.BucketObject("example_mp4", {
* name: "example.mp4",
* source: new pulumi.asset.FileAsset("./test-fixtures/example.mp4"),
* bucket: _default.name,
* });
* const defaultJob = new gcp.transcoder.Job("default", {
* location: "us-central1",
* config: {
* inputs: [{
* key: "input0",
* uri: pulumi.interpolate`gs://${_default.name}/${exampleMp4.name}`,
* }],
* editLists: [{
* key: "atom0",
* startTimeOffset: "0s",
* inputs: ["input0"],
* }],
* adBreaks: [{
* startTimeOffset: "3.500s",
* }],
* elementaryStreams: [
* {
* key: "video-stream0",
* videoStream: {
* h264: {
* widthPixels: 640,
* heightPixels: 360,
* bitrateBps: 550000,
* frameRate: 60,
* pixelFormat: "yuv420p",
* rateControlMode: "vbr",
* crfLevel: 21,
* gopDuration: "3s",
* vbvSizeBits: 550000,
* vbvFullnessBits: 495000,
* entropyCoder: "cabac",
* profile: "high",
* preset: "veryfast",
* },
* },
* },
* {
* key: "video-stream1",
* videoStream: {
* h264: {
* widthPixels: 1280,
* heightPixels: 720,
* bitrateBps: 550000,
* frameRate: 60,
* pixelFormat: "yuv420p",
* rateControlMode: "vbr",
* crfLevel: 21,
* gopDuration: "3s",
* vbvSizeBits: 2500000,
* vbvFullnessBits: 2250000,
* entropyCoder: "cabac",
* profile: "high",
* preset: "veryfast",
* },
* },
* },
* {
* key: "audio-stream0",
* audioStream: {
* codec: "aac",
* bitrateBps: 64000,
* channelCount: 2,
* channelLayouts: [
* "fl",
* "fr",
* ],
* sampleRateHertz: 48000,
* },
* },
* ],
* muxStreams: [
* {
* key: "sd",
* fileName: "sd.mp4",
* container: "mp4",
* elementaryStreams: [
* "video-stream0",
* "audio-stream0",
* ],
* },
* {
* key: "hd",
* fileName: "hd.mp4",
* container: "mp4",
* elementaryStreams: [
* "video-stream1",
* "audio-stream0",
* ],
* },
* {
* key: "media-sd",
* fileName: "media-sd.ts",
* container: "ts",
* elementaryStreams: [
* "video-stream0",
* "audio-stream0",
* ],
* },
* {
* key: "media-hd",
* fileName: "media-hd.ts",
* container: "ts",
* elementaryStreams: [
* "video-stream1",
* "audio-stream0",
* ],
* },
* {
* key: "video-only-sd",
* fileName: "video-only-sd.m4s",
* container: "fmp4",
* elementaryStreams: ["video-stream0"],
* },
* {
* key: "video-only-hd",
* fileName: "video-only-hd.m4s",
* container: "fmp4",
* elementaryStreams: ["video-stream1"],
* },
* {
* key: "audio-only",
* fileName: "audio-only.m4s",
* container: "fmp4",
* elementaryStreams: ["audio-stream0"],
* },
* ],
* manifests: [
* {
* fileName: "manifest.m3u8",
* type: "HLS",
* muxStreams: [
* "media-sd",
* "media-hd",
* ],
* },
* {
* fileName: "manifest.mpd",
* type: "DASH",
* muxStreams: [
* "video-only-sd",
* "video-only-hd",
* "audio-only",
* ],
* },
* ],
* output: {
* uri: pulumi.interpolate`gs://${_default.name}/outputs/`,
* },
* },
* labels: {
* label: "key",
* },
* });
* ```
*
* ## Import
*
* Job can be imported using any of these accepted formats:
*
* * `{{project}}/{{name}}`
*
* * `{{project}} {{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, Job can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:transcoder/job:Job default {{project}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:transcoder/job:Job default "{{project}} {{name}}"
* ```
*
* ```sh
* $ pulumi import gcp:transcoder/job:Job default {{name}}
* ```
*/
class Job extends pulumi.CustomResource {
/**
* Get an existing Job resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new Job(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Job. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Job.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["config"] = state ? state.config : undefined;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["endTime"] = state ? state.endTime : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["location"] = state ? state.location : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["startTime"] = state ? state.startTime : undefined;
resourceInputs["state"] = state ? state.state : undefined;
resourceInputs["templateId"] = state ? state.templateId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.location === undefined) && !opts.urn) {
throw new Error("Missing required property 'location'");
}
resourceInputs["config"] = args ? args.config : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["location"] = args ? args.location : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["templateId"] = args ? args.templateId : undefined;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["endTime"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["startTime"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Job.__pulumiType, name, resourceInputs, opts);
}
}
exports.Job = Job;
/** @internal */
Job.__pulumiType = 'gcp:transcoder/job:Job';
//# sourceMappingURL=job.js.map