github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/lightsail/bucketAccessKey.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 lightsail
     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  // Provides a lightsail bucket access key. This is a set of credentials that allow API requests to be made to the lightsail bucket.
    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"
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lightsail"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			_, err := lightsail.NewBucket(ctx, "test", &lightsail.BucketArgs{
    34  //				Name:     pulumi.String("mytestbucket"),
    35  //				BundleId: pulumi.String("small_1_0"),
    36  //			})
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			_, err = aws.NewLightsailBucketAccessKeyAccessKey(ctx, "test", &aws.LightsailBucketAccessKeyAccessKeyArgs{
    41  //				BucketName: testAwsLightsailBucketAccessKey.Id,
    42  //			})
    43  //			if err != nil {
    44  //				return err
    45  //			}
    46  //			return nil
    47  //		})
    48  //	}
    49  //
    50  // ```
    51  // <!--End PulumiCodeChooser -->
    52  //
    53  // ## Import
    54  //
    55  // Using `pulumi import`, import `aws_lightsail_bucket_access_key` using the `id` attribute. For example:
    56  //
    57  // ```sh
    58  // $ pulumi import aws:lightsail/bucketAccessKey:BucketAccessKey test example-bucket,AKIAIOSFODNN7EXAMPLE
    59  // ```
    60  type BucketAccessKey struct {
    61  	pulumi.CustomResourceState
    62  
    63  	// The ID of the access key.
    64  	AccessKeyId pulumi.StringOutput `pulumi:"accessKeyId"`
    65  	// The name of the bucket that the new access key will belong to, and grant access to.
    66  	BucketName pulumi.StringOutput `pulumi:"bucketName"`
    67  	// The timestamp when the access key was created.
    68  	CreatedAt pulumi.StringOutput `pulumi:"createdAt"`
    69  	// The secret access key used to sign requests. This attribute is not available for imported resources. Note that this will be written to the state file.
    70  	SecretAccessKey pulumi.StringOutput `pulumi:"secretAccessKey"`
    71  	// The status of the access key.
    72  	Status pulumi.StringOutput `pulumi:"status"`
    73  }
    74  
    75  // NewBucketAccessKey registers a new resource with the given unique name, arguments, and options.
    76  func NewBucketAccessKey(ctx *pulumi.Context,
    77  	name string, args *BucketAccessKeyArgs, opts ...pulumi.ResourceOption) (*BucketAccessKey, error) {
    78  	if args == nil {
    79  		return nil, errors.New("missing one or more required arguments")
    80  	}
    81  
    82  	if args.BucketName == nil {
    83  		return nil, errors.New("invalid value for required argument 'BucketName'")
    84  	}
    85  	opts = internal.PkgResourceDefaultOpts(opts)
    86  	var resource BucketAccessKey
    87  	err := ctx.RegisterResource("aws:lightsail/bucketAccessKey:BucketAccessKey", name, args, &resource, opts...)
    88  	if err != nil {
    89  		return nil, err
    90  	}
    91  	return &resource, nil
    92  }
    93  
    94  // GetBucketAccessKey gets an existing BucketAccessKey resource's state with the given name, ID, and optional
    95  // state properties that are used to uniquely qualify the lookup (nil if not required).
    96  func GetBucketAccessKey(ctx *pulumi.Context,
    97  	name string, id pulumi.IDInput, state *BucketAccessKeyState, opts ...pulumi.ResourceOption) (*BucketAccessKey, error) {
    98  	var resource BucketAccessKey
    99  	err := ctx.ReadResource("aws:lightsail/bucketAccessKey:BucketAccessKey", name, id, state, &resource, opts...)
   100  	if err != nil {
   101  		return nil, err
   102  	}
   103  	return &resource, nil
   104  }
   105  
   106  // Input properties used for looking up and filtering BucketAccessKey resources.
   107  type bucketAccessKeyState struct {
   108  	// The ID of the access key.
   109  	AccessKeyId *string `pulumi:"accessKeyId"`
   110  	// The name of the bucket that the new access key will belong to, and grant access to.
   111  	BucketName *string `pulumi:"bucketName"`
   112  	// The timestamp when the access key was created.
   113  	CreatedAt *string `pulumi:"createdAt"`
   114  	// The secret access key used to sign requests. This attribute is not available for imported resources. Note that this will be written to the state file.
   115  	SecretAccessKey *string `pulumi:"secretAccessKey"`
   116  	// The status of the access key.
   117  	Status *string `pulumi:"status"`
   118  }
   119  
   120  type BucketAccessKeyState struct {
   121  	// The ID of the access key.
   122  	AccessKeyId pulumi.StringPtrInput
   123  	// The name of the bucket that the new access key will belong to, and grant access to.
   124  	BucketName pulumi.StringPtrInput
   125  	// The timestamp when the access key was created.
   126  	CreatedAt pulumi.StringPtrInput
   127  	// The secret access key used to sign requests. This attribute is not available for imported resources. Note that this will be written to the state file.
   128  	SecretAccessKey pulumi.StringPtrInput
   129  	// The status of the access key.
   130  	Status pulumi.StringPtrInput
   131  }
   132  
   133  func (BucketAccessKeyState) ElementType() reflect.Type {
   134  	return reflect.TypeOf((*bucketAccessKeyState)(nil)).Elem()
   135  }
   136  
   137  type bucketAccessKeyArgs struct {
   138  	// The name of the bucket that the new access key will belong to, and grant access to.
   139  	BucketName string `pulumi:"bucketName"`
   140  }
   141  
   142  // The set of arguments for constructing a BucketAccessKey resource.
   143  type BucketAccessKeyArgs struct {
   144  	// The name of the bucket that the new access key will belong to, and grant access to.
   145  	BucketName pulumi.StringInput
   146  }
   147  
   148  func (BucketAccessKeyArgs) ElementType() reflect.Type {
   149  	return reflect.TypeOf((*bucketAccessKeyArgs)(nil)).Elem()
   150  }
   151  
   152  type BucketAccessKeyInput interface {
   153  	pulumi.Input
   154  
   155  	ToBucketAccessKeyOutput() BucketAccessKeyOutput
   156  	ToBucketAccessKeyOutputWithContext(ctx context.Context) BucketAccessKeyOutput
   157  }
   158  
   159  func (*BucketAccessKey) ElementType() reflect.Type {
   160  	return reflect.TypeOf((**BucketAccessKey)(nil)).Elem()
   161  }
   162  
   163  func (i *BucketAccessKey) ToBucketAccessKeyOutput() BucketAccessKeyOutput {
   164  	return i.ToBucketAccessKeyOutputWithContext(context.Background())
   165  }
   166  
   167  func (i *BucketAccessKey) ToBucketAccessKeyOutputWithContext(ctx context.Context) BucketAccessKeyOutput {
   168  	return pulumi.ToOutputWithContext(ctx, i).(BucketAccessKeyOutput)
   169  }
   170  
   171  // BucketAccessKeyArrayInput is an input type that accepts BucketAccessKeyArray and BucketAccessKeyArrayOutput values.
   172  // You can construct a concrete instance of `BucketAccessKeyArrayInput` via:
   173  //
   174  //	BucketAccessKeyArray{ BucketAccessKeyArgs{...} }
   175  type BucketAccessKeyArrayInput interface {
   176  	pulumi.Input
   177  
   178  	ToBucketAccessKeyArrayOutput() BucketAccessKeyArrayOutput
   179  	ToBucketAccessKeyArrayOutputWithContext(context.Context) BucketAccessKeyArrayOutput
   180  }
   181  
   182  type BucketAccessKeyArray []BucketAccessKeyInput
   183  
   184  func (BucketAccessKeyArray) ElementType() reflect.Type {
   185  	return reflect.TypeOf((*[]*BucketAccessKey)(nil)).Elem()
   186  }
   187  
   188  func (i BucketAccessKeyArray) ToBucketAccessKeyArrayOutput() BucketAccessKeyArrayOutput {
   189  	return i.ToBucketAccessKeyArrayOutputWithContext(context.Background())
   190  }
   191  
   192  func (i BucketAccessKeyArray) ToBucketAccessKeyArrayOutputWithContext(ctx context.Context) BucketAccessKeyArrayOutput {
   193  	return pulumi.ToOutputWithContext(ctx, i).(BucketAccessKeyArrayOutput)
   194  }
   195  
   196  // BucketAccessKeyMapInput is an input type that accepts BucketAccessKeyMap and BucketAccessKeyMapOutput values.
   197  // You can construct a concrete instance of `BucketAccessKeyMapInput` via:
   198  //
   199  //	BucketAccessKeyMap{ "key": BucketAccessKeyArgs{...} }
   200  type BucketAccessKeyMapInput interface {
   201  	pulumi.Input
   202  
   203  	ToBucketAccessKeyMapOutput() BucketAccessKeyMapOutput
   204  	ToBucketAccessKeyMapOutputWithContext(context.Context) BucketAccessKeyMapOutput
   205  }
   206  
   207  type BucketAccessKeyMap map[string]BucketAccessKeyInput
   208  
   209  func (BucketAccessKeyMap) ElementType() reflect.Type {
   210  	return reflect.TypeOf((*map[string]*BucketAccessKey)(nil)).Elem()
   211  }
   212  
   213  func (i BucketAccessKeyMap) ToBucketAccessKeyMapOutput() BucketAccessKeyMapOutput {
   214  	return i.ToBucketAccessKeyMapOutputWithContext(context.Background())
   215  }
   216  
   217  func (i BucketAccessKeyMap) ToBucketAccessKeyMapOutputWithContext(ctx context.Context) BucketAccessKeyMapOutput {
   218  	return pulumi.ToOutputWithContext(ctx, i).(BucketAccessKeyMapOutput)
   219  }
   220  
   221  type BucketAccessKeyOutput struct{ *pulumi.OutputState }
   222  
   223  func (BucketAccessKeyOutput) ElementType() reflect.Type {
   224  	return reflect.TypeOf((**BucketAccessKey)(nil)).Elem()
   225  }
   226  
   227  func (o BucketAccessKeyOutput) ToBucketAccessKeyOutput() BucketAccessKeyOutput {
   228  	return o
   229  }
   230  
   231  func (o BucketAccessKeyOutput) ToBucketAccessKeyOutputWithContext(ctx context.Context) BucketAccessKeyOutput {
   232  	return o
   233  }
   234  
   235  // The ID of the access key.
   236  func (o BucketAccessKeyOutput) AccessKeyId() pulumi.StringOutput {
   237  	return o.ApplyT(func(v *BucketAccessKey) pulumi.StringOutput { return v.AccessKeyId }).(pulumi.StringOutput)
   238  }
   239  
   240  // The name of the bucket that the new access key will belong to, and grant access to.
   241  func (o BucketAccessKeyOutput) BucketName() pulumi.StringOutput {
   242  	return o.ApplyT(func(v *BucketAccessKey) pulumi.StringOutput { return v.BucketName }).(pulumi.StringOutput)
   243  }
   244  
   245  // The timestamp when the access key was created.
   246  func (o BucketAccessKeyOutput) CreatedAt() pulumi.StringOutput {
   247  	return o.ApplyT(func(v *BucketAccessKey) pulumi.StringOutput { return v.CreatedAt }).(pulumi.StringOutput)
   248  }
   249  
   250  // The secret access key used to sign requests. This attribute is not available for imported resources. Note that this will be written to the state file.
   251  func (o BucketAccessKeyOutput) SecretAccessKey() pulumi.StringOutput {
   252  	return o.ApplyT(func(v *BucketAccessKey) pulumi.StringOutput { return v.SecretAccessKey }).(pulumi.StringOutput)
   253  }
   254  
   255  // The status of the access key.
   256  func (o BucketAccessKeyOutput) Status() pulumi.StringOutput {
   257  	return o.ApplyT(func(v *BucketAccessKey) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
   258  }
   259  
   260  type BucketAccessKeyArrayOutput struct{ *pulumi.OutputState }
   261  
   262  func (BucketAccessKeyArrayOutput) ElementType() reflect.Type {
   263  	return reflect.TypeOf((*[]*BucketAccessKey)(nil)).Elem()
   264  }
   265  
   266  func (o BucketAccessKeyArrayOutput) ToBucketAccessKeyArrayOutput() BucketAccessKeyArrayOutput {
   267  	return o
   268  }
   269  
   270  func (o BucketAccessKeyArrayOutput) ToBucketAccessKeyArrayOutputWithContext(ctx context.Context) BucketAccessKeyArrayOutput {
   271  	return o
   272  }
   273  
   274  func (o BucketAccessKeyArrayOutput) Index(i pulumi.IntInput) BucketAccessKeyOutput {
   275  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *BucketAccessKey {
   276  		return vs[0].([]*BucketAccessKey)[vs[1].(int)]
   277  	}).(BucketAccessKeyOutput)
   278  }
   279  
   280  type BucketAccessKeyMapOutput struct{ *pulumi.OutputState }
   281  
   282  func (BucketAccessKeyMapOutput) ElementType() reflect.Type {
   283  	return reflect.TypeOf((*map[string]*BucketAccessKey)(nil)).Elem()
   284  }
   285  
   286  func (o BucketAccessKeyMapOutput) ToBucketAccessKeyMapOutput() BucketAccessKeyMapOutput {
   287  	return o
   288  }
   289  
   290  func (o BucketAccessKeyMapOutput) ToBucketAccessKeyMapOutputWithContext(ctx context.Context) BucketAccessKeyMapOutput {
   291  	return o
   292  }
   293  
   294  func (o BucketAccessKeyMapOutput) MapIndex(k pulumi.StringInput) BucketAccessKeyOutput {
   295  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *BucketAccessKey {
   296  		return vs[0].(map[string]*BucketAccessKey)[vs[1].(string)]
   297  	}).(BucketAccessKeyOutput)
   298  }
   299  
   300  func init() {
   301  	pulumi.RegisterInputType(reflect.TypeOf((*BucketAccessKeyInput)(nil)).Elem(), &BucketAccessKey{})
   302  	pulumi.RegisterInputType(reflect.TypeOf((*BucketAccessKeyArrayInput)(nil)).Elem(), BucketAccessKeyArray{})
   303  	pulumi.RegisterInputType(reflect.TypeOf((*BucketAccessKeyMapInput)(nil)).Elem(), BucketAccessKeyMap{})
   304  	pulumi.RegisterOutputType(BucketAccessKeyOutput{})
   305  	pulumi.RegisterOutputType(BucketAccessKeyArrayOutput{})
   306  	pulumi.RegisterOutputType(BucketAccessKeyMapOutput{})
   307  }