github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/directconnect/getLocations.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 directconnect 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 // Retrieve information about the AWS Direct Connect locations in the current AWS Region. 15 // These are the locations that can be specified when configuring `directconnect.Connection` or `directconnect.LinkAggregationGroup` resources. 16 // 17 // > **Note:** This data source is different from the `directconnect.getLocation` data source which retrieves information about a specific AWS Direct Connect location in the current AWS Region. 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/directconnect" 28 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 29 // 30 // ) 31 // 32 // func main() { 33 // pulumi.Run(func(ctx *pulumi.Context) error { 34 // _, err := directconnect.GetLocations(ctx, nil, nil) 35 // if err != nil { 36 // return err 37 // } 38 // return nil 39 // }) 40 // } 41 // 42 // ``` 43 // <!--End PulumiCodeChooser --> 44 func GetLocations(ctx *pulumi.Context, opts ...pulumi.InvokeOption) (*GetLocationsResult, error) { 45 opts = internal.PkgInvokeDefaultOpts(opts) 46 var rv GetLocationsResult 47 err := ctx.Invoke("aws:directconnect/getLocations:getLocations", nil, &rv, opts...) 48 if err != nil { 49 return nil, err 50 } 51 return &rv, nil 52 } 53 54 // A collection of values returned by getLocations. 55 type GetLocationsResult struct { 56 // The provider-assigned unique ID for this managed resource. 57 Id string `pulumi:"id"` 58 // Code for the locations. 59 LocationCodes []string `pulumi:"locationCodes"` 60 } 61 62 func GetLocationsOutput(ctx *pulumi.Context, opts ...pulumi.InvokeOption) GetLocationsResultOutput { 63 return pulumi.ToOutput(0).ApplyT(func(int) (GetLocationsResult, error) { 64 r, err := GetLocations(ctx, opts...) 65 var s GetLocationsResult 66 if r != nil { 67 s = *r 68 } 69 return s, err 70 }).(GetLocationsResultOutput) 71 } 72 73 // A collection of values returned by getLocations. 74 type GetLocationsResultOutput struct{ *pulumi.OutputState } 75 76 func (GetLocationsResultOutput) ElementType() reflect.Type { 77 return reflect.TypeOf((*GetLocationsResult)(nil)).Elem() 78 } 79 80 func (o GetLocationsResultOutput) ToGetLocationsResultOutput() GetLocationsResultOutput { 81 return o 82 } 83 84 func (o GetLocationsResultOutput) ToGetLocationsResultOutputWithContext(ctx context.Context) GetLocationsResultOutput { 85 return o 86 } 87 88 // The provider-assigned unique ID for this managed resource. 89 func (o GetLocationsResultOutput) Id() pulumi.StringOutput { 90 return o.ApplyT(func(v GetLocationsResult) string { return v.Id }).(pulumi.StringOutput) 91 } 92 93 // Code for the locations. 94 func (o GetLocationsResultOutput) LocationCodes() pulumi.StringArrayOutput { 95 return o.ApplyT(func(v GetLocationsResult) []string { return v.LocationCodes }).(pulumi.StringArrayOutput) 96 } 97 98 func init() { 99 pulumi.RegisterOutputType(GetLocationsResultOutput{}) 100 }