github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cloudfront/keyvaluestoreKey.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 cloudfront
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Resource for managing an AWS CloudFront KeyValueStore Key.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudfront"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			example, err := cloudfront.NewKeyValueStore(ctx, "example", &cloudfront.KeyValueStoreArgs{
    35  //				Name:    pulumi.String("ExampleKeyValueStore"),
    36  //				Comment: pulumi.String("This is an example key value store"),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			_, err = cloudfront.NewKeyvaluestoreKey(ctx, "example", &cloudfront.KeyvaluestoreKeyArgs{
    42  //				KeyValueStoreArn: example.Arn,
    43  //				Key:              pulumi.String("Test Key"),
    44  //				Value:            pulumi.String("Test Value"),
    45  //			})
    46  //			if err != nil {
    47  //				return err
    48  //			}
    49  //			return nil
    50  //		})
    51  //	}
    52  //
    53  // ```
    54  // <!--End PulumiCodeChooser -->
    55  //
    56  // ## Import
    57  //
    58  // Using `pulumi import`, import CloudFront KeyValueStore Key using the `id`. For example:
    59  //
    60  // ```sh
    61  // $ pulumi import aws:cloudfront/keyvaluestoreKey:KeyvaluestoreKey example arn:aws:cloudfront::111111111111:key-value-store/8562g61f-caba-2845-9d99-b97diwae5d3c,someKey
    62  // ```
    63  type KeyvaluestoreKey struct {
    64  	pulumi.CustomResourceState
    65  
    66  	// Key to put.
    67  	Key pulumi.StringOutput `pulumi:"key"`
    68  	// Amazon Resource Name (ARN) of the Key Value Store.
    69  	KeyValueStoreArn pulumi.StringOutput `pulumi:"keyValueStoreArn"`
    70  	// Total size of the Key Value Store in bytes.
    71  	TotalSizeInBytes pulumi.IntOutput `pulumi:"totalSizeInBytes"`
    72  	// Value to put.
    73  	Value pulumi.StringOutput `pulumi:"value"`
    74  }
    75  
    76  // NewKeyvaluestoreKey registers a new resource with the given unique name, arguments, and options.
    77  func NewKeyvaluestoreKey(ctx *pulumi.Context,
    78  	name string, args *KeyvaluestoreKeyArgs, opts ...pulumi.ResourceOption) (*KeyvaluestoreKey, error) {
    79  	if args == nil {
    80  		return nil, errors.New("missing one or more required arguments")
    81  	}
    82  
    83  	if args.Key == nil {
    84  		return nil, errors.New("invalid value for required argument 'Key'")
    85  	}
    86  	if args.KeyValueStoreArn == nil {
    87  		return nil, errors.New("invalid value for required argument 'KeyValueStoreArn'")
    88  	}
    89  	if args.Value == nil {
    90  		return nil, errors.New("invalid value for required argument 'Value'")
    91  	}
    92  	opts = internal.PkgResourceDefaultOpts(opts)
    93  	var resource KeyvaluestoreKey
    94  	err := ctx.RegisterResource("aws:cloudfront/keyvaluestoreKey:KeyvaluestoreKey", name, args, &resource, opts...)
    95  	if err != nil {
    96  		return nil, err
    97  	}
    98  	return &resource, nil
    99  }
   100  
   101  // GetKeyvaluestoreKey gets an existing KeyvaluestoreKey resource's state with the given name, ID, and optional
   102  // state properties that are used to uniquely qualify the lookup (nil if not required).
   103  func GetKeyvaluestoreKey(ctx *pulumi.Context,
   104  	name string, id pulumi.IDInput, state *KeyvaluestoreKeyState, opts ...pulumi.ResourceOption) (*KeyvaluestoreKey, error) {
   105  	var resource KeyvaluestoreKey
   106  	err := ctx.ReadResource("aws:cloudfront/keyvaluestoreKey:KeyvaluestoreKey", name, id, state, &resource, opts...)
   107  	if err != nil {
   108  		return nil, err
   109  	}
   110  	return &resource, nil
   111  }
   112  
   113  // Input properties used for looking up and filtering KeyvaluestoreKey resources.
   114  type keyvaluestoreKeyState struct {
   115  	// Key to put.
   116  	Key *string `pulumi:"key"`
   117  	// Amazon Resource Name (ARN) of the Key Value Store.
   118  	KeyValueStoreArn *string `pulumi:"keyValueStoreArn"`
   119  	// Total size of the Key Value Store in bytes.
   120  	TotalSizeInBytes *int `pulumi:"totalSizeInBytes"`
   121  	// Value to put.
   122  	Value *string `pulumi:"value"`
   123  }
   124  
   125  type KeyvaluestoreKeyState struct {
   126  	// Key to put.
   127  	Key pulumi.StringPtrInput
   128  	// Amazon Resource Name (ARN) of the Key Value Store.
   129  	KeyValueStoreArn pulumi.StringPtrInput
   130  	// Total size of the Key Value Store in bytes.
   131  	TotalSizeInBytes pulumi.IntPtrInput
   132  	// Value to put.
   133  	Value pulumi.StringPtrInput
   134  }
   135  
   136  func (KeyvaluestoreKeyState) ElementType() reflect.Type {
   137  	return reflect.TypeOf((*keyvaluestoreKeyState)(nil)).Elem()
   138  }
   139  
   140  type keyvaluestoreKeyArgs struct {
   141  	// Key to put.
   142  	Key string `pulumi:"key"`
   143  	// Amazon Resource Name (ARN) of the Key Value Store.
   144  	KeyValueStoreArn string `pulumi:"keyValueStoreArn"`
   145  	// Value to put.
   146  	Value string `pulumi:"value"`
   147  }
   148  
   149  // The set of arguments for constructing a KeyvaluestoreKey resource.
   150  type KeyvaluestoreKeyArgs struct {
   151  	// Key to put.
   152  	Key pulumi.StringInput
   153  	// Amazon Resource Name (ARN) of the Key Value Store.
   154  	KeyValueStoreArn pulumi.StringInput
   155  	// Value to put.
   156  	Value pulumi.StringInput
   157  }
   158  
   159  func (KeyvaluestoreKeyArgs) ElementType() reflect.Type {
   160  	return reflect.TypeOf((*keyvaluestoreKeyArgs)(nil)).Elem()
   161  }
   162  
   163  type KeyvaluestoreKeyInput interface {
   164  	pulumi.Input
   165  
   166  	ToKeyvaluestoreKeyOutput() KeyvaluestoreKeyOutput
   167  	ToKeyvaluestoreKeyOutputWithContext(ctx context.Context) KeyvaluestoreKeyOutput
   168  }
   169  
   170  func (*KeyvaluestoreKey) ElementType() reflect.Type {
   171  	return reflect.TypeOf((**KeyvaluestoreKey)(nil)).Elem()
   172  }
   173  
   174  func (i *KeyvaluestoreKey) ToKeyvaluestoreKeyOutput() KeyvaluestoreKeyOutput {
   175  	return i.ToKeyvaluestoreKeyOutputWithContext(context.Background())
   176  }
   177  
   178  func (i *KeyvaluestoreKey) ToKeyvaluestoreKeyOutputWithContext(ctx context.Context) KeyvaluestoreKeyOutput {
   179  	return pulumi.ToOutputWithContext(ctx, i).(KeyvaluestoreKeyOutput)
   180  }
   181  
   182  // KeyvaluestoreKeyArrayInput is an input type that accepts KeyvaluestoreKeyArray and KeyvaluestoreKeyArrayOutput values.
   183  // You can construct a concrete instance of `KeyvaluestoreKeyArrayInput` via:
   184  //
   185  //	KeyvaluestoreKeyArray{ KeyvaluestoreKeyArgs{...} }
   186  type KeyvaluestoreKeyArrayInput interface {
   187  	pulumi.Input
   188  
   189  	ToKeyvaluestoreKeyArrayOutput() KeyvaluestoreKeyArrayOutput
   190  	ToKeyvaluestoreKeyArrayOutputWithContext(context.Context) KeyvaluestoreKeyArrayOutput
   191  }
   192  
   193  type KeyvaluestoreKeyArray []KeyvaluestoreKeyInput
   194  
   195  func (KeyvaluestoreKeyArray) ElementType() reflect.Type {
   196  	return reflect.TypeOf((*[]*KeyvaluestoreKey)(nil)).Elem()
   197  }
   198  
   199  func (i KeyvaluestoreKeyArray) ToKeyvaluestoreKeyArrayOutput() KeyvaluestoreKeyArrayOutput {
   200  	return i.ToKeyvaluestoreKeyArrayOutputWithContext(context.Background())
   201  }
   202  
   203  func (i KeyvaluestoreKeyArray) ToKeyvaluestoreKeyArrayOutputWithContext(ctx context.Context) KeyvaluestoreKeyArrayOutput {
   204  	return pulumi.ToOutputWithContext(ctx, i).(KeyvaluestoreKeyArrayOutput)
   205  }
   206  
   207  // KeyvaluestoreKeyMapInput is an input type that accepts KeyvaluestoreKeyMap and KeyvaluestoreKeyMapOutput values.
   208  // You can construct a concrete instance of `KeyvaluestoreKeyMapInput` via:
   209  //
   210  //	KeyvaluestoreKeyMap{ "key": KeyvaluestoreKeyArgs{...} }
   211  type KeyvaluestoreKeyMapInput interface {
   212  	pulumi.Input
   213  
   214  	ToKeyvaluestoreKeyMapOutput() KeyvaluestoreKeyMapOutput
   215  	ToKeyvaluestoreKeyMapOutputWithContext(context.Context) KeyvaluestoreKeyMapOutput
   216  }
   217  
   218  type KeyvaluestoreKeyMap map[string]KeyvaluestoreKeyInput
   219  
   220  func (KeyvaluestoreKeyMap) ElementType() reflect.Type {
   221  	return reflect.TypeOf((*map[string]*KeyvaluestoreKey)(nil)).Elem()
   222  }
   223  
   224  func (i KeyvaluestoreKeyMap) ToKeyvaluestoreKeyMapOutput() KeyvaluestoreKeyMapOutput {
   225  	return i.ToKeyvaluestoreKeyMapOutputWithContext(context.Background())
   226  }
   227  
   228  func (i KeyvaluestoreKeyMap) ToKeyvaluestoreKeyMapOutputWithContext(ctx context.Context) KeyvaluestoreKeyMapOutput {
   229  	return pulumi.ToOutputWithContext(ctx, i).(KeyvaluestoreKeyMapOutput)
   230  }
   231  
   232  type KeyvaluestoreKeyOutput struct{ *pulumi.OutputState }
   233  
   234  func (KeyvaluestoreKeyOutput) ElementType() reflect.Type {
   235  	return reflect.TypeOf((**KeyvaluestoreKey)(nil)).Elem()
   236  }
   237  
   238  func (o KeyvaluestoreKeyOutput) ToKeyvaluestoreKeyOutput() KeyvaluestoreKeyOutput {
   239  	return o
   240  }
   241  
   242  func (o KeyvaluestoreKeyOutput) ToKeyvaluestoreKeyOutputWithContext(ctx context.Context) KeyvaluestoreKeyOutput {
   243  	return o
   244  }
   245  
   246  // Key to put.
   247  func (o KeyvaluestoreKeyOutput) Key() pulumi.StringOutput {
   248  	return o.ApplyT(func(v *KeyvaluestoreKey) pulumi.StringOutput { return v.Key }).(pulumi.StringOutput)
   249  }
   250  
   251  // Amazon Resource Name (ARN) of the Key Value Store.
   252  func (o KeyvaluestoreKeyOutput) KeyValueStoreArn() pulumi.StringOutput {
   253  	return o.ApplyT(func(v *KeyvaluestoreKey) pulumi.StringOutput { return v.KeyValueStoreArn }).(pulumi.StringOutput)
   254  }
   255  
   256  // Total size of the Key Value Store in bytes.
   257  func (o KeyvaluestoreKeyOutput) TotalSizeInBytes() pulumi.IntOutput {
   258  	return o.ApplyT(func(v *KeyvaluestoreKey) pulumi.IntOutput { return v.TotalSizeInBytes }).(pulumi.IntOutput)
   259  }
   260  
   261  // Value to put.
   262  func (o KeyvaluestoreKeyOutput) Value() pulumi.StringOutput {
   263  	return o.ApplyT(func(v *KeyvaluestoreKey) pulumi.StringOutput { return v.Value }).(pulumi.StringOutput)
   264  }
   265  
   266  type KeyvaluestoreKeyArrayOutput struct{ *pulumi.OutputState }
   267  
   268  func (KeyvaluestoreKeyArrayOutput) ElementType() reflect.Type {
   269  	return reflect.TypeOf((*[]*KeyvaluestoreKey)(nil)).Elem()
   270  }
   271  
   272  func (o KeyvaluestoreKeyArrayOutput) ToKeyvaluestoreKeyArrayOutput() KeyvaluestoreKeyArrayOutput {
   273  	return o
   274  }
   275  
   276  func (o KeyvaluestoreKeyArrayOutput) ToKeyvaluestoreKeyArrayOutputWithContext(ctx context.Context) KeyvaluestoreKeyArrayOutput {
   277  	return o
   278  }
   279  
   280  func (o KeyvaluestoreKeyArrayOutput) Index(i pulumi.IntInput) KeyvaluestoreKeyOutput {
   281  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *KeyvaluestoreKey {
   282  		return vs[0].([]*KeyvaluestoreKey)[vs[1].(int)]
   283  	}).(KeyvaluestoreKeyOutput)
   284  }
   285  
   286  type KeyvaluestoreKeyMapOutput struct{ *pulumi.OutputState }
   287  
   288  func (KeyvaluestoreKeyMapOutput) ElementType() reflect.Type {
   289  	return reflect.TypeOf((*map[string]*KeyvaluestoreKey)(nil)).Elem()
   290  }
   291  
   292  func (o KeyvaluestoreKeyMapOutput) ToKeyvaluestoreKeyMapOutput() KeyvaluestoreKeyMapOutput {
   293  	return o
   294  }
   295  
   296  func (o KeyvaluestoreKeyMapOutput) ToKeyvaluestoreKeyMapOutputWithContext(ctx context.Context) KeyvaluestoreKeyMapOutput {
   297  	return o
   298  }
   299  
   300  func (o KeyvaluestoreKeyMapOutput) MapIndex(k pulumi.StringInput) KeyvaluestoreKeyOutput {
   301  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *KeyvaluestoreKey {
   302  		return vs[0].(map[string]*KeyvaluestoreKey)[vs[1].(string)]
   303  	}).(KeyvaluestoreKeyOutput)
   304  }
   305  
   306  func init() {
   307  	pulumi.RegisterInputType(reflect.TypeOf((*KeyvaluestoreKeyInput)(nil)).Elem(), &KeyvaluestoreKey{})
   308  	pulumi.RegisterInputType(reflect.TypeOf((*KeyvaluestoreKeyArrayInput)(nil)).Elem(), KeyvaluestoreKeyArray{})
   309  	pulumi.RegisterInputType(reflect.TypeOf((*KeyvaluestoreKeyMapInput)(nil)).Elem(), KeyvaluestoreKeyMap{})
   310  	pulumi.RegisterOutputType(KeyvaluestoreKeyOutput{})
   311  	pulumi.RegisterOutputType(KeyvaluestoreKeyArrayOutput{})
   312  	pulumi.RegisterOutputType(KeyvaluestoreKeyMapOutput{})
   313  }