github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ecr/getPullThroughCacheRule.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 Pull Through Cache Rule data source allows the upstream registry URL and registry ID to be retrieved for a Pull Through Cache Rule.
    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.LookupPullThroughCacheRule(ctx, &ecr.LookupPullThroughCacheRuleArgs{
    32  //				EcrRepositoryPrefix: "ecr-public",
    33  //			}, nil)
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			return nil
    38  //		})
    39  //	}
    40  //
    41  // ```
    42  // <!--End PulumiCodeChooser -->
    43  func LookupPullThroughCacheRule(ctx *pulumi.Context, args *LookupPullThroughCacheRuleArgs, opts ...pulumi.InvokeOption) (*LookupPullThroughCacheRuleResult, error) {
    44  	opts = internal.PkgInvokeDefaultOpts(opts)
    45  	var rv LookupPullThroughCacheRuleResult
    46  	err := ctx.Invoke("aws:ecr/getPullThroughCacheRule:getPullThroughCacheRule", 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 getPullThroughCacheRule.
    54  type LookupPullThroughCacheRuleArgs struct {
    55  	// The repository name prefix to use when caching images from the source registry.
    56  	EcrRepositoryPrefix string `pulumi:"ecrRepositoryPrefix"`
    57  }
    58  
    59  // A collection of values returned by getPullThroughCacheRule.
    60  type LookupPullThroughCacheRuleResult struct {
    61  	// ARN of the Secret which will be used to authenticate against the registry.
    62  	CredentialArn       string `pulumi:"credentialArn"`
    63  	EcrRepositoryPrefix string `pulumi:"ecrRepositoryPrefix"`
    64  	// The provider-assigned unique ID for this managed resource.
    65  	Id string `pulumi:"id"`
    66  	// The registry ID where the repository was created.
    67  	RegistryId string `pulumi:"registryId"`
    68  	// The registry URL of the upstream public registry to use as the source.
    69  	UpstreamRegistryUrl string `pulumi:"upstreamRegistryUrl"`
    70  }
    71  
    72  func LookupPullThroughCacheRuleOutput(ctx *pulumi.Context, args LookupPullThroughCacheRuleOutputArgs, opts ...pulumi.InvokeOption) LookupPullThroughCacheRuleResultOutput {
    73  	return pulumi.ToOutputWithContext(context.Background(), args).
    74  		ApplyT(func(v interface{}) (LookupPullThroughCacheRuleResult, error) {
    75  			args := v.(LookupPullThroughCacheRuleArgs)
    76  			r, err := LookupPullThroughCacheRule(ctx, &args, opts...)
    77  			var s LookupPullThroughCacheRuleResult
    78  			if r != nil {
    79  				s = *r
    80  			}
    81  			return s, err
    82  		}).(LookupPullThroughCacheRuleResultOutput)
    83  }
    84  
    85  // A collection of arguments for invoking getPullThroughCacheRule.
    86  type LookupPullThroughCacheRuleOutputArgs struct {
    87  	// The repository name prefix to use when caching images from the source registry.
    88  	EcrRepositoryPrefix pulumi.StringInput `pulumi:"ecrRepositoryPrefix"`
    89  }
    90  
    91  func (LookupPullThroughCacheRuleOutputArgs) ElementType() reflect.Type {
    92  	return reflect.TypeOf((*LookupPullThroughCacheRuleArgs)(nil)).Elem()
    93  }
    94  
    95  // A collection of values returned by getPullThroughCacheRule.
    96  type LookupPullThroughCacheRuleResultOutput struct{ *pulumi.OutputState }
    97  
    98  func (LookupPullThroughCacheRuleResultOutput) ElementType() reflect.Type {
    99  	return reflect.TypeOf((*LookupPullThroughCacheRuleResult)(nil)).Elem()
   100  }
   101  
   102  func (o LookupPullThroughCacheRuleResultOutput) ToLookupPullThroughCacheRuleResultOutput() LookupPullThroughCacheRuleResultOutput {
   103  	return o
   104  }
   105  
   106  func (o LookupPullThroughCacheRuleResultOutput) ToLookupPullThroughCacheRuleResultOutputWithContext(ctx context.Context) LookupPullThroughCacheRuleResultOutput {
   107  	return o
   108  }
   109  
   110  // ARN of the Secret which will be used to authenticate against the registry.
   111  func (o LookupPullThroughCacheRuleResultOutput) CredentialArn() pulumi.StringOutput {
   112  	return o.ApplyT(func(v LookupPullThroughCacheRuleResult) string { return v.CredentialArn }).(pulumi.StringOutput)
   113  }
   114  
   115  func (o LookupPullThroughCacheRuleResultOutput) EcrRepositoryPrefix() pulumi.StringOutput {
   116  	return o.ApplyT(func(v LookupPullThroughCacheRuleResult) string { return v.EcrRepositoryPrefix }).(pulumi.StringOutput)
   117  }
   118  
   119  // The provider-assigned unique ID for this managed resource.
   120  func (o LookupPullThroughCacheRuleResultOutput) Id() pulumi.StringOutput {
   121  	return o.ApplyT(func(v LookupPullThroughCacheRuleResult) string { return v.Id }).(pulumi.StringOutput)
   122  }
   123  
   124  // The registry ID where the repository was created.
   125  func (o LookupPullThroughCacheRuleResultOutput) RegistryId() pulumi.StringOutput {
   126  	return o.ApplyT(func(v LookupPullThroughCacheRuleResult) string { return v.RegistryId }).(pulumi.StringOutput)
   127  }
   128  
   129  // The registry URL of the upstream public registry to use as the source.
   130  func (o LookupPullThroughCacheRuleResultOutput) UpstreamRegistryUrl() pulumi.StringOutput {
   131  	return o.ApplyT(func(v LookupPullThroughCacheRuleResult) string { return v.UpstreamRegistryUrl }).(pulumi.StringOutput)
   132  }
   133  
   134  func init() {
   135  	pulumi.RegisterOutputType(LookupPullThroughCacheRuleResultOutput{})
   136  }