github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/lightsail/disk.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 Disk resource.
    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  //			available, err := aws.GetAvailabilityZones(ctx, &aws.GetAvailabilityZonesArgs{
    34  //				State: pulumi.StringRef("available"),
    35  //				Filters: []aws.GetAvailabilityZonesFilter{
    36  //					{
    37  //						Name: "opt-in-status",
    38  //						Values: []string{
    39  //							"opt-in-not-required",
    40  //						},
    41  //					},
    42  //				},
    43  //			}, nil)
    44  //			if err != nil {
    45  //				return err
    46  //			}
    47  //			_, err = lightsail.NewDisk(ctx, "test", &lightsail.DiskArgs{
    48  //				Name:             pulumi.String("test"),
    49  //				SizeInGb:         pulumi.Int(8),
    50  //				AvailabilityZone: pulumi.String(available.Names[0]),
    51  //			})
    52  //			if err != nil {
    53  //				return err
    54  //			}
    55  //			return nil
    56  //		})
    57  //	}
    58  //
    59  // ```
    60  // <!--End PulumiCodeChooser -->
    61  //
    62  // ## Import
    63  //
    64  // Using `pulumi import`, import `aws_lightsail_disk` using the name attribute. For example:
    65  //
    66  // ```sh
    67  // $ pulumi import aws:lightsail/disk:Disk test test
    68  // ```
    69  type Disk struct {
    70  	pulumi.CustomResourceState
    71  
    72  	// The ARN of the Lightsail load balancer.
    73  	Arn pulumi.StringOutput `pulumi:"arn"`
    74  	// The Availability Zone in which to create your disk.
    75  	AvailabilityZone pulumi.StringOutput `pulumi:"availabilityZone"`
    76  	// The timestamp when the load balancer was created.
    77  	CreatedAt pulumi.StringOutput `pulumi:"createdAt"`
    78  	// The name of the Lightsail load balancer.
    79  	Name pulumi.StringOutput `pulumi:"name"`
    80  	// The instance port the load balancer will connect.
    81  	SizeInGb pulumi.IntOutput `pulumi:"sizeInGb"`
    82  	// The support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail. This code enables our support team to look up your Lightsail information more easily.
    83  	SupportCode pulumi.StringOutput `pulumi:"supportCode"`
    84  	// A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    85  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    86  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    87  	//
    88  	// Deprecated: Please use `tags` instead.
    89  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    90  }
    91  
    92  // NewDisk registers a new resource with the given unique name, arguments, and options.
    93  func NewDisk(ctx *pulumi.Context,
    94  	name string, args *DiskArgs, opts ...pulumi.ResourceOption) (*Disk, error) {
    95  	if args == nil {
    96  		return nil, errors.New("missing one or more required arguments")
    97  	}
    98  
    99  	if args.AvailabilityZone == nil {
   100  		return nil, errors.New("invalid value for required argument 'AvailabilityZone'")
   101  	}
   102  	if args.SizeInGb == nil {
   103  		return nil, errors.New("invalid value for required argument 'SizeInGb'")
   104  	}
   105  	opts = internal.PkgResourceDefaultOpts(opts)
   106  	var resource Disk
   107  	err := ctx.RegisterResource("aws:lightsail/disk:Disk", name, args, &resource, opts...)
   108  	if err != nil {
   109  		return nil, err
   110  	}
   111  	return &resource, nil
   112  }
   113  
   114  // GetDisk gets an existing Disk resource's state with the given name, ID, and optional
   115  // state properties that are used to uniquely qualify the lookup (nil if not required).
   116  func GetDisk(ctx *pulumi.Context,
   117  	name string, id pulumi.IDInput, state *DiskState, opts ...pulumi.ResourceOption) (*Disk, error) {
   118  	var resource Disk
   119  	err := ctx.ReadResource("aws:lightsail/disk:Disk", name, id, state, &resource, opts...)
   120  	if err != nil {
   121  		return nil, err
   122  	}
   123  	return &resource, nil
   124  }
   125  
   126  // Input properties used for looking up and filtering Disk resources.
   127  type diskState struct {
   128  	// The ARN of the Lightsail load balancer.
   129  	Arn *string `pulumi:"arn"`
   130  	// The Availability Zone in which to create your disk.
   131  	AvailabilityZone *string `pulumi:"availabilityZone"`
   132  	// The timestamp when the load balancer was created.
   133  	CreatedAt *string `pulumi:"createdAt"`
   134  	// The name of the Lightsail load balancer.
   135  	Name *string `pulumi:"name"`
   136  	// The instance port the load balancer will connect.
   137  	SizeInGb *int `pulumi:"sizeInGb"`
   138  	// The support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail. This code enables our support team to look up your Lightsail information more easily.
   139  	SupportCode *string `pulumi:"supportCode"`
   140  	// A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   141  	Tags map[string]string `pulumi:"tags"`
   142  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   143  	//
   144  	// Deprecated: Please use `tags` instead.
   145  	TagsAll map[string]string `pulumi:"tagsAll"`
   146  }
   147  
   148  type DiskState struct {
   149  	// The ARN of the Lightsail load balancer.
   150  	Arn pulumi.StringPtrInput
   151  	// The Availability Zone in which to create your disk.
   152  	AvailabilityZone pulumi.StringPtrInput
   153  	// The timestamp when the load balancer was created.
   154  	CreatedAt pulumi.StringPtrInput
   155  	// The name of the Lightsail load balancer.
   156  	Name pulumi.StringPtrInput
   157  	// The instance port the load balancer will connect.
   158  	SizeInGb pulumi.IntPtrInput
   159  	// The support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail. This code enables our support team to look up your Lightsail information more easily.
   160  	SupportCode pulumi.StringPtrInput
   161  	// A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   162  	Tags pulumi.StringMapInput
   163  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   164  	//
   165  	// Deprecated: Please use `tags` instead.
   166  	TagsAll pulumi.StringMapInput
   167  }
   168  
   169  func (DiskState) ElementType() reflect.Type {
   170  	return reflect.TypeOf((*diskState)(nil)).Elem()
   171  }
   172  
   173  type diskArgs struct {
   174  	// The Availability Zone in which to create your disk.
   175  	AvailabilityZone string `pulumi:"availabilityZone"`
   176  	// The name of the Lightsail load balancer.
   177  	Name *string `pulumi:"name"`
   178  	// The instance port the load balancer will connect.
   179  	SizeInGb int `pulumi:"sizeInGb"`
   180  	// A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   181  	Tags map[string]string `pulumi:"tags"`
   182  }
   183  
   184  // The set of arguments for constructing a Disk resource.
   185  type DiskArgs struct {
   186  	// The Availability Zone in which to create your disk.
   187  	AvailabilityZone pulumi.StringInput
   188  	// The name of the Lightsail load balancer.
   189  	Name pulumi.StringPtrInput
   190  	// The instance port the load balancer will connect.
   191  	SizeInGb pulumi.IntInput
   192  	// A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   193  	Tags pulumi.StringMapInput
   194  }
   195  
   196  func (DiskArgs) ElementType() reflect.Type {
   197  	return reflect.TypeOf((*diskArgs)(nil)).Elem()
   198  }
   199  
   200  type DiskInput interface {
   201  	pulumi.Input
   202  
   203  	ToDiskOutput() DiskOutput
   204  	ToDiskOutputWithContext(ctx context.Context) DiskOutput
   205  }
   206  
   207  func (*Disk) ElementType() reflect.Type {
   208  	return reflect.TypeOf((**Disk)(nil)).Elem()
   209  }
   210  
   211  func (i *Disk) ToDiskOutput() DiskOutput {
   212  	return i.ToDiskOutputWithContext(context.Background())
   213  }
   214  
   215  func (i *Disk) ToDiskOutputWithContext(ctx context.Context) DiskOutput {
   216  	return pulumi.ToOutputWithContext(ctx, i).(DiskOutput)
   217  }
   218  
   219  // DiskArrayInput is an input type that accepts DiskArray and DiskArrayOutput values.
   220  // You can construct a concrete instance of `DiskArrayInput` via:
   221  //
   222  //	DiskArray{ DiskArgs{...} }
   223  type DiskArrayInput interface {
   224  	pulumi.Input
   225  
   226  	ToDiskArrayOutput() DiskArrayOutput
   227  	ToDiskArrayOutputWithContext(context.Context) DiskArrayOutput
   228  }
   229  
   230  type DiskArray []DiskInput
   231  
   232  func (DiskArray) ElementType() reflect.Type {
   233  	return reflect.TypeOf((*[]*Disk)(nil)).Elem()
   234  }
   235  
   236  func (i DiskArray) ToDiskArrayOutput() DiskArrayOutput {
   237  	return i.ToDiskArrayOutputWithContext(context.Background())
   238  }
   239  
   240  func (i DiskArray) ToDiskArrayOutputWithContext(ctx context.Context) DiskArrayOutput {
   241  	return pulumi.ToOutputWithContext(ctx, i).(DiskArrayOutput)
   242  }
   243  
   244  // DiskMapInput is an input type that accepts DiskMap and DiskMapOutput values.
   245  // You can construct a concrete instance of `DiskMapInput` via:
   246  //
   247  //	DiskMap{ "key": DiskArgs{...} }
   248  type DiskMapInput interface {
   249  	pulumi.Input
   250  
   251  	ToDiskMapOutput() DiskMapOutput
   252  	ToDiskMapOutputWithContext(context.Context) DiskMapOutput
   253  }
   254  
   255  type DiskMap map[string]DiskInput
   256  
   257  func (DiskMap) ElementType() reflect.Type {
   258  	return reflect.TypeOf((*map[string]*Disk)(nil)).Elem()
   259  }
   260  
   261  func (i DiskMap) ToDiskMapOutput() DiskMapOutput {
   262  	return i.ToDiskMapOutputWithContext(context.Background())
   263  }
   264  
   265  func (i DiskMap) ToDiskMapOutputWithContext(ctx context.Context) DiskMapOutput {
   266  	return pulumi.ToOutputWithContext(ctx, i).(DiskMapOutput)
   267  }
   268  
   269  type DiskOutput struct{ *pulumi.OutputState }
   270  
   271  func (DiskOutput) ElementType() reflect.Type {
   272  	return reflect.TypeOf((**Disk)(nil)).Elem()
   273  }
   274  
   275  func (o DiskOutput) ToDiskOutput() DiskOutput {
   276  	return o
   277  }
   278  
   279  func (o DiskOutput) ToDiskOutputWithContext(ctx context.Context) DiskOutput {
   280  	return o
   281  }
   282  
   283  // The ARN of the Lightsail load balancer.
   284  func (o DiskOutput) Arn() pulumi.StringOutput {
   285  	return o.ApplyT(func(v *Disk) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   286  }
   287  
   288  // The Availability Zone in which to create your disk.
   289  func (o DiskOutput) AvailabilityZone() pulumi.StringOutput {
   290  	return o.ApplyT(func(v *Disk) pulumi.StringOutput { return v.AvailabilityZone }).(pulumi.StringOutput)
   291  }
   292  
   293  // The timestamp when the load balancer was created.
   294  func (o DiskOutput) CreatedAt() pulumi.StringOutput {
   295  	return o.ApplyT(func(v *Disk) pulumi.StringOutput { return v.CreatedAt }).(pulumi.StringOutput)
   296  }
   297  
   298  // The name of the Lightsail load balancer.
   299  func (o DiskOutput) Name() pulumi.StringOutput {
   300  	return o.ApplyT(func(v *Disk) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   301  }
   302  
   303  // The instance port the load balancer will connect.
   304  func (o DiskOutput) SizeInGb() pulumi.IntOutput {
   305  	return o.ApplyT(func(v *Disk) pulumi.IntOutput { return v.SizeInGb }).(pulumi.IntOutput)
   306  }
   307  
   308  // The support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail. This code enables our support team to look up your Lightsail information more easily.
   309  func (o DiskOutput) SupportCode() pulumi.StringOutput {
   310  	return o.ApplyT(func(v *Disk) pulumi.StringOutput { return v.SupportCode }).(pulumi.StringOutput)
   311  }
   312  
   313  // A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   314  func (o DiskOutput) Tags() pulumi.StringMapOutput {
   315  	return o.ApplyT(func(v *Disk) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   316  }
   317  
   318  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   319  //
   320  // Deprecated: Please use `tags` instead.
   321  func (o DiskOutput) TagsAll() pulumi.StringMapOutput {
   322  	return o.ApplyT(func(v *Disk) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   323  }
   324  
   325  type DiskArrayOutput struct{ *pulumi.OutputState }
   326  
   327  func (DiskArrayOutput) ElementType() reflect.Type {
   328  	return reflect.TypeOf((*[]*Disk)(nil)).Elem()
   329  }
   330  
   331  func (o DiskArrayOutput) ToDiskArrayOutput() DiskArrayOutput {
   332  	return o
   333  }
   334  
   335  func (o DiskArrayOutput) ToDiskArrayOutputWithContext(ctx context.Context) DiskArrayOutput {
   336  	return o
   337  }
   338  
   339  func (o DiskArrayOutput) Index(i pulumi.IntInput) DiskOutput {
   340  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Disk {
   341  		return vs[0].([]*Disk)[vs[1].(int)]
   342  	}).(DiskOutput)
   343  }
   344  
   345  type DiskMapOutput struct{ *pulumi.OutputState }
   346  
   347  func (DiskMapOutput) ElementType() reflect.Type {
   348  	return reflect.TypeOf((*map[string]*Disk)(nil)).Elem()
   349  }
   350  
   351  func (o DiskMapOutput) ToDiskMapOutput() DiskMapOutput {
   352  	return o
   353  }
   354  
   355  func (o DiskMapOutput) ToDiskMapOutputWithContext(ctx context.Context) DiskMapOutput {
   356  	return o
   357  }
   358  
   359  func (o DiskMapOutput) MapIndex(k pulumi.StringInput) DiskOutput {
   360  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Disk {
   361  		return vs[0].(map[string]*Disk)[vs[1].(string)]
   362  	}).(DiskOutput)
   363  }
   364  
   365  func init() {
   366  	pulumi.RegisterInputType(reflect.TypeOf((*DiskInput)(nil)).Elem(), &Disk{})
   367  	pulumi.RegisterInputType(reflect.TypeOf((*DiskArrayInput)(nil)).Elem(), DiskArray{})
   368  	pulumi.RegisterInputType(reflect.TypeOf((*DiskMapInput)(nil)).Elem(), DiskMap{})
   369  	pulumi.RegisterOutputType(DiskOutput{})
   370  	pulumi.RegisterOutputType(DiskArrayOutput{})
   371  	pulumi.RegisterOutputType(DiskMapOutput{})
   372  }