github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudfront/getOriginAccessIdentity.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 cloudfront
     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  // Use this data source to retrieve information for an Amazon CloudFront origin access identity.
    15  //
    16  // ## Example Usage
    17  //
    18  // The following example below creates a CloudFront origin access identity.
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudfront"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			_, err := cloudfront.LookupOriginAccessIdentity(ctx, &cloudfront.LookupOriginAccessIdentityArgs{
    34  //				Id: "E1ZAKK699EOLAL",
    35  //			}, nil)
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  func LookupOriginAccessIdentity(ctx *pulumi.Context, args *LookupOriginAccessIdentityArgs, opts ...pulumi.InvokeOption) (*LookupOriginAccessIdentityResult, error) {
    46  	opts = internal.PkgInvokeDefaultOpts(opts)
    47  	var rv LookupOriginAccessIdentityResult
    48  	err := ctx.Invoke("aws:cloudfront/getOriginAccessIdentity:getOriginAccessIdentity", args, &rv, opts...)
    49  	if err != nil {
    50  		return nil, err
    51  	}
    52  	return &rv, nil
    53  }
    54  
    55  // A collection of arguments for invoking getOriginAccessIdentity.
    56  type LookupOriginAccessIdentityArgs struct {
    57  	// The identifier for the origin access identity. For example: `E1ZAKK699EOLAL`.
    58  	Id string `pulumi:"id"`
    59  }
    60  
    61  // A collection of values returned by getOriginAccessIdentity.
    62  type LookupOriginAccessIdentityResult struct {
    63  	// Internal value used by CloudFront to allow future
    64  	// updates to the origin access identity.
    65  	CallerReference string `pulumi:"callerReference"`
    66  	// A shortcut to the full path for the
    67  	// origin access identity to use in CloudFront, see below.
    68  	CloudfrontAccessIdentityPath string `pulumi:"cloudfrontAccessIdentityPath"`
    69  	// An optional comment for the origin access identity.
    70  	Comment string `pulumi:"comment"`
    71  	// Current version of the origin access identity's information.
    72  	// For example: `E2QWRUHAPOMQZL`.
    73  	Etag string `pulumi:"etag"`
    74  	// Pre-generated ARN for use in S3 bucket policies (see below).
    75  	// Example: `arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity
    76  	// E2QWRUHAPOMQZL`.
    77  	IamArn string `pulumi:"iamArn"`
    78  	Id     string `pulumi:"id"`
    79  	// The Amazon S3 canonical user ID for the origin
    80  	// access identity, which you use when giving the origin access identity read
    81  	// permission to an object in Amazon S3.
    82  	S3CanonicalUserId string `pulumi:"s3CanonicalUserId"`
    83  }
    84  
    85  func LookupOriginAccessIdentityOutput(ctx *pulumi.Context, args LookupOriginAccessIdentityOutputArgs, opts ...pulumi.InvokeOption) LookupOriginAccessIdentityResultOutput {
    86  	return pulumi.ToOutputWithContext(context.Background(), args).
    87  		ApplyT(func(v interface{}) (LookupOriginAccessIdentityResult, error) {
    88  			args := v.(LookupOriginAccessIdentityArgs)
    89  			r, err := LookupOriginAccessIdentity(ctx, &args, opts...)
    90  			var s LookupOriginAccessIdentityResult
    91  			if r != nil {
    92  				s = *r
    93  			}
    94  			return s, err
    95  		}).(LookupOriginAccessIdentityResultOutput)
    96  }
    97  
    98  // A collection of arguments for invoking getOriginAccessIdentity.
    99  type LookupOriginAccessIdentityOutputArgs struct {
   100  	// The identifier for the origin access identity. For example: `E1ZAKK699EOLAL`.
   101  	Id pulumi.StringInput `pulumi:"id"`
   102  }
   103  
   104  func (LookupOriginAccessIdentityOutputArgs) ElementType() reflect.Type {
   105  	return reflect.TypeOf((*LookupOriginAccessIdentityArgs)(nil)).Elem()
   106  }
   107  
   108  // A collection of values returned by getOriginAccessIdentity.
   109  type LookupOriginAccessIdentityResultOutput struct{ *pulumi.OutputState }
   110  
   111  func (LookupOriginAccessIdentityResultOutput) ElementType() reflect.Type {
   112  	return reflect.TypeOf((*LookupOriginAccessIdentityResult)(nil)).Elem()
   113  }
   114  
   115  func (o LookupOriginAccessIdentityResultOutput) ToLookupOriginAccessIdentityResultOutput() LookupOriginAccessIdentityResultOutput {
   116  	return o
   117  }
   118  
   119  func (o LookupOriginAccessIdentityResultOutput) ToLookupOriginAccessIdentityResultOutputWithContext(ctx context.Context) LookupOriginAccessIdentityResultOutput {
   120  	return o
   121  }
   122  
   123  // Internal value used by CloudFront to allow future
   124  // updates to the origin access identity.
   125  func (o LookupOriginAccessIdentityResultOutput) CallerReference() pulumi.StringOutput {
   126  	return o.ApplyT(func(v LookupOriginAccessIdentityResult) string { return v.CallerReference }).(pulumi.StringOutput)
   127  }
   128  
   129  // A shortcut to the full path for the
   130  // origin access identity to use in CloudFront, see below.
   131  func (o LookupOriginAccessIdentityResultOutput) CloudfrontAccessIdentityPath() pulumi.StringOutput {
   132  	return o.ApplyT(func(v LookupOriginAccessIdentityResult) string { return v.CloudfrontAccessIdentityPath }).(pulumi.StringOutput)
   133  }
   134  
   135  // An optional comment for the origin access identity.
   136  func (o LookupOriginAccessIdentityResultOutput) Comment() pulumi.StringOutput {
   137  	return o.ApplyT(func(v LookupOriginAccessIdentityResult) string { return v.Comment }).(pulumi.StringOutput)
   138  }
   139  
   140  // Current version of the origin access identity's information.
   141  // For example: `E2QWRUHAPOMQZL`.
   142  func (o LookupOriginAccessIdentityResultOutput) Etag() pulumi.StringOutput {
   143  	return o.ApplyT(func(v LookupOriginAccessIdentityResult) string { return v.Etag }).(pulumi.StringOutput)
   144  }
   145  
   146  // Pre-generated ARN for use in S3 bucket policies (see below).
   147  // Example: `arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity
   148  // E2QWRUHAPOMQZL`.
   149  func (o LookupOriginAccessIdentityResultOutput) IamArn() pulumi.StringOutput {
   150  	return o.ApplyT(func(v LookupOriginAccessIdentityResult) string { return v.IamArn }).(pulumi.StringOutput)
   151  }
   152  
   153  func (o LookupOriginAccessIdentityResultOutput) Id() pulumi.StringOutput {
   154  	return o.ApplyT(func(v LookupOriginAccessIdentityResult) string { return v.Id }).(pulumi.StringOutput)
   155  }
   156  
   157  // The Amazon S3 canonical user ID for the origin
   158  // access identity, which you use when giving the origin access identity read
   159  // permission to an object in Amazon S3.
   160  func (o LookupOriginAccessIdentityResultOutput) S3CanonicalUserId() pulumi.StringOutput {
   161  	return o.ApplyT(func(v LookupOriginAccessIdentityResult) string { return v.S3CanonicalUserId }).(pulumi.StringOutput)
   162  }
   163  
   164  func init() {
   165  	pulumi.RegisterOutputType(LookupOriginAccessIdentityResultOutput{})
   166  }