com.pulumi.aws.oam.SinkPolicy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws Show documentation
Show all versions of aws Show documentation
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
The 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.oam;
import com.pulumi.aws.Utilities;
import com.pulumi.aws.oam.SinkPolicyArgs;
import com.pulumi.aws.oam.inputs.SinkPolicyState;
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;
/**
* Resource for managing an AWS CloudWatch Observability Access Manager Sink Policy.
*
* ## 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.aws.oam.Sink;
* import com.pulumi.aws.oam.SinkArgs;
* import com.pulumi.aws.oam.SinkPolicy;
* import com.pulumi.aws.oam.SinkPolicyArgs;
* 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 example = new Sink("example", SinkArgs.builder()
* .name("ExampleSink")
* .build());
*
* var exampleSinkPolicy = new SinkPolicy("exampleSinkPolicy", SinkPolicyArgs.builder()
* .sinkIdentifier(example.id())
* .policy(serializeJson(
* jsonObject(
* jsonProperty("Version", "2012-10-17"),
* jsonProperty("Statement", jsonArray(jsonObject(
* jsonProperty("Action", jsonArray(
* "oam:CreateLink",
* "oam:UpdateLink"
* )),
* jsonProperty("Effect", "Allow"),
* jsonProperty("Resource", "*"),
* jsonProperty("Principal", jsonObject(
* jsonProperty("AWS", jsonArray(
* "1111111111111",
* "222222222222"
* ))
* )),
* jsonProperty("Condition", jsonObject(
* jsonProperty("ForAllValues:StringEquals", jsonObject(
* jsonProperty("oam:ResourceTypes", jsonArray(
* "AWS::CloudWatch::Metric",
* "AWS::Logs::LogGroup"
* ))
* ))
* ))
* )))
* )))
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Using `pulumi import`, import CloudWatch Observability Access Manager Sink Policy using the `sink_identifier`. For example:
*
* ```sh
* $ pulumi import aws:oam/sinkPolicy:SinkPolicy example arn:aws:oam:us-west-2:123456789012:sink/sink-id
* ```
*
*/
@ResourceType(type="aws:oam/sinkPolicy:SinkPolicy")
public class SinkPolicy extends com.pulumi.resources.CustomResource {
/**
* ARN of the Sink.
*
*/
@Export(name="arn", refs={String.class}, tree="[0]")
private Output arn;
/**
* @return ARN of the Sink.
*
*/
public Output arn() {
return this.arn;
}
/**
* JSON policy to use. If you are updating an existing policy, the entire existing policy is replaced by what you specify here.
*
*/
@Export(name="policy", refs={String.class}, tree="[0]")
private Output policy;
/**
* @return JSON policy to use. If you are updating an existing policy, the entire existing policy is replaced by what you specify here.
*
*/
public Output policy() {
return this.policy;
}
/**
* ID string that AWS generated as part of the sink ARN.
*
*/
@Export(name="sinkId", refs={String.class}, tree="[0]")
private Output sinkId;
/**
* @return ID string that AWS generated as part of the sink ARN.
*
*/
public Output sinkId() {
return this.sinkId;
}
/**
* ARN of the sink to attach this policy to.
*
*/
@Export(name="sinkIdentifier", refs={String.class}, tree="[0]")
private Output sinkIdentifier;
/**
* @return ARN of the sink to attach this policy to.
*
*/
public Output sinkIdentifier() {
return this.sinkIdentifier;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public SinkPolicy(java.lang.String name) {
this(name, SinkPolicyArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public SinkPolicy(java.lang.String name, SinkPolicyArgs 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 SinkPolicy(java.lang.String name, SinkPolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("aws:oam/sinkPolicy:SinkPolicy", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private SinkPolicy(java.lang.String name, Output id, @Nullable SinkPolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("aws:oam/sinkPolicy:SinkPolicy", name, state, makeResourceOptions(options, id), false);
}
private static SinkPolicyArgs makeArgs(SinkPolicyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? SinkPolicyArgs.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 SinkPolicy get(java.lang.String name, Output id, @Nullable SinkPolicyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new SinkPolicy(name, id, state, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy