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

com.pulumi.aws.cfg.RecorderStatus Maven / Gradle / Ivy

Go to download

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

There is a newer version: 6.60.0-alpha.1731982519
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.aws.cfg;

import com.pulumi.aws.Utilities;
import com.pulumi.aws.cfg.RecorderStatusArgs;
import com.pulumi.aws.cfg.inputs.RecorderStatusState;
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.Boolean;
import java.lang.String;
import javax.annotation.Nullable;

/**
 * Manages status (recording / stopped) of an AWS Config Configuration Recorder.
 * 
 * > **Note:** Starting Configuration Recorder requires a Delivery Channel to be present. Use of `depends_on` (as shown below) is recommended to avoid race conditions.
 * 
 * ## Example Usage
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.s3.BucketV2;
 * import com.pulumi.aws.s3.BucketV2Args;
 * import com.pulumi.aws.cfg.DeliveryChannel;
 * import com.pulumi.aws.cfg.DeliveryChannelArgs;
 * import com.pulumi.aws.iam.IamFunctions;
 * import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
 * import com.pulumi.aws.iam.Role;
 * import com.pulumi.aws.iam.RoleArgs;
 * import com.pulumi.aws.cfg.Recorder;
 * import com.pulumi.aws.cfg.RecorderArgs;
 * import com.pulumi.aws.cfg.RecorderStatus;
 * import com.pulumi.aws.cfg.RecorderStatusArgs;
 * import com.pulumi.aws.iam.RolePolicyAttachment;
 * import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
 * import com.pulumi.aws.iam.RolePolicy;
 * import com.pulumi.aws.iam.RolePolicyArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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) {
 *         var b = new BucketV2("b", BucketV2Args.builder()
 *             .bucket("awsconfig-example")
 *             .build());
 * 
 *         var fooDeliveryChannel = new DeliveryChannel("fooDeliveryChannel", DeliveryChannelArgs.builder()
 *             .name("example")
 *             .s3BucketName(b.bucket())
 *             .build());
 * 
 *         final var assumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
 *             .statements(GetPolicyDocumentStatementArgs.builder()
 *                 .effect("Allow")
 *                 .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
 *                     .type("Service")
 *                     .identifiers("config.amazonaws.com")
 *                     .build())
 *                 .actions("sts:AssumeRole")
 *                 .build())
 *             .build());
 * 
 *         var r = new Role("r", RoleArgs.builder()
 *             .name("example-awsconfig")
 *             .assumeRolePolicy(assumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
 *             .build());
 * 
 *         var fooRecorder = new Recorder("fooRecorder", RecorderArgs.builder()
 *             .name("example")
 *             .roleArn(r.arn())
 *             .build());
 * 
 *         var foo = new RecorderStatus("foo", RecorderStatusArgs.builder()
 *             .name(fooRecorder.name())
 *             .isEnabled(true)
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(fooDeliveryChannel)
 *                 .build());
 * 
 *         var a = new RolePolicyAttachment("a", RolePolicyAttachmentArgs.builder()
 *             .role(r.name())
 *             .policyArn("arn:aws:iam::aws:policy/service-role/AWS_ConfigRole")
 *             .build());
 * 
 *         final var p = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
 *             .statements(GetPolicyDocumentStatementArgs.builder()
 *                 .effect("Allow")
 *                 .actions("s3:*")
 *                 .resources(                
 *                     b.arn(),
 *                     b.arn().applyValue(arn -> String.format("%s/*", arn)))
 *                 .build())
 *             .build());
 * 
 *         var pRolePolicy = new RolePolicy("pRolePolicy", RolePolicyArgs.builder()
 *             .name("awsconfig-example")
 *             .role(r.id())
 *             .policy(p.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(p -> p.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * Using `pulumi import`, import Configuration Recorder Status using the name of the Configuration Recorder. For example: * * ```sh * $ pulumi import aws:cfg/recorderStatus:RecorderStatus foo example * ``` * */ @ResourceType(type="aws:cfg/recorderStatus:RecorderStatus") public class RecorderStatus extends com.pulumi.resources.CustomResource { /** * Whether the configuration recorder should be enabled or disabled. * */ @Export(name="isEnabled", refs={Boolean.class}, tree="[0]") private Output isEnabled; /** * @return Whether the configuration recorder should be enabled or disabled. * */ public Output isEnabled() { return this.isEnabled; } /** * The name of the recorder * */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return The name of the recorder * */ public Output name() { return this.name; } /** * * @param name The _unique_ name of the resulting resource. */ public RecorderStatus(java.lang.String name) { this(name, RecorderStatusArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public RecorderStatus(java.lang.String name, RecorderStatusArgs 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 RecorderStatus(java.lang.String name, RecorderStatusArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("aws:cfg/recorderStatus:RecorderStatus", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private RecorderStatus(java.lang.String name, Output id, @Nullable RecorderStatusState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("aws:cfg/recorderStatus:RecorderStatus", name, state, makeResourceOptions(options, id), false); } private static RecorderStatusArgs makeArgs(RecorderStatusArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? RecorderStatusArgs.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 RecorderStatus get(java.lang.String name, Output id, @Nullable RecorderStatusState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new RecorderStatus(name, id, state, options); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy