@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
91 lines • 4.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.UserToken = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an IAM user token resource within HuaweiCloud.
*
* ->**Note** The token can not be destroyed. It will be invalid after expiration time. If password or AK/SK is changed,
* the token valid time will last less than 30 minutes.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const accountName = config.requireObject("accountName");
* const userName = config.requireObject("userName");
* const password = config.requireObject("password");
* const test = new huaweicloud.iam.UserToken("test", {
* accountName: accountName,
* userName: userName,
* password: password,
* });
* ```
*/
class UserToken extends pulumi.CustomResource {
/**
* Get an existing UserToken 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 UserToken(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of UserToken. 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'] === UserToken.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accountName"] = state ? state.accountName : undefined;
resourceInputs["expiresAt"] = state ? state.expiresAt : undefined;
resourceInputs["password"] = state ? state.password : undefined;
resourceInputs["projectName"] = state ? state.projectName : undefined;
resourceInputs["token"] = state ? state.token : undefined;
resourceInputs["userName"] = state ? state.userName : undefined;
}
else {
const args = argsOrState;
if ((!args || args.accountName === undefined) && !opts.urn) {
throw new Error("Missing required property 'accountName'");
}
if ((!args || args.password === undefined) && !opts.urn) {
throw new Error("Missing required property 'password'");
}
if ((!args || args.userName === undefined) && !opts.urn) {
throw new Error("Missing required property 'userName'");
}
resourceInputs["accountName"] = args ? args.accountName : undefined;
resourceInputs["password"] = args ? args.password : undefined;
resourceInputs["projectName"] = args ? args.projectName : undefined;
resourceInputs["userName"] = args ? args.userName : undefined;
resourceInputs["expiresAt"] = undefined /*out*/;
resourceInputs["token"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(UserToken.__pulumiType, name, resourceInputs, opts);
}
}
exports.UserToken = UserToken;
/** @internal */
UserToken.__pulumiType = 'huaweicloud:Iam/userToken:UserToken';
//# sourceMappingURL=userToken.js.map