github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ecr/getAuthorizationToken.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 Authorization Token data source allows the authorization token, proxy endpoint, token expiration date, user name and password 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.GetAuthorizationToken(ctx, nil, nil)
    32  //			if err != nil {
    33  //				return err
    34  //			}
    35  //			return nil
    36  //		})
    37  //	}
    38  //
    39  // ```
    40  // <!--End PulumiCodeChooser -->
    41  func GetAuthorizationToken(ctx *pulumi.Context, args *GetAuthorizationTokenArgs, opts ...pulumi.InvokeOption) (*GetAuthorizationTokenResult, error) {
    42  	opts = internal.PkgInvokeDefaultOpts(opts)
    43  	var rv GetAuthorizationTokenResult
    44  	err := ctx.Invoke("aws:ecr/getAuthorizationToken:getAuthorizationToken", args, &rv, opts...)
    45  	if err != nil {
    46  		return nil, err
    47  	}
    48  	return &rv, nil
    49  }
    50  
    51  // A collection of arguments for invoking getAuthorizationToken.
    52  type GetAuthorizationTokenArgs struct {
    53  	// AWS account ID of the ECR Repository. If not specified the default account is assumed.
    54  	RegistryId *string `pulumi:"registryId"`
    55  }
    56  
    57  // A collection of values returned by getAuthorizationToken.
    58  type GetAuthorizationTokenResult struct {
    59  	// Temporary IAM authentication credentials to access the ECR repository encoded in base64 in the form of `user_name:password`.
    60  	AuthorizationToken string `pulumi:"authorizationToken"`
    61  	// Time in UTC RFC3339 format when the authorization token expires.
    62  	ExpiresAt string `pulumi:"expiresAt"`
    63  	// The provider-assigned unique ID for this managed resource.
    64  	Id string `pulumi:"id"`
    65  	// Password decoded from the authorization token.
    66  	Password string `pulumi:"password"`
    67  	// Registry URL to use in the docker login command.
    68  	ProxyEndpoint string  `pulumi:"proxyEndpoint"`
    69  	RegistryId    *string `pulumi:"registryId"`
    70  	// User name decoded from the authorization token.
    71  	UserName string `pulumi:"userName"`
    72  }
    73  
    74  func GetAuthorizationTokenOutput(ctx *pulumi.Context, args GetAuthorizationTokenOutputArgs, opts ...pulumi.InvokeOption) GetAuthorizationTokenResultOutput {
    75  	return pulumi.ToOutputWithContext(context.Background(), args).
    76  		ApplyT(func(v interface{}) (GetAuthorizationTokenResult, error) {
    77  			args := v.(GetAuthorizationTokenArgs)
    78  			r, err := GetAuthorizationToken(ctx, &args, opts...)
    79  			var s GetAuthorizationTokenResult
    80  			if r != nil {
    81  				s = *r
    82  			}
    83  			return s, err
    84  		}).(GetAuthorizationTokenResultOutput)
    85  }
    86  
    87  // A collection of arguments for invoking getAuthorizationToken.
    88  type GetAuthorizationTokenOutputArgs struct {
    89  	// AWS account ID of the ECR Repository. If not specified the default account is assumed.
    90  	RegistryId pulumi.StringPtrInput `pulumi:"registryId"`
    91  }
    92  
    93  func (GetAuthorizationTokenOutputArgs) ElementType() reflect.Type {
    94  	return reflect.TypeOf((*GetAuthorizationTokenArgs)(nil)).Elem()
    95  }
    96  
    97  // A collection of values returned by getAuthorizationToken.
    98  type GetAuthorizationTokenResultOutput struct{ *pulumi.OutputState }
    99  
   100  func (GetAuthorizationTokenResultOutput) ElementType() reflect.Type {
   101  	return reflect.TypeOf((*GetAuthorizationTokenResult)(nil)).Elem()
   102  }
   103  
   104  func (o GetAuthorizationTokenResultOutput) ToGetAuthorizationTokenResultOutput() GetAuthorizationTokenResultOutput {
   105  	return o
   106  }
   107  
   108  func (o GetAuthorizationTokenResultOutput) ToGetAuthorizationTokenResultOutputWithContext(ctx context.Context) GetAuthorizationTokenResultOutput {
   109  	return o
   110  }
   111  
   112  // Temporary IAM authentication credentials to access the ECR repository encoded in base64 in the form of `user_name:password`.
   113  func (o GetAuthorizationTokenResultOutput) AuthorizationToken() pulumi.StringOutput {
   114  	return o.ApplyT(func(v GetAuthorizationTokenResult) string { return v.AuthorizationToken }).(pulumi.StringOutput)
   115  }
   116  
   117  // Time in UTC RFC3339 format when the authorization token expires.
   118  func (o GetAuthorizationTokenResultOutput) ExpiresAt() pulumi.StringOutput {
   119  	return o.ApplyT(func(v GetAuthorizationTokenResult) string { return v.ExpiresAt }).(pulumi.StringOutput)
   120  }
   121  
   122  // The provider-assigned unique ID for this managed resource.
   123  func (o GetAuthorizationTokenResultOutput) Id() pulumi.StringOutput {
   124  	return o.ApplyT(func(v GetAuthorizationTokenResult) string { return v.Id }).(pulumi.StringOutput)
   125  }
   126  
   127  // Password decoded from the authorization token.
   128  func (o GetAuthorizationTokenResultOutput) Password() pulumi.StringOutput {
   129  	return o.ApplyT(func(v GetAuthorizationTokenResult) string { return v.Password }).(pulumi.StringOutput)
   130  }
   131  
   132  // Registry URL to use in the docker login command.
   133  func (o GetAuthorizationTokenResultOutput) ProxyEndpoint() pulumi.StringOutput {
   134  	return o.ApplyT(func(v GetAuthorizationTokenResult) string { return v.ProxyEndpoint }).(pulumi.StringOutput)
   135  }
   136  
   137  func (o GetAuthorizationTokenResultOutput) RegistryId() pulumi.StringPtrOutput {
   138  	return o.ApplyT(func(v GetAuthorizationTokenResult) *string { return v.RegistryId }).(pulumi.StringPtrOutput)
   139  }
   140  
   141  // User name decoded from the authorization token.
   142  func (o GetAuthorizationTokenResultOutput) UserName() pulumi.StringOutput {
   143  	return o.ApplyT(func(v GetAuthorizationTokenResult) string { return v.UserName }).(pulumi.StringOutput)
   144  }
   145  
   146  func init() {
   147  	pulumi.RegisterOutputType(GetAuthorizationTokenResultOutput{})
   148  }