@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
201 lines • 8.63 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Connector = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* A Managed Service for Kafka Connect Connectors.
*
* ## Example Usage
*
* ### Managedkafka Connector Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const project = gcp.organizations.getProject({});
* const mkcSecondarySubnet = new gcp.compute.Subnetwork("mkc_secondary_subnet", {
* project: project.then(project => project.projectId),
* name: "my-secondary-subnetwork-00",
* ipCidrRange: "10.5.0.0/16",
* region: "us-central1",
* network: "default",
* });
* const cpsTopic = new gcp.pubsub.Topic("cps_topic", {
* project: project.then(project => project.projectId),
* name: "my-cps-topic",
* messageRetentionDuration: "86600s",
* });
* const gmkCluster = new gcp.managedkafka.Cluster("gmk_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 gmkTopic = new gcp.managedkafka.Topic("gmk_topic", {
* topicId: "my-topic",
* cluster: gmkCluster.clusterId,
* location: "us-central1",
* partitionCount: 2,
* replicationFactor: 3,
* });
* const mkcCluster = new gcp.managedkafka.ConnectCluster("mkc_cluster", {
* connectClusterId: "my-connect-cluster",
* kafkaCluster: pulumi.all([project, gmkCluster.clusterId]).apply(([project, clusterId]) => `projects/${project.projectId}/locations/us-central1/clusters/${clusterId}`),
* location: "us-central1",
* capacityConfig: {
* vcpuCount: "12",
* memoryBytes: "21474836480",
* },
* gcpConfig: {
* accessConfig: {
* networkConfigs: [{
* primarySubnet: project.then(project => `projects/${project.number}/regions/us-central1/subnetworks/default`),
* additionalSubnets: [mkcSecondarySubnet.id],
* dnsDomainNames: [Promise.all([gmkCluster.clusterId, project]).then(([clusterId, project]) => `${clusterId}.us-central1.managedkafka.${project.projectId}.cloud.goog`)],
* }],
* },
* },
* labels: {
* key: "value",
* },
* });
* const example = new gcp.managedkafka.Connector("example", {
* connectorId: "my-connector",
* connectCluster: mkcCluster.connectClusterId,
* location: "us-central1",
* configs: {
* "connector.class": "com.google.pubsub.kafka.sink.CloudPubSubSinkConnector",
* name: "my-connector",
* "tasks.max": "3",
* topics: gmkTopic.topicId,
* "cps.topic": cpsTopic.name,
* "cps.project": project.then(project => project.projectId),
* "value.converter": "org.apache.kafka.connect.storage.StringConverter",
* "key.converter": "org.apache.kafka.connect.storage.StringConverter",
* },
* taskRestartPolicy: {
* minimumBackoff: "60s",
* maximumBackoff: "1800s",
* },
* });
* ```
*
* ## Import
*
* Connector can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/connectClusters/{{connect_cluster}}/connectors/{{connector_id}}`
* * `{{project}}/{{location}}/{{connect_cluster}}/{{connector_id}}`
* * `{{location}}/{{connect_cluster}}/{{connector_id}}`
*
* When using the `pulumi import` command, Connector can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:managedkafka/connector:Connector default projects/{{project}}/locations/{{location}}/connectClusters/{{connect_cluster}}/connectors/{{connector_id}}
* $ pulumi import gcp:managedkafka/connector:Connector default {{project}}/{{location}}/{{connect_cluster}}/{{connector_id}}
* $ pulumi import gcp:managedkafka/connector:Connector default {{location}}/{{connect_cluster}}/{{connector_id}}
* ```
*/
class Connector extends pulumi.CustomResource {
/**
* Get an existing Connector 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 Connector(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:managedkafka/connector:Connector';
/**
* Returns true if the given object is an instance of Connector. 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'] === Connector.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["configs"] = state?.configs;
resourceInputs["connectCluster"] = state?.connectCluster;
resourceInputs["connectorId"] = state?.connectorId;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["location"] = state?.location;
resourceInputs["name"] = state?.name;
resourceInputs["project"] = state?.project;
resourceInputs["state"] = state?.state;
resourceInputs["taskRestartPolicy"] = state?.taskRestartPolicy;
}
else {
const args = argsOrState;
if (args?.connectCluster === undefined && !opts.urn) {
throw new Error("Missing required property 'connectCluster'");
}
if (args?.connectorId === undefined && !opts.urn) {
throw new Error("Missing required property 'connectorId'");
}
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
resourceInputs["configs"] = args?.configs;
resourceInputs["connectCluster"] = args?.connectCluster;
resourceInputs["connectorId"] = args?.connectorId;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["location"] = args?.location;
resourceInputs["project"] = args?.project;
resourceInputs["taskRestartPolicy"] = args?.taskRestartPolicy;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Connector.__pulumiType, name, resourceInputs, opts);
}
}
exports.Connector = Connector;
//# sourceMappingURL=connector.js.map