github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/storagegateway/workingStorage.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 working storage.
    16  //
    17  // > **NOTE:** The Storage Gateway API provides no method to remove a working storage disk. Destroying this resource does not perform any Storage Gateway actions.
    18  //
    19  // ## Example Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/storagegateway"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := storagegateway.NewWorkingStorage(ctx, "example", &storagegateway.WorkingStorageArgs{
    35  //				DiskId:     pulumi.Any(exampleAwsStoragegatewayLocalDisk.Id),
    36  //				GatewayArn: pulumi.Any(exampleAwsStoragegatewayGateway.Arn),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			return nil
    42  //		})
    43  //	}
    44  //
    45  // ```
    46  // <!--End PulumiCodeChooser -->
    47  //
    48  // ## Import
    49  //
    50  // Using `pulumi import`, import `aws_storagegateway_working_storage` using the gateway Amazon Resource Name (ARN) and local disk identifier separated with a colon (`:`). For example:
    51  //
    52  // ```sh
    53  // $ pulumi import aws:storagegateway/workingStorage:WorkingStorage example arn:aws:storagegateway:us-east-1:123456789012:gateway/sgw-12345678:pci-0000:03:00.0-scsi-0:0:0:0
    54  // ```
    55  type WorkingStorage struct {
    56  	pulumi.CustomResourceState
    57  
    58  	// Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`.
    59  	DiskId pulumi.StringOutput `pulumi:"diskId"`
    60  	// The Amazon Resource Name (ARN) of the gateway.
    61  	GatewayArn pulumi.StringOutput `pulumi:"gatewayArn"`
    62  }
    63  
    64  // NewWorkingStorage registers a new resource with the given unique name, arguments, and options.
    65  func NewWorkingStorage(ctx *pulumi.Context,
    66  	name string, args *WorkingStorageArgs, opts ...pulumi.ResourceOption) (*WorkingStorage, error) {
    67  	if args == nil {
    68  		return nil, errors.New("missing one or more required arguments")
    69  	}
    70  
    71  	if args.DiskId == nil {
    72  		return nil, errors.New("invalid value for required argument 'DiskId'")
    73  	}
    74  	if args.GatewayArn == nil {
    75  		return nil, errors.New("invalid value for required argument 'GatewayArn'")
    76  	}
    77  	opts = internal.PkgResourceDefaultOpts(opts)
    78  	var resource WorkingStorage
    79  	err := ctx.RegisterResource("aws:storagegateway/workingStorage:WorkingStorage", name, args, &resource, opts...)
    80  	if err != nil {
    81  		return nil, err
    82  	}
    83  	return &resource, nil
    84  }
    85  
    86  // GetWorkingStorage gets an existing WorkingStorage resource's state with the given name, ID, and optional
    87  // state properties that are used to uniquely qualify the lookup (nil if not required).
    88  func GetWorkingStorage(ctx *pulumi.Context,
    89  	name string, id pulumi.IDInput, state *WorkingStorageState, opts ...pulumi.ResourceOption) (*WorkingStorage, error) {
    90  	var resource WorkingStorage
    91  	err := ctx.ReadResource("aws:storagegateway/workingStorage:WorkingStorage", name, id, state, &resource, opts...)
    92  	if err != nil {
    93  		return nil, err
    94  	}
    95  	return &resource, nil
    96  }
    97  
    98  // Input properties used for looking up and filtering WorkingStorage resources.
    99  type workingStorageState struct {
   100  	// Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`.
   101  	DiskId *string `pulumi:"diskId"`
   102  	// The Amazon Resource Name (ARN) of the gateway.
   103  	GatewayArn *string `pulumi:"gatewayArn"`
   104  }
   105  
   106  type WorkingStorageState struct {
   107  	// Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`.
   108  	DiskId pulumi.StringPtrInput
   109  	// The Amazon Resource Name (ARN) of the gateway.
   110  	GatewayArn pulumi.StringPtrInput
   111  }
   112  
   113  func (WorkingStorageState) ElementType() reflect.Type {
   114  	return reflect.TypeOf((*workingStorageState)(nil)).Elem()
   115  }
   116  
   117  type workingStorageArgs struct {
   118  	// Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`.
   119  	DiskId string `pulumi:"diskId"`
   120  	// The Amazon Resource Name (ARN) of the gateway.
   121  	GatewayArn string `pulumi:"gatewayArn"`
   122  }
   123  
   124  // The set of arguments for constructing a WorkingStorage resource.
   125  type WorkingStorageArgs struct {
   126  	// Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`.
   127  	DiskId pulumi.StringInput
   128  	// The Amazon Resource Name (ARN) of the gateway.
   129  	GatewayArn pulumi.StringInput
   130  }
   131  
   132  func (WorkingStorageArgs) ElementType() reflect.Type {
   133  	return reflect.TypeOf((*workingStorageArgs)(nil)).Elem()
   134  }
   135  
   136  type WorkingStorageInput interface {
   137  	pulumi.Input
   138  
   139  	ToWorkingStorageOutput() WorkingStorageOutput
   140  	ToWorkingStorageOutputWithContext(ctx context.Context) WorkingStorageOutput
   141  }
   142  
   143  func (*WorkingStorage) ElementType() reflect.Type {
   144  	return reflect.TypeOf((**WorkingStorage)(nil)).Elem()
   145  }
   146  
   147  func (i *WorkingStorage) ToWorkingStorageOutput() WorkingStorageOutput {
   148  	return i.ToWorkingStorageOutputWithContext(context.Background())
   149  }
   150  
   151  func (i *WorkingStorage) ToWorkingStorageOutputWithContext(ctx context.Context) WorkingStorageOutput {
   152  	return pulumi.ToOutputWithContext(ctx, i).(WorkingStorageOutput)
   153  }
   154  
   155  // WorkingStorageArrayInput is an input type that accepts WorkingStorageArray and WorkingStorageArrayOutput values.
   156  // You can construct a concrete instance of `WorkingStorageArrayInput` via:
   157  //
   158  //	WorkingStorageArray{ WorkingStorageArgs{...} }
   159  type WorkingStorageArrayInput interface {
   160  	pulumi.Input
   161  
   162  	ToWorkingStorageArrayOutput() WorkingStorageArrayOutput
   163  	ToWorkingStorageArrayOutputWithContext(context.Context) WorkingStorageArrayOutput
   164  }
   165  
   166  type WorkingStorageArray []WorkingStorageInput
   167  
   168  func (WorkingStorageArray) ElementType() reflect.Type {
   169  	return reflect.TypeOf((*[]*WorkingStorage)(nil)).Elem()
   170  }
   171  
   172  func (i WorkingStorageArray) ToWorkingStorageArrayOutput() WorkingStorageArrayOutput {
   173  	return i.ToWorkingStorageArrayOutputWithContext(context.Background())
   174  }
   175  
   176  func (i WorkingStorageArray) ToWorkingStorageArrayOutputWithContext(ctx context.Context) WorkingStorageArrayOutput {
   177  	return pulumi.ToOutputWithContext(ctx, i).(WorkingStorageArrayOutput)
   178  }
   179  
   180  // WorkingStorageMapInput is an input type that accepts WorkingStorageMap and WorkingStorageMapOutput values.
   181  // You can construct a concrete instance of `WorkingStorageMapInput` via:
   182  //
   183  //	WorkingStorageMap{ "key": WorkingStorageArgs{...} }
   184  type WorkingStorageMapInput interface {
   185  	pulumi.Input
   186  
   187  	ToWorkingStorageMapOutput() WorkingStorageMapOutput
   188  	ToWorkingStorageMapOutputWithContext(context.Context) WorkingStorageMapOutput
   189  }
   190  
   191  type WorkingStorageMap map[string]WorkingStorageInput
   192  
   193  func (WorkingStorageMap) ElementType() reflect.Type {
   194  	return reflect.TypeOf((*map[string]*WorkingStorage)(nil)).Elem()
   195  }
   196  
   197  func (i WorkingStorageMap) ToWorkingStorageMapOutput() WorkingStorageMapOutput {
   198  	return i.ToWorkingStorageMapOutputWithContext(context.Background())
   199  }
   200  
   201  func (i WorkingStorageMap) ToWorkingStorageMapOutputWithContext(ctx context.Context) WorkingStorageMapOutput {
   202  	return pulumi.ToOutputWithContext(ctx, i).(WorkingStorageMapOutput)
   203  }
   204  
   205  type WorkingStorageOutput struct{ *pulumi.OutputState }
   206  
   207  func (WorkingStorageOutput) ElementType() reflect.Type {
   208  	return reflect.TypeOf((**WorkingStorage)(nil)).Elem()
   209  }
   210  
   211  func (o WorkingStorageOutput) ToWorkingStorageOutput() WorkingStorageOutput {
   212  	return o
   213  }
   214  
   215  func (o WorkingStorageOutput) ToWorkingStorageOutputWithContext(ctx context.Context) WorkingStorageOutput {
   216  	return o
   217  }
   218  
   219  // Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`.
   220  func (o WorkingStorageOutput) DiskId() pulumi.StringOutput {
   221  	return o.ApplyT(func(v *WorkingStorage) pulumi.StringOutput { return v.DiskId }).(pulumi.StringOutput)
   222  }
   223  
   224  // The Amazon Resource Name (ARN) of the gateway.
   225  func (o WorkingStorageOutput) GatewayArn() pulumi.StringOutput {
   226  	return o.ApplyT(func(v *WorkingStorage) pulumi.StringOutput { return v.GatewayArn }).(pulumi.StringOutput)
   227  }
   228  
   229  type WorkingStorageArrayOutput struct{ *pulumi.OutputState }
   230  
   231  func (WorkingStorageArrayOutput) ElementType() reflect.Type {
   232  	return reflect.TypeOf((*[]*WorkingStorage)(nil)).Elem()
   233  }
   234  
   235  func (o WorkingStorageArrayOutput) ToWorkingStorageArrayOutput() WorkingStorageArrayOutput {
   236  	return o
   237  }
   238  
   239  func (o WorkingStorageArrayOutput) ToWorkingStorageArrayOutputWithContext(ctx context.Context) WorkingStorageArrayOutput {
   240  	return o
   241  }
   242  
   243  func (o WorkingStorageArrayOutput) Index(i pulumi.IntInput) WorkingStorageOutput {
   244  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *WorkingStorage {
   245  		return vs[0].([]*WorkingStorage)[vs[1].(int)]
   246  	}).(WorkingStorageOutput)
   247  }
   248  
   249  type WorkingStorageMapOutput struct{ *pulumi.OutputState }
   250  
   251  func (WorkingStorageMapOutput) ElementType() reflect.Type {
   252  	return reflect.TypeOf((*map[string]*WorkingStorage)(nil)).Elem()
   253  }
   254  
   255  func (o WorkingStorageMapOutput) ToWorkingStorageMapOutput() WorkingStorageMapOutput {
   256  	return o
   257  }
   258  
   259  func (o WorkingStorageMapOutput) ToWorkingStorageMapOutputWithContext(ctx context.Context) WorkingStorageMapOutput {
   260  	return o
   261  }
   262  
   263  func (o WorkingStorageMapOutput) MapIndex(k pulumi.StringInput) WorkingStorageOutput {
   264  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *WorkingStorage {
   265  		return vs[0].(map[string]*WorkingStorage)[vs[1].(string)]
   266  	}).(WorkingStorageOutput)
   267  }
   268  
   269  func init() {
   270  	pulumi.RegisterInputType(reflect.TypeOf((*WorkingStorageInput)(nil)).Elem(), &WorkingStorage{})
   271  	pulumi.RegisterInputType(reflect.TypeOf((*WorkingStorageArrayInput)(nil)).Elem(), WorkingStorageArray{})
   272  	pulumi.RegisterInputType(reflect.TypeOf((*WorkingStorageMapInput)(nil)).Elem(), WorkingStorageMap{})
   273  	pulumi.RegisterOutputType(WorkingStorageOutput{})
   274  	pulumi.RegisterOutputType(WorkingStorageArrayOutput{})
   275  	pulumi.RegisterOutputType(WorkingStorageMapOutput{})
   276  }