/
getCachePolicy.go
150 lines (128 loc) · 6.3 KB
/
getCachePolicy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package cloudfront
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Use this data source to retrieve information about a CloudFront cache policy.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/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
// })
// }
// ```
func LookupCachePolicy(ctx *pulumi.Context, args *LookupCachePolicyArgs, opts ...pulumi.InvokeOption) (*LookupCachePolicyResult, error) {
var rv LookupCachePolicyResult
err := ctx.Invoke("aws:cloudfront/getCachePolicy:getCachePolicy", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getCachePolicy.
type LookupCachePolicyArgs struct {
// The identifier for the cache policy.
Id *string `pulumi:"id"`
// A unique name to identify the cache policy.
Name *string `pulumi:"name"`
}
// A collection of values returned by getCachePolicy.
type LookupCachePolicyResult struct {
// A comment to describe the cache policy.
Comment string `pulumi:"comment"`
// 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.
DefaultTtl int `pulumi:"defaultTtl"`
// The current version of the cache policy.
Etag string `pulumi:"etag"`
Id *string `pulumi:"id"`
// 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.
MaxTtl int `pulumi:"maxTtl"`
// 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.
MinTtl int `pulumi:"minTtl"`
Name *string `pulumi:"name"`
// 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.
ParametersInCacheKeyAndForwardedToOrigins []GetCachePolicyParametersInCacheKeyAndForwardedToOrigin `pulumi:"parametersInCacheKeyAndForwardedToOrigins"`
}
func LookupCachePolicyOutput(ctx *pulumi.Context, args LookupCachePolicyOutputArgs, opts ...pulumi.InvokeOption) LookupCachePolicyResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupCachePolicyResult, error) {
args := v.(LookupCachePolicyArgs)
r, err := LookupCachePolicy(ctx, &args, opts...)
return *r, err
}).(LookupCachePolicyResultOutput)
}
// A collection of arguments for invoking getCachePolicy.
type LookupCachePolicyOutputArgs struct {
// The identifier for the cache policy.
Id pulumi.StringPtrInput `pulumi:"id"`
// A unique name to identify the cache policy.
Name pulumi.StringPtrInput `pulumi:"name"`
}
func (LookupCachePolicyOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupCachePolicyArgs)(nil)).Elem()
}
// A collection of values returned by getCachePolicy.
type LookupCachePolicyResultOutput struct{ *pulumi.OutputState }
func (LookupCachePolicyResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupCachePolicyResult)(nil)).Elem()
}
func (o LookupCachePolicyResultOutput) ToLookupCachePolicyResultOutput() LookupCachePolicyResultOutput {
return o
}
func (o LookupCachePolicyResultOutput) ToLookupCachePolicyResultOutputWithContext(ctx context.Context) LookupCachePolicyResultOutput {
return o
}
// A comment to describe the cache policy.
func (o LookupCachePolicyResultOutput) Comment() pulumi.StringOutput {
return o.ApplyT(func(v LookupCachePolicyResult) string { return v.Comment }).(pulumi.StringOutput)
}
// 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.
func (o LookupCachePolicyResultOutput) DefaultTtl() pulumi.IntOutput {
return o.ApplyT(func(v LookupCachePolicyResult) int { return v.DefaultTtl }).(pulumi.IntOutput)
}
// The current version of the cache policy.
func (o LookupCachePolicyResultOutput) Etag() pulumi.StringOutput {
return o.ApplyT(func(v LookupCachePolicyResult) string { return v.Etag }).(pulumi.StringOutput)
}
func (o LookupCachePolicyResultOutput) Id() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupCachePolicyResult) *string { return v.Id }).(pulumi.StringPtrOutput)
}
// 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.
func (o LookupCachePolicyResultOutput) MaxTtl() pulumi.IntOutput {
return o.ApplyT(func(v LookupCachePolicyResult) int { return v.MaxTtl }).(pulumi.IntOutput)
}
// 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.
func (o LookupCachePolicyResultOutput) MinTtl() pulumi.IntOutput {
return o.ApplyT(func(v LookupCachePolicyResult) int { return v.MinTtl }).(pulumi.IntOutput)
}
func (o LookupCachePolicyResultOutput) Name() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupCachePolicyResult) *string { return v.Name }).(pulumi.StringPtrOutput)
}
// 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.
func (o LookupCachePolicyResultOutput) ParametersInCacheKeyAndForwardedToOrigins() GetCachePolicyParametersInCacheKeyAndForwardedToOriginArrayOutput {
return o.ApplyT(func(v LookupCachePolicyResult) []GetCachePolicyParametersInCacheKeyAndForwardedToOrigin {
return v.ParametersInCacheKeyAndForwardedToOrigins
}).(GetCachePolicyParametersInCacheKeyAndForwardedToOriginArrayOutput)
}
func init() {
pulumi.RegisterOutputType(LookupCachePolicyResultOutput{})
}