All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.alicloud.cfg.Remediation Maven / Gradle / Ivy

There is a newer version: 3.63.0-alpha.1727424957
Show newest version
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.alicloud.cfg;

import com.pulumi.alicloud.Utilities;
import com.pulumi.alicloud.cfg.RemediationArgs;
import com.pulumi.alicloud.cfg.inputs.RemediationState;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.String;
import javax.annotation.Nullable;

/**
 * Provides a Config Remediation resource.
 * 
 * For information about Config Remediation and how to use it, see [What is Remediation](https://www.alibabacloud.com/help/en/cloud-config/latest/api-config-2020-09-07-createremediation).
 * 
 * > **NOTE:** Available since v1.204.0.
 * 
 * ## Example Usage
 * 
 * Basic Usage
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.alicloud.AlicloudFunctions;
 * import com.pulumi.alicloud.inputs.GetRegionsArgs;
 * import com.pulumi.random.integer;
 * import com.pulumi.random.IntegerArgs;
 * import com.pulumi.alicloud.oss.Bucket;
 * import com.pulumi.alicloud.oss.BucketArgs;
 * import com.pulumi.alicloud.oss.BucketAcl;
 * import com.pulumi.alicloud.oss.BucketAclArgs;
 * import com.pulumi.alicloud.cfg.Rule;
 * import com.pulumi.alicloud.cfg.RuleArgs;
 * import com.pulumi.alicloud.cfg.Remediation;
 * import com.pulumi.alicloud.cfg.RemediationArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * 
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 * 
 *     public static void stack(Context ctx) {
 *         final var config = ctx.config();
 *         final var name = config.get("name").orElse("tf-example-oss");
 *         final var default = AlicloudFunctions.getRegions(GetRegionsArgs.builder()
 *             .current(true)
 *             .build());
 * 
 *         var defaultInteger = new Integer("defaultInteger", IntegerArgs.builder()
 *             .min(10000)
 *             .max(99999)
 *             .build());
 * 
 *         var defaultBucket = new Bucket("defaultBucket", BucketArgs.builder()
 *             .bucket(String.format("%s-%s", name,defaultInteger.result()))
 *             .tags(Map.of("For", "example"))
 *             .build());
 * 
 *         var nameBucketAcl = new BucketAcl("nameBucketAcl", BucketAclArgs.builder()
 *             .bucket(defaultBucket.bucket())
 *             .acl("public-read")
 *             .build());
 * 
 *         var defaultRule = new Rule("defaultRule", RuleArgs.builder()
 *             .description("If the ACL policy of the OSS bucket denies read access from the Internet, the configuration is considered compliant.")
 *             .sourceOwner("ALIYUN")
 *             .sourceIdentifier("oss-bucket-public-read-prohibited")
 *             .riskLevel(1)
 *             .tagKeyScope("For")
 *             .tagValueScope("example")
 *             .regionIdsScope(default_.regions()[0].id())
 *             .configRuleTriggerTypes("ConfigurationItemChangeNotification")
 *             .resourceTypesScopes("ACS::OSS::Bucket")
 *             .ruleName("oss-bucket-public-read-prohibited")
 *             .build());
 * 
 *         var defaultRemediation = new Remediation("defaultRemediation", RemediationArgs.builder()
 *             .configRuleId(defaultRule.configRuleId())
 *             .remediationTemplateId("ACS-OSS-PutBucketAcl")
 *             .remediationSourceType("ALIYUN")
 *             .invokeType("MANUAL_EXECUTION")
 *             .params(defaultBucket.bucket().applyValue(bucket -> String.format("{{\"bucketName\": \"%s\", \"regionId\": \"%s\", \"permissionName\": \"private\"}}", bucket,default_.regions()[0].id())))
 *             .remediationType("OOS")
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * Config Remediation can be imported using the id, e.g. * * ```sh * $ pulumi import alicloud:cfg/remediation:Remediation example <id> * ``` * */ @ResourceType(type="alicloud:cfg/remediation:Remediation") public class Remediation extends com.pulumi.resources.CustomResource { /** * Rule ID. * */ @Export(name="configRuleId", refs={String.class}, tree="[0]") private Output configRuleId; /** * @return Rule ID. * */ public Output configRuleId() { return this.configRuleId; } /** * Execution type, valid values: `Manual`, `Automatic`. * */ @Export(name="invokeType", refs={String.class}, tree="[0]") private Output invokeType; /** * @return Execution type, valid values: `Manual`, `Automatic`. * */ public Output invokeType() { return this.invokeType; } /** * Remediation parameter. * */ @Export(name="params", refs={String.class}, tree="[0]") private Output params; /** * @return Remediation parameter. * */ public Output params() { return this.params; } /** * Remediation ID. * */ @Export(name="remediationId", refs={String.class}, tree="[0]") private Output remediationId; /** * @return Remediation ID. * */ public Output remediationId() { return this.remediationId; } /** * Remediation resource type, valid values: `ALIYUN` , `CUSTOMER`. * */ @Export(name="remediationSourceType", refs={String.class}, tree="[0]") private Output remediationSourceType; /** * @return Remediation resource type, valid values: `ALIYUN` , `CUSTOMER`. * */ public Output remediationSourceType() { return this.remediationSourceType; } /** * Remediation template ID. * */ @Export(name="remediationTemplateId", refs={String.class}, tree="[0]") private Output remediationTemplateId; /** * @return Remediation template ID. * */ public Output remediationTemplateId() { return this.remediationTemplateId; } /** * Remediation type, valid values: `OOS`, `FC`. * * The following arguments will be discarded. Please use new fields as soon as possible: * */ @Export(name="remediationType", refs={String.class}, tree="[0]") private Output remediationType; /** * @return Remediation type, valid values: `OOS`, `FC`. * * The following arguments will be discarded. Please use new fields as soon as possible: * */ public Output remediationType() { return this.remediationType; } /** * * @param name The _unique_ name of the resulting resource. */ public Remediation(java.lang.String name) { this(name, RemediationArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public Remediation(java.lang.String name, RemediationArgs args) { this(name, args, null); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. * @param options A bag of options that control this resource's behavior. */ public Remediation(java.lang.String name, RemediationArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("alicloud:cfg/remediation:Remediation", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private Remediation(java.lang.String name, Output id, @Nullable RemediationState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("alicloud:cfg/remediation:Remediation", name, state, makeResourceOptions(options, id), false); } private static RemediationArgs makeArgs(RemediationArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? RemediationArgs.Empty : args; } private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() .version(Utilities.getVersion()) .build(); return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); } /** * Get an existing Host 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 * @param options Optional settings to control the behavior of the CustomResource. */ public static Remediation get(java.lang.String name, Output id, @Nullable RemediationState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new Remediation(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy