UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

138 lines 5.65 kB
"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.Topic = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * A Managed Service for Apache Kafka topic. Apache Kafka is a trademark owned by the Apache Software Foundation. * * ## Example Usage * * ### Managedkafka Topic Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const cluster = new gcp.managedkafka.Cluster("cluster", { * clusterId: "my-cluster", * location: "us-central1", * capacityConfig: { * vcpuCount: "3", * memoryBytes: "3221225472", * }, * gcpConfig: { * accessConfig: { * networkConfigs: [{ * subnet: project.then(project => `projects/${project.number}/regions/us-central1/subnetworks/default`), * }], * }, * }, * }); * const example = new gcp.managedkafka.Topic("example", { * topicId: "my-topic", * cluster: cluster.clusterId, * location: "us-central1", * partitionCount: 2, * replicationFactor: 3, * configs: { * "cleanup.policy": "compact", * }, * }); * ``` * * ## Import * * Topic can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/clusters/{{cluster}}/topics/{{topic_id}}` * * * `{{project}}/{{location}}/{{cluster}}/{{topic_id}}` * * * `{{location}}/{{cluster}}/{{topic_id}}` * * When using the `pulumi import` command, Topic can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:managedkafka/topic:Topic default projects/{{project}}/locations/{{location}}/clusters/{{cluster}}/topics/{{topic_id}} * ``` * * ```sh * $ pulumi import gcp:managedkafka/topic:Topic default {{project}}/{{location}}/{{cluster}}/{{topic_id}} * ``` * * ```sh * $ pulumi import gcp:managedkafka/topic:Topic default {{location}}/{{cluster}}/{{topic_id}} * ``` */ 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["cluster"] = state ? state.cluster : undefined; resourceInputs["configs"] = state ? state.configs : undefined; resourceInputs["location"] = state ? state.location : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["partitionCount"] = state ? state.partitionCount : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["replicationFactor"] = state ? state.replicationFactor : undefined; resourceInputs["topicId"] = state ? state.topicId : undefined; } else { const args = argsOrState; if ((!args || args.cluster === undefined) && !opts.urn) { throw new Error("Missing required property 'cluster'"); } if ((!args || args.location === undefined) && !opts.urn) { throw new Error("Missing required property 'location'"); } if ((!args || args.replicationFactor === undefined) && !opts.urn) { throw new Error("Missing required property 'replicationFactor'"); } if ((!args || args.topicId === undefined) && !opts.urn) { throw new Error("Missing required property 'topicId'"); } resourceInputs["cluster"] = args ? args.cluster : undefined; resourceInputs["configs"] = args ? args.configs : undefined; resourceInputs["location"] = args ? args.location : undefined; resourceInputs["partitionCount"] = args ? args.partitionCount : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["replicationFactor"] = args ? args.replicationFactor : undefined; resourceInputs["topicId"] = args ? args.topicId : undefined; resourceInputs["name"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Topic.__pulumiType, name, resourceInputs, opts); } } exports.Topic = Topic; /** @internal */ Topic.__pulumiType = 'gcp:managedkafka/topic:Topic'; //# sourceMappingURL=topic.js.map