
com.pulumi.aws.s3.BucketServerSideEncryptionConfigurationV2 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.
// *** 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.s3;
import com.pulumi.aws.Utilities;
import com.pulumi.aws.s3.BucketServerSideEncryptionConfigurationV2Args;
import com.pulumi.aws.s3.inputs.BucketServerSideEncryptionConfigurationV2State;
import com.pulumi.aws.s3.outputs.BucketServerSideEncryptionConfigurationV2Rule;
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.List;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Provides a S3 bucket server-side encryption configuration resource.
*
* > **NOTE:** Destroying an `aws.s3.BucketServerSideEncryptionConfigurationV2` resource resets the bucket to [Amazon S3 bucket default encryption](https://docs.aws.amazon.com/AmazonS3/latest/userguide/default-encryption-faq.html).
*
* ## 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.kms.Key;
* import com.pulumi.aws.kms.KeyArgs;
* import com.pulumi.aws.s3.BucketV2;
* import com.pulumi.aws.s3.BucketV2Args;
* import com.pulumi.aws.s3.BucketServerSideEncryptionConfigurationV2;
* import com.pulumi.aws.s3.BucketServerSideEncryptionConfigurationV2Args;
* import com.pulumi.aws.s3.inputs.BucketServerSideEncryptionConfigurationV2RuleArgs;
* import com.pulumi.aws.s3.inputs.BucketServerSideEncryptionConfigurationV2RuleApplyServerSideEncryptionByDefaultArgs;
* 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 mykey = new Key("mykey", KeyArgs.builder()
* .description("This key is used to encrypt bucket objects")
* .deletionWindowInDays(10)
* .build());
*
* var mybucket = new BucketV2("mybucket", BucketV2Args.builder()
* .bucket("mybucket")
* .build());
*
* var example = new BucketServerSideEncryptionConfigurationV2("example", BucketServerSideEncryptionConfigurationV2Args.builder()
* .bucket(mybucket.id())
* .rules(BucketServerSideEncryptionConfigurationV2RuleArgs.builder()
* .applyServerSideEncryptionByDefault(BucketServerSideEncryptionConfigurationV2RuleApplyServerSideEncryptionByDefaultArgs.builder()
* .kmsMasterKeyId(mykey.arn())
* .sseAlgorithm("aws:kms")
* .build())
* .build())
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, import using the `bucket` and `expected_bucket_owner` separated by a comma (`,`):
*
* __Using `pulumi import` to import__ S3 bucket server-side encryption configuration using the `bucket` or using the `bucket` and `expected_bucket_owner` separated by a comma (`,`). For example:
*
* If the owner (account ID) of the source bucket is the same account used to configure the AWS Provider, import using the `bucket`:
*
* ```sh
* $ pulumi import aws:s3/bucketServerSideEncryptionConfigurationV2:BucketServerSideEncryptionConfigurationV2 example bucket-name
* ```
* If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, import using the `bucket` and `expected_bucket_owner` separated by a comma (`,`):
*
* ```sh
* $ pulumi import aws:s3/bucketServerSideEncryptionConfigurationV2:BucketServerSideEncryptionConfigurationV2 example bucket-name,123456789012
* ```
*
*/
@ResourceType(type="aws:s3/bucketServerSideEncryptionConfigurationV2:BucketServerSideEncryptionConfigurationV2")
public class BucketServerSideEncryptionConfigurationV2 extends com.pulumi.resources.CustomResource {
/**
* ID (name) of the bucket.
*
*/
@Export(name="bucket", refs={String.class}, tree="[0]")
private Output bucket;
/**
* @return ID (name) of the bucket.
*
*/
public Output bucket() {
return this.bucket;
}
/**
* Account ID of the expected bucket owner.
*
*/
@Export(name="expectedBucketOwner", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> expectedBucketOwner;
/**
* @return Account ID of the expected bucket owner.
*
*/
public Output> expectedBucketOwner() {
return Codegen.optional(this.expectedBucketOwner);
}
/**
* Set of server-side encryption configuration rules. See below. Currently, only a single rule is supported.
*
*/
@Export(name="rules", refs={List.class,BucketServerSideEncryptionConfigurationV2Rule.class}, tree="[0,1]")
private Output> rules;
/**
* @return Set of server-side encryption configuration rules. See below. Currently, only a single rule is supported.
*
*/
public Output> rules() {
return this.rules;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public BucketServerSideEncryptionConfigurationV2(java.lang.String name) {
this(name, BucketServerSideEncryptionConfigurationV2Args.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public BucketServerSideEncryptionConfigurationV2(java.lang.String name, BucketServerSideEncryptionConfigurationV2Args 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 BucketServerSideEncryptionConfigurationV2(java.lang.String name, BucketServerSideEncryptionConfigurationV2Args args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("aws:s3/bucketServerSideEncryptionConfigurationV2:BucketServerSideEncryptionConfigurationV2", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private BucketServerSideEncryptionConfigurationV2(java.lang.String name, Output id, @Nullable BucketServerSideEncryptionConfigurationV2State state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("aws:s3/bucketServerSideEncryptionConfigurationV2:BucketServerSideEncryptionConfigurationV2", name, state, makeResourceOptions(options, id), false);
}
private static BucketServerSideEncryptionConfigurationV2Args makeArgs(BucketServerSideEncryptionConfigurationV2Args args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? BucketServerSideEncryptionConfigurationV2Args.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 BucketServerSideEncryptionConfigurationV2 get(java.lang.String name, Output id, @Nullable BucketServerSideEncryptionConfigurationV2State state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new BucketServerSideEncryptionConfigurationV2(name, id, state, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy