github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iot/getEndpoint.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 iot
     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  // Returns a unique endpoint specific to the AWS account making the call.
    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/iot"
    25  //	"github.com/pulumi/pulumi-kubernetes/sdk/v3/go/kubernetes"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			example, err := iot.GetEndpoint(ctx, nil, nil)
    33  //			if err != nil {
    34  //				return err
    35  //			}
    36  //			_, err = kubernetes.NewPod(ctx, "agent", &kubernetes.PodArgs{
    37  //				Metadata: []map[string]interface{}{
    38  //					map[string]interface{}{
    39  //						"name": "my-device",
    40  //					},
    41  //				},
    42  //				Spec: []map[string]interface{}{
    43  //					map[string]interface{}{
    44  //						"container": []map[string]interface{}{
    45  //							map[string]interface{}{
    46  //								"image": "gcr.io/my-project/image-name",
    47  //								"name":  "image-name",
    48  //								"env": []map[string]interface{}{
    49  //									map[string]interface{}{
    50  //										"name":  "IOT_ENDPOINT",
    51  //										"value": example.EndpointAddress,
    52  //									},
    53  //								},
    54  //							},
    55  //						},
    56  //					},
    57  //				},
    58  //			})
    59  //			if err != nil {
    60  //				return err
    61  //			}
    62  //			return nil
    63  //		})
    64  //	}
    65  //
    66  // ```
    67  // <!--End PulumiCodeChooser -->
    68  func GetEndpoint(ctx *pulumi.Context, args *GetEndpointArgs, opts ...pulumi.InvokeOption) (*GetEndpointResult, error) {
    69  	opts = internal.PkgInvokeDefaultOpts(opts)
    70  	var rv GetEndpointResult
    71  	err := ctx.Invoke("aws:iot/getEndpoint:getEndpoint", args, &rv, opts...)
    72  	if err != nil {
    73  		return nil, err
    74  	}
    75  	return &rv, nil
    76  }
    77  
    78  // A collection of arguments for invoking getEndpoint.
    79  type GetEndpointArgs struct {
    80  	// Endpoint type. Valid values: `iot:CredentialProvider`, `iot:Data`, `iot:Data-ATS`, `iot:Jobs`.
    81  	EndpointType *string `pulumi:"endpointType"`
    82  }
    83  
    84  // A collection of values returned by getEndpoint.
    85  type GetEndpointResult struct {
    86  	// Endpoint based on `endpointType`:
    87  	// * No `endpointType`: Either `iot:Data` or `iot:Data-ATS` [depending on region](https://aws.amazon.com/blogs/iot/aws-iot-core-ats-endpoints/)
    88  	// * `iot:CredentialsProvider`: `IDENTIFIER.credentials.iot.REGION.amazonaws.com`
    89  	// * `iot:Data`: `IDENTIFIER.iot.REGION.amazonaws.com`
    90  	// * `iot:Data-ATS`: `IDENTIFIER-ats.iot.REGION.amazonaws.com`
    91  	// * `iot:Jobs`: `IDENTIFIER.jobs.iot.REGION.amazonaws.com`
    92  	EndpointAddress string  `pulumi:"endpointAddress"`
    93  	EndpointType    *string `pulumi:"endpointType"`
    94  	// The provider-assigned unique ID for this managed resource.
    95  	Id string `pulumi:"id"`
    96  }
    97  
    98  func GetEndpointOutput(ctx *pulumi.Context, args GetEndpointOutputArgs, opts ...pulumi.InvokeOption) GetEndpointResultOutput {
    99  	return pulumi.ToOutputWithContext(context.Background(), args).
   100  		ApplyT(func(v interface{}) (GetEndpointResult, error) {
   101  			args := v.(GetEndpointArgs)
   102  			r, err := GetEndpoint(ctx, &args, opts...)
   103  			var s GetEndpointResult
   104  			if r != nil {
   105  				s = *r
   106  			}
   107  			return s, err
   108  		}).(GetEndpointResultOutput)
   109  }
   110  
   111  // A collection of arguments for invoking getEndpoint.
   112  type GetEndpointOutputArgs struct {
   113  	// Endpoint type. Valid values: `iot:CredentialProvider`, `iot:Data`, `iot:Data-ATS`, `iot:Jobs`.
   114  	EndpointType pulumi.StringPtrInput `pulumi:"endpointType"`
   115  }
   116  
   117  func (GetEndpointOutputArgs) ElementType() reflect.Type {
   118  	return reflect.TypeOf((*GetEndpointArgs)(nil)).Elem()
   119  }
   120  
   121  // A collection of values returned by getEndpoint.
   122  type GetEndpointResultOutput struct{ *pulumi.OutputState }
   123  
   124  func (GetEndpointResultOutput) ElementType() reflect.Type {
   125  	return reflect.TypeOf((*GetEndpointResult)(nil)).Elem()
   126  }
   127  
   128  func (o GetEndpointResultOutput) ToGetEndpointResultOutput() GetEndpointResultOutput {
   129  	return o
   130  }
   131  
   132  func (o GetEndpointResultOutput) ToGetEndpointResultOutputWithContext(ctx context.Context) GetEndpointResultOutput {
   133  	return o
   134  }
   135  
   136  // Endpoint based on `endpointType`:
   137  // * No `endpointType`: Either `iot:Data` or `iot:Data-ATS` [depending on region](https://aws.amazon.com/blogs/iot/aws-iot-core-ats-endpoints/)
   138  // * `iot:CredentialsProvider`: `IDENTIFIER.credentials.iot.REGION.amazonaws.com`
   139  // * `iot:Data`: `IDENTIFIER.iot.REGION.amazonaws.com`
   140  // * `iot:Data-ATS`: `IDENTIFIER-ats.iot.REGION.amazonaws.com`
   141  // * `iot:Jobs`: `IDENTIFIER.jobs.iot.REGION.amazonaws.com`
   142  func (o GetEndpointResultOutput) EndpointAddress() pulumi.StringOutput {
   143  	return o.ApplyT(func(v GetEndpointResult) string { return v.EndpointAddress }).(pulumi.StringOutput)
   144  }
   145  
   146  func (o GetEndpointResultOutput) EndpointType() pulumi.StringPtrOutput {
   147  	return o.ApplyT(func(v GetEndpointResult) *string { return v.EndpointType }).(pulumi.StringPtrOutput)
   148  }
   149  
   150  // The provider-assigned unique ID for this managed resource.
   151  func (o GetEndpointResultOutput) Id() pulumi.StringOutput {
   152  	return o.ApplyT(func(v GetEndpointResult) string { return v.Id }).(pulumi.StringOutput)
   153  }
   154  
   155  func init() {
   156  	pulumi.RegisterOutputType(GetEndpointResultOutput{})
   157  }