Package com.pulumi.aws.cloudfront
Class CachePolicy
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.cloudfront.CachePolicy
-
public class CachePolicy extends com.pulumi.resources.CustomResource## Example Usage Use the `aws.cloudfront.CachePolicy` resource to create a cache policy for CloudFront.
## Import Using `pulumi import`, import CloudFront cache policies using the `id` of the cache policy. For example: ```sh $ pulumi import aws:cloudfront/cachePolicy:CachePolicy policy 658327ea-f89d-4fab-a63d-7e88639e58f6 ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.cloudfront.CachePolicy; import com.pulumi.aws.cloudfront.CachePolicyArgs; import com.pulumi.aws.cloudfront.inputs.CachePolicyParametersInCacheKeyAndForwardedToOriginArgs; import com.pulumi.aws.cloudfront.inputs.CachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfigArgs; import com.pulumi.aws.cloudfront.inputs.CachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfigCookiesArgs; import com.pulumi.aws.cloudfront.inputs.CachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfigArgs; import com.pulumi.aws.cloudfront.inputs.CachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfigHeadersArgs; import com.pulumi.aws.cloudfront.inputs.CachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfigArgs; import com.pulumi.aws.cloudfront.inputs.CachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfigQueryStringsArgs; 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) { var example = new CachePolicy("example", CachePolicyArgs.builder() .parametersInCacheKeyAndForwardedToOrigin(CachePolicyParametersInCacheKeyAndForwardedToOriginArgs.builder() .cookiesConfig(CachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfigArgs.builder() .cookies(CachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfigCookiesArgs.builder() .items("example") .build()) .cookieBehavior("whitelist") .build()) .headersConfig(CachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfigArgs.builder() .headers(CachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfigHeadersArgs.builder() .items("example") .build()) .headerBehavior("whitelist") .build()) .queryStringsConfig(CachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfigArgs.builder() .queryStrings(CachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfigQueryStringsArgs.builder() .items("example") .build()) .queryStringBehavior("whitelist") .build()) .build()) .name("example-policy") .comment("test comment") .defaultTtl(50) .maxTtl(100) .minTtl(1) .build()); } }
-
-
Constructor Summary
Constructors Constructor Description CachePolicy(java.lang.String name)CachePolicy(java.lang.String name, CachePolicyArgs args)CachePolicy(java.lang.String name, CachePolicyArgs 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()com.pulumi.core.Output<java.util.Optional<java.lang.String>>comment()com.pulumi.core.Output<java.util.Optional<java.lang.Integer>>defaultTtl()com.pulumi.core.Output<java.lang.String>etag()static CachePolicyget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, CachePolicyState 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.util.Optional<java.lang.Integer>>maxTtl()com.pulumi.core.Output<java.util.Optional<java.lang.Integer>>minTtl()com.pulumi.core.Output<java.lang.String>name()com.pulumi.core.Output<CachePolicyParametersInCacheKeyAndForwardedToOrigin>parametersInCacheKeyAndForwardedToOrigin()
-
-
-
Constructor Detail
-
CachePolicy
public CachePolicy(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
CachePolicy
public CachePolicy(java.lang.String name, CachePolicyArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
CachePolicy
public CachePolicy(java.lang.String name, CachePolicyArgs 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 cache policy ARN.
-
comment
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> comment()
- Returns:
- Description for the cache policy.
-
defaultTtl
public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> defaultTtl()
- Returns:
- Amount of time, in seconds, that objects are allowed to remain in the CloudFront cache before CloudFront sends a new request to the origin server to check if the object has been updated.
-
etag
public com.pulumi.core.Output<java.lang.String> etag()
- Returns:
- Current version of the cache policy.
-
maxTtl
public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> maxTtl()
- Returns:
- Maximum amount of time, in seconds, that objects stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.
-
minTtl
public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> minTtl()
- Returns:
- Minimum amount of time, in seconds, that objects should remain in the CloudFront cache before a new request is sent to the origin to check for updates.
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- Unique name used to identify the cache policy.
-
parametersInCacheKeyAndForwardedToOrigin
public com.pulumi.core.Output<CachePolicyParametersInCacheKeyAndForwardedToOrigin> parametersInCacheKeyAndForwardedToOrigin()
- Returns:
- Configuration for including HTTP headers, cookies, and URL query strings in the cache key. For more information, refer to the Parameters In Cache Key And Forwarded To Origin section.
-
get
public static CachePolicy get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable CachePolicyState 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.
-
-