github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ecr/getRepository.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  // The ECR Repository data source allows the ARN, Repository URI and Registry ID to be retrieved for an ECR 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.LookupRepository(ctx, &ecr.LookupRepositoryArgs{
    32  //				Name: "ecr-repository",
    33  //			}, nil)
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			return nil
    38  //		})
    39  //	}
    40  //
    41  // ```
    42  // <!--End PulumiCodeChooser -->
    43  func LookupRepository(ctx *pulumi.Context, args *LookupRepositoryArgs, opts ...pulumi.InvokeOption) (*LookupRepositoryResult, error) {
    44  	opts = internal.PkgInvokeDefaultOpts(opts)
    45  	var rv LookupRepositoryResult
    46  	err := ctx.Invoke("aws:ecr/getRepository:getRepository", args, &rv, opts...)
    47  	if err != nil {
    48  		return nil, err
    49  	}
    50  	return &rv, nil
    51  }
    52  
    53  // A collection of arguments for invoking getRepository.
    54  type LookupRepositoryArgs struct {
    55  	// Name of the ECR Repository.
    56  	Name string `pulumi:"name"`
    57  	// Registry ID where the repository was created.
    58  	RegistryId *string `pulumi:"registryId"`
    59  	// Map of tags assigned to the resource.
    60  	Tags map[string]string `pulumi:"tags"`
    61  }
    62  
    63  // A collection of values returned by getRepository.
    64  type LookupRepositoryResult struct {
    65  	// Full ARN of the repository.
    66  	Arn string `pulumi:"arn"`
    67  	// Encryption configuration for the repository. See Encryption Configuration below.
    68  	EncryptionConfigurations []GetRepositoryEncryptionConfiguration `pulumi:"encryptionConfigurations"`
    69  	// The provider-assigned unique ID for this managed resource.
    70  	Id string `pulumi:"id"`
    71  	// Configuration block that defines image scanning configuration for the repository. See Image Scanning Configuration below.
    72  	ImageScanningConfigurations []GetRepositoryImageScanningConfiguration `pulumi:"imageScanningConfigurations"`
    73  	// The tag mutability setting for the repository.
    74  	ImageTagMutability string `pulumi:"imageTagMutability"`
    75  	// List of image tags associated with the most recently pushed image in the repository.
    76  	MostRecentImageTags []string `pulumi:"mostRecentImageTags"`
    77  	Name                string   `pulumi:"name"`
    78  	RegistryId          string   `pulumi:"registryId"`
    79  	// URL of the repository (in the form `aws_account_id.dkr.ecr.region.amazonaws.com/repositoryName`).
    80  	RepositoryUrl string `pulumi:"repositoryUrl"`
    81  	// Map of tags assigned to the resource.
    82  	Tags map[string]string `pulumi:"tags"`
    83  }
    84  
    85  func LookupRepositoryOutput(ctx *pulumi.Context, args LookupRepositoryOutputArgs, opts ...pulumi.InvokeOption) LookupRepositoryResultOutput {
    86  	return pulumi.ToOutputWithContext(context.Background(), args).
    87  		ApplyT(func(v interface{}) (LookupRepositoryResult, error) {
    88  			args := v.(LookupRepositoryArgs)
    89  			r, err := LookupRepository(ctx, &args, opts...)
    90  			var s LookupRepositoryResult
    91  			if r != nil {
    92  				s = *r
    93  			}
    94  			return s, err
    95  		}).(LookupRepositoryResultOutput)
    96  }
    97  
    98  // A collection of arguments for invoking getRepository.
    99  type LookupRepositoryOutputArgs struct {
   100  	// Name of the ECR Repository.
   101  	Name pulumi.StringInput `pulumi:"name"`
   102  	// Registry ID where the repository was created.
   103  	RegistryId pulumi.StringPtrInput `pulumi:"registryId"`
   104  	// Map of tags assigned to the resource.
   105  	Tags pulumi.StringMapInput `pulumi:"tags"`
   106  }
   107  
   108  func (LookupRepositoryOutputArgs) ElementType() reflect.Type {
   109  	return reflect.TypeOf((*LookupRepositoryArgs)(nil)).Elem()
   110  }
   111  
   112  // A collection of values returned by getRepository.
   113  type LookupRepositoryResultOutput struct{ *pulumi.OutputState }
   114  
   115  func (LookupRepositoryResultOutput) ElementType() reflect.Type {
   116  	return reflect.TypeOf((*LookupRepositoryResult)(nil)).Elem()
   117  }
   118  
   119  func (o LookupRepositoryResultOutput) ToLookupRepositoryResultOutput() LookupRepositoryResultOutput {
   120  	return o
   121  }
   122  
   123  func (o LookupRepositoryResultOutput) ToLookupRepositoryResultOutputWithContext(ctx context.Context) LookupRepositoryResultOutput {
   124  	return o
   125  }
   126  
   127  // Full ARN of the repository.
   128  func (o LookupRepositoryResultOutput) Arn() pulumi.StringOutput {
   129  	return o.ApplyT(func(v LookupRepositoryResult) string { return v.Arn }).(pulumi.StringOutput)
   130  }
   131  
   132  // Encryption configuration for the repository. See Encryption Configuration below.
   133  func (o LookupRepositoryResultOutput) EncryptionConfigurations() GetRepositoryEncryptionConfigurationArrayOutput {
   134  	return o.ApplyT(func(v LookupRepositoryResult) []GetRepositoryEncryptionConfiguration {
   135  		return v.EncryptionConfigurations
   136  	}).(GetRepositoryEncryptionConfigurationArrayOutput)
   137  }
   138  
   139  // The provider-assigned unique ID for this managed resource.
   140  func (o LookupRepositoryResultOutput) Id() pulumi.StringOutput {
   141  	return o.ApplyT(func(v LookupRepositoryResult) string { return v.Id }).(pulumi.StringOutput)
   142  }
   143  
   144  // Configuration block that defines image scanning configuration for the repository. See Image Scanning Configuration below.
   145  func (o LookupRepositoryResultOutput) ImageScanningConfigurations() GetRepositoryImageScanningConfigurationArrayOutput {
   146  	return o.ApplyT(func(v LookupRepositoryResult) []GetRepositoryImageScanningConfiguration {
   147  		return v.ImageScanningConfigurations
   148  	}).(GetRepositoryImageScanningConfigurationArrayOutput)
   149  }
   150  
   151  // The tag mutability setting for the repository.
   152  func (o LookupRepositoryResultOutput) ImageTagMutability() pulumi.StringOutput {
   153  	return o.ApplyT(func(v LookupRepositoryResult) string { return v.ImageTagMutability }).(pulumi.StringOutput)
   154  }
   155  
   156  // List of image tags associated with the most recently pushed image in the repository.
   157  func (o LookupRepositoryResultOutput) MostRecentImageTags() pulumi.StringArrayOutput {
   158  	return o.ApplyT(func(v LookupRepositoryResult) []string { return v.MostRecentImageTags }).(pulumi.StringArrayOutput)
   159  }
   160  
   161  func (o LookupRepositoryResultOutput) Name() pulumi.StringOutput {
   162  	return o.ApplyT(func(v LookupRepositoryResult) string { return v.Name }).(pulumi.StringOutput)
   163  }
   164  
   165  func (o LookupRepositoryResultOutput) RegistryId() pulumi.StringOutput {
   166  	return o.ApplyT(func(v LookupRepositoryResult) string { return v.RegistryId }).(pulumi.StringOutput)
   167  }
   168  
   169  // URL of the repository (in the form `aws_account_id.dkr.ecr.region.amazonaws.com/repositoryName`).
   170  func (o LookupRepositoryResultOutput) RepositoryUrl() pulumi.StringOutput {
   171  	return o.ApplyT(func(v LookupRepositoryResult) string { return v.RepositoryUrl }).(pulumi.StringOutput)
   172  }
   173  
   174  // Map of tags assigned to the resource.
   175  func (o LookupRepositoryResultOutput) Tags() pulumi.StringMapOutput {
   176  	return o.ApplyT(func(v LookupRepositoryResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   177  }
   178  
   179  func init() {
   180  	pulumi.RegisterOutputType(LookupRepositoryResultOutput{})
   181  }