@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
1,078 lines • 37.5 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.Stream = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* A resource representing streaming data from a source to a destination.
*
* To get more information about Stream, see:
*
* * [API documentation](https://cloud.google.com/datastream/docs/reference/rest/v1/projects.locations.streams)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/datastream/docs/create-a-stream)
*
* ## Example Usage
*
* ### Datastream Stream Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as random from "@pulumi/random";
*
* const project = gcp.organizations.getProject({});
* const instance = new gcp.sql.DatabaseInstance("instance", {
* name: "my-instance",
* databaseVersion: "MYSQL_8_0",
* region: "us-central1",
* settings: {
* tier: "db-f1-micro",
* backupConfiguration: {
* enabled: true,
* binaryLogEnabled: true,
* },
* ipConfiguration: {
* authorizedNetworks: [
* {
* value: "34.71.242.81",
* },
* {
* value: "34.72.28.29",
* },
* {
* value: "34.67.6.157",
* },
* {
* value: "34.67.234.134",
* },
* {
* value: "34.72.239.218",
* },
* ],
* },
* },
* deletionProtection: true,
* });
* const db = new gcp.sql.Database("db", {
* instance: instance.name,
* name: "db",
* });
* const pwd = new random.RandomPassword("pwd", {
* length: 16,
* special: false,
* });
* const user = new gcp.sql.User("user", {
* name: "user",
* instance: instance.name,
* host: "%",
* password: pwd.result,
* });
* const sourceConnectionProfile = new gcp.datastream.ConnectionProfile("source_connection_profile", {
* displayName: "Source connection profile",
* location: "us-central1",
* connectionProfileId: "source-profile",
* mysqlProfile: {
* hostname: instance.publicIpAddress,
* username: user.name,
* password: user.password,
* },
* });
* const bucket = new gcp.storage.Bucket("bucket", {
* name: "my-bucket",
* location: "US",
* uniformBucketLevelAccess: true,
* });
* const viewer = new gcp.storage.BucketIAMMember("viewer", {
* bucket: bucket.name,
* role: "roles/storage.objectViewer",
* member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-datastream.iam.gserviceaccount.com`),
* });
* const creator = new gcp.storage.BucketIAMMember("creator", {
* bucket: bucket.name,
* role: "roles/storage.objectCreator",
* member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-datastream.iam.gserviceaccount.com`),
* });
* const reader = new gcp.storage.BucketIAMMember("reader", {
* bucket: bucket.name,
* role: "roles/storage.legacyBucketReader",
* member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-datastream.iam.gserviceaccount.com`),
* });
* const keyUser = new gcp.kms.CryptoKeyIAMMember("key_user", {
* cryptoKeyId: "kms-name",
* role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
* member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-datastream.iam.gserviceaccount.com`),
* });
* const destinationConnectionProfile = new gcp.datastream.ConnectionProfile("destination_connection_profile", {
* displayName: "Connection profile",
* location: "us-central1",
* connectionProfileId: "destination-profile",
* gcsProfile: {
* bucket: bucket.name,
* rootPath: "/path",
* },
* });
* const _default = new gcp.datastream.Stream("default", {
* streamId: "my-stream",
* desiredState: "NOT_STARTED",
* location: "us-central1",
* displayName: "my stream",
* labels: {
* key: "value",
* },
* sourceConfig: {
* sourceConnectionProfile: sourceConnectionProfile.id,
* mysqlSourceConfig: {
* includeObjects: {
* mysqlDatabases: [{
* database: "my-database",
* mysqlTables: [
* {
* table: "includedTable",
* mysqlColumns: [{
* column: "includedColumn",
* dataType: "VARCHAR",
* collation: "utf8mb4",
* primaryKey: false,
* nullable: false,
* ordinalPosition: 0,
* }],
* },
* {
* table: "includedTable_2",
* },
* ],
* }],
* },
* excludeObjects: {
* mysqlDatabases: [{
* database: "my-database",
* mysqlTables: [{
* table: "excludedTable",
* mysqlColumns: [{
* column: "excludedColumn",
* dataType: "VARCHAR",
* collation: "utf8mb4",
* primaryKey: false,
* nullable: false,
* ordinalPosition: 0,
* }],
* }],
* }],
* },
* maxConcurrentCdcTasks: 5,
* },
* },
* destinationConfig: {
* destinationConnectionProfile: destinationConnectionProfile.id,
* gcsDestinationConfig: {
* path: "mydata",
* fileRotationMb: 200,
* fileRotationInterval: "60s",
* jsonFileFormat: {
* schemaFileFormat: "NO_SCHEMA_FILE",
* compression: "GZIP",
* },
* },
* },
* backfillAll: {
* mysqlExcludedObjects: {
* mysqlDatabases: [{
* database: "my-database",
* mysqlTables: [{
* table: "excludedTable",
* mysqlColumns: [{
* column: "excludedColumn",
* dataType: "VARCHAR",
* collation: "utf8mb4",
* primaryKey: false,
* nullable: false,
* ordinalPosition: 0,
* }],
* }],
* }],
* },
* },
* customerManagedEncryptionKey: "kms-name",
* }, {
* dependsOn: [keyUser],
* });
* ```
* ### Datastream Stream Postgresql
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const source = new gcp.datastream.ConnectionProfile("source", {
* displayName: "Postgresql Source",
* location: "us-central1",
* connectionProfileId: "source-profile",
* postgresqlProfile: {
* hostname: "hostname",
* port: 5432,
* username: "user",
* password: "pass",
* database: "postgres",
* },
* });
* const destination = new gcp.datastream.ConnectionProfile("destination", {
* displayName: "BigQuery Destination",
* location: "us-central1",
* connectionProfileId: "destination-profile",
* bigqueryProfile: {},
* });
* const _default = new gcp.datastream.Stream("default", {
* displayName: "Postgres to BigQuery",
* location: "us-central1",
* streamId: "my-stream",
* desiredState: "RUNNING",
* sourceConfig: {
* sourceConnectionProfile: source.id,
* postgresqlSourceConfig: {
* maxConcurrentBackfillTasks: 12,
* publication: "publication",
* replicationSlot: "replication_slot",
* includeObjects: {
* postgresqlSchemas: [{
* schema: "schema",
* postgresqlTables: [{
* table: "table",
* postgresqlColumns: [{
* column: "column",
* }],
* }],
* }],
* },
* excludeObjects: {
* postgresqlSchemas: [{
* schema: "schema",
* postgresqlTables: [{
* table: "table",
* postgresqlColumns: [{
* column: "column",
* }],
* }],
* }],
* },
* },
* },
* destinationConfig: {
* destinationConnectionProfile: destination.id,
* bigqueryDestinationConfig: {
* dataFreshness: "900s",
* sourceHierarchyDatasets: {
* datasetTemplate: {
* location: "us-central1",
* },
* },
* },
* },
* backfillAll: {
* postgresqlExcludedObjects: {
* postgresqlSchemas: [{
* schema: "schema",
* postgresqlTables: [{
* table: "table",
* postgresqlColumns: [{
* column: "column",
* }],
* }],
* }],
* },
* },
* });
* ```
* ### Datastream Stream Oracle
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const source = new gcp.datastream.ConnectionProfile("source", {
* displayName: "Oracle Source",
* location: "us-central1",
* connectionProfileId: "source-profile",
* oracleProfile: {
* hostname: "hostname",
* port: 1521,
* username: "user",
* password: "pass",
* databaseService: "ORCL",
* },
* });
* const destination = new gcp.datastream.ConnectionProfile("destination", {
* displayName: "BigQuery Destination",
* location: "us-central1",
* connectionProfileId: "destination-profile",
* bigqueryProfile: {},
* });
* const stream5 = new gcp.datastream.Stream("stream5", {
* displayName: "Oracle to BigQuery",
* location: "us-central1",
* streamId: "my-stream",
* desiredState: "RUNNING",
* sourceConfig: {
* sourceConnectionProfile: source.id,
* oracleSourceConfig: {
* maxConcurrentCdcTasks: 8,
* maxConcurrentBackfillTasks: 12,
* includeObjects: {
* oracleSchemas: [{
* schema: "schema",
* oracleTables: [{
* table: "table",
* oracleColumns: [{
* column: "column",
* }],
* }],
* }],
* },
* excludeObjects: {
* oracleSchemas: [{
* schema: "schema",
* oracleTables: [{
* table: "table",
* oracleColumns: [{
* column: "column",
* }],
* }],
* }],
* },
* dropLargeObjects: {},
* },
* },
* destinationConfig: {
* destinationConnectionProfile: destination.id,
* bigqueryDestinationConfig: {
* dataFreshness: "900s",
* sourceHierarchyDatasets: {
* datasetTemplate: {
* location: "us-central1",
* },
* },
* },
* },
* backfillAll: {
* oracleExcludedObjects: {
* oracleSchemas: [{
* schema: "schema",
* oracleTables: [{
* table: "table",
* oracleColumns: [{
* column: "column",
* }],
* }],
* }],
* },
* },
* });
* ```
* ### Datastream Stream Sql Server
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const instance = new gcp.sql.DatabaseInstance("instance", {
* name: "sql-server",
* databaseVersion: "SQLSERVER_2019_STANDARD",
* region: "us-central1",
* rootPassword: "root-password",
* deletionProtection: true,
* settings: {
* tier: "db-custom-2-4096",
* ipConfiguration: {
* authorizedNetworks: [
* {
* value: "34.71.242.81",
* },
* {
* value: "34.72.28.29",
* },
* {
* value: "34.67.6.157",
* },
* {
* value: "34.67.234.134",
* },
* {
* value: "34.72.239.218",
* },
* ],
* },
* },
* });
* const user = new gcp.sql.User("user", {
* name: "user",
* instance: instance.name,
* password: "password",
* });
* const db = new gcp.sql.Database("db", {
* name: "db",
* instance: instance.name,
* }, {
* dependsOn: [user],
* });
* const source = new gcp.datastream.ConnectionProfile("source", {
* displayName: "SQL Server Source",
* location: "us-central1",
* connectionProfileId: "source-profile",
* sqlServerProfile: {
* hostname: instance.publicIpAddress,
* port: 1433,
* username: user.name,
* password: user.password,
* database: db.name,
* },
* });
* const destination = new gcp.datastream.ConnectionProfile("destination", {
* displayName: "BigQuery Destination",
* location: "us-central1",
* connectionProfileId: "destination-profile",
* bigqueryProfile: {},
* });
* const _default = new gcp.datastream.Stream("default", {
* displayName: "SQL Server to BigQuery",
* location: "us-central1",
* streamId: "stream",
* sourceConfig: {
* sourceConnectionProfile: source.id,
* sqlServerSourceConfig: {
* includeObjects: {
* schemas: [{
* schema: "schema",
* tables: [{
* table: "table",
* }],
* }],
* },
* transactionLogs: {},
* },
* },
* destinationConfig: {
* destinationConnectionProfile: destination.id,
* bigqueryDestinationConfig: {
* dataFreshness: "900s",
* sourceHierarchyDatasets: {
* datasetTemplate: {
* location: "us-central1",
* },
* },
* },
* },
* backfillNone: {},
* });
* ```
* ### Datastream Stream Sql Server Change Tables
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const instance = new gcp.sql.DatabaseInstance("instance", {
* name: "sql-server",
* databaseVersion: "SQLSERVER_2019_STANDARD",
* region: "us-central1",
* rootPassword: "root-password",
* deletionProtection: true,
* settings: {
* tier: "db-custom-2-4096",
* ipConfiguration: {
* authorizedNetworks: [
* {
* value: "34.71.242.81",
* },
* {
* value: "34.72.28.29",
* },
* {
* value: "34.67.6.157",
* },
* {
* value: "34.67.234.134",
* },
* {
* value: "34.72.239.218",
* },
* ],
* },
* },
* });
* const user = new gcp.sql.User("user", {
* name: "user",
* instance: instance.name,
* password: "password",
* });
* const db = new gcp.sql.Database("db", {
* name: "db",
* instance: instance.name,
* }, {
* dependsOn: [user],
* });
* const source = new gcp.datastream.ConnectionProfile("source", {
* displayName: "SQL Server Source",
* location: "us-central1",
* connectionProfileId: "source-profile",
* sqlServerProfile: {
* hostname: instance.publicIpAddress,
* port: 1433,
* username: user.name,
* password: user.password,
* database: db.name,
* },
* });
* const destination = new gcp.datastream.ConnectionProfile("destination", {
* displayName: "BigQuery Destination",
* location: "us-central1",
* connectionProfileId: "destination-profile",
* bigqueryProfile: {},
* });
* const _default = new gcp.datastream.Stream("default", {
* displayName: "SQL Server to BigQuery",
* location: "us-central1",
* streamId: "stream",
* sourceConfig: {
* sourceConnectionProfile: source.id,
* sqlServerSourceConfig: {
* includeObjects: {
* schemas: [{
* schema: "schema",
* tables: [{
* table: "table",
* }],
* }],
* },
* changeTables: {},
* },
* },
* destinationConfig: {
* destinationConnectionProfile: destination.id,
* bigqueryDestinationConfig: {
* dataFreshness: "900s",
* sourceHierarchyDatasets: {
* datasetTemplate: {
* location: "us-central1",
* },
* },
* },
* },
* backfillNone: {},
* });
* ```
* ### Datastream Stream Postgresql Bigquery Dataset Id
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as random from "@pulumi/random";
*
* const postgres = new gcp.bigquery.Dataset("postgres", {
* datasetId: "postgres",
* friendlyName: "postgres",
* description: "Database of postgres",
* location: "us-central1",
* });
* const destinationConnectionProfile2 = new gcp.datastream.ConnectionProfile("destination_connection_profile2", {
* displayName: "Connection profile",
* location: "us-central1",
* connectionProfileId: "dest-profile",
* bigqueryProfile: {},
* });
* const instance = new gcp.sql.DatabaseInstance("instance", {
* name: "instance-name",
* databaseVersion: "MYSQL_8_0",
* region: "us-central1",
* settings: {
* tier: "db-f1-micro",
* backupConfiguration: {
* enabled: true,
* binaryLogEnabled: true,
* },
* ipConfiguration: {
* authorizedNetworks: [
* {
* value: "34.71.242.81",
* },
* {
* value: "34.72.28.29",
* },
* {
* value: "34.67.6.157",
* },
* {
* value: "34.67.234.134",
* },
* {
* value: "34.72.239.218",
* },
* ],
* },
* },
* deletionProtection: false,
* });
* const pwd = new random.RandomPassword("pwd", {
* length: 16,
* special: false,
* });
* const user = new gcp.sql.User("user", {
* name: "my-user",
* instance: instance.name,
* host: "%",
* password: pwd.result,
* });
* const sourceConnectionProfile = new gcp.datastream.ConnectionProfile("source_connection_profile", {
* displayName: "Source connection profile",
* location: "us-central1",
* connectionProfileId: "source-profile",
* mysqlProfile: {
* hostname: instance.publicIpAddress,
* username: user.name,
* password: user.password,
* },
* });
* const _default = new gcp.datastream.Stream("default", {
* displayName: "postgres to bigQuery",
* location: "us-central1",
* streamId: "postgres-bigquery",
* sourceConfig: {
* sourceConnectionProfile: sourceConnectionProfile.id,
* mysqlSourceConfig: {},
* },
* destinationConfig: {
* destinationConnectionProfile: destinationConnectionProfile2.id,
* bigqueryDestinationConfig: {
* dataFreshness: "900s",
* singleTargetDataset: {
* datasetId: postgres.id,
* },
* },
* },
* backfillAll: {},
* });
* const db = new gcp.sql.Database("db", {
* instance: instance.name,
* name: "db",
* });
* ```
* ### Datastream Stream Bigquery
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as random from "@pulumi/random";
*
* const project = gcp.organizations.getProject({});
* const instance = new gcp.sql.DatabaseInstance("instance", {
* name: "my-instance",
* databaseVersion: "MYSQL_8_0",
* region: "us-central1",
* settings: {
* tier: "db-f1-micro",
* backupConfiguration: {
* enabled: true,
* binaryLogEnabled: true,
* },
* ipConfiguration: {
* authorizedNetworks: [
* {
* value: "34.71.242.81",
* },
* {
* value: "34.72.28.29",
* },
* {
* value: "34.67.6.157",
* },
* {
* value: "34.67.234.134",
* },
* {
* value: "34.72.239.218",
* },
* ],
* },
* },
* deletionProtection: true,
* });
* const db = new gcp.sql.Database("db", {
* instance: instance.name,
* name: "db",
* });
* const pwd = new random.RandomPassword("pwd", {
* length: 16,
* special: false,
* });
* const user = new gcp.sql.User("user", {
* name: "user",
* instance: instance.name,
* host: "%",
* password: pwd.result,
* });
* const sourceConnectionProfile = new gcp.datastream.ConnectionProfile("source_connection_profile", {
* displayName: "Source connection profile",
* location: "us-central1",
* connectionProfileId: "source-profile",
* mysqlProfile: {
* hostname: instance.publicIpAddress,
* username: user.name,
* password: user.password,
* },
* });
* const bqSa = gcp.bigquery.getDefaultServiceAccount({});
* const bigqueryKeyUser = new gcp.kms.CryptoKeyIAMMember("bigquery_key_user", {
* cryptoKeyId: "bigquery-kms-name",
* role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
* member: bqSa.then(bqSa => `serviceAccount:${bqSa.email}`),
* });
* const destinationConnectionProfile = new gcp.datastream.ConnectionProfile("destination_connection_profile", {
* displayName: "Connection profile",
* location: "us-central1",
* connectionProfileId: "destination-profile",
* bigqueryProfile: {},
* });
* const _default = new gcp.datastream.Stream("default", {
* streamId: "my-stream",
* location: "us-central1",
* displayName: "my stream",
* sourceConfig: {
* sourceConnectionProfile: sourceConnectionProfile.id,
* mysqlSourceConfig: {},
* },
* destinationConfig: {
* destinationConnectionProfile: destinationConnectionProfile.id,
* bigqueryDestinationConfig: {
* sourceHierarchyDatasets: {
* datasetTemplate: {
* location: "us-central1",
* kmsKeyName: "bigquery-kms-name",
* },
* },
* },
* },
* backfillNone: {},
* }, {
* dependsOn: [bigqueryKeyUser],
* });
* ```
* ### Datastream Stream Bigquery Append Only
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as random from "@pulumi/random";
*
* const project = gcp.organizations.getProject({});
* const instance = new gcp.sql.DatabaseInstance("instance", {
* name: "my-instance",
* databaseVersion: "MYSQL_8_0",
* region: "us-central1",
* settings: {
* tier: "db-f1-micro",
* backupConfiguration: {
* enabled: true,
* binaryLogEnabled: true,
* },
* ipConfiguration: {
* authorizedNetworks: [
* {
* value: "34.71.242.81",
* },
* {
* value: "34.72.28.29",
* },
* {
* value: "34.67.6.157",
* },
* {
* value: "34.67.234.134",
* },
* {
* value: "34.72.239.218",
* },
* ],
* },
* },
* deletionProtection: true,
* });
* const db = new gcp.sql.Database("db", {
* instance: instance.name,
* name: "db",
* });
* const pwd = new random.RandomPassword("pwd", {
* length: 16,
* special: false,
* });
* const user = new gcp.sql.User("user", {
* name: "user",
* instance: instance.name,
* host: "%",
* password: pwd.result,
* });
* const sourceConnectionProfile = new gcp.datastream.ConnectionProfile("source_connection_profile", {
* displayName: "Source connection profile",
* location: "us-central1",
* connectionProfileId: "source-profile",
* mysqlProfile: {
* hostname: instance.publicIpAddress,
* username: user.name,
* password: user.password,
* },
* });
* const destinationConnectionProfile = new gcp.datastream.ConnectionProfile("destination_connection_profile", {
* displayName: "Connection profile",
* location: "us-central1",
* connectionProfileId: "destination-profile",
* bigqueryProfile: {},
* });
* const _default = new gcp.datastream.Stream("default", {
* streamId: "my-stream",
* location: "us-central1",
* displayName: "my stream",
* sourceConfig: {
* sourceConnectionProfile: sourceConnectionProfile.id,
* mysqlSourceConfig: {},
* },
* destinationConfig: {
* destinationConnectionProfile: destinationConnectionProfile.id,
* bigqueryDestinationConfig: {
* sourceHierarchyDatasets: {
* datasetTemplate: {
* location: "us-central1",
* },
* },
* appendOnly: {},
* },
* },
* backfillNone: {},
* });
* ```
* ### Datastream Stream Bigquery Blmt
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as random from "@pulumi/random";
*
* const project = gcp.organizations.getProject({});
* const instance = new gcp.sql.DatabaseInstance("instance", {
* name: "blmt-instance",
* databaseVersion: "MYSQL_8_0",
* region: "us-central1",
* settings: {
* tier: "db-f1-micro",
* ipConfiguration: {
* authorizedNetworks: [
* {
* value: "34.71.242.81",
* },
* {
* value: "34.72.28.29",
* },
* {
* value: "34.67.6.157",
* },
* {
* value: "34.67.234.134",
* },
* {
* value: "34.72.239.218",
* },
* ],
* },
* },
* deletionProtection: true,
* });
* const db = new gcp.sql.Database("db", {
* instance: instance.name,
* name: "db",
* });
* const pwd = new random.RandomPassword("pwd", {
* length: 16,
* special: false,
* });
* const user = new gcp.sql.User("user", {
* name: "user",
* instance: instance.name,
* host: "%",
* password: pwd.result,
* });
* const blmtBucket = new gcp.storage.Bucket("blmt_bucket", {
* name: "blmt-bucket",
* location: "us-central1",
* forceDestroy: true,
* });
* const blmtConnection = new gcp.bigquery.Connection("blmt_connection", {
* project: project.then(project => project.projectId),
* location: "us-central1",
* connectionId: "blmt-connection",
* friendlyName: "Datastream BLMT Test Connection",
* description: "Connection for Datastream BLMT test",
* cloudResource: {},
* });
* const blmtConnectionBucketAdmin = new gcp.storage.BucketIAMMember("blmt_connection_bucket_admin", {
* bucket: blmtBucket.name,
* role: "roles/storage.admin",
* member: blmtConnection.cloudResource.apply(cloudResource => `serviceAccount:${cloudResource?.serviceAccountId}`),
* });
* const sourceConnectionProfile = new gcp.datastream.ConnectionProfile("source_connection_profile", {
* displayName: "Source connection profile",
* location: "us-central1",
* connectionProfileId: "blmt-source-profile",
* mysqlProfile: {
* hostname: instance.publicIpAddress,
* username: user.name,
* password: user.password,
* },
* });
* const destinationConnectionProfile = new gcp.datastream.ConnectionProfile("destination_connection_profile", {
* displayName: "Connection profile",
* location: "us-central1",
* connectionProfileId: "blmt-destination-profile",
* bigqueryProfile: {},
* });
* const _default = new gcp.datastream.Stream("default", {
* streamId: "blmt-stream",
* location: "us-central1",
* displayName: "My BLMT stream",
* sourceConfig: {
* sourceConnectionProfile: sourceConnectionProfile.id,
* mysqlSourceConfig: {},
* },
* destinationConfig: {
* destinationConnectionProfile: destinationConnectionProfile.id,
* bigqueryDestinationConfig: {
* sourceHierarchyDatasets: {
* datasetTemplate: {
* location: "us-central1",
* },
* },
* blmtConfig: {
* bucket: blmtBucket.name,
* connectionName: pulumi.all([blmtConnection.project, blmtConnection.location, blmtConnection.connectionId]).apply(([project, location, connectionId]) => `${project}.${location}.${connectionId}`),
* fileFormat: "PARQUET",
* tableFormat: "ICEBERG",
* rootPath: "/",
* },
* appendOnly: {},
* },
* },
* backfillNone: {},
* });
* ```
*
* ## Import
*
* Stream can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/streams/{{stream_id}}`
*
* * `{{project}}/{{location}}/{{stream_id}}`
*
* * `{{location}}/{{stream_id}}`
*
* When using the `pulumi import` command, Stream can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:datastream/stream:Stream default projects/{{project}}/locations/{{location}}/streams/{{stream_id}}
* ```
*
* ```sh
* $ pulumi import gcp:datastream/stream:Stream default {{project}}/{{location}}/{{stream_id}}
* ```
*
* ```sh
* $ pulumi import gcp:datastream/stream:Stream default {{location}}/{{stream_id}}
* ```
*/
class Stream extends pulumi.CustomResource {
/**
* Get an existing Stream 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 Stream(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Stream. 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'] === Stream.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["backfillAll"] = state ? state.backfillAll : undefined;
resourceInputs["backfillNone"] = state ? state.backfillNone : undefined;
resourceInputs["createWithoutValidation"] = state ? state.createWithoutValidation : undefined;
resourceInputs["customerManagedEncryptionKey"] = state ? state.customerManagedEncryptionKey : undefined;
resourceInputs["desiredState"] = state ? state.desiredState : undefined;
resourceInputs["destinationConfig"] = state ? state.destinationConfig : undefined;
resourceInputs["displayName"] = state ? state.displayName : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : 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["sourceConfig"] = state ? state.sourceConfig : undefined;
resourceInputs["state"] = state ? state.state : undefined;
resourceInputs["streamId"] = state ? state.streamId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.destinationConfig === undefined) && !opts.urn) {
throw new Error("Missing required property 'destinationConfig'");
}
if ((!args || args.displayName === undefined) && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
if ((!args || args.location === undefined) && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if ((!args || args.sourceConfig === undefined) && !opts.urn) {
throw new Error("Missing required property 'sourceConfig'");
}
if ((!args || args.streamId === undefined) && !opts.urn) {
throw new Error("Missing required property 'streamId'");
}
resourceInputs["backfillAll"] = args ? args.backfillAll : undefined;
resourceInputs["backfillNone"] = args ? args.backfillNone : undefined;
resourceInputs["createWithoutValidation"] = args ? args.createWithoutValidation : undefined;
resourceInputs["customerManagedEncryptionKey"] = args ? args.customerManagedEncryptionKey : undefined;
resourceInputs["desiredState"] = args ? args.desiredState : undefined;
resourceInputs["destinationConfig"] = args ? args.destinationConfig : undefined;
resourceInputs["displayName"] = args ? args.displayName : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["location"] = args ? args.location : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["sourceConfig"] = args ? args.sourceConfig : undefined;
resourceInputs["streamId"] = args ? args.streamId : undefined;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Stream.__pulumiType, name, resourceInputs, opts);
}
}
exports.Stream = Stream;
/** @internal */
Stream.__pulumiType = 'gcp:datastream/stream:Stream';
//# sourceMappingURL=stream.js.map