AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.9.2 published on Friday, Jun 24, 2022 by Pulumi

getCachePolicy

Use this data source to retrieve information about a CloudFront cache policy.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var example = Output.Create(Aws.CloudFront.GetCachePolicy.InvokeAsync(new Aws.CloudFront.GetCachePolicyArgs
        {
            Name = "example-policy",
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/cloudfront"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cloudfront.LookupCachePolicy(ctx, &cloudfront.LookupCachePolicyArgs{
			Name: pulumi.StringRef("example-policy"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var example = Output.of(CloudfrontFunctions.getCachePolicy(GetCachePolicyArgs.builder()
            .name("example-policy")
            .build()));

    }
}
import pulumi
import pulumi_aws as aws

example = aws.cloudfront.get_cache_policy(name="example-policy")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = pulumi.output(aws.cloudfront.getCachePolicy({
    name: "example-policy",
}));
variables:
  example:
    Fn::Invoke:
      Function: aws:cloudfront:getCachePolicy
      Arguments:
        name: example-policy

Using getCachePolicy

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getCachePolicy(args: GetCachePolicyArgs, opts?: InvokeOptions): Promise<GetCachePolicyResult>
function getCachePolicyOutput(args: GetCachePolicyOutputArgs, opts?: InvokeOptions): Output<GetCachePolicyResult>
def get_cache_policy(id: Optional[str] = None,
                     name: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetCachePolicyResult
def get_cache_policy_output(id: Optional[pulumi.Input[str]] = None,
                     name: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetCachePolicyResult]
func LookupCachePolicy(ctx *Context, args *LookupCachePolicyArgs, opts ...InvokeOption) (*LookupCachePolicyResult, error)
func LookupCachePolicyOutput(ctx *Context, args *LookupCachePolicyOutputArgs, opts ...InvokeOption) LookupCachePolicyResultOutput

> Note: This function is named LookupCachePolicy in the Go SDK.

public static class GetCachePolicy 
{
    public static Task<GetCachePolicyResult> InvokeAsync(GetCachePolicyArgs args, InvokeOptions? opts = null)
    public static Output<GetCachePolicyResult> Invoke(GetCachePolicyInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetCachePolicyResult> getCachePolicy(GetCachePolicyArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: aws:cloudfront/getCachePolicy:getCachePolicy
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Id string

The identifier for the cache policy.

Name string

A unique name to identify the cache policy.

Id string

The identifier for the cache policy.

Name string

A unique name to identify the cache policy.

id String

The identifier for the cache policy.

name String

A unique name to identify the cache policy.

id string

The identifier for the cache policy.

name string

A unique name to identify the cache policy.

id str

The identifier for the cache policy.

name str

A unique name to identify the cache policy.

id String

The identifier for the cache policy.

name String

A unique name to identify the cache policy.

getCachePolicy Result

The following output properties are available:

Comment string

A comment to describe the cache policy.

DefaultTtl int

The default amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

Etag string

The current version of the cache policy.

MaxTtl int

The 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 int

The minimum amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

ParametersInCacheKeyAndForwardedToOrigins List<GetCachePolicyParametersInCacheKeyAndForwardedToOrigin>

The HTTP headers, cookies, and URL query strings to include in the cache key. See Parameters In Cache Key And Forwarded To Origin for more information.

Id string
Name string
Comment string

A comment to describe the cache policy.

DefaultTtl int

The default amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

Etag string

The current version of the cache policy.

MaxTtl int

The 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 int

The minimum amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

ParametersInCacheKeyAndForwardedToOrigins []GetCachePolicyParametersInCacheKeyAndForwardedToOrigin

The HTTP headers, cookies, and URL query strings to include in the cache key. See Parameters In Cache Key And Forwarded To Origin for more information.

Id string
Name string
comment String

A comment to describe the cache policy.

defaultTtl Integer

The default amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

etag String

The current version of the cache policy.

maxTtl Integer

The 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 Integer

The minimum amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

parametersInCacheKeyAndForwardedToOrigins List<GetCachePolicyParametersInCacheKeyAndForwardedToOrigin>

The HTTP headers, cookies, and URL query strings to include in the cache key. See Parameters In Cache Key And Forwarded To Origin for more information.

id String
name String
comment string

A comment to describe the cache policy.

defaultTtl number

The default amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

etag string

The current version of the cache policy.

maxTtl number

The 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 number

The minimum amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

parametersInCacheKeyAndForwardedToOrigins GetCachePolicyParametersInCacheKeyAndForwardedToOrigin[]

The HTTP headers, cookies, and URL query strings to include in the cache key. See Parameters In Cache Key And Forwarded To Origin for more information.

id string
name string
comment str

A comment to describe the cache policy.

default_ttl int

The default amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

etag str

The current version of the cache policy.

max_ttl int

The 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.

min_ttl int

The minimum amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

parameters_in_cache_key_and_forwarded_to_origins Sequence[GetCachePolicyParametersInCacheKeyAndForwardedToOrigin]

The HTTP headers, cookies, and URL query strings to include in the cache key. See Parameters In Cache Key And Forwarded To Origin for more information.

id str
name str
comment String

A comment to describe the cache policy.

defaultTtl Number

The default amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

etag String

The current version of the cache policy.

maxTtl Number

The 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 Number

The minimum amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

parametersInCacheKeyAndForwardedToOrigins List<Property Map>

The HTTP headers, cookies, and URL query strings to include in the cache key. See Parameters In Cache Key And Forwarded To Origin for more information.

id String
name String

Supporting Types

GetCachePolicyParametersInCacheKeyAndForwardedToOrigin

CookiesConfigs List<GetCachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfig>

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

EnableAcceptEncodingBrotli bool

A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.

EnableAcceptEncodingGzip bool

A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.

HeadersConfigs List<GetCachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfig>

Object that determines whether any HTTP headers (and if so, which headers) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

QueryStringsConfigs List<GetCachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfig>

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

CookiesConfigs []GetCachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfig

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

EnableAcceptEncodingBrotli bool

A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.

EnableAcceptEncodingGzip bool

A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.

HeadersConfigs []GetCachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfig

Object that determines whether any HTTP headers (and if so, which headers) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

QueryStringsConfigs []GetCachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfig

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

cookiesConfigs List<GetCachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfig>

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

enableAcceptEncodingBrotli Boolean

A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.

enableAcceptEncodingGzip Boolean

A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.

headersConfigs List<GetCachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfig>

Object that determines whether any HTTP headers (and if so, which headers) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

queryStringsConfigs List<GetCachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfig>

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

cookiesConfigs GetCachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfig[]

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

enableAcceptEncodingBrotli boolean

A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.

enableAcceptEncodingGzip boolean

A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.

headersConfigs GetCachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfig[]

Object that determines whether any HTTP headers (and if so, which headers) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

queryStringsConfigs GetCachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfig[]

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

cookies_configs Sequence[GetCachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfig]

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

enable_accept_encoding_brotli bool

A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.

enable_accept_encoding_gzip bool

A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.

headers_configs Sequence[GetCachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfig]

Object that determines whether any HTTP headers (and if so, which headers) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

query_strings_configs Sequence[GetCachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfig]

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

cookiesConfigs List<Property Map>

Object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Cookies Config for more information.

enableAcceptEncodingBrotli Boolean

A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.

enableAcceptEncodingGzip Boolean

A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.

headersConfigs List<Property Map>

Object that determines whether any HTTP headers (and if so, which headers) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Headers Config for more information.

queryStringsConfigs List<Property Map>

Object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the cache key and automatically included in requests that CloudFront sends to the origin. See Query String Config for more information.

GetCachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfig

CookieBehavior string

Determines whether any cookies in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist, allExcept, all.

Cookies List<GetCachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfigCookie>

Object that contains a list of cookie names. See Items for more information.

CookieBehavior string

Determines whether any cookies in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist, allExcept, all.

Cookies []GetCachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfigCookie

Object that contains a list of cookie names. See Items for more information.

cookieBehavior String

Determines whether any cookies in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist, allExcept, all.

cookies List<GetCachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfigCookie>

Object that contains a list of cookie names. See Items for more information.

cookieBehavior string

Determines whether any cookies in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist, allExcept, all.

cookies GetCachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfigCookie[]

Object that contains a list of cookie names. See Items for more information.

cookie_behavior str

Determines whether any cookies in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist, allExcept, all.

cookies Sequence[GetCachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfigCookie]

Object that contains a list of cookie names. See Items for more information.

cookieBehavior String

Determines whether any cookies in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist, allExcept, all.

cookies List<Property Map>

Object that contains a list of cookie names. See Items for more information.

GetCachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfigCookie

Items List<string>

A list of item names (cookies, headers, or query_strings).

Items []string

A list of item names (cookies, headers, or query_strings).

items List<String>

A list of item names (cookies, headers, or query_strings).

items string[]

A list of item names (cookies, headers, or query_strings).

items Sequence[str]

A list of item names (cookies, headers, or query_strings).

items List<String>

A list of item names (cookies, headers, or query_strings).

GetCachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfig

HeaderBehavior string

Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist.

Headers List<GetCachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfigHeader>

Object that contains a list of header names. See Items for more information.

HeaderBehavior string

Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist.

Headers []GetCachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfigHeader

Object that contains a list of header names. See Items for more information.

headerBehavior String

Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist.

headers List<GetCachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfigHeader>

Object that contains a list of header names. See Items for more information.

headerBehavior string

Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist.

headers GetCachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfigHeader[]

Object that contains a list of header names. See Items for more information.

header_behavior str

Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist.

headers Sequence[GetCachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfigHeader]

Object that contains a list of header names. See Items for more information.

headerBehavior String

Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist.

headers List<Property Map>

Object that contains a list of header names. See Items for more information.

GetCachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfigHeader

Items List<string>

A list of item names (cookies, headers, or query_strings).

Items []string

A list of item names (cookies, headers, or query_strings).

items List<String>

A list of item names (cookies, headers, or query_strings).

items string[]

A list of item names (cookies, headers, or query_strings).

items Sequence[str]

A list of item names (cookies, headers, or query_strings).

items List<String>

A list of item names (cookies, headers, or query_strings).

GetCachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfig

QueryStringBehavior string

Determines whether any URL query strings in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist, allExcept, all.

QueryStrings List<GetCachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfigQueryString>

Object that contains a list of query string names. See Items for more information.

QueryStringBehavior string

Determines whether any URL query strings in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist, allExcept, all.

QueryStrings []GetCachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfigQueryString

Object that contains a list of query string names. See Items for more information.

queryStringBehavior String

Determines whether any URL query strings in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist, allExcept, all.

queryStrings List<GetCachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfigQueryString>

Object that contains a list of query string names. See Items for more information.

queryStringBehavior string

Determines whether any URL query strings in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist, allExcept, all.

queryStrings GetCachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfigQueryString[]

Object that contains a list of query string names. See Items for more information.

query_string_behavior str

Determines whether any URL query strings in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist, allExcept, all.

query_strings Sequence[GetCachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfigQueryString]

Object that contains a list of query string names. See Items for more information.

queryStringBehavior String

Determines whether any URL query strings in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Valid values are none, whitelist, allExcept, all.

queryStrings List<Property Map>

Object that contains a list of query string names. See Items for more information.

GetCachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfigQueryString

Items List<string>

A list of item names (cookies, headers, or query_strings).

Items []string

A list of item names (cookies, headers, or query_strings).

items List<String>

A list of item names (cookies, headers, or query_strings).

items string[]

A list of item names (cookies, headers, or query_strings).

items Sequence[str]

A list of item names (cookies, headers, or query_strings).

items List<String>

A list of item names (cookies, headers, or query_strings).

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.