github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/storagegateway/uploadBuffer.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 storagegateway
     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  // Manages an AWS Storage Gateway upload buffer.
    16  //
    17  // > **NOTE:** The Storage Gateway API provides no method to remove an upload buffer disk. Destroying this resource does not perform any Storage Gateway actions.
    18  //
    19  // ## Example Usage
    20  //
    21  // ### Cached and VTL Gateway Type
    22  //
    23  // <!--Start PulumiCodeChooser -->
    24  // ```go
    25  // package main
    26  //
    27  // import (
    28  //
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/storagegateway"
    30  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    31  //
    32  // )
    33  //
    34  //	func main() {
    35  //		pulumi.Run(func(ctx *pulumi.Context) error {
    36  //			test, err := storagegateway.GetLocalDisk(ctx, &storagegateway.GetLocalDiskArgs{
    37  //				DiskNode:   pulumi.StringRef(testAwsVolumeAttachment.DeviceName),
    38  //				GatewayArn: testAwsStoragegatewayGateway.Arn,
    39  //			}, nil)
    40  //			if err != nil {
    41  //				return err
    42  //			}
    43  //			_, err = storagegateway.NewUploadBuffer(ctx, "test", &storagegateway.UploadBufferArgs{
    44  //				DiskPath:   pulumi.String(test.DiskPath),
    45  //				GatewayArn: pulumi.Any(testAwsStoragegatewayGateway.Arn),
    46  //			})
    47  //			if err != nil {
    48  //				return err
    49  //			}
    50  //			return nil
    51  //		})
    52  //	}
    53  //
    54  // ```
    55  // <!--End PulumiCodeChooser -->
    56  //
    57  // ### Stored Gateway Type
    58  //
    59  // <!--Start PulumiCodeChooser -->
    60  // ```go
    61  // package main
    62  //
    63  // import (
    64  //
    65  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/storagegateway"
    66  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    67  //
    68  // )
    69  //
    70  //	func main() {
    71  //		pulumi.Run(func(ctx *pulumi.Context) error {
    72  //			_, err := storagegateway.GetLocalDisk(ctx, &storagegateway.GetLocalDiskArgs{
    73  //				DiskNode:   pulumi.StringRef(testAwsVolumeAttachment.DeviceName),
    74  //				GatewayArn: testAwsStoragegatewayGateway.Arn,
    75  //			}, nil)
    76  //			if err != nil {
    77  //				return err
    78  //			}
    79  //			_, err = storagegateway.NewUploadBuffer(ctx, "example", &storagegateway.UploadBufferArgs{
    80  //				DiskId:     pulumi.Any(exampleAwsStoragegatewayLocalDisk.Id),
    81  //				GatewayArn: pulumi.Any(exampleAwsStoragegatewayGateway.Arn),
    82  //			})
    83  //			if err != nil {
    84  //				return err
    85  //			}
    86  //			return nil
    87  //		})
    88  //	}
    89  //
    90  // ```
    91  // <!--End PulumiCodeChooser -->
    92  //
    93  // ## Import
    94  //
    95  // Using `pulumi import`, import `aws_storagegateway_upload_buffer` using the gateway Amazon Resource Name (ARN) and local disk identifier separated with a colon (`:`). For example:
    96  //
    97  // ```sh
    98  // $ pulumi import aws:storagegateway/uploadBuffer:UploadBuffer example arn:aws:storagegateway:us-east-1:123456789012:gateway/sgw-12345678:pci-0000:03:00.0-scsi-0:0:0:0
    99  // ```
   100  type UploadBuffer struct {
   101  	pulumi.CustomResourceState
   102  
   103  	// Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`.
   104  	DiskId pulumi.StringOutput `pulumi:"diskId"`
   105  	// Local disk path. For example, `/dev/nvme1n1`.
   106  	DiskPath pulumi.StringOutput `pulumi:"diskPath"`
   107  	// The Amazon Resource Name (ARN) of the gateway.
   108  	GatewayArn pulumi.StringOutput `pulumi:"gatewayArn"`
   109  }
   110  
   111  // NewUploadBuffer registers a new resource with the given unique name, arguments, and options.
   112  func NewUploadBuffer(ctx *pulumi.Context,
   113  	name string, args *UploadBufferArgs, opts ...pulumi.ResourceOption) (*UploadBuffer, error) {
   114  	if args == nil {
   115  		return nil, errors.New("missing one or more required arguments")
   116  	}
   117  
   118  	if args.GatewayArn == nil {
   119  		return nil, errors.New("invalid value for required argument 'GatewayArn'")
   120  	}
   121  	opts = internal.PkgResourceDefaultOpts(opts)
   122  	var resource UploadBuffer
   123  	err := ctx.RegisterResource("aws:storagegateway/uploadBuffer:UploadBuffer", name, args, &resource, opts...)
   124  	if err != nil {
   125  		return nil, err
   126  	}
   127  	return &resource, nil
   128  }
   129  
   130  // GetUploadBuffer gets an existing UploadBuffer resource's state with the given name, ID, and optional
   131  // state properties that are used to uniquely qualify the lookup (nil if not required).
   132  func GetUploadBuffer(ctx *pulumi.Context,
   133  	name string, id pulumi.IDInput, state *UploadBufferState, opts ...pulumi.ResourceOption) (*UploadBuffer, error) {
   134  	var resource UploadBuffer
   135  	err := ctx.ReadResource("aws:storagegateway/uploadBuffer:UploadBuffer", name, id, state, &resource, opts...)
   136  	if err != nil {
   137  		return nil, err
   138  	}
   139  	return &resource, nil
   140  }
   141  
   142  // Input properties used for looking up and filtering UploadBuffer resources.
   143  type uploadBufferState struct {
   144  	// Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`.
   145  	DiskId *string `pulumi:"diskId"`
   146  	// Local disk path. For example, `/dev/nvme1n1`.
   147  	DiskPath *string `pulumi:"diskPath"`
   148  	// The Amazon Resource Name (ARN) of the gateway.
   149  	GatewayArn *string `pulumi:"gatewayArn"`
   150  }
   151  
   152  type UploadBufferState struct {
   153  	// Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`.
   154  	DiskId pulumi.StringPtrInput
   155  	// Local disk path. For example, `/dev/nvme1n1`.
   156  	DiskPath pulumi.StringPtrInput
   157  	// The Amazon Resource Name (ARN) of the gateway.
   158  	GatewayArn pulumi.StringPtrInput
   159  }
   160  
   161  func (UploadBufferState) ElementType() reflect.Type {
   162  	return reflect.TypeOf((*uploadBufferState)(nil)).Elem()
   163  }
   164  
   165  type uploadBufferArgs struct {
   166  	// Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`.
   167  	DiskId *string `pulumi:"diskId"`
   168  	// Local disk path. For example, `/dev/nvme1n1`.
   169  	DiskPath *string `pulumi:"diskPath"`
   170  	// The Amazon Resource Name (ARN) of the gateway.
   171  	GatewayArn string `pulumi:"gatewayArn"`
   172  }
   173  
   174  // The set of arguments for constructing a UploadBuffer resource.
   175  type UploadBufferArgs struct {
   176  	// Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`.
   177  	DiskId pulumi.StringPtrInput
   178  	// Local disk path. For example, `/dev/nvme1n1`.
   179  	DiskPath pulumi.StringPtrInput
   180  	// The Amazon Resource Name (ARN) of the gateway.
   181  	GatewayArn pulumi.StringInput
   182  }
   183  
   184  func (UploadBufferArgs) ElementType() reflect.Type {
   185  	return reflect.TypeOf((*uploadBufferArgs)(nil)).Elem()
   186  }
   187  
   188  type UploadBufferInput interface {
   189  	pulumi.Input
   190  
   191  	ToUploadBufferOutput() UploadBufferOutput
   192  	ToUploadBufferOutputWithContext(ctx context.Context) UploadBufferOutput
   193  }
   194  
   195  func (*UploadBuffer) ElementType() reflect.Type {
   196  	return reflect.TypeOf((**UploadBuffer)(nil)).Elem()
   197  }
   198  
   199  func (i *UploadBuffer) ToUploadBufferOutput() UploadBufferOutput {
   200  	return i.ToUploadBufferOutputWithContext(context.Background())
   201  }
   202  
   203  func (i *UploadBuffer) ToUploadBufferOutputWithContext(ctx context.Context) UploadBufferOutput {
   204  	return pulumi.ToOutputWithContext(ctx, i).(UploadBufferOutput)
   205  }
   206  
   207  // UploadBufferArrayInput is an input type that accepts UploadBufferArray and UploadBufferArrayOutput values.
   208  // You can construct a concrete instance of `UploadBufferArrayInput` via:
   209  //
   210  //	UploadBufferArray{ UploadBufferArgs{...} }
   211  type UploadBufferArrayInput interface {
   212  	pulumi.Input
   213  
   214  	ToUploadBufferArrayOutput() UploadBufferArrayOutput
   215  	ToUploadBufferArrayOutputWithContext(context.Context) UploadBufferArrayOutput
   216  }
   217  
   218  type UploadBufferArray []UploadBufferInput
   219  
   220  func (UploadBufferArray) ElementType() reflect.Type {
   221  	return reflect.TypeOf((*[]*UploadBuffer)(nil)).Elem()
   222  }
   223  
   224  func (i UploadBufferArray) ToUploadBufferArrayOutput() UploadBufferArrayOutput {
   225  	return i.ToUploadBufferArrayOutputWithContext(context.Background())
   226  }
   227  
   228  func (i UploadBufferArray) ToUploadBufferArrayOutputWithContext(ctx context.Context) UploadBufferArrayOutput {
   229  	return pulumi.ToOutputWithContext(ctx, i).(UploadBufferArrayOutput)
   230  }
   231  
   232  // UploadBufferMapInput is an input type that accepts UploadBufferMap and UploadBufferMapOutput values.
   233  // You can construct a concrete instance of `UploadBufferMapInput` via:
   234  //
   235  //	UploadBufferMap{ "key": UploadBufferArgs{...} }
   236  type UploadBufferMapInput interface {
   237  	pulumi.Input
   238  
   239  	ToUploadBufferMapOutput() UploadBufferMapOutput
   240  	ToUploadBufferMapOutputWithContext(context.Context) UploadBufferMapOutput
   241  }
   242  
   243  type UploadBufferMap map[string]UploadBufferInput
   244  
   245  func (UploadBufferMap) ElementType() reflect.Type {
   246  	return reflect.TypeOf((*map[string]*UploadBuffer)(nil)).Elem()
   247  }
   248  
   249  func (i UploadBufferMap) ToUploadBufferMapOutput() UploadBufferMapOutput {
   250  	return i.ToUploadBufferMapOutputWithContext(context.Background())
   251  }
   252  
   253  func (i UploadBufferMap) ToUploadBufferMapOutputWithContext(ctx context.Context) UploadBufferMapOutput {
   254  	return pulumi.ToOutputWithContext(ctx, i).(UploadBufferMapOutput)
   255  }
   256  
   257  type UploadBufferOutput struct{ *pulumi.OutputState }
   258  
   259  func (UploadBufferOutput) ElementType() reflect.Type {
   260  	return reflect.TypeOf((**UploadBuffer)(nil)).Elem()
   261  }
   262  
   263  func (o UploadBufferOutput) ToUploadBufferOutput() UploadBufferOutput {
   264  	return o
   265  }
   266  
   267  func (o UploadBufferOutput) ToUploadBufferOutputWithContext(ctx context.Context) UploadBufferOutput {
   268  	return o
   269  }
   270  
   271  // Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`.
   272  func (o UploadBufferOutput) DiskId() pulumi.StringOutput {
   273  	return o.ApplyT(func(v *UploadBuffer) pulumi.StringOutput { return v.DiskId }).(pulumi.StringOutput)
   274  }
   275  
   276  // Local disk path. For example, `/dev/nvme1n1`.
   277  func (o UploadBufferOutput) DiskPath() pulumi.StringOutput {
   278  	return o.ApplyT(func(v *UploadBuffer) pulumi.StringOutput { return v.DiskPath }).(pulumi.StringOutput)
   279  }
   280  
   281  // The Amazon Resource Name (ARN) of the gateway.
   282  func (o UploadBufferOutput) GatewayArn() pulumi.StringOutput {
   283  	return o.ApplyT(func(v *UploadBuffer) pulumi.StringOutput { return v.GatewayArn }).(pulumi.StringOutput)
   284  }
   285  
   286  type UploadBufferArrayOutput struct{ *pulumi.OutputState }
   287  
   288  func (UploadBufferArrayOutput) ElementType() reflect.Type {
   289  	return reflect.TypeOf((*[]*UploadBuffer)(nil)).Elem()
   290  }
   291  
   292  func (o UploadBufferArrayOutput) ToUploadBufferArrayOutput() UploadBufferArrayOutput {
   293  	return o
   294  }
   295  
   296  func (o UploadBufferArrayOutput) ToUploadBufferArrayOutputWithContext(ctx context.Context) UploadBufferArrayOutput {
   297  	return o
   298  }
   299  
   300  func (o UploadBufferArrayOutput) Index(i pulumi.IntInput) UploadBufferOutput {
   301  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *UploadBuffer {
   302  		return vs[0].([]*UploadBuffer)[vs[1].(int)]
   303  	}).(UploadBufferOutput)
   304  }
   305  
   306  type UploadBufferMapOutput struct{ *pulumi.OutputState }
   307  
   308  func (UploadBufferMapOutput) ElementType() reflect.Type {
   309  	return reflect.TypeOf((*map[string]*UploadBuffer)(nil)).Elem()
   310  }
   311  
   312  func (o UploadBufferMapOutput) ToUploadBufferMapOutput() UploadBufferMapOutput {
   313  	return o
   314  }
   315  
   316  func (o UploadBufferMapOutput) ToUploadBufferMapOutputWithContext(ctx context.Context) UploadBufferMapOutput {
   317  	return o
   318  }
   319  
   320  func (o UploadBufferMapOutput) MapIndex(k pulumi.StringInput) UploadBufferOutput {
   321  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *UploadBuffer {
   322  		return vs[0].(map[string]*UploadBuffer)[vs[1].(string)]
   323  	}).(UploadBufferOutput)
   324  }
   325  
   326  func init() {
   327  	pulumi.RegisterInputType(reflect.TypeOf((*UploadBufferInput)(nil)).Elem(), &UploadBuffer{})
   328  	pulumi.RegisterInputType(reflect.TypeOf((*UploadBufferArrayInput)(nil)).Elem(), UploadBufferArray{})
   329  	pulumi.RegisterInputType(reflect.TypeOf((*UploadBufferMapInput)(nil)).Elem(), UploadBufferMap{})
   330  	pulumi.RegisterOutputType(UploadBufferOutput{})
   331  	pulumi.RegisterOutputType(UploadBufferArrayOutput{})
   332  	pulumi.RegisterOutputType(UploadBufferMapOutput{})
   333  }