@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
127 lines • 6.05 kB
JavaScript
;
// *** 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.NetworkInstance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a network instance resource within HuaweiCloud.
*
* Load VPCs or virtual gateways to the cloud connection. If you load virtual gateways, your on-premises data center
* can access multiple VPCs to build a hybrid cloud.
*
* Each network instance can be loaded onto only one cloud connection.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const cloudConnectionId = config.requireObject("cloudConnectionId");
* const vpcInstanceId = config.requireObject("vpcInstanceId");
* const vpcProjectId = config.requireObject("vpcProjectId");
* const vpcRegionId = config.requireObject("vpcRegionId");
* const cidr = config.requireObject("cidr");
* const test = new huaweicloud.cc.NetworkInstance("test", {
* type: "vpc",
* cloudConnectionId: cloudConnectionId,
* instanceId: vpcInstanceId,
* projectId: vpcProjectId,
* regionId: vpcRegionId,
* cidrs: [cidr],
* });
* ```
*
* ## Import
*
* The network instance can be imported using the `id`, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Cc/networkInstance:NetworkInstance test 0ce123456a00f2591fabc00385ff1234
* ```
*/
class NetworkInstance extends pulumi.CustomResource {
/**
* Get an existing NetworkInstance 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 NetworkInstance(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of NetworkInstance. 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'] === NetworkInstance.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["cidrs"] = state ? state.cidrs : undefined;
resourceInputs["cloudConnectionId"] = state ? state.cloudConnectionId : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["domainId"] = state ? state.domainId : undefined;
resourceInputs["instanceDomainId"] = state ? state.instanceDomainId : undefined;
resourceInputs["instanceId"] = state ? state.instanceId : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["regionId"] = state ? state.regionId : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["type"] = state ? state.type : undefined;
}
else {
const args = argsOrState;
if ((!args || args.cidrs === undefined) && !opts.urn) {
throw new Error("Missing required property 'cidrs'");
}
if ((!args || args.cloudConnectionId === undefined) && !opts.urn) {
throw new Error("Missing required property 'cloudConnectionId'");
}
if ((!args || args.instanceId === undefined) && !opts.urn) {
throw new Error("Missing required property 'instanceId'");
}
if ((!args || args.projectId === undefined) && !opts.urn) {
throw new Error("Missing required property 'projectId'");
}
if ((!args || args.regionId === undefined) && !opts.urn) {
throw new Error("Missing required property 'regionId'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["cidrs"] = args ? args.cidrs : undefined;
resourceInputs["cloudConnectionId"] = args ? args.cloudConnectionId : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["instanceDomainId"] = args ? args.instanceDomainId : undefined;
resourceInputs["instanceId"] = args ? args.instanceId : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["regionId"] = args ? args.regionId : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["domainId"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NetworkInstance.__pulumiType, name, resourceInputs, opts);
}
}
exports.NetworkInstance = NetworkInstance;
/** @internal */
NetworkInstance.__pulumiType = 'huaweicloud:Cc/networkInstance:NetworkInstance';
//# sourceMappingURL=networkInstance.js.map