@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
289 lines • 10.2 kB
JavaScript
;
// *** 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.Topic = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* A named resource to which messages are sent by publishers.
*
* To get more information about Topic, see:
*
* * [API documentation](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics)
* * How-to Guides
* * [Managing Topics](https://cloud.google.com/pubsub/docs/admin#managing_topics)
*
* > **Note:** You can retrieve the email of the Google Managed Pub/Sub Service Account used for forwarding
* by using the `gcp.projects.ServiceIdentity` resource.
*
* ## Example Usage
*
* ### Pubsub Topic Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* labels: {
* foo: "bar",
* },
* messageRetentionDuration: "86600s",
* });
* ```
* ### Pubsub Topic Cmek
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const keyRing = new gcp.kms.KeyRing("key_ring", {
* name: "example-keyring",
* location: "global",
* });
* const cryptoKey = new gcp.kms.CryptoKey("crypto_key", {
* name: "example-key",
* keyRing: keyRing.id,
* });
* const example = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* kmsKeyName: cryptoKey.id,
* });
* ```
* ### Pubsub Topic Geo Restricted
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* messageStoragePolicy: {
* allowedPersistenceRegions: ["europe-west3"],
* enforceInTransit: true,
* },
* });
* ```
* ### Pubsub Topic Schema Settings
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Schema("example", {
* name: "example",
* type: "AVRO",
* definition: `{
* "type" : "record",
* "name" : "Avro",
* "fields" : [
* {
* "name" : "StringField",
* "type" : "string"
* },
* {
* "name" : "IntField",
* "type" : "int"
* }
* ]
* }
* `,
* });
* const exampleTopic = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* schemaSettings: {
* schema: "projects/my-project-name/schemas/example",
* encoding: "JSON",
* },
* }, {
* dependsOn: [example],
* });
* ```
* ### Pubsub Topic Ingestion Kinesis
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* ingestionDataSourceSettings: {
* awsKinesis: {
* streamArn: "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name",
* consumerArn: "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111",
* awsRoleArn: "arn:aws:iam::111111111111:role/fake-role-name",
* gcpServiceAccount: "fake-service-account@fake-gcp-project.iam.gserviceaccount.com",
* },
* },
* });
* ```
* ### Pubsub Topic Ingestion Cloud Storage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* ingestionDataSourceSettings: {
* cloudStorage: {
* bucket: "test-bucket",
* textFormat: {
* delimiter: " ",
* },
* minimumObjectCreateTime: "2024-01-01T00:00:00Z",
* matchGlob: "foo/**",
* },
* platformLogsSettings: {
* severity: "WARNING",
* },
* },
* });
* ```
* ### Pubsub Topic Ingestion Azure Event Hubs
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* ingestionDataSourceSettings: {
* azureEventHubs: {
* resourceGroup: "azure-ingestion-resource-group",
* namespace: "azure-ingestion-namespace",
* eventHub: "azure-ingestion-event-hub",
* clientId: "aZZZZZZZ-YYYY-HHHH-GGGG-abcdef569123",
* tenantId: "0XXXXXXX-YYYY-HHHH-GGGG-123456789123",
* subscriptionId: "bXXXXXXX-YYYY-HHHH-GGGG-123456789123",
* gcpServiceAccount: "fake-service-account@fake-gcp-project.iam.gserviceaccount.com",
* },
* },
* });
* ```
* ### Pubsub Topic Ingestion Aws Msk
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* ingestionDataSourceSettings: {
* awsMsk: {
* clusterArn: "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name",
* topic: "test-topic",
* awsRoleArn: "arn:aws:iam::111111111111:role/fake-role-name",
* gcpServiceAccount: "fake-service-account@fake-gcp-project.iam.gserviceaccount.com",
* },
* },
* });
* ```
* ### Pubsub Topic Ingestion Confluent Cloud
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* ingestionDataSourceSettings: {
* confluentCloud: {
* bootstrapServer: "test.us-west2.gcp.confluent.cloud:1111",
* clusterId: "1234",
* topic: "test-topic",
* identityPoolId: "test-identity-pool-id",
* gcpServiceAccount: "fake-service-account@fake-gcp-project.iam.gserviceaccount.com",
* },
* },
* });
* ```
*
* ## Import
*
* Topic can be imported using any of these accepted formats:
*
* * `projects/{{project}}/topics/{{name}}`
*
* * `{{project}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, Topic can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:pubsub/topic:Topic default projects/{{project}}/topics/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:pubsub/topic:Topic default {{project}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:pubsub/topic:Topic default {{name}}
* ```
*/
class Topic extends pulumi.CustomResource {
/**
* Get an existing Topic 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 Topic(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Topic. 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'] === Topic.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["ingestionDataSourceSettings"] = state ? state.ingestionDataSourceSettings : undefined;
resourceInputs["kmsKeyName"] = state ? state.kmsKeyName : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["messageRetentionDuration"] = state ? state.messageRetentionDuration : undefined;
resourceInputs["messageStoragePolicy"] = state ? state.messageStoragePolicy : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["schemaSettings"] = state ? state.schemaSettings : undefined;
}
else {
const args = argsOrState;
resourceInputs["ingestionDataSourceSettings"] = args ? args.ingestionDataSourceSettings : undefined;
resourceInputs["kmsKeyName"] = args ? args.kmsKeyName : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["messageRetentionDuration"] = args ? args.messageRetentionDuration : undefined;
resourceInputs["messageStoragePolicy"] = args ? args.messageStoragePolicy : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["schemaSettings"] = args ? args.schemaSettings : undefined;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Topic.__pulumiType, name, resourceInputs, opts);
}
}
exports.Topic = Topic;
/** @internal */
Topic.__pulumiType = 'gcp:pubsub/topic:Topic';
//# sourceMappingURL=topic.js.map