Package com.pulumi.aws.shield
Class Protection
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.shield.Protection
-
public class Protection extends com.pulumi.resources.CustomResourceEnables AWS Shield Advanced for a specific AWS resource. The resource can be an Amazon CloudFront distribution, Elastic Load Balancing load balancer, AWS Global Accelerator accelerator, Elastic IP Address, or an Amazon Route 53 hosted zone. ## Example Usage ### Create protection
## Import Using `pulumi import`, import Shield protection resources using specifying their ID. For example: ```sh $ pulumi import aws:shield/protection:Protection example ff9592dc-22f3-4e88-afa1-7b29fde9669a ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.AwsFunctions; import com.pulumi.aws.inputs.GetAvailabilityZonesArgs; import com.pulumi.aws.inputs.GetRegionArgs; import com.pulumi.aws.inputs.GetCallerIdentityArgs; import com.pulumi.aws.ec2.Eip; import com.pulumi.aws.ec2.EipArgs; import com.pulumi.aws.shield.Protection; import com.pulumi.aws.shield.ProtectionArgs; import java.util.ArrayList; import java.util.Arrays; 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 available = AwsFunctions.getAvailabilityZones(GetAvailabilityZonesArgs.builder() .build()); final var current = AwsFunctions.getRegion(GetRegionArgs.builder() .build()); final var currentGetCallerIdentity = AwsFunctions.getCallerIdentity(GetCallerIdentityArgs.builder() .build()); var example = new Eip("example", EipArgs.builder() .domain("vpc") .build()); var exampleProtection = new Protection("exampleProtection", ProtectionArgs.builder() .name("example") .resourceArn(example.id().applyValue(_id -> String.format("arn:aws:ec2:%s:%s:eip-allocation/%s", current.region(),currentGetCallerIdentity.accountId(),_id))) .tags(Map.of("Environment", "Dev")) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description Protection(java.lang.String name)Protection(java.lang.String name, ProtectionArgs args)Protection(java.lang.String name, ProtectionArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>arn()static Protectionget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, ProtectionState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>name()com.pulumi.core.Output<java.lang.String>resourceArn()com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>tags()com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>>tagsAll()
-
-
-
Constructor Detail
-
Protection
public Protection(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
Protection
public Protection(java.lang.String name, ProtectionArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
Protection
public Protection(java.lang.String name, ProtectionArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
arn
public com.pulumi.core.Output<java.lang.String> arn()
- Returns:
- The ARN of the Protection.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- A friendly name for the Protection you are creating.
-
resourceArn
public com.pulumi.core.Output<java.lang.String> resourceArn()
- Returns:
- ARN of the resource to be protected.
-
tags
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> tags()
- Returns:
- Key-value map of resource tags. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
-
tagsAll
public com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>> tagsAll()
- Returns:
- A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
-
get
public static Protection get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable ProtectionState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-