github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ecr/repository.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package ecr 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Provides an Elastic Container Registry Repository. 15 // 16 // ## Example Usage 17 // 18 // <!--Start PulumiCodeChooser --> 19 // ```go 20 // package main 21 // 22 // import ( 23 // 24 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecr" 25 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 26 // 27 // ) 28 // 29 // func main() { 30 // pulumi.Run(func(ctx *pulumi.Context) error { 31 // _, err := ecr.NewRepository(ctx, "foo", &ecr.RepositoryArgs{ 32 // Name: pulumi.String("bar"), 33 // ImageTagMutability: pulumi.String("MUTABLE"), 34 // ImageScanningConfiguration: &ecr.RepositoryImageScanningConfigurationArgs{ 35 // ScanOnPush: pulumi.Bool(true), 36 // }, 37 // }) 38 // if err != nil { 39 // return err 40 // } 41 // return nil 42 // }) 43 // } 44 // 45 // ``` 46 // <!--End PulumiCodeChooser --> 47 // 48 // ## Import 49 // 50 // Using `pulumi import`, import ECR Repositories using the `name`. For example: 51 // 52 // ```sh 53 // $ pulumi import aws:ecr/repository:Repository service test-service 54 // ``` 55 type Repository struct { 56 pulumi.CustomResourceState 57 58 // Full ARN of the repository. 59 Arn pulumi.StringOutput `pulumi:"arn"` 60 // Encryption configuration for the repository. See below for schema. 61 EncryptionConfigurations RepositoryEncryptionConfigurationArrayOutput `pulumi:"encryptionConfigurations"` 62 // If `true`, will delete the repository even if it contains images. 63 // Defaults to `false`. 64 ForceDelete pulumi.BoolPtrOutput `pulumi:"forceDelete"` 65 // Configuration block that defines image scanning configuration for the repository. By default, image scanning must be manually triggered. See the [ECR User Guide](https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html) for more information about image scanning. 66 ImageScanningConfiguration RepositoryImageScanningConfigurationPtrOutput `pulumi:"imageScanningConfiguration"` 67 // The tag mutability setting for the repository. Must be one of: `MUTABLE` or `IMMUTABLE`. Defaults to `MUTABLE`. 68 ImageTagMutability pulumi.StringPtrOutput `pulumi:"imageTagMutability"` 69 // Name of the repository. 70 Name pulumi.StringOutput `pulumi:"name"` 71 // The registry ID where the repository was created. 72 RegistryId pulumi.StringOutput `pulumi:"registryId"` 73 // The URL of the repository (in the form `aws_account_id.dkr.ecr.region.amazonaws.com/repositoryName`). 74 RepositoryUrl pulumi.StringOutput `pulumi:"repositoryUrl"` 75 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 76 Tags pulumi.StringMapOutput `pulumi:"tags"` 77 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 78 // 79 // Deprecated: Please use `tags` instead. 80 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 81 } 82 83 // NewRepository registers a new resource with the given unique name, arguments, and options. 84 func NewRepository(ctx *pulumi.Context, 85 name string, args *RepositoryArgs, opts ...pulumi.ResourceOption) (*Repository, error) { 86 if args == nil { 87 args = &RepositoryArgs{} 88 } 89 90 opts = internal.PkgResourceDefaultOpts(opts) 91 var resource Repository 92 err := ctx.RegisterResource("aws:ecr/repository:Repository", name, args, &resource, opts...) 93 if err != nil { 94 return nil, err 95 } 96 return &resource, nil 97 } 98 99 // GetRepository gets an existing Repository resource's state with the given name, ID, and optional 100 // state properties that are used to uniquely qualify the lookup (nil if not required). 101 func GetRepository(ctx *pulumi.Context, 102 name string, id pulumi.IDInput, state *RepositoryState, opts ...pulumi.ResourceOption) (*Repository, error) { 103 var resource Repository 104 err := ctx.ReadResource("aws:ecr/repository:Repository", name, id, state, &resource, opts...) 105 if err != nil { 106 return nil, err 107 } 108 return &resource, nil 109 } 110 111 // Input properties used for looking up and filtering Repository resources. 112 type repositoryState struct { 113 // Full ARN of the repository. 114 Arn *string `pulumi:"arn"` 115 // Encryption configuration for the repository. See below for schema. 116 EncryptionConfigurations []RepositoryEncryptionConfiguration `pulumi:"encryptionConfigurations"` 117 // If `true`, will delete the repository even if it contains images. 118 // Defaults to `false`. 119 ForceDelete *bool `pulumi:"forceDelete"` 120 // Configuration block that defines image scanning configuration for the repository. By default, image scanning must be manually triggered. See the [ECR User Guide](https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html) for more information about image scanning. 121 ImageScanningConfiguration *RepositoryImageScanningConfiguration `pulumi:"imageScanningConfiguration"` 122 // The tag mutability setting for the repository. Must be one of: `MUTABLE` or `IMMUTABLE`. Defaults to `MUTABLE`. 123 ImageTagMutability *string `pulumi:"imageTagMutability"` 124 // Name of the repository. 125 Name *string `pulumi:"name"` 126 // The registry ID where the repository was created. 127 RegistryId *string `pulumi:"registryId"` 128 // The URL of the repository (in the form `aws_account_id.dkr.ecr.region.amazonaws.com/repositoryName`). 129 RepositoryUrl *string `pulumi:"repositoryUrl"` 130 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 131 Tags map[string]string `pulumi:"tags"` 132 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 133 // 134 // Deprecated: Please use `tags` instead. 135 TagsAll map[string]string `pulumi:"tagsAll"` 136 } 137 138 type RepositoryState struct { 139 // Full ARN of the repository. 140 Arn pulumi.StringPtrInput 141 // Encryption configuration for the repository. See below for schema. 142 EncryptionConfigurations RepositoryEncryptionConfigurationArrayInput 143 // If `true`, will delete the repository even if it contains images. 144 // Defaults to `false`. 145 ForceDelete pulumi.BoolPtrInput 146 // Configuration block that defines image scanning configuration for the repository. By default, image scanning must be manually triggered. See the [ECR User Guide](https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html) for more information about image scanning. 147 ImageScanningConfiguration RepositoryImageScanningConfigurationPtrInput 148 // The tag mutability setting for the repository. Must be one of: `MUTABLE` or `IMMUTABLE`. Defaults to `MUTABLE`. 149 ImageTagMutability pulumi.StringPtrInput 150 // Name of the repository. 151 Name pulumi.StringPtrInput 152 // The registry ID where the repository was created. 153 RegistryId pulumi.StringPtrInput 154 // The URL of the repository (in the form `aws_account_id.dkr.ecr.region.amazonaws.com/repositoryName`). 155 RepositoryUrl pulumi.StringPtrInput 156 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 157 Tags pulumi.StringMapInput 158 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 159 // 160 // Deprecated: Please use `tags` instead. 161 TagsAll pulumi.StringMapInput 162 } 163 164 func (RepositoryState) ElementType() reflect.Type { 165 return reflect.TypeOf((*repositoryState)(nil)).Elem() 166 } 167 168 type repositoryArgs struct { 169 // Encryption configuration for the repository. See below for schema. 170 EncryptionConfigurations []RepositoryEncryptionConfiguration `pulumi:"encryptionConfigurations"` 171 // If `true`, will delete the repository even if it contains images. 172 // Defaults to `false`. 173 ForceDelete *bool `pulumi:"forceDelete"` 174 // Configuration block that defines image scanning configuration for the repository. By default, image scanning must be manually triggered. See the [ECR User Guide](https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html) for more information about image scanning. 175 ImageScanningConfiguration *RepositoryImageScanningConfiguration `pulumi:"imageScanningConfiguration"` 176 // The tag mutability setting for the repository. Must be one of: `MUTABLE` or `IMMUTABLE`. Defaults to `MUTABLE`. 177 ImageTagMutability *string `pulumi:"imageTagMutability"` 178 // Name of the repository. 179 Name *string `pulumi:"name"` 180 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 181 Tags map[string]string `pulumi:"tags"` 182 } 183 184 // The set of arguments for constructing a Repository resource. 185 type RepositoryArgs struct { 186 // Encryption configuration for the repository. See below for schema. 187 EncryptionConfigurations RepositoryEncryptionConfigurationArrayInput 188 // If `true`, will delete the repository even if it contains images. 189 // Defaults to `false`. 190 ForceDelete pulumi.BoolPtrInput 191 // Configuration block that defines image scanning configuration for the repository. By default, image scanning must be manually triggered. See the [ECR User Guide](https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html) for more information about image scanning. 192 ImageScanningConfiguration RepositoryImageScanningConfigurationPtrInput 193 // The tag mutability setting for the repository. Must be one of: `MUTABLE` or `IMMUTABLE`. Defaults to `MUTABLE`. 194 ImageTagMutability pulumi.StringPtrInput 195 // Name of the repository. 196 Name pulumi.StringPtrInput 197 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 198 Tags pulumi.StringMapInput 199 } 200 201 func (RepositoryArgs) ElementType() reflect.Type { 202 return reflect.TypeOf((*repositoryArgs)(nil)).Elem() 203 } 204 205 type RepositoryInput interface { 206 pulumi.Input 207 208 ToRepositoryOutput() RepositoryOutput 209 ToRepositoryOutputWithContext(ctx context.Context) RepositoryOutput 210 } 211 212 func (*Repository) ElementType() reflect.Type { 213 return reflect.TypeOf((**Repository)(nil)).Elem() 214 } 215 216 func (i *Repository) ToRepositoryOutput() RepositoryOutput { 217 return i.ToRepositoryOutputWithContext(context.Background()) 218 } 219 220 func (i *Repository) ToRepositoryOutputWithContext(ctx context.Context) RepositoryOutput { 221 return pulumi.ToOutputWithContext(ctx, i).(RepositoryOutput) 222 } 223 224 // RepositoryArrayInput is an input type that accepts RepositoryArray and RepositoryArrayOutput values. 225 // You can construct a concrete instance of `RepositoryArrayInput` via: 226 // 227 // RepositoryArray{ RepositoryArgs{...} } 228 type RepositoryArrayInput interface { 229 pulumi.Input 230 231 ToRepositoryArrayOutput() RepositoryArrayOutput 232 ToRepositoryArrayOutputWithContext(context.Context) RepositoryArrayOutput 233 } 234 235 type RepositoryArray []RepositoryInput 236 237 func (RepositoryArray) ElementType() reflect.Type { 238 return reflect.TypeOf((*[]*Repository)(nil)).Elem() 239 } 240 241 func (i RepositoryArray) ToRepositoryArrayOutput() RepositoryArrayOutput { 242 return i.ToRepositoryArrayOutputWithContext(context.Background()) 243 } 244 245 func (i RepositoryArray) ToRepositoryArrayOutputWithContext(ctx context.Context) RepositoryArrayOutput { 246 return pulumi.ToOutputWithContext(ctx, i).(RepositoryArrayOutput) 247 } 248 249 // RepositoryMapInput is an input type that accepts RepositoryMap and RepositoryMapOutput values. 250 // You can construct a concrete instance of `RepositoryMapInput` via: 251 // 252 // RepositoryMap{ "key": RepositoryArgs{...} } 253 type RepositoryMapInput interface { 254 pulumi.Input 255 256 ToRepositoryMapOutput() RepositoryMapOutput 257 ToRepositoryMapOutputWithContext(context.Context) RepositoryMapOutput 258 } 259 260 type RepositoryMap map[string]RepositoryInput 261 262 func (RepositoryMap) ElementType() reflect.Type { 263 return reflect.TypeOf((*map[string]*Repository)(nil)).Elem() 264 } 265 266 func (i RepositoryMap) ToRepositoryMapOutput() RepositoryMapOutput { 267 return i.ToRepositoryMapOutputWithContext(context.Background()) 268 } 269 270 func (i RepositoryMap) ToRepositoryMapOutputWithContext(ctx context.Context) RepositoryMapOutput { 271 return pulumi.ToOutputWithContext(ctx, i).(RepositoryMapOutput) 272 } 273 274 type RepositoryOutput struct{ *pulumi.OutputState } 275 276 func (RepositoryOutput) ElementType() reflect.Type { 277 return reflect.TypeOf((**Repository)(nil)).Elem() 278 } 279 280 func (o RepositoryOutput) ToRepositoryOutput() RepositoryOutput { 281 return o 282 } 283 284 func (o RepositoryOutput) ToRepositoryOutputWithContext(ctx context.Context) RepositoryOutput { 285 return o 286 } 287 288 // Full ARN of the repository. 289 func (o RepositoryOutput) Arn() pulumi.StringOutput { 290 return o.ApplyT(func(v *Repository) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 291 } 292 293 // Encryption configuration for the repository. See below for schema. 294 func (o RepositoryOutput) EncryptionConfigurations() RepositoryEncryptionConfigurationArrayOutput { 295 return o.ApplyT(func(v *Repository) RepositoryEncryptionConfigurationArrayOutput { return v.EncryptionConfigurations }).(RepositoryEncryptionConfigurationArrayOutput) 296 } 297 298 // If `true`, will delete the repository even if it contains images. 299 // Defaults to `false`. 300 func (o RepositoryOutput) ForceDelete() pulumi.BoolPtrOutput { 301 return o.ApplyT(func(v *Repository) pulumi.BoolPtrOutput { return v.ForceDelete }).(pulumi.BoolPtrOutput) 302 } 303 304 // Configuration block that defines image scanning configuration for the repository. By default, image scanning must be manually triggered. See the [ECR User Guide](https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning.html) for more information about image scanning. 305 func (o RepositoryOutput) ImageScanningConfiguration() RepositoryImageScanningConfigurationPtrOutput { 306 return o.ApplyT(func(v *Repository) RepositoryImageScanningConfigurationPtrOutput { return v.ImageScanningConfiguration }).(RepositoryImageScanningConfigurationPtrOutput) 307 } 308 309 // The tag mutability setting for the repository. Must be one of: `MUTABLE` or `IMMUTABLE`. Defaults to `MUTABLE`. 310 func (o RepositoryOutput) ImageTagMutability() pulumi.StringPtrOutput { 311 return o.ApplyT(func(v *Repository) pulumi.StringPtrOutput { return v.ImageTagMutability }).(pulumi.StringPtrOutput) 312 } 313 314 // Name of the repository. 315 func (o RepositoryOutput) Name() pulumi.StringOutput { 316 return o.ApplyT(func(v *Repository) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 317 } 318 319 // The registry ID where the repository was created. 320 func (o RepositoryOutput) RegistryId() pulumi.StringOutput { 321 return o.ApplyT(func(v *Repository) pulumi.StringOutput { return v.RegistryId }).(pulumi.StringOutput) 322 } 323 324 // The URL of the repository (in the form `aws_account_id.dkr.ecr.region.amazonaws.com/repositoryName`). 325 func (o RepositoryOutput) RepositoryUrl() pulumi.StringOutput { 326 return o.ApplyT(func(v *Repository) pulumi.StringOutput { return v.RepositoryUrl }).(pulumi.StringOutput) 327 } 328 329 // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 330 func (o RepositoryOutput) Tags() pulumi.StringMapOutput { 331 return o.ApplyT(func(v *Repository) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 332 } 333 334 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 335 // 336 // Deprecated: Please use `tags` instead. 337 func (o RepositoryOutput) TagsAll() pulumi.StringMapOutput { 338 return o.ApplyT(func(v *Repository) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 339 } 340 341 type RepositoryArrayOutput struct{ *pulumi.OutputState } 342 343 func (RepositoryArrayOutput) ElementType() reflect.Type { 344 return reflect.TypeOf((*[]*Repository)(nil)).Elem() 345 } 346 347 func (o RepositoryArrayOutput) ToRepositoryArrayOutput() RepositoryArrayOutput { 348 return o 349 } 350 351 func (o RepositoryArrayOutput) ToRepositoryArrayOutputWithContext(ctx context.Context) RepositoryArrayOutput { 352 return o 353 } 354 355 func (o RepositoryArrayOutput) Index(i pulumi.IntInput) RepositoryOutput { 356 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Repository { 357 return vs[0].([]*Repository)[vs[1].(int)] 358 }).(RepositoryOutput) 359 } 360 361 type RepositoryMapOutput struct{ *pulumi.OutputState } 362 363 func (RepositoryMapOutput) ElementType() reflect.Type { 364 return reflect.TypeOf((*map[string]*Repository)(nil)).Elem() 365 } 366 367 func (o RepositoryMapOutput) ToRepositoryMapOutput() RepositoryMapOutput { 368 return o 369 } 370 371 func (o RepositoryMapOutput) ToRepositoryMapOutputWithContext(ctx context.Context) RepositoryMapOutput { 372 return o 373 } 374 375 func (o RepositoryMapOutput) MapIndex(k pulumi.StringInput) RepositoryOutput { 376 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Repository { 377 return vs[0].(map[string]*Repository)[vs[1].(string)] 378 }).(RepositoryOutput) 379 } 380 381 func init() { 382 pulumi.RegisterInputType(reflect.TypeOf((*RepositoryInput)(nil)).Elem(), &Repository{}) 383 pulumi.RegisterInputType(reflect.TypeOf((*RepositoryArrayInput)(nil)).Elem(), RepositoryArray{}) 384 pulumi.RegisterInputType(reflect.TypeOf((*RepositoryMapInput)(nil)).Elem(), RepositoryMap{}) 385 pulumi.RegisterOutputType(RepositoryOutput{}) 386 pulumi.RegisterOutputType(RepositoryArrayOutput{}) 387 pulumi.RegisterOutputType(RepositoryMapOutput{}) 388 }