github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/lightsail/staticIp.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  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Allocates a static IP address.
    15  //
    16  // > **Note:** Lightsail is currently only supported in a limited number of AWS Regions, please see ["Regions and Availability Zones in Amazon Lightsail"](https://lightsail.aws.amazon.com/ls/docs/overview/article/understanding-regions-and-availability-zones-in-amazon-lightsail) for more details
    17  //
    18  // ## Example Usage
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    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.NewStaticIp(ctx, "test", &lightsail.StaticIpArgs{
    34  //				Name: pulumi.String("example"),
    35  //			})
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  type StaticIp struct {
    46  	pulumi.CustomResourceState
    47  
    48  	// The ARN of the Lightsail static IP
    49  	Arn pulumi.StringOutput `pulumi:"arn"`
    50  	// The allocated static IP address
    51  	IpAddress pulumi.StringOutput `pulumi:"ipAddress"`
    52  	// The name for the allocated static IP
    53  	Name pulumi.StringOutput `pulumi:"name"`
    54  	// The support code.
    55  	SupportCode pulumi.StringOutput `pulumi:"supportCode"`
    56  }
    57  
    58  // NewStaticIp registers a new resource with the given unique name, arguments, and options.
    59  func NewStaticIp(ctx *pulumi.Context,
    60  	name string, args *StaticIpArgs, opts ...pulumi.ResourceOption) (*StaticIp, error) {
    61  	if args == nil {
    62  		args = &StaticIpArgs{}
    63  	}
    64  
    65  	opts = internal.PkgResourceDefaultOpts(opts)
    66  	var resource StaticIp
    67  	err := ctx.RegisterResource("aws:lightsail/staticIp:StaticIp", name, args, &resource, opts...)
    68  	if err != nil {
    69  		return nil, err
    70  	}
    71  	return &resource, nil
    72  }
    73  
    74  // GetStaticIp gets an existing StaticIp resource's state with the given name, ID, and optional
    75  // state properties that are used to uniquely qualify the lookup (nil if not required).
    76  func GetStaticIp(ctx *pulumi.Context,
    77  	name string, id pulumi.IDInput, state *StaticIpState, opts ...pulumi.ResourceOption) (*StaticIp, error) {
    78  	var resource StaticIp
    79  	err := ctx.ReadResource("aws:lightsail/staticIp:StaticIp", name, id, state, &resource, opts...)
    80  	if err != nil {
    81  		return nil, err
    82  	}
    83  	return &resource, nil
    84  }
    85  
    86  // Input properties used for looking up and filtering StaticIp resources.
    87  type staticIpState struct {
    88  	// The ARN of the Lightsail static IP
    89  	Arn *string `pulumi:"arn"`
    90  	// The allocated static IP address
    91  	IpAddress *string `pulumi:"ipAddress"`
    92  	// The name for the allocated static IP
    93  	Name *string `pulumi:"name"`
    94  	// The support code.
    95  	SupportCode *string `pulumi:"supportCode"`
    96  }
    97  
    98  type StaticIpState struct {
    99  	// The ARN of the Lightsail static IP
   100  	Arn pulumi.StringPtrInput
   101  	// The allocated static IP address
   102  	IpAddress pulumi.StringPtrInput
   103  	// The name for the allocated static IP
   104  	Name pulumi.StringPtrInput
   105  	// The support code.
   106  	SupportCode pulumi.StringPtrInput
   107  }
   108  
   109  func (StaticIpState) ElementType() reflect.Type {
   110  	return reflect.TypeOf((*staticIpState)(nil)).Elem()
   111  }
   112  
   113  type staticIpArgs struct {
   114  	// The name for the allocated static IP
   115  	Name *string `pulumi:"name"`
   116  }
   117  
   118  // The set of arguments for constructing a StaticIp resource.
   119  type StaticIpArgs struct {
   120  	// The name for the allocated static IP
   121  	Name pulumi.StringPtrInput
   122  }
   123  
   124  func (StaticIpArgs) ElementType() reflect.Type {
   125  	return reflect.TypeOf((*staticIpArgs)(nil)).Elem()
   126  }
   127  
   128  type StaticIpInput interface {
   129  	pulumi.Input
   130  
   131  	ToStaticIpOutput() StaticIpOutput
   132  	ToStaticIpOutputWithContext(ctx context.Context) StaticIpOutput
   133  }
   134  
   135  func (*StaticIp) ElementType() reflect.Type {
   136  	return reflect.TypeOf((**StaticIp)(nil)).Elem()
   137  }
   138  
   139  func (i *StaticIp) ToStaticIpOutput() StaticIpOutput {
   140  	return i.ToStaticIpOutputWithContext(context.Background())
   141  }
   142  
   143  func (i *StaticIp) ToStaticIpOutputWithContext(ctx context.Context) StaticIpOutput {
   144  	return pulumi.ToOutputWithContext(ctx, i).(StaticIpOutput)
   145  }
   146  
   147  // StaticIpArrayInput is an input type that accepts StaticIpArray and StaticIpArrayOutput values.
   148  // You can construct a concrete instance of `StaticIpArrayInput` via:
   149  //
   150  //	StaticIpArray{ StaticIpArgs{...} }
   151  type StaticIpArrayInput interface {
   152  	pulumi.Input
   153  
   154  	ToStaticIpArrayOutput() StaticIpArrayOutput
   155  	ToStaticIpArrayOutputWithContext(context.Context) StaticIpArrayOutput
   156  }
   157  
   158  type StaticIpArray []StaticIpInput
   159  
   160  func (StaticIpArray) ElementType() reflect.Type {
   161  	return reflect.TypeOf((*[]*StaticIp)(nil)).Elem()
   162  }
   163  
   164  func (i StaticIpArray) ToStaticIpArrayOutput() StaticIpArrayOutput {
   165  	return i.ToStaticIpArrayOutputWithContext(context.Background())
   166  }
   167  
   168  func (i StaticIpArray) ToStaticIpArrayOutputWithContext(ctx context.Context) StaticIpArrayOutput {
   169  	return pulumi.ToOutputWithContext(ctx, i).(StaticIpArrayOutput)
   170  }
   171  
   172  // StaticIpMapInput is an input type that accepts StaticIpMap and StaticIpMapOutput values.
   173  // You can construct a concrete instance of `StaticIpMapInput` via:
   174  //
   175  //	StaticIpMap{ "key": StaticIpArgs{...} }
   176  type StaticIpMapInput interface {
   177  	pulumi.Input
   178  
   179  	ToStaticIpMapOutput() StaticIpMapOutput
   180  	ToStaticIpMapOutputWithContext(context.Context) StaticIpMapOutput
   181  }
   182  
   183  type StaticIpMap map[string]StaticIpInput
   184  
   185  func (StaticIpMap) ElementType() reflect.Type {
   186  	return reflect.TypeOf((*map[string]*StaticIp)(nil)).Elem()
   187  }
   188  
   189  func (i StaticIpMap) ToStaticIpMapOutput() StaticIpMapOutput {
   190  	return i.ToStaticIpMapOutputWithContext(context.Background())
   191  }
   192  
   193  func (i StaticIpMap) ToStaticIpMapOutputWithContext(ctx context.Context) StaticIpMapOutput {
   194  	return pulumi.ToOutputWithContext(ctx, i).(StaticIpMapOutput)
   195  }
   196  
   197  type StaticIpOutput struct{ *pulumi.OutputState }
   198  
   199  func (StaticIpOutput) ElementType() reflect.Type {
   200  	return reflect.TypeOf((**StaticIp)(nil)).Elem()
   201  }
   202  
   203  func (o StaticIpOutput) ToStaticIpOutput() StaticIpOutput {
   204  	return o
   205  }
   206  
   207  func (o StaticIpOutput) ToStaticIpOutputWithContext(ctx context.Context) StaticIpOutput {
   208  	return o
   209  }
   210  
   211  // The ARN of the Lightsail static IP
   212  func (o StaticIpOutput) Arn() pulumi.StringOutput {
   213  	return o.ApplyT(func(v *StaticIp) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   214  }
   215  
   216  // The allocated static IP address
   217  func (o StaticIpOutput) IpAddress() pulumi.StringOutput {
   218  	return o.ApplyT(func(v *StaticIp) pulumi.StringOutput { return v.IpAddress }).(pulumi.StringOutput)
   219  }
   220  
   221  // The name for the allocated static IP
   222  func (o StaticIpOutput) Name() pulumi.StringOutput {
   223  	return o.ApplyT(func(v *StaticIp) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   224  }
   225  
   226  // The support code.
   227  func (o StaticIpOutput) SupportCode() pulumi.StringOutput {
   228  	return o.ApplyT(func(v *StaticIp) pulumi.StringOutput { return v.SupportCode }).(pulumi.StringOutput)
   229  }
   230  
   231  type StaticIpArrayOutput struct{ *pulumi.OutputState }
   232  
   233  func (StaticIpArrayOutput) ElementType() reflect.Type {
   234  	return reflect.TypeOf((*[]*StaticIp)(nil)).Elem()
   235  }
   236  
   237  func (o StaticIpArrayOutput) ToStaticIpArrayOutput() StaticIpArrayOutput {
   238  	return o
   239  }
   240  
   241  func (o StaticIpArrayOutput) ToStaticIpArrayOutputWithContext(ctx context.Context) StaticIpArrayOutput {
   242  	return o
   243  }
   244  
   245  func (o StaticIpArrayOutput) Index(i pulumi.IntInput) StaticIpOutput {
   246  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *StaticIp {
   247  		return vs[0].([]*StaticIp)[vs[1].(int)]
   248  	}).(StaticIpOutput)
   249  }
   250  
   251  type StaticIpMapOutput struct{ *pulumi.OutputState }
   252  
   253  func (StaticIpMapOutput) ElementType() reflect.Type {
   254  	return reflect.TypeOf((*map[string]*StaticIp)(nil)).Elem()
   255  }
   256  
   257  func (o StaticIpMapOutput) ToStaticIpMapOutput() StaticIpMapOutput {
   258  	return o
   259  }
   260  
   261  func (o StaticIpMapOutput) ToStaticIpMapOutputWithContext(ctx context.Context) StaticIpMapOutput {
   262  	return o
   263  }
   264  
   265  func (o StaticIpMapOutput) MapIndex(k pulumi.StringInput) StaticIpOutput {
   266  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *StaticIp {
   267  		return vs[0].(map[string]*StaticIp)[vs[1].(string)]
   268  	}).(StaticIpOutput)
   269  }
   270  
   271  func init() {
   272  	pulumi.RegisterInputType(reflect.TypeOf((*StaticIpInput)(nil)).Elem(), &StaticIp{})
   273  	pulumi.RegisterInputType(reflect.TypeOf((*StaticIpArrayInput)(nil)).Elem(), StaticIpArray{})
   274  	pulumi.RegisterInputType(reflect.TypeOf((*StaticIpMapInput)(nil)).Elem(), StaticIpMap{})
   275  	pulumi.RegisterOutputType(StaticIpOutput{})
   276  	pulumi.RegisterOutputType(StaticIpArrayOutput{})
   277  	pulumi.RegisterOutputType(StaticIpMapOutput{})
   278  }