UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

386 lines (385 loc) 15.2 kB
import * as pulumi from "@pulumi/pulumi"; import { input as inputs, output as outputs } from "../types"; /** * 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 * ``` */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: ComponentInstanceState, opts?: pulumi.CustomResourceOptions): ComponentInstance; /** * 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: any): obj is ComponentInstance; /** * Specifies the application ID to which the instance belongs. * Changing this will create a new instance. */ readonly applicationId: pulumi.Output<string>; /** * Specifies the component artifact settings. * The key indicates the component name. In the Docker container scenario, the key indicates the container name. * The object structure is documented below. */ readonly artifacts: pulumi.Output<outputs.ServiceStage.ComponentInstanceArtifact[]>; /** * Specifies the component ID to build (deploy). * Changing this will create a new instance. */ readonly componentId: pulumi.Output<string>; /** * Specifies the configuration parameters, such as environment variables, * deployment configurations, and O&M monitoring. * The object structure is documented below. */ readonly configuration: pulumi.Output<outputs.ServiceStage.ComponentInstanceConfiguration>; /** * Specifies the description of the instance. * The description can contain a maximum of `128` characters. */ readonly description: pulumi.Output<string | undefined>; /** * Specifies the environment ID in which the component to build (deployed). * Changing this will create a new instance. */ readonly environmentId: pulumi.Output<string>; /** * Specifies the configuration of the external network access. * The object structure is documented below. */ readonly externalAccesses: pulumi.Output<outputs.ServiceStage.ComponentInstanceExternalAccess[]>; /** * Specifies the resource specifications, which can be obtained by using data source or * the customize resource specifications. * The format of customize resource specifications is **CUSTOM-xxG:xxC-xxC:xxGi-xxGi**. * The meaning of each part is: * + **xxG**: storage capacity allocated to a component instance (reserved field). You can set it to a fixed number. * + **xxC-xxC**: the maximum and minimum number of CPU cores allocated to a component instance. * + **xxGi-xxGi**: the maximum and minimum memory allocated to a component instance. */ readonly flavorId: pulumi.Output<string>; /** * Specifies the configuration item. */ readonly name: pulumi.Output<string>; /** * Specifies the deployed resources. * The object structure is documented below. */ readonly referResources: pulumi.Output<outputs.ServiceStage.ComponentInstanceReferResource[]>; /** * Specifies the region in which to create (deploy) the ServiceStage (component) instance. * If omitted, the provider-level region will be used. Changing this will create a new instance. */ readonly region: pulumi.Output<string>; /** * Specifies the number of instance replicas. * Changing this will create a new instance. */ readonly replica: pulumi.Output<number>; /** * The instance status, which supports: * + **FAILED** * + **RUNNING** * + **DOWN** * + **STOPPED** * + **UNKNOWN** * + **PARTIALLY_FAILED** */ readonly status: pulumi.Output<string>; /** * Specifies the version number. */ readonly version: pulumi.Output<string>; /** * Create a ComponentInstance resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: ComponentInstanceArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering ComponentInstance resources. */ export interface ComponentInstanceState { /** * Specifies the application ID to which the instance belongs. * Changing this will create a new instance. */ applicationId?: pulumi.Input<string>; /** * Specifies the component artifact settings. * The key indicates the component name. In the Docker container scenario, the key indicates the container name. * The object structure is documented below. */ artifacts?: pulumi.Input<pulumi.Input<inputs.ServiceStage.ComponentInstanceArtifact>[]>; /** * Specifies the component ID to build (deploy). * Changing this will create a new instance. */ componentId?: pulumi.Input<string>; /** * Specifies the configuration parameters, such as environment variables, * deployment configurations, and O&M monitoring. * The object structure is documented below. */ configuration?: pulumi.Input<inputs.ServiceStage.ComponentInstanceConfiguration>; /** * Specifies the description of the instance. * The description can contain a maximum of `128` characters. */ description?: pulumi.Input<string>; /** * Specifies the environment ID in which the component to build (deployed). * Changing this will create a new instance. */ environmentId?: pulumi.Input<string>; /** * Specifies the configuration of the external network access. * The object structure is documented below. */ externalAccesses?: pulumi.Input<pulumi.Input<inputs.ServiceStage.ComponentInstanceExternalAccess>[]>; /** * Specifies the resource specifications, which can be obtained by using data source or * the customize resource specifications. * The format of customize resource specifications is **CUSTOM-xxG:xxC-xxC:xxGi-xxGi**. * The meaning of each part is: * + **xxG**: storage capacity allocated to a component instance (reserved field). You can set it to a fixed number. * + **xxC-xxC**: the maximum and minimum number of CPU cores allocated to a component instance. * + **xxGi-xxGi**: the maximum and minimum memory allocated to a component instance. */ flavorId?: pulumi.Input<string>; /** * Specifies the configuration item. */ name?: pulumi.Input<string>; /** * Specifies the deployed resources. * The object structure is documented below. */ referResources?: pulumi.Input<pulumi.Input<inputs.ServiceStage.ComponentInstanceReferResource>[]>; /** * Specifies the region in which to create (deploy) the ServiceStage (component) instance. * If omitted, the provider-level region will be used. Changing this will create a new instance. */ region?: pulumi.Input<string>; /** * Specifies the number of instance replicas. * Changing this will create a new instance. */ replica?: pulumi.Input<number>; /** * The instance status, which supports: * + **FAILED** * + **RUNNING** * + **DOWN** * + **STOPPED** * + **UNKNOWN** * + **PARTIALLY_FAILED** */ status?: pulumi.Input<string>; /** * Specifies the version number. */ version?: pulumi.Input<string>; } /** * The set of arguments for constructing a ComponentInstance resource. */ export interface ComponentInstanceArgs { /** * Specifies the application ID to which the instance belongs. * Changing this will create a new instance. */ applicationId: pulumi.Input<string>; /** * Specifies the component artifact settings. * The key indicates the component name. In the Docker container scenario, the key indicates the container name. * The object structure is documented below. */ artifacts?: pulumi.Input<pulumi.Input<inputs.ServiceStage.ComponentInstanceArtifact>[]>; /** * Specifies the component ID to build (deploy). * Changing this will create a new instance. */ componentId: pulumi.Input<string>; /** * Specifies the configuration parameters, such as environment variables, * deployment configurations, and O&M monitoring. * The object structure is documented below. */ configuration?: pulumi.Input<inputs.ServiceStage.ComponentInstanceConfiguration>; /** * Specifies the description of the instance. * The description can contain a maximum of `128` characters. */ description?: pulumi.Input<string>; /** * Specifies the environment ID in which the component to build (deployed). * Changing this will create a new instance. */ environmentId: pulumi.Input<string>; /** * Specifies the configuration of the external network access. * The object structure is documented below. */ externalAccesses?: pulumi.Input<pulumi.Input<inputs.ServiceStage.ComponentInstanceExternalAccess>[]>; /** * Specifies the resource specifications, which can be obtained by using data source or * the customize resource specifications. * The format of customize resource specifications is **CUSTOM-xxG:xxC-xxC:xxGi-xxGi**. * The meaning of each part is: * + **xxG**: storage capacity allocated to a component instance (reserved field). You can set it to a fixed number. * + **xxC-xxC**: the maximum and minimum number of CPU cores allocated to a component instance. * + **xxGi-xxGi**: the maximum and minimum memory allocated to a component instance. */ flavorId: pulumi.Input<string>; /** * Specifies the configuration item. */ name?: pulumi.Input<string>; /** * Specifies the deployed resources. * The object structure is documented below. */ referResources: pulumi.Input<pulumi.Input<inputs.ServiceStage.ComponentInstanceReferResource>[]>; /** * Specifies the region in which to create (deploy) the ServiceStage (component) instance. * If omitted, the provider-level region will be used. Changing this will create a new instance. */ region?: pulumi.Input<string>; /** * Specifies the number of instance replicas. * Changing this will create a new instance. */ replica: pulumi.Input<number>; /** * Specifies the version number. */ version: pulumi.Input<string>; }