UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

220 lines 9.22 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.Endpoint = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a resource to manage a VPC endpoint resource. * * ## Example Usage * ### Access to the public interface service * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const publicInterfaceServiceId = config.requireObject("publicInterfaceServiceId"); * const vpcId = config.requireObject("vpcId"); * const networkId = config.requireObject("networkId"); * const test = new huaweicloud.vpcep.Endpoint("test", { * serviceId: publicInterfaceServiceId, * vpcId: vpcId, * networkId: networkId, * enableDns: true, * enableWhitelist: true, * whitelists: ["192.168.0.0/24"], * }); * ``` * ### Access to the private interface service * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const serviceVpcId = config.requireObject("serviceVpcId"); * const vmPort = config.requireObject("vmPort"); * const vpcId = config.requireObject("vpcId"); * const networkId = config.requireObject("networkId"); * const testService = new huaweicloud.vpcep.Service("testService", { * serverType: "VM", * vpcId: serviceVpcId, * portId: vmPort, * portMappings: [{ * servicePort: 8080, * terminalPort: 80, * }], * }); * const testEndpoint = new huaweicloud.vpcep.Endpoint("testEndpoint", { * serviceId: testService.id, * vpcId: vpcId, * networkId: networkId, * enableDns: true, * description: "test description", * }); * ``` * ### Access to the gateway service without policy statement * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const gatewayServiceId = config.requireObject("gatewayServiceId"); * const vpcId = config.requireObject("vpcId"); * const test = new huaweicloud.vpcep.Endpoint("test", { * serviceId: gatewayServiceId, * vpcId: vpcId, * description: "test description", * }); * ``` * ### Access to the gateway service with policy statement * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const gatewayServiceId = config.requireObject("gatewayServiceId"); * const vpcId = config.requireObject("vpcId"); * const test = new huaweicloud.vpcep.Endpoint("test", { * serviceId: gatewayServiceId, * vpcId: vpcId, * description: "test description", * policyStatement: ` [ * { * "Effect": "Allow", * "Action": [ * "obs:bucket:ListBucket" * ], * "Resource": [ * "obs:*:*:*:*&#47;*", * "obs:*:*:*:*" * ] * }, * { * "Effect": "Deny", * "Action": [ * "obs:object:DeleteObject" * ], * "Resource": [ * "obs:*:*:*:*&#47;*", * "obs:*:*:*:*" * ] * } * ] * `, * }); * ``` * * ## Import * * VPC endpoint can be imported using the `id`, e.g. bash * * ```sh * $ pulumi import huaweicloud:Vpcep/endpoint:Endpoint test <id> * ``` * * Note that the imported state may not be identical to your resource definition, due to some attributes missing from the API response, security or some other reason. The missing attributes include`enable_dns`. It is generally recommended running `terraform plan` after importing a resource. You can then decide if changes should be applied to the resource, or the resource definition should be updated to align with the resource. Also, you can ignore changes as below. hcl resource "huaweicloud_vpcep_endpoint" "test" { * * ... * * lifecycle { * * ignore_changes = [ * * enable_dns, * * ] * * } } */ class Endpoint extends pulumi.CustomResource { /** * Get an existing Endpoint 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 Endpoint(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Endpoint. 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'] === Endpoint.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["enableDns"] = state ? state.enableDns : undefined; resourceInputs["enableWhitelist"] = state ? state.enableWhitelist : undefined; resourceInputs["ipAddress"] = state ? state.ipAddress : undefined; resourceInputs["ipVersion"] = state ? state.ipVersion : undefined; resourceInputs["ipv6Address"] = state ? state.ipv6Address : undefined; resourceInputs["networkId"] = state ? state.networkId : undefined; resourceInputs["packetId"] = state ? state.packetId : undefined; resourceInputs["policyDocument"] = state ? state.policyDocument : undefined; resourceInputs["policyStatement"] = state ? state.policyStatement : undefined; resourceInputs["privateDomainName"] = state ? state.privateDomainName : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["routetables"] = state ? state.routetables : undefined; resourceInputs["serviceId"] = state ? state.serviceId : undefined; resourceInputs["serviceName"] = state ? state.serviceName : undefined; resourceInputs["serviceType"] = state ? state.serviceType : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["vpcId"] = state ? state.vpcId : undefined; resourceInputs["whitelists"] = state ? state.whitelists : undefined; } else { const args = argsOrState; if ((!args || args.serviceId === undefined) && !opts.urn) { throw new Error("Missing required property 'serviceId'"); } if ((!args || args.vpcId === undefined) && !opts.urn) { throw new Error("Missing required property 'vpcId'"); } resourceInputs["description"] = args ? args.description : undefined; resourceInputs["enableDns"] = args ? args.enableDns : undefined; resourceInputs["enableWhitelist"] = args ? args.enableWhitelist : undefined; resourceInputs["ipAddress"] = args ? args.ipAddress : undefined; resourceInputs["ipVersion"] = args ? args.ipVersion : undefined; resourceInputs["ipv6Address"] = args ? args.ipv6Address : undefined; resourceInputs["networkId"] = args ? args.networkId : undefined; resourceInputs["policyDocument"] = args ? args.policyDocument : undefined; resourceInputs["policyStatement"] = args ? args.policyStatement : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["routetables"] = args ? args.routetables : undefined; resourceInputs["serviceId"] = args ? args.serviceId : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["vpcId"] = args ? args.vpcId : undefined; resourceInputs["whitelists"] = args ? args.whitelists : undefined; resourceInputs["packetId"] = undefined /*out*/; resourceInputs["privateDomainName"] = undefined /*out*/; resourceInputs["serviceName"] = undefined /*out*/; resourceInputs["serviceType"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Endpoint.__pulumiType, name, resourceInputs, opts); } } exports.Endpoint = Endpoint; /** @internal */ Endpoint.__pulumiType = 'huaweicloud:Vpcep/endpoint:Endpoint'; //# sourceMappingURL=endpoint.js.map