/
pullThroughCacheRule.go
304 lines (254 loc) · 12.1 KB
/
pullThroughCacheRule.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package ecr
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides an Elastic Container Registry Pull Through Cache Rule.
//
// More information about pull through cache rules, including the set of supported
// upstream repositories, see [Using pull through cache rules](https://docs.aws.amazon.com/AmazonECR/latest/userguide/pull-through-cache.html).
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecr"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ecr.NewPullThroughCacheRule(ctx, "example", &ecr.PullThroughCacheRuleArgs{
// EcrRepositoryPrefix: pulumi.String("ecr-public"),
// UpstreamRegistryUrl: pulumi.String("public.ecr.aws"),
// CredentialArn: pulumi.String("arn:aws:secretsmanager:us-east-1:123456789:secret:ecr-pullthroughcache/ecrpublic"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Using `pulumi import`, import a pull-through cache rule using the `ecr_repository_prefix`. For example:
//
// ```sh
// $ pulumi import aws:ecr/pullThroughCacheRule:PullThroughCacheRule example ecr-public
// ```
type PullThroughCacheRule struct {
pulumi.CustomResourceState
// ARN of the Secret which will be used to authenticate against the registry.
CredentialArn pulumi.StringPtrOutput `pulumi:"credentialArn"`
// The repository name prefix to use when caching images from the source registry.
EcrRepositoryPrefix pulumi.StringOutput `pulumi:"ecrRepositoryPrefix"`
// The registry ID where the repository was created.
RegistryId pulumi.StringOutput `pulumi:"registryId"`
// The registry URL of the upstream public registry to use as the source.
UpstreamRegistryUrl pulumi.StringOutput `pulumi:"upstreamRegistryUrl"`
}
// NewPullThroughCacheRule registers a new resource with the given unique name, arguments, and options.
func NewPullThroughCacheRule(ctx *pulumi.Context,
name string, args *PullThroughCacheRuleArgs, opts ...pulumi.ResourceOption) (*PullThroughCacheRule, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.EcrRepositoryPrefix == nil {
return nil, errors.New("invalid value for required argument 'EcrRepositoryPrefix'")
}
if args.UpstreamRegistryUrl == nil {
return nil, errors.New("invalid value for required argument 'UpstreamRegistryUrl'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource PullThroughCacheRule
err := ctx.RegisterResource("aws:ecr/pullThroughCacheRule:PullThroughCacheRule", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetPullThroughCacheRule gets an existing PullThroughCacheRule resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetPullThroughCacheRule(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *PullThroughCacheRuleState, opts ...pulumi.ResourceOption) (*PullThroughCacheRule, error) {
var resource PullThroughCacheRule
err := ctx.ReadResource("aws:ecr/pullThroughCacheRule:PullThroughCacheRule", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering PullThroughCacheRule resources.
type pullThroughCacheRuleState struct {
// ARN of the Secret which will be used to authenticate against the registry.
CredentialArn *string `pulumi:"credentialArn"`
// The repository name prefix to use when caching images from the source registry.
EcrRepositoryPrefix *string `pulumi:"ecrRepositoryPrefix"`
// The registry ID where the repository was created.
RegistryId *string `pulumi:"registryId"`
// The registry URL of the upstream public registry to use as the source.
UpstreamRegistryUrl *string `pulumi:"upstreamRegistryUrl"`
}
type PullThroughCacheRuleState struct {
// ARN of the Secret which will be used to authenticate against the registry.
CredentialArn pulumi.StringPtrInput
// The repository name prefix to use when caching images from the source registry.
EcrRepositoryPrefix pulumi.StringPtrInput
// The registry ID where the repository was created.
RegistryId pulumi.StringPtrInput
// The registry URL of the upstream public registry to use as the source.
UpstreamRegistryUrl pulumi.StringPtrInput
}
func (PullThroughCacheRuleState) ElementType() reflect.Type {
return reflect.TypeOf((*pullThroughCacheRuleState)(nil)).Elem()
}
type pullThroughCacheRuleArgs struct {
// ARN of the Secret which will be used to authenticate against the registry.
CredentialArn *string `pulumi:"credentialArn"`
// The repository name prefix to use when caching images from the source registry.
EcrRepositoryPrefix string `pulumi:"ecrRepositoryPrefix"`
// The registry URL of the upstream public registry to use as the source.
UpstreamRegistryUrl string `pulumi:"upstreamRegistryUrl"`
}
// The set of arguments for constructing a PullThroughCacheRule resource.
type PullThroughCacheRuleArgs struct {
// ARN of the Secret which will be used to authenticate against the registry.
CredentialArn pulumi.StringPtrInput
// The repository name prefix to use when caching images from the source registry.
EcrRepositoryPrefix pulumi.StringInput
// The registry URL of the upstream public registry to use as the source.
UpstreamRegistryUrl pulumi.StringInput
}
func (PullThroughCacheRuleArgs) ElementType() reflect.Type {
return reflect.TypeOf((*pullThroughCacheRuleArgs)(nil)).Elem()
}
type PullThroughCacheRuleInput interface {
pulumi.Input
ToPullThroughCacheRuleOutput() PullThroughCacheRuleOutput
ToPullThroughCacheRuleOutputWithContext(ctx context.Context) PullThroughCacheRuleOutput
}
func (*PullThroughCacheRule) ElementType() reflect.Type {
return reflect.TypeOf((**PullThroughCacheRule)(nil)).Elem()
}
func (i *PullThroughCacheRule) ToPullThroughCacheRuleOutput() PullThroughCacheRuleOutput {
return i.ToPullThroughCacheRuleOutputWithContext(context.Background())
}
func (i *PullThroughCacheRule) ToPullThroughCacheRuleOutputWithContext(ctx context.Context) PullThroughCacheRuleOutput {
return pulumi.ToOutputWithContext(ctx, i).(PullThroughCacheRuleOutput)
}
// PullThroughCacheRuleArrayInput is an input type that accepts PullThroughCacheRuleArray and PullThroughCacheRuleArrayOutput values.
// You can construct a concrete instance of `PullThroughCacheRuleArrayInput` via:
//
// PullThroughCacheRuleArray{ PullThroughCacheRuleArgs{...} }
type PullThroughCacheRuleArrayInput interface {
pulumi.Input
ToPullThroughCacheRuleArrayOutput() PullThroughCacheRuleArrayOutput
ToPullThroughCacheRuleArrayOutputWithContext(context.Context) PullThroughCacheRuleArrayOutput
}
type PullThroughCacheRuleArray []PullThroughCacheRuleInput
func (PullThroughCacheRuleArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*PullThroughCacheRule)(nil)).Elem()
}
func (i PullThroughCacheRuleArray) ToPullThroughCacheRuleArrayOutput() PullThroughCacheRuleArrayOutput {
return i.ToPullThroughCacheRuleArrayOutputWithContext(context.Background())
}
func (i PullThroughCacheRuleArray) ToPullThroughCacheRuleArrayOutputWithContext(ctx context.Context) PullThroughCacheRuleArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(PullThroughCacheRuleArrayOutput)
}
// PullThroughCacheRuleMapInput is an input type that accepts PullThroughCacheRuleMap and PullThroughCacheRuleMapOutput values.
// You can construct a concrete instance of `PullThroughCacheRuleMapInput` via:
//
// PullThroughCacheRuleMap{ "key": PullThroughCacheRuleArgs{...} }
type PullThroughCacheRuleMapInput interface {
pulumi.Input
ToPullThroughCacheRuleMapOutput() PullThroughCacheRuleMapOutput
ToPullThroughCacheRuleMapOutputWithContext(context.Context) PullThroughCacheRuleMapOutput
}
type PullThroughCacheRuleMap map[string]PullThroughCacheRuleInput
func (PullThroughCacheRuleMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*PullThroughCacheRule)(nil)).Elem()
}
func (i PullThroughCacheRuleMap) ToPullThroughCacheRuleMapOutput() PullThroughCacheRuleMapOutput {
return i.ToPullThroughCacheRuleMapOutputWithContext(context.Background())
}
func (i PullThroughCacheRuleMap) ToPullThroughCacheRuleMapOutputWithContext(ctx context.Context) PullThroughCacheRuleMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(PullThroughCacheRuleMapOutput)
}
type PullThroughCacheRuleOutput struct{ *pulumi.OutputState }
func (PullThroughCacheRuleOutput) ElementType() reflect.Type {
return reflect.TypeOf((**PullThroughCacheRule)(nil)).Elem()
}
func (o PullThroughCacheRuleOutput) ToPullThroughCacheRuleOutput() PullThroughCacheRuleOutput {
return o
}
func (o PullThroughCacheRuleOutput) ToPullThroughCacheRuleOutputWithContext(ctx context.Context) PullThroughCacheRuleOutput {
return o
}
// ARN of the Secret which will be used to authenticate against the registry.
func (o PullThroughCacheRuleOutput) CredentialArn() pulumi.StringPtrOutput {
return o.ApplyT(func(v *PullThroughCacheRule) pulumi.StringPtrOutput { return v.CredentialArn }).(pulumi.StringPtrOutput)
}
// The repository name prefix to use when caching images from the source registry.
func (o PullThroughCacheRuleOutput) EcrRepositoryPrefix() pulumi.StringOutput {
return o.ApplyT(func(v *PullThroughCacheRule) pulumi.StringOutput { return v.EcrRepositoryPrefix }).(pulumi.StringOutput)
}
// The registry ID where the repository was created.
func (o PullThroughCacheRuleOutput) RegistryId() pulumi.StringOutput {
return o.ApplyT(func(v *PullThroughCacheRule) pulumi.StringOutput { return v.RegistryId }).(pulumi.StringOutput)
}
// The registry URL of the upstream public registry to use as the source.
func (o PullThroughCacheRuleOutput) UpstreamRegistryUrl() pulumi.StringOutput {
return o.ApplyT(func(v *PullThroughCacheRule) pulumi.StringOutput { return v.UpstreamRegistryUrl }).(pulumi.StringOutput)
}
type PullThroughCacheRuleArrayOutput struct{ *pulumi.OutputState }
func (PullThroughCacheRuleArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*PullThroughCacheRule)(nil)).Elem()
}
func (o PullThroughCacheRuleArrayOutput) ToPullThroughCacheRuleArrayOutput() PullThroughCacheRuleArrayOutput {
return o
}
func (o PullThroughCacheRuleArrayOutput) ToPullThroughCacheRuleArrayOutputWithContext(ctx context.Context) PullThroughCacheRuleArrayOutput {
return o
}
func (o PullThroughCacheRuleArrayOutput) Index(i pulumi.IntInput) PullThroughCacheRuleOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *PullThroughCacheRule {
return vs[0].([]*PullThroughCacheRule)[vs[1].(int)]
}).(PullThroughCacheRuleOutput)
}
type PullThroughCacheRuleMapOutput struct{ *pulumi.OutputState }
func (PullThroughCacheRuleMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*PullThroughCacheRule)(nil)).Elem()
}
func (o PullThroughCacheRuleMapOutput) ToPullThroughCacheRuleMapOutput() PullThroughCacheRuleMapOutput {
return o
}
func (o PullThroughCacheRuleMapOutput) ToPullThroughCacheRuleMapOutputWithContext(ctx context.Context) PullThroughCacheRuleMapOutput {
return o
}
func (o PullThroughCacheRuleMapOutput) MapIndex(k pulumi.StringInput) PullThroughCacheRuleOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *PullThroughCacheRule {
return vs[0].(map[string]*PullThroughCacheRule)[vs[1].(string)]
}).(PullThroughCacheRuleOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*PullThroughCacheRuleInput)(nil)).Elem(), &PullThroughCacheRule{})
pulumi.RegisterInputType(reflect.TypeOf((*PullThroughCacheRuleArrayInput)(nil)).Elem(), PullThroughCacheRuleArray{})
pulumi.RegisterInputType(reflect.TypeOf((*PullThroughCacheRuleMapInput)(nil)).Elem(), PullThroughCacheRuleMap{})
pulumi.RegisterOutputType(PullThroughCacheRuleOutput{})
pulumi.RegisterOutputType(PullThroughCacheRuleArrayOutput{})
pulumi.RegisterOutputType(PullThroughCacheRuleMapOutput{})
}