@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
113 lines • 4.08 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.Role = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a **Custom Policy** resource within HuaweiCloud IAM service.
*
* ->**Note** You *must* have admin privileges to use this resource.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as huaweicloud from "@pulumi/huaweicloud";
*
* const role1 = new huaweicloud.Iam.Role("role1", {
* description: "created by terraform",
* policy: `{
* "Version": "1.1",
* "Statement": [
* {
* "Action": [
* "obs:bucket:GetBucketAcl"
* ],
* "Effect": "Allow",
* "Resource": [
* "obs:*:*:bucket:*"
* ],
* "Condition": {
* "StringStartWith": {
* "g:ProjectName": [
* "cn-north-4"
* ]
* }
* }
* }
* ]
* }
* `,
* type: "AX",
* });
* ```
*
* ## Import
*
* IAM custom policies can be imported using the `id`, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Iam/role:Role role1 89c60255-9bd6-460c-822a-e2b959ede9d2
* ```
*/
class Role extends pulumi.CustomResource {
/**
* Get an existing Role 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 Role(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Role. 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'] === Role.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["policy"] = state ? state.policy : undefined;
resourceInputs["references"] = state ? state.references : undefined;
resourceInputs["type"] = state ? state.type : undefined;
}
else {
const args = argsOrState;
if ((!args || args.description === undefined) && !opts.urn) {
throw new Error("Missing required property 'description'");
}
if ((!args || args.policy === undefined) && !opts.urn) {
throw new Error("Missing required property 'policy'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["policy"] = args ? args.policy : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["references"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Role.__pulumiType, name, resourceInputs, opts);
}
}
exports.Role = Role;
/** @internal */
Role.__pulumiType = 'huaweicloud:Iam/role:Role';
//# sourceMappingURL=role.js.map