github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/apigateway/getKey.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 apigateway
     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  // Use this data source to get the name and value of a pre-existing API Key, for
    15  // example to supply credentials for a dependency microservice.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigateway"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := apigateway.GetKey(ctx, &apigateway.GetKeyArgs{
    33  //				Id: "ru3mpjgse6",
    34  //			}, nil)
    35  //			if err != nil {
    36  //				return err
    37  //			}
    38  //			return nil
    39  //		})
    40  //	}
    41  //
    42  // ```
    43  // <!--End PulumiCodeChooser -->
    44  func GetKey(ctx *pulumi.Context, args *GetKeyArgs, opts ...pulumi.InvokeOption) (*GetKeyResult, error) {
    45  	opts = internal.PkgInvokeDefaultOpts(opts)
    46  	var rv GetKeyResult
    47  	err := ctx.Invoke("aws:apigateway/getKey:getKey", args, &rv, opts...)
    48  	if err != nil {
    49  		return nil, err
    50  	}
    51  	return &rv, nil
    52  }
    53  
    54  // A collection of arguments for invoking getKey.
    55  type GetKeyArgs struct {
    56  	// ID of the API Key to look up.
    57  	Id string `pulumi:"id"`
    58  	// Map of tags for the resource.
    59  	Tags map[string]string `pulumi:"tags"`
    60  }
    61  
    62  // A collection of values returned by getKey.
    63  type GetKeyResult struct {
    64  	// Date and time when the API Key was created.
    65  	CreatedDate string `pulumi:"createdDate"`
    66  	// Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
    67  	CustomerId string `pulumi:"customerId"`
    68  	// Description of the API Key.
    69  	Description string `pulumi:"description"`
    70  	// Whether the API Key is enabled.
    71  	Enabled bool `pulumi:"enabled"`
    72  	// Set to the ID of the API Key.
    73  	Id string `pulumi:"id"`
    74  	// Date and time when the API Key was last updated.
    75  	LastUpdatedDate string `pulumi:"lastUpdatedDate"`
    76  	// Set to the name of the API Key.
    77  	Name string `pulumi:"name"`
    78  	// Map of tags for the resource.
    79  	Tags map[string]string `pulumi:"tags"`
    80  	// Set to the value of the API Key.
    81  	Value string `pulumi:"value"`
    82  }
    83  
    84  func GetKeyOutput(ctx *pulumi.Context, args GetKeyOutputArgs, opts ...pulumi.InvokeOption) GetKeyResultOutput {
    85  	return pulumi.ToOutputWithContext(context.Background(), args).
    86  		ApplyT(func(v interface{}) (GetKeyResult, error) {
    87  			args := v.(GetKeyArgs)
    88  			r, err := GetKey(ctx, &args, opts...)
    89  			var s GetKeyResult
    90  			if r != nil {
    91  				s = *r
    92  			}
    93  			return s, err
    94  		}).(GetKeyResultOutput)
    95  }
    96  
    97  // A collection of arguments for invoking getKey.
    98  type GetKeyOutputArgs struct {
    99  	// ID of the API Key to look up.
   100  	Id pulumi.StringInput `pulumi:"id"`
   101  	// Map of tags for the resource.
   102  	Tags pulumi.StringMapInput `pulumi:"tags"`
   103  }
   104  
   105  func (GetKeyOutputArgs) ElementType() reflect.Type {
   106  	return reflect.TypeOf((*GetKeyArgs)(nil)).Elem()
   107  }
   108  
   109  // A collection of values returned by getKey.
   110  type GetKeyResultOutput struct{ *pulumi.OutputState }
   111  
   112  func (GetKeyResultOutput) ElementType() reflect.Type {
   113  	return reflect.TypeOf((*GetKeyResult)(nil)).Elem()
   114  }
   115  
   116  func (o GetKeyResultOutput) ToGetKeyResultOutput() GetKeyResultOutput {
   117  	return o
   118  }
   119  
   120  func (o GetKeyResultOutput) ToGetKeyResultOutputWithContext(ctx context.Context) GetKeyResultOutput {
   121  	return o
   122  }
   123  
   124  // Date and time when the API Key was created.
   125  func (o GetKeyResultOutput) CreatedDate() pulumi.StringOutput {
   126  	return o.ApplyT(func(v GetKeyResult) string { return v.CreatedDate }).(pulumi.StringOutput)
   127  }
   128  
   129  // Amazon Web Services Marketplace customer identifier, when integrating with the Amazon Web Services SaaS Marketplace.
   130  func (o GetKeyResultOutput) CustomerId() pulumi.StringOutput {
   131  	return o.ApplyT(func(v GetKeyResult) string { return v.CustomerId }).(pulumi.StringOutput)
   132  }
   133  
   134  // Description of the API Key.
   135  func (o GetKeyResultOutput) Description() pulumi.StringOutput {
   136  	return o.ApplyT(func(v GetKeyResult) string { return v.Description }).(pulumi.StringOutput)
   137  }
   138  
   139  // Whether the API Key is enabled.
   140  func (o GetKeyResultOutput) Enabled() pulumi.BoolOutput {
   141  	return o.ApplyT(func(v GetKeyResult) bool { return v.Enabled }).(pulumi.BoolOutput)
   142  }
   143  
   144  // Set to the ID of the API Key.
   145  func (o GetKeyResultOutput) Id() pulumi.StringOutput {
   146  	return o.ApplyT(func(v GetKeyResult) string { return v.Id }).(pulumi.StringOutput)
   147  }
   148  
   149  // Date and time when the API Key was last updated.
   150  func (o GetKeyResultOutput) LastUpdatedDate() pulumi.StringOutput {
   151  	return o.ApplyT(func(v GetKeyResult) string { return v.LastUpdatedDate }).(pulumi.StringOutput)
   152  }
   153  
   154  // Set to the name of the API Key.
   155  func (o GetKeyResultOutput) Name() pulumi.StringOutput {
   156  	return o.ApplyT(func(v GetKeyResult) string { return v.Name }).(pulumi.StringOutput)
   157  }
   158  
   159  // Map of tags for the resource.
   160  func (o GetKeyResultOutput) Tags() pulumi.StringMapOutput {
   161  	return o.ApplyT(func(v GetKeyResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput)
   162  }
   163  
   164  // Set to the value of the API Key.
   165  func (o GetKeyResultOutput) Value() pulumi.StringOutput {
   166  	return o.ApplyT(func(v GetKeyResult) string { return v.Value }).(pulumi.StringOutput)
   167  }
   168  
   169  func init() {
   170  	pulumi.RegisterOutputType(GetKeyResultOutput{})
   171  }