UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

214 lines 9.41 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.ComponentInstance = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * This resource is used to deploy a component under specified application within HuaweiCloud ServiceStage service. * * ## Example Usage * ### Deploy a component in the container with specified SWR image * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const appId = config.requireObject("appId"); * const componentId = config.requireObject("componentId"); * const envId = config.requireObject("envId"); * const instanceName = config.requireObject("instanceName"); * const flavorId = config.requireObject("flavorId"); * const componentName = config.requireObject("componentName"); * const swrImageUrl = config.requireObject("swrImageUrl"); * const cceClusterId = config.requireObject("cceClusterId"); * const cseEngineId = config.requireObject("cseEngineId"); * const _default = new huaweicloud.servicestage.ComponentInstance("default", { * applicationId: appId, * componentId: componentId, * environmentId: envId, * version: "1.0.0", * replica: 1, * flavorId: flavorId, * artifacts: [{ * name: componentName, * type: "image", * storage: "swr", * url: swrImageUrl, * authType: "iam", * }], * referResources: [ * { * type: "cce", * id: cceClusterId, * parameters: { * type: "VirtualMachine", * namespace: "default", * }, * }, * { * type: "cse", * id: cseEngineId, * }, * ], * configuration: { * envVariables: [{ * name: "TZ", * value: "Asia/Shanghai", * }], * logCollectionPolicies: [{ * hostPath: "/tmp", * containerMountings: [{ * path: "/attached/01", * agingPeriod: "Hourly", * }], * }], * }, * }); * ``` * ### Deploy a component in the ECS instance with specified jar package * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const appId = config.requireObject("appId"); * const componentId = config.requireObject("componentId"); * const envId = config.requireObject("envId"); * const instanceName = config.requireObject("instanceName"); * const flavorId = config.requireObject("flavorId"); * const componentName = config.requireObject("componentName"); * const jarUrl = config.requireObject("jarUrl"); * const obsBucketName = config.requireObject("obsBucketName"); * const obsBucketEndpoint = config.requireObject("obsBucketEndpoint"); * const obsObjectKey = config.requireObject("obsObjectKey"); * const ecsInstanceId = config.requireObject("ecsInstanceId"); * const test = new huaweicloud.servicestage.ComponentInstance("test", { * applicationId: appId, * componentId: componentId, * environmentId: envId, * version: "1.0.0", * replica: 1, * flavorId: flavorId, * artifacts: [{ * name: componentName, * authType: "iam", * type: "package", * storage: "obs", * url: jarUrl, * properties: { * bucket: obsBucketName, * endpoint: obsBucketEndpoint, * key: obsObjectKey, * }, * }], * referResources: [{ * type: "ecs", * id: "Default", * parameters: { * hosts: `["${ecsInstanceId}"]`, * }, * }], * }); * ``` * * ## Import * * Instances can be imported using their related `application_id`, `component_id` and `id`, separated by a slash (/), e.g. bash * * ```sh * $ pulumi import huaweicloud:ServiceStage/componentInstance:ComponentInstance test 4e65a759-e7b1-4e9e-8277-857f8e261f3c/4e65a759-e7b1-4e9e-8277-857f8e261f3c/c0a13d88-d4e3-11ec-93a9-0255ac101d30 * ``` */ class ComponentInstance extends pulumi.CustomResource { /** * Get an existing ComponentInstance 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 ComponentInstance(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of ComponentInstance. 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'] === ComponentInstance.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["applicationId"] = state ? state.applicationId : undefined; resourceInputs["artifacts"] = state ? state.artifacts : undefined; resourceInputs["componentId"] = state ? state.componentId : undefined; resourceInputs["configuration"] = state ? state.configuration : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["environmentId"] = state ? state.environmentId : undefined; resourceInputs["externalAccesses"] = state ? state.externalAccesses : undefined; resourceInputs["flavorId"] = state ? state.flavorId : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["referResources"] = state ? state.referResources : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["replica"] = state ? state.replica : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["version"] = state ? state.version : undefined; } else { const args = argsOrState; if ((!args || args.applicationId === undefined) && !opts.urn) { throw new Error("Missing required property 'applicationId'"); } if ((!args || args.componentId === undefined) && !opts.urn) { throw new Error("Missing required property 'componentId'"); } if ((!args || args.environmentId === undefined) && !opts.urn) { throw new Error("Missing required property 'environmentId'"); } if ((!args || args.flavorId === undefined) && !opts.urn) { throw new Error("Missing required property 'flavorId'"); } if ((!args || args.referResources === undefined) && !opts.urn) { throw new Error("Missing required property 'referResources'"); } if ((!args || args.replica === undefined) && !opts.urn) { throw new Error("Missing required property 'replica'"); } if ((!args || args.version === undefined) && !opts.urn) { throw new Error("Missing required property 'version'"); } resourceInputs["applicationId"] = args ? args.applicationId : undefined; resourceInputs["artifacts"] = args ? args.artifacts : undefined; resourceInputs["componentId"] = args ? args.componentId : undefined; resourceInputs["configuration"] = args ? args.configuration : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["environmentId"] = args ? args.environmentId : undefined; resourceInputs["externalAccesses"] = args ? args.externalAccesses : undefined; resourceInputs["flavorId"] = args ? args.flavorId : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["referResources"] = args ? args.referResources : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["replica"] = args ? args.replica : undefined; resourceInputs["version"] = args ? args.version : undefined; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ComponentInstance.__pulumiType, name, resourceInputs, opts); } } exports.ComponentInstance = ComponentInstance; /** @internal */ ComponentInstance.__pulumiType = 'huaweicloud:ServiceStage/componentInstance:ComponentInstance'; //# sourceMappingURL=componentInstance.js.map