UNPKG

@pulumi/gcp

Version:

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

138 lines 5.28 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** 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, { ...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?.cluster; resourceInputs["configs"] = state?.configs; resourceInputs["location"] = state?.location; resourceInputs["name"] = state?.name; resourceInputs["partitionCount"] = state?.partitionCount; resourceInputs["project"] = state?.project; resourceInputs["replicationFactor"] = state?.replicationFactor; resourceInputs["topicId"] = state?.topicId; } else { const args = argsOrState; if (args?.cluster === undefined && !opts.urn) { throw new Error("Missing required property 'cluster'"); } if (args?.location === undefined && !opts.urn) { throw new Error("Missing required property 'location'"); } if (args?.replicationFactor === undefined && !opts.urn) { throw new Error("Missing required property 'replicationFactor'"); } if (args?.topicId === undefined && !opts.urn) { throw new Error("Missing required property 'topicId'"); } resourceInputs["cluster"] = args?.cluster; resourceInputs["configs"] = args?.configs; resourceInputs["location"] = args?.location; resourceInputs["partitionCount"] = args?.partitionCount; resourceInputs["project"] = args?.project; resourceInputs["replicationFactor"] = args?.replicationFactor; resourceInputs["topicId"] = args?.topicId; 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