github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/directconnect/getLocation.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 a specific AWS Direct Connect location 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.getLocations` data source which retrieves information about all the AWS Direct Connect locations 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.GetLocation(ctx, &directconnect.GetLocationArgs{
    35  //				LocationCode: "CS32A-24FL",
    36  //			}, nil)
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			return nil
    41  //		})
    42  //	}
    43  //
    44  // ```
    45  // <!--End PulumiCodeChooser -->
    46  func GetLocation(ctx *pulumi.Context, args *GetLocationArgs, opts ...pulumi.InvokeOption) (*GetLocationResult, error) {
    47  	opts = internal.PkgInvokeDefaultOpts(opts)
    48  	var rv GetLocationResult
    49  	err := ctx.Invoke("aws:directconnect/getLocation:getLocation", args, &rv, opts...)
    50  	if err != nil {
    51  		return nil, err
    52  	}
    53  	return &rv, nil
    54  }
    55  
    56  // A collection of arguments for invoking getLocation.
    57  type GetLocationArgs struct {
    58  	// Code for the location to retrieve.
    59  	LocationCode string `pulumi:"locationCode"`
    60  }
    61  
    62  // A collection of values returned by getLocation.
    63  type GetLocationResult struct {
    64  	// The available MAC Security (MACsec) port speeds for the location.
    65  	AvailableMacsecPortSpeeds []string `pulumi:"availableMacsecPortSpeeds"`
    66  	// The available port speeds for the location.
    67  	AvailablePortSpeeds []string `pulumi:"availablePortSpeeds"`
    68  	// Names of the service providers for the location.
    69  	AvailableProviders []string `pulumi:"availableProviders"`
    70  	// The provider-assigned unique ID for this managed resource.
    71  	Id           string `pulumi:"id"`
    72  	LocationCode string `pulumi:"locationCode"`
    73  	// Name of the location. This includes the name of the colocation partner and the physical site of the building.
    74  	LocationName string `pulumi:"locationName"`
    75  }
    76  
    77  func GetLocationOutput(ctx *pulumi.Context, args GetLocationOutputArgs, opts ...pulumi.InvokeOption) GetLocationResultOutput {
    78  	return pulumi.ToOutputWithContext(context.Background(), args).
    79  		ApplyT(func(v interface{}) (GetLocationResult, error) {
    80  			args := v.(GetLocationArgs)
    81  			r, err := GetLocation(ctx, &args, opts...)
    82  			var s GetLocationResult
    83  			if r != nil {
    84  				s = *r
    85  			}
    86  			return s, err
    87  		}).(GetLocationResultOutput)
    88  }
    89  
    90  // A collection of arguments for invoking getLocation.
    91  type GetLocationOutputArgs struct {
    92  	// Code for the location to retrieve.
    93  	LocationCode pulumi.StringInput `pulumi:"locationCode"`
    94  }
    95  
    96  func (GetLocationOutputArgs) ElementType() reflect.Type {
    97  	return reflect.TypeOf((*GetLocationArgs)(nil)).Elem()
    98  }
    99  
   100  // A collection of values returned by getLocation.
   101  type GetLocationResultOutput struct{ *pulumi.OutputState }
   102  
   103  func (GetLocationResultOutput) ElementType() reflect.Type {
   104  	return reflect.TypeOf((*GetLocationResult)(nil)).Elem()
   105  }
   106  
   107  func (o GetLocationResultOutput) ToGetLocationResultOutput() GetLocationResultOutput {
   108  	return o
   109  }
   110  
   111  func (o GetLocationResultOutput) ToGetLocationResultOutputWithContext(ctx context.Context) GetLocationResultOutput {
   112  	return o
   113  }
   114  
   115  // The available MAC Security (MACsec) port speeds for the location.
   116  func (o GetLocationResultOutput) AvailableMacsecPortSpeeds() pulumi.StringArrayOutput {
   117  	return o.ApplyT(func(v GetLocationResult) []string { return v.AvailableMacsecPortSpeeds }).(pulumi.StringArrayOutput)
   118  }
   119  
   120  // The available port speeds for the location.
   121  func (o GetLocationResultOutput) AvailablePortSpeeds() pulumi.StringArrayOutput {
   122  	return o.ApplyT(func(v GetLocationResult) []string { return v.AvailablePortSpeeds }).(pulumi.StringArrayOutput)
   123  }
   124  
   125  // Names of the service providers for the location.
   126  func (o GetLocationResultOutput) AvailableProviders() pulumi.StringArrayOutput {
   127  	return o.ApplyT(func(v GetLocationResult) []string { return v.AvailableProviders }).(pulumi.StringArrayOutput)
   128  }
   129  
   130  // The provider-assigned unique ID for this managed resource.
   131  func (o GetLocationResultOutput) Id() pulumi.StringOutput {
   132  	return o.ApplyT(func(v GetLocationResult) string { return v.Id }).(pulumi.StringOutput)
   133  }
   134  
   135  func (o GetLocationResultOutput) LocationCode() pulumi.StringOutput {
   136  	return o.ApplyT(func(v GetLocationResult) string { return v.LocationCode }).(pulumi.StringOutput)
   137  }
   138  
   139  // Name of the location. This includes the name of the colocation partner and the physical site of the building.
   140  func (o GetLocationResultOutput) LocationName() pulumi.StringOutput {
   141  	return o.ApplyT(func(v GetLocationResult) string { return v.LocationName }).(pulumi.StringOutput)
   142  }
   143  
   144  func init() {
   145  	pulumi.RegisterOutputType(GetLocationResultOutput{})
   146  }