UNPKG

@pulumi/gcp

Version:

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

190 lines 8.07 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.Connector = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * ## Example Usage * * ### Managedkafka Connector Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const mkcNetwork = new gcp.compute.Network("mkc_network", { * name: "my-network-0", * autoCreateSubnetworks: false, * }); * const mkcSubnet = new gcp.compute.Subnetwork("mkc_subnet", { * name: "my-subnetwork-0", * ipCidrRange: "10.4.0.0/16", * region: "us-central1", * network: mkcNetwork.id, * }); * const mkcAdditionalSubnet = new gcp.compute.Subnetwork("mkc_additional_subnet", { * name: "my-additional-subnetwork-0", * ipCidrRange: "10.5.0.0/16", * region: "us-central1", * network: mkcNetwork.id, * }); * const cpsTopic = new gcp.pubsub.Topic("cps_topic", { * name: "my-cps-topic", * messageRetentionDuration: "86600s", * }); * const project = gcp.organizations.getProject({}); * const gmkCluster = new gcp.managedkafka.Cluster("gmk_cluster", { * clusterId: "my-cluster", * location: "us-central1", * capacityConfig: { * vcpuCount: "3", * memoryBytes: "3221225472", * }, * gcpConfig: { * accessConfig: { * networkConfigs: [{ * subnet: pulumi.all([project, mkcSubnet.id]).apply(([project, id]) => `projects/${project.projectId}/regions/us-central1/subnetworks/${id}`), * }], * }, * }, * }); * 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: pulumi.all([project, mkcSubnet.id]).apply(([project, id]) => `projects/${project.projectId}/regions/us-central1/subnetworks/${id}`), * additionalSubnets: [mkcAdditionalSubnet.id], * dnsDomainNames: [pulumi.all([gmkCluster.clusterId, project]).apply(([clusterId, project]) => `${clusterId}.us-central1.managedkafka-staging.${project.projectId}.cloud-staging.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": "1", * 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}} * ``` * * ```sh * $ pulumi import gcp:managedkafka/connector:Connector default {{project}}/{{location}}/{{connect_cluster}}/{{connector_id}} * ``` * * ```sh * $ 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, Object.assign(Object.assign({}, opts), { id: id })); } /** * 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 ? state.configs : undefined; resourceInputs["connectCluster"] = state ? state.connectCluster : undefined; resourceInputs["connectorId"] = state ? state.connectorId : undefined; resourceInputs["location"] = state ? state.location : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["state"] = state ? state.state : undefined; resourceInputs["taskRestartPolicy"] = state ? state.taskRestartPolicy : undefined; } else { const args = argsOrState; if ((!args || args.connectCluster === undefined) && !opts.urn) { throw new Error("Missing required property 'connectCluster'"); } if ((!args || args.connectorId === undefined) && !opts.urn) { throw new Error("Missing required property 'connectorId'"); } if ((!args || args.location === undefined) && !opts.urn) { throw new Error("Missing required property 'location'"); } resourceInputs["configs"] = args ? args.configs : undefined; resourceInputs["connectCluster"] = args ? args.connectCluster : undefined; resourceInputs["connectorId"] = args ? args.connectorId : undefined; resourceInputs["location"] = args ? args.location : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["taskRestartPolicy"] = args ? args.taskRestartPolicy : undefined; resourceInputs["name"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Connector.__pulumiType, name, resourceInputs, opts); } } exports.Connector = Connector; /** @internal */ Connector.__pulumiType = 'gcp:managedkafka/connector:Connector'; //# sourceMappingURL=connector.js.map