
com.pulumi.aws.cloudwatch.LogAccountPolicy Maven / Gradle / Ivy
// *** 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.cloudwatch;
import com.pulumi.aws.Utilities;
import com.pulumi.aws.cloudwatch.LogAccountPolicyArgs;
import com.pulumi.aws.cloudwatch.inputs.LogAccountPolicyState;
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 java.util.Optional;
import javax.annotation.Nullable;
/**
* Provides a CloudWatch Log Account Policy resource.
*
* ## Example Usage
*
* ### Account Data Protection Policy
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.cloudwatch.LogAccountPolicy;
* import com.pulumi.aws.cloudwatch.LogAccountPolicyArgs;
* import static com.pulumi.codegen.internal.Serialization.*;
* 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 dataProtection = new LogAccountPolicy("dataProtection", LogAccountPolicyArgs.builder()
* .policyName("data-protection")
* .policyType("DATA_PROTECTION_POLICY")
* .policyDocument(serializeJson(
* jsonObject(
* jsonProperty("Name", "DataProtection"),
* jsonProperty("Version", "2021-06-01"),
* jsonProperty("Statement", jsonArray(
* jsonObject(
* jsonProperty("Sid", "Audit"),
* jsonProperty("DataIdentifier", jsonArray("arn:aws:dataprotection::aws:data-identifier/EmailAddress")),
* jsonProperty("Operation", jsonObject(
* jsonProperty("Audit", jsonObject(
* jsonProperty("FindingsDestination", jsonObject(
*
* ))
* ))
* ))
* ),
* jsonObject(
* jsonProperty("Sid", "Redact"),
* jsonProperty("DataIdentifier", jsonArray("arn:aws:dataprotection::aws:data-identifier/EmailAddress")),
* jsonProperty("Operation", jsonObject(
* jsonProperty("Deidentify", jsonObject(
* jsonProperty("MaskConfig", jsonObject(
*
* ))
* ))
* ))
* )
* ))
* )))
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ### Subscription Filter Policy
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.cloudwatch.LogAccountPolicy;
* import com.pulumi.aws.cloudwatch.LogAccountPolicyArgs;
* import static com.pulumi.codegen.internal.Serialization.*;
* 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 subscriptionFilter = new LogAccountPolicy("subscriptionFilter", LogAccountPolicyArgs.builder()
* .policyName("subscription-filter")
* .policyType("SUBSCRIPTION_FILTER_POLICY")
* .policyDocument(serializeJson(
* jsonObject(
* jsonProperty("DestinationArn", test.arn()),
* jsonProperty("FilterPattern", "test")
* )))
* .selectionCriteria("LogGroupName NOT IN [\"excluded_log_group_name\"]")
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Using `pulumi import`, import this resource using the `policy_name` and `policy_type` separated by `:`. For example:
*
* ```sh
* $ pulumi import aws:cloudwatch/logAccountPolicy:LogAccountPolicy example "my-account-policy:SUBSCRIPTION_FILTER_POLICY"
* ```
*
*/
@ResourceType(type="aws:cloudwatch/logAccountPolicy:LogAccountPolicy")
public class LogAccountPolicy extends com.pulumi.resources.CustomResource {
/**
* Text of the account policy. Refer to the [AWS docs](https://docs.aws.amazon.com/cli/latest/reference/logs/put-account-policy.html) for more information.
*
*/
@Export(name="policyDocument", refs={String.class}, tree="[0]")
private Output policyDocument;
/**
* @return Text of the account policy. Refer to the [AWS docs](https://docs.aws.amazon.com/cli/latest/reference/logs/put-account-policy.html) for more information.
*
*/
public Output policyDocument() {
return this.policyDocument;
}
/**
* Name of the account policy.
*
*/
@Export(name="policyName", refs={String.class}, tree="[0]")
private Output policyName;
/**
* @return Name of the account policy.
*
*/
public Output policyName() {
return this.policyName;
}
/**
* Type of account policy. Either `DATA_PROTECTION_POLICY` or `SUBSCRIPTION_FILTER_POLICY`. You can have one account policy per type in an account.
*
*/
@Export(name="policyType", refs={String.class}, tree="[0]")
private Output policyType;
/**
* @return Type of account policy. Either `DATA_PROTECTION_POLICY` or `SUBSCRIPTION_FILTER_POLICY`. You can have one account policy per type in an account.
*
*/
public Output policyType() {
return this.policyType;
}
/**
* Currently defaults to and only accepts the value: `ALL`.
*
*/
@Export(name="scope", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> scope;
/**
* @return Currently defaults to and only accepts the value: `ALL`.
*
*/
public Output> scope() {
return Codegen.optional(this.scope);
}
/**
* Criteria for applying a subscription filter policy to a selection of log groups. The only allowable criteria selector is `LogGroupName NOT IN []`.
*
*/
@Export(name="selectionCriteria", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> selectionCriteria;
/**
* @return Criteria for applying a subscription filter policy to a selection of log groups. The only allowable criteria selector is `LogGroupName NOT IN []`.
*
*/
public Output> selectionCriteria() {
return Codegen.optional(this.selectionCriteria);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public LogAccountPolicy(java.lang.String name) {
this(name, LogAccountPolicyArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public LogAccountPolicy(java.lang.String name, LogAccountPolicyArgs 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 LogAccountPolicy(java.lang.String name, LogAccountPolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("aws:cloudwatch/logAccountPolicy:LogAccountPolicy", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private LogAccountPolicy(java.lang.String name, Output id, @Nullable LogAccountPolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("aws:cloudwatch/logAccountPolicy:LogAccountPolicy", name, state, makeResourceOptions(options, id), false);
}
private static LogAccountPolicyArgs makeArgs(LogAccountPolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? LogAccountPolicyArgs.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 LogAccountPolicy get(java.lang.String name, Output id, @Nullable LogAccountPolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new LogAccountPolicy(name, id, state, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy