@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
133 lines • 6.43 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.Task = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an SMS migration task resource within HuaweiCloud.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const sourceServer = config.requireObject("sourceServer");
* const templateId = config.requireObject("templateId");
* const migration = new huaweicloud.sms.Task("migration", {
* type: "MIGRATE_FILE",
* osType: "LINUX",
* sourceServerId: sourceServer,
* vmTemplateId: templateId,
* action: "start",
* });
* ```
*
* ## Import
*
* SMS migration tasks can be imported by `id`, e.g.
*
* ```sh
* $ pulumi import huaweicloud:Sms/task:Task demo 6402c49b-7d9a-413e-8b5f-a7307f7d5679
* ```
*
* Note that the imported state may not be identical to your resource definition, due to some attributes missing from the API response. The missing attributes include`use_public_ip`, `syncing` and `action`. It is generally recommended running `terraform plan` after importing a migration task. You can then decide if changes should be applied to the task, or the resource definition should be updated to align with the task. Also you can ignore changes as below. hcl resource "huaweicloud_sms_task" "demo" {
*
* ...
*
* lifecycle {
*
* ignore_changes = [
*
* use_public_ip, syncing, action,
*
* ]
*
* } }
*/
class Task extends pulumi.CustomResource {
/**
* Get an existing Task 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 Task(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Task. 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'] === Task.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["action"] = state ? state.action : undefined;
resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined;
resourceInputs["migrateSpeed"] = state ? state.migrateSpeed : undefined;
resourceInputs["migrationIp"] = state ? state.migrationIp : undefined;
resourceInputs["osType"] = state ? state.osType : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["sourceServerId"] = state ? state.sourceServerId : undefined;
resourceInputs["startTargetServer"] = state ? state.startTargetServer : undefined;
resourceInputs["state"] = state ? state.state : undefined;
resourceInputs["syncing"] = state ? state.syncing : undefined;
resourceInputs["targetServerDisks"] = state ? state.targetServerDisks : undefined;
resourceInputs["targetServerId"] = state ? state.targetServerId : undefined;
resourceInputs["targetServerName"] = state ? state.targetServerName : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["usePublicIp"] = state ? state.usePublicIp : undefined;
resourceInputs["vmTemplateId"] = state ? state.vmTemplateId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.osType === undefined) && !opts.urn) {
throw new Error("Missing required property 'osType'");
}
if ((!args || args.sourceServerId === undefined) && !opts.urn) {
throw new Error("Missing required property 'sourceServerId'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["action"] = args ? args.action : undefined;
resourceInputs["migrationIp"] = args ? args.migrationIp : undefined;
resourceInputs["osType"] = args ? args.osType : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["sourceServerId"] = args ? args.sourceServerId : undefined;
resourceInputs["startTargetServer"] = args ? args.startTargetServer : undefined;
resourceInputs["syncing"] = args ? args.syncing : undefined;
resourceInputs["targetServerDisks"] = args ? args.targetServerDisks : undefined;
resourceInputs["targetServerId"] = args ? args.targetServerId : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["usePublicIp"] = args ? args.usePublicIp : undefined;
resourceInputs["vmTemplateId"] = args ? args.vmTemplateId : undefined;
resourceInputs["enterpriseProjectId"] = undefined /*out*/;
resourceInputs["migrateSpeed"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
resourceInputs["targetServerName"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Task.__pulumiType, name, resourceInputs, opts);
}
}
exports.Task = Task;
/** @internal */
Task.__pulumiType = 'huaweicloud:Sms/task:Task';
//# sourceMappingURL=task.js.map