github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/eks/getClusterAuth.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 eks 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 // Get an authentication token to communicate with an EKS cluster. 15 // 16 // Uses IAM credentials from the AWS provider to generate a temporary token that is compatible with 17 // [AWS IAM Authenticator](https://github.com/kubernetes-sigs/aws-iam-authenticator) authentication. 18 // This can be used to authenticate to an EKS cluster or to a cluster that has the AWS IAM Authenticator 19 // server configured. 20 // 21 // ## Example Usage 22 // 23 // <!--Start PulumiCodeChooser --> 24 // ```go 25 // package main 26 // 27 // import ( 28 // 29 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/eks" 30 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 31 // 32 // ) 33 // 34 // func main() { 35 // pulumi.Run(func(ctx *pulumi.Context) error { 36 // _, err := eks.LookupCluster(ctx, &eks.LookupClusterArgs{ 37 // Name: "example", 38 // }, nil) 39 // if err != nil { 40 // return err 41 // } 42 // _, err = eks.GetClusterAuth(ctx, &eks.GetClusterAuthArgs{ 43 // Name: "example", 44 // }, nil) 45 // if err != nil { 46 // return err 47 // } 48 // return nil 49 // }) 50 // } 51 // 52 // ``` 53 // <!--End PulumiCodeChooser --> 54 func GetClusterAuth(ctx *pulumi.Context, args *GetClusterAuthArgs, opts ...pulumi.InvokeOption) (*GetClusterAuthResult, error) { 55 opts = internal.PkgInvokeDefaultOpts(opts) 56 var rv GetClusterAuthResult 57 err := ctx.Invoke("aws:eks/getClusterAuth:getClusterAuth", args, &rv, opts...) 58 if err != nil { 59 return nil, err 60 } 61 return &rv, nil 62 } 63 64 // A collection of arguments for invoking getClusterAuth. 65 type GetClusterAuthArgs struct { 66 // Name of the cluster 67 Name string `pulumi:"name"` 68 } 69 70 // A collection of values returned by getClusterAuth. 71 type GetClusterAuthResult struct { 72 // The provider-assigned unique ID for this managed resource. 73 Id string `pulumi:"id"` 74 Name string `pulumi:"name"` 75 // Token to use to authenticate with the cluster. 76 Token string `pulumi:"token"` 77 } 78 79 func GetClusterAuthOutput(ctx *pulumi.Context, args GetClusterAuthOutputArgs, opts ...pulumi.InvokeOption) GetClusterAuthResultOutput { 80 return pulumi.ToOutputWithContext(context.Background(), args). 81 ApplyT(func(v interface{}) (GetClusterAuthResult, error) { 82 args := v.(GetClusterAuthArgs) 83 r, err := GetClusterAuth(ctx, &args, opts...) 84 var s GetClusterAuthResult 85 if r != nil { 86 s = *r 87 } 88 return s, err 89 }).(GetClusterAuthResultOutput) 90 } 91 92 // A collection of arguments for invoking getClusterAuth. 93 type GetClusterAuthOutputArgs struct { 94 // Name of the cluster 95 Name pulumi.StringInput `pulumi:"name"` 96 } 97 98 func (GetClusterAuthOutputArgs) ElementType() reflect.Type { 99 return reflect.TypeOf((*GetClusterAuthArgs)(nil)).Elem() 100 } 101 102 // A collection of values returned by getClusterAuth. 103 type GetClusterAuthResultOutput struct{ *pulumi.OutputState } 104 105 func (GetClusterAuthResultOutput) ElementType() reflect.Type { 106 return reflect.TypeOf((*GetClusterAuthResult)(nil)).Elem() 107 } 108 109 func (o GetClusterAuthResultOutput) ToGetClusterAuthResultOutput() GetClusterAuthResultOutput { 110 return o 111 } 112 113 func (o GetClusterAuthResultOutput) ToGetClusterAuthResultOutputWithContext(ctx context.Context) GetClusterAuthResultOutput { 114 return o 115 } 116 117 // The provider-assigned unique ID for this managed resource. 118 func (o GetClusterAuthResultOutput) Id() pulumi.StringOutput { 119 return o.ApplyT(func(v GetClusterAuthResult) string { return v.Id }).(pulumi.StringOutput) 120 } 121 122 func (o GetClusterAuthResultOutput) Name() pulumi.StringOutput { 123 return o.ApplyT(func(v GetClusterAuthResult) string { return v.Name }).(pulumi.StringOutput) 124 } 125 126 // Token to use to authenticate with the cluster. 127 func (o GetClusterAuthResultOutput) Token() pulumi.StringOutput { 128 return o.ApplyT(func(v GetClusterAuthResult) string { return v.Token }).(pulumi.StringOutput) 129 } 130 131 func init() { 132 pulumi.RegisterOutputType(GetClusterAuthResultOutput{}) 133 }