@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
134 lines • 4.92 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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.LiteSubscription = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* A named resource representing the stream of messages from a single,
* specific topic, to be delivered to the subscribing application.
*
* To get more information about Subscription, see:
*
* * [API documentation](https://cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions)
* * How-to Guides
* * [Managing Subscriptions](https://cloud.google.com/pubsub/lite/docs/subscriptions)
*
* ## Example Usage
*
* ### Pubsub Lite Subscription Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const project = gcp.organizations.getProject({});
* const example = new gcp.pubsub.LiteTopic("example", {
* name: "example-topic",
* project: project.then(project => project.number),
* partitionConfig: {
* count: 1,
* capacity: {
* publishMibPerSec: 4,
* subscribeMibPerSec: 8,
* },
* },
* retentionConfig: {
* perPartitionBytes: "32212254720",
* },
* });
* const exampleLiteSubscription = new gcp.pubsub.LiteSubscription("example", {
* name: "example-subscription",
* topic: example.name,
* deliveryConfig: {
* deliveryRequirement: "DELIVER_AFTER_STORED",
* },
* });
* ```
*
* ## Import
*
* Subscription can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{zone}}/subscriptions/{{name}}`
*
* * `{{project}}/{{zone}}/{{name}}`
*
* * `{{zone}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, Subscription can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:pubsub/liteSubscription:LiteSubscription default projects/{{project}}/locations/{{zone}}/subscriptions/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:pubsub/liteSubscription:LiteSubscription default {{project}}/{{zone}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:pubsub/liteSubscription:LiteSubscription default {{zone}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:pubsub/liteSubscription:LiteSubscription default {{name}}
* ```
*/
class LiteSubscription extends pulumi.CustomResource {
/**
* Get an existing LiteSubscription 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 LiteSubscription(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of LiteSubscription. 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'] === LiteSubscription.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["deliveryConfig"] = state?.deliveryConfig;
resourceInputs["name"] = state?.name;
resourceInputs["project"] = state?.project;
resourceInputs["region"] = state?.region;
resourceInputs["topic"] = state?.topic;
resourceInputs["zone"] = state?.zone;
}
else {
const args = argsOrState;
if (args?.topic === undefined && !opts.urn) {
throw new Error("Missing required property 'topic'");
}
resourceInputs["deliveryConfig"] = args?.deliveryConfig;
resourceInputs["name"] = args?.name;
resourceInputs["project"] = args?.project;
resourceInputs["region"] = args?.region;
resourceInputs["topic"] = args?.topic;
resourceInputs["zone"] = args?.zone;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(LiteSubscription.__pulumiType, name, resourceInputs, opts);
}
}
exports.LiteSubscription = LiteSubscription;
/** @internal */
LiteSubscription.__pulumiType = 'gcp:pubsub/liteSubscription:LiteSubscription';
//# sourceMappingURL=liteSubscription.js.map
;