Class CachePolicy


  • public class CachePolicy
    extends com.pulumi.resources.CustomResource
    ## Example Usage Use the `aws.cloudfront.CachePolicy` resource to create a cache policy for CloudFront.
     
     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());
     
         }
     }
     
     
    ## 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 ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • 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 CachePolicy get​(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()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.