UNPKG

@pulumi/aws-native

Version:

The Pulumi AWS Cloud Control Provider enables you to build, deploy, and manage [any AWS resource that's supported by the AWS Cloud Control API](https://github.com/pulumi/pulumi-aws-native/blob/master/provider/cmd/pulumi-gen-aws-native/supported-types.txt)

156 lines 6.18 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.ExperimentTemplate = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Resource schema for AWS::FIS::ExperimentTemplate * * ## Example Usage * ### Example * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws_native from "@pulumi/aws-native"; * * const fisRole = new aws_native.iam.Role("fisRole", { * assumeRolePolicyDocument: { * version: "2012-10-17", * statement: [{ * effect: "Allow", * principal: { * service: "fis.amazonaws.com", * }, * action: "sts:AssumeRole", * }], * }, * policies: [{ * policyName: "FISRoleEC2Actions", * policyDocument: { * version: "2012-10-17", * statement: [{ * effect: "Allow", * action: [ * "ec2:RebootInstances", * "ec2:StopInstances", * "ec2:StartInstances", * "ec2:TerminateInstances", * ], * resource: "arn:aws:ec2:*:*:instance/*", * }], * }, * }], * }); * const experimentTemplate = new aws_native.fis.ExperimentTemplate("experimentTemplate", { * description: "stop an instance based on a tag", * actions: { * stopInstances: { * actionId: "aws:ec2:stop-instances", * parameters: { * startInstancesAfterDuration: "PT2M", * }, * targets: { * instances: "oneRandomInstance", * }, * }, * }, * targets: { * oneRandomInstance: { * resourceTags: { * env: "prod", * }, * resourceType: "aws:ec2:instance", * selectionMode: "COUNT(1)", * }, * }, * stopConditions: [{ * source: "none", * }], * tags: { * name: "fisStopInstances", * }, * roleArn: fisRole.arn, * }); * * ``` */ class ExperimentTemplate extends pulumi.CustomResource { /** * Get an existing ExperimentTemplate 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 opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, opts) { return new ExperimentTemplate(name, undefined, { ...opts, id: id }); } /** * Returns true if the given object is an instance of ExperimentTemplate. 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'] === ExperimentTemplate.__pulumiType; } /** * Create a ExperimentTemplate 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, args, opts) { let resourceInputs = {}; opts = opts || {}; if (!opts.id) { if (args?.description === undefined && !opts.urn) { throw new Error("Missing required property 'description'"); } if (args?.roleArn === undefined && !opts.urn) { throw new Error("Missing required property 'roleArn'"); } if (args?.stopConditions === undefined && !opts.urn) { throw new Error("Missing required property 'stopConditions'"); } if (args?.targets === undefined && !opts.urn) { throw new Error("Missing required property 'targets'"); } resourceInputs["actions"] = args?.actions; resourceInputs["description"] = args?.description; resourceInputs["experimentOptions"] = args?.experimentOptions; resourceInputs["experimentReportConfiguration"] = args?.experimentReportConfiguration; resourceInputs["logConfiguration"] = args?.logConfiguration; resourceInputs["roleArn"] = args?.roleArn; resourceInputs["stopConditions"] = args?.stopConditions; resourceInputs["tags"] = args?.tags; resourceInputs["targets"] = args?.targets; resourceInputs["awsId"] = undefined /*out*/; } else { resourceInputs["actions"] = undefined /*out*/; resourceInputs["awsId"] = undefined /*out*/; resourceInputs["description"] = undefined /*out*/; resourceInputs["experimentOptions"] = undefined /*out*/; resourceInputs["experimentReportConfiguration"] = undefined /*out*/; resourceInputs["logConfiguration"] = undefined /*out*/; resourceInputs["roleArn"] = undefined /*out*/; resourceInputs["stopConditions"] = undefined /*out*/; resourceInputs["tags"] = undefined /*out*/; resourceInputs["targets"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const replaceOnChanges = { replaceOnChanges: ["experimentOptions.accountTargeting"] }; opts = pulumi.mergeOptions(opts, replaceOnChanges); super(ExperimentTemplate.__pulumiType, name, resourceInputs, opts); } } exports.ExperimentTemplate = ExperimentTemplate; /** @internal */ ExperimentTemplate.__pulumiType = 'aws-native:fis:ExperimentTemplate'; //# sourceMappingURL=experimentTemplate.js.map