github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/getPartition.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 aws 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 lookup information about the current AWS partition in 15 // which the provider is working. 16 // 17 // ## Example Usage 18 // 19 // <!--Start PulumiCodeChooser --> 20 // ```go 21 // package main 22 // 23 // import ( 24 // 25 // "fmt" 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" 28 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 29 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 30 // 31 // ) 32 // 33 // func main() { 34 // pulumi.Run(func(ctx *pulumi.Context) error { 35 // current, err := aws.GetPartition(ctx, nil, nil) 36 // if err != nil { 37 // return err 38 // } 39 // _, err = iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{ 40 // Statements: []iam.GetPolicyDocumentStatement{ 41 // { 42 // Sid: pulumi.StringRef("1"), 43 // Actions: []string{ 44 // "s3:ListBucket", 45 // }, 46 // Resources: []string{ 47 // fmt.Sprintf("arn:%v:s3:::my-bucket", current.Partition), 48 // }, 49 // }, 50 // }, 51 // }, nil) 52 // if err != nil { 53 // return err 54 // } 55 // return nil 56 // }) 57 // } 58 // 59 // ``` 60 // <!--End PulumiCodeChooser --> 61 func GetPartition(ctx *pulumi.Context, args *GetPartitionArgs, opts ...pulumi.InvokeOption) (*GetPartitionResult, error) { 62 opts = internal.PkgInvokeDefaultOpts(opts) 63 var rv GetPartitionResult 64 err := ctx.Invoke("aws:index/getPartition:getPartition", args, &rv, opts...) 65 if err != nil { 66 return nil, err 67 } 68 return &rv, nil 69 } 70 71 // A collection of arguments for invoking getPartition. 72 type GetPartitionArgs struct { 73 // Identifier of the current partition (e.g., `aws` in AWS Commercial, `aws-cn` in AWS China). 74 Id *string `pulumi:"id"` 75 } 76 77 // A collection of values returned by getPartition. 78 type GetPartitionResult struct { 79 // Base DNS domain name for the current partition (e.g., `amazonaws.com` in AWS Commercial, `amazonaws.com.cn` in AWS China). 80 DnsSuffix string `pulumi:"dnsSuffix"` 81 // Identifier of the current partition (e.g., `aws` in AWS Commercial, `aws-cn` in AWS China). 82 Id string `pulumi:"id"` 83 // Identifier of the current partition (e.g., `aws` in AWS Commercial, `aws-cn` in AWS China). 84 Partition string `pulumi:"partition"` 85 // Prefix of service names (e.g., `com.amazonaws` in AWS Commercial, `cn.com.amazonaws` in AWS China). 86 ReverseDnsPrefix string `pulumi:"reverseDnsPrefix"` 87 } 88 89 func GetPartitionOutput(ctx *pulumi.Context, args GetPartitionOutputArgs, opts ...pulumi.InvokeOption) GetPartitionResultOutput { 90 return pulumi.ToOutputWithContext(context.Background(), args). 91 ApplyT(func(v interface{}) (GetPartitionResult, error) { 92 args := v.(GetPartitionArgs) 93 r, err := GetPartition(ctx, &args, opts...) 94 var s GetPartitionResult 95 if r != nil { 96 s = *r 97 } 98 return s, err 99 }).(GetPartitionResultOutput) 100 } 101 102 // A collection of arguments for invoking getPartition. 103 type GetPartitionOutputArgs struct { 104 // Identifier of the current partition (e.g., `aws` in AWS Commercial, `aws-cn` in AWS China). 105 Id pulumi.StringPtrInput `pulumi:"id"` 106 } 107 108 func (GetPartitionOutputArgs) ElementType() reflect.Type { 109 return reflect.TypeOf((*GetPartitionArgs)(nil)).Elem() 110 } 111 112 // A collection of values returned by getPartition. 113 type GetPartitionResultOutput struct{ *pulumi.OutputState } 114 115 func (GetPartitionResultOutput) ElementType() reflect.Type { 116 return reflect.TypeOf((*GetPartitionResult)(nil)).Elem() 117 } 118 119 func (o GetPartitionResultOutput) ToGetPartitionResultOutput() GetPartitionResultOutput { 120 return o 121 } 122 123 func (o GetPartitionResultOutput) ToGetPartitionResultOutputWithContext(ctx context.Context) GetPartitionResultOutput { 124 return o 125 } 126 127 // Base DNS domain name for the current partition (e.g., `amazonaws.com` in AWS Commercial, `amazonaws.com.cn` in AWS China). 128 func (o GetPartitionResultOutput) DnsSuffix() pulumi.StringOutput { 129 return o.ApplyT(func(v GetPartitionResult) string { return v.DnsSuffix }).(pulumi.StringOutput) 130 } 131 132 // Identifier of the current partition (e.g., `aws` in AWS Commercial, `aws-cn` in AWS China). 133 func (o GetPartitionResultOutput) Id() pulumi.StringOutput { 134 return o.ApplyT(func(v GetPartitionResult) string { return v.Id }).(pulumi.StringOutput) 135 } 136 137 // Identifier of the current partition (e.g., `aws` in AWS Commercial, `aws-cn` in AWS China). 138 func (o GetPartitionResultOutput) Partition() pulumi.StringOutput { 139 return o.ApplyT(func(v GetPartitionResult) string { return v.Partition }).(pulumi.StringOutput) 140 } 141 142 // Prefix of service names (e.g., `com.amazonaws` in AWS Commercial, `cn.com.amazonaws` in AWS China). 143 func (o GetPartitionResultOutput) ReverseDnsPrefix() pulumi.StringOutput { 144 return o.ApplyT(func(v GetPartitionResult) string { return v.ReverseDnsPrefix }).(pulumi.StringOutput) 145 } 146 147 func init() { 148 pulumi.RegisterOutputType(GetPartitionResultOutput{}) 149 }