github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/s3/getCanonicalUserId.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 s3
     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 Canonical User ID data source allows access to the [canonical user ID](http://docs.aws.amazon.com/general/latest/gr/acct-identifiers.html)
    15  // for the effective account in which this provider is working.
    16  //
    17  // > **NOTE:** To use this data source, you must have the `s3:ListAllMyBuckets` permission.
    18  //
    19  // ## Example Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			current, err := s3.GetCanonicalUserId(ctx, nil, nil)
    35  //			if err != nil {
    36  //				return err
    37  //			}
    38  //			ctx.Export("canonicalUserId", current.Id)
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  func GetCanonicalUserId(ctx *pulumi.Context, opts ...pulumi.InvokeOption) (*GetCanonicalUserIdResult, error) {
    46  	opts = internal.PkgInvokeDefaultOpts(opts)
    47  	var rv GetCanonicalUserIdResult
    48  	err := ctx.Invoke("aws:s3/getCanonicalUserId:getCanonicalUserId", nil, &rv, opts...)
    49  	if err != nil {
    50  		return nil, err
    51  	}
    52  	return &rv, nil
    53  }
    54  
    55  // A collection of values returned by getCanonicalUserId.
    56  type GetCanonicalUserIdResult struct {
    57  	// Human-friendly name linked to the canonical user ID. The bucket owner's display name. **NOTE:** [This value](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTServiceGET.html) is only included in the response in the US East (N. Virginia), US West (N. California), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), EU (Ireland), and South America (São Paulo) regions.
    58  	DisplayName string `pulumi:"displayName"`
    59  	// The provider-assigned unique ID for this managed resource.
    60  	Id string `pulumi:"id"`
    61  }
    62  
    63  func GetCanonicalUserIdOutput(ctx *pulumi.Context, opts ...pulumi.InvokeOption) GetCanonicalUserIdResultOutput {
    64  	return pulumi.ToOutput(0).ApplyT(func(int) (GetCanonicalUserIdResult, error) {
    65  		r, err := GetCanonicalUserId(ctx, opts...)
    66  		var s GetCanonicalUserIdResult
    67  		if r != nil {
    68  			s = *r
    69  		}
    70  		return s, err
    71  	}).(GetCanonicalUserIdResultOutput)
    72  }
    73  
    74  // A collection of values returned by getCanonicalUserId.
    75  type GetCanonicalUserIdResultOutput struct{ *pulumi.OutputState }
    76  
    77  func (GetCanonicalUserIdResultOutput) ElementType() reflect.Type {
    78  	return reflect.TypeOf((*GetCanonicalUserIdResult)(nil)).Elem()
    79  }
    80  
    81  func (o GetCanonicalUserIdResultOutput) ToGetCanonicalUserIdResultOutput() GetCanonicalUserIdResultOutput {
    82  	return o
    83  }
    84  
    85  func (o GetCanonicalUserIdResultOutput) ToGetCanonicalUserIdResultOutputWithContext(ctx context.Context) GetCanonicalUserIdResultOutput {
    86  	return o
    87  }
    88  
    89  // Human-friendly name linked to the canonical user ID. The bucket owner's display name. **NOTE:** [This value](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTServiceGET.html) is only included in the response in the US East (N. Virginia), US West (N. California), US West (Oregon), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), EU (Ireland), and South America (São Paulo) regions.
    90  func (o GetCanonicalUserIdResultOutput) DisplayName() pulumi.StringOutput {
    91  	return o.ApplyT(func(v GetCanonicalUserIdResult) string { return v.DisplayName }).(pulumi.StringOutput)
    92  }
    93  
    94  // The provider-assigned unique ID for this managed resource.
    95  func (o GetCanonicalUserIdResultOutput) Id() pulumi.StringOutput {
    96  	return o.ApplyT(func(v GetCanonicalUserIdResult) string { return v.Id }).(pulumi.StringOutput)
    97  }
    98  
    99  func init() {
   100  	pulumi.RegisterOutputType(GetCanonicalUserIdResultOutput{})
   101  }