github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/getArn.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 // Parses an ARN into its constituent parts. 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" 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 := aws.GetArn(ctx, &aws.GetArnArgs{ 32 // Arn: "arn:aws:rds:eu-west-1:123456789012:db:mysql-db", 33 // }, nil) 34 // if err != nil { 35 // return err 36 // } 37 // return nil 38 // }) 39 // } 40 // 41 // ``` 42 // <!--End PulumiCodeChooser --> 43 func GetArn(ctx *pulumi.Context, args *GetArnArgs, opts ...pulumi.InvokeOption) (*GetArnResult, error) { 44 opts = internal.PkgInvokeDefaultOpts(opts) 45 var rv GetArnResult 46 err := ctx.Invoke("aws:index/getArn:getArn", 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 getArn. 54 type GetArnArgs struct { 55 // ARN to parse. 56 Arn string `pulumi:"arn"` 57 Id *string `pulumi:"id"` 58 } 59 60 // A collection of values returned by getArn. 61 type GetArnResult struct { 62 // The [ID](https://docs.aws.amazon.com/general/latest/gr/acct-identifiers.html) of the AWS account that owns the resource, without the hyphens. 63 Account string `pulumi:"account"` 64 Arn string `pulumi:"arn"` 65 Id string `pulumi:"id"` 66 // Partition that the resource is in. 67 Partition string `pulumi:"partition"` 68 // Region the resource resides in. 69 // Note that the ARNs for some resources do not require a region, so this component might be omitted. 70 Region string `pulumi:"region"` 71 // Content of this part of the ARN varies by service. 72 // It often includes an indicator of the type of resource—for example, an IAM user or Amazon RDS database —followed by a slash (/) or a colon (:), followed by the resource name itself. 73 Resource string `pulumi:"resource"` 74 // The [service namespace](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces) that identifies the AWS product. 75 Service string `pulumi:"service"` 76 } 77 78 func GetArnOutput(ctx *pulumi.Context, args GetArnOutputArgs, opts ...pulumi.InvokeOption) GetArnResultOutput { 79 return pulumi.ToOutputWithContext(context.Background(), args). 80 ApplyT(func(v interface{}) (GetArnResult, error) { 81 args := v.(GetArnArgs) 82 r, err := GetArn(ctx, &args, opts...) 83 var s GetArnResult 84 if r != nil { 85 s = *r 86 } 87 return s, err 88 }).(GetArnResultOutput) 89 } 90 91 // A collection of arguments for invoking getArn. 92 type GetArnOutputArgs struct { 93 // ARN to parse. 94 Arn pulumi.StringInput `pulumi:"arn"` 95 Id pulumi.StringPtrInput `pulumi:"id"` 96 } 97 98 func (GetArnOutputArgs) ElementType() reflect.Type { 99 return reflect.TypeOf((*GetArnArgs)(nil)).Elem() 100 } 101 102 // A collection of values returned by getArn. 103 type GetArnResultOutput struct{ *pulumi.OutputState } 104 105 func (GetArnResultOutput) ElementType() reflect.Type { 106 return reflect.TypeOf((*GetArnResult)(nil)).Elem() 107 } 108 109 func (o GetArnResultOutput) ToGetArnResultOutput() GetArnResultOutput { 110 return o 111 } 112 113 func (o GetArnResultOutput) ToGetArnResultOutputWithContext(ctx context.Context) GetArnResultOutput { 114 return o 115 } 116 117 // The [ID](https://docs.aws.amazon.com/general/latest/gr/acct-identifiers.html) of the AWS account that owns the resource, without the hyphens. 118 func (o GetArnResultOutput) Account() pulumi.StringOutput { 119 return o.ApplyT(func(v GetArnResult) string { return v.Account }).(pulumi.StringOutput) 120 } 121 122 func (o GetArnResultOutput) Arn() pulumi.StringOutput { 123 return o.ApplyT(func(v GetArnResult) string { return v.Arn }).(pulumi.StringOutput) 124 } 125 126 func (o GetArnResultOutput) Id() pulumi.StringOutput { 127 return o.ApplyT(func(v GetArnResult) string { return v.Id }).(pulumi.StringOutput) 128 } 129 130 // Partition that the resource is in. 131 func (o GetArnResultOutput) Partition() pulumi.StringOutput { 132 return o.ApplyT(func(v GetArnResult) string { return v.Partition }).(pulumi.StringOutput) 133 } 134 135 // Region the resource resides in. 136 // Note that the ARNs for some resources do not require a region, so this component might be omitted. 137 func (o GetArnResultOutput) Region() pulumi.StringOutput { 138 return o.ApplyT(func(v GetArnResult) string { return v.Region }).(pulumi.StringOutput) 139 } 140 141 // Content of this part of the ARN varies by service. 142 // It often includes an indicator of the type of resource—for example, an IAM user or Amazon RDS database —followed by a slash (/) or a colon (:), followed by the resource name itself. 143 func (o GetArnResultOutput) Resource() pulumi.StringOutput { 144 return o.ApplyT(func(v GetArnResult) string { return v.Resource }).(pulumi.StringOutput) 145 } 146 147 // The [service namespace](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces) that identifies the AWS product. 148 func (o GetArnResultOutput) Service() pulumi.StringOutput { 149 return o.ApplyT(func(v GetArnResult) string { return v.Service }).(pulumi.StringOutput) 150 } 151 152 func init() { 153 pulumi.RegisterOutputType(GetArnResultOutput{}) 154 }