github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/lightsail/instancePublicPorts.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  // Opens ports for a specific Amazon Lightsail instance, and specifies the IP addresses allowed to connect to the instance through the ports, and the protocol.
    16  //
    17  // > See [What is Amazon Lightsail?](https://lightsail.aws.amazon.com/ls/docs/getting-started/article/what-is-amazon-lightsail) for more information.
    18  //
    19  // > **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.
    20  //
    21  // ## Example Usage
    22  //
    23  // <!--Start PulumiCodeChooser -->
    24  // ```go
    25  // package main
    26  //
    27  // import (
    28  //
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lightsail"
    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 := lightsail.NewInstance(ctx, "test", &lightsail.InstanceArgs{
    37  //				Name:             pulumi.String("yak_sail"),
    38  //				AvailabilityZone: pulumi.Any(available.Names[0]),
    39  //				BlueprintId:      pulumi.String("amazon_linux_2"),
    40  //				BundleId:         pulumi.String("nano_3_0"),
    41  //			})
    42  //			if err != nil {
    43  //				return err
    44  //			}
    45  //			_, err = lightsail.NewInstancePublicPorts(ctx, "test", &lightsail.InstancePublicPortsArgs{
    46  //				InstanceName: test.Name,
    47  //				PortInfos: lightsail.InstancePublicPortsPortInfoArray{
    48  //					&lightsail.InstancePublicPortsPortInfoArgs{
    49  //						Protocol: pulumi.String("tcp"),
    50  //						FromPort: pulumi.Int(80),
    51  //						ToPort:   pulumi.Int(80),
    52  //					},
    53  //				},
    54  //			})
    55  //			if err != nil {
    56  //				return err
    57  //			}
    58  //			return nil
    59  //		})
    60  //	}
    61  //
    62  // ```
    63  // <!--End PulumiCodeChooser -->
    64  type InstancePublicPorts struct {
    65  	pulumi.CustomResourceState
    66  
    67  	// Name of the Lightsail Instance.
    68  	InstanceName pulumi.StringOutput `pulumi:"instanceName"`
    69  	// Configuration block with port information. AWS closes all currently open ports that are not included in the `portInfo`. Detailed below.
    70  	PortInfos InstancePublicPortsPortInfoArrayOutput `pulumi:"portInfos"`
    71  }
    72  
    73  // NewInstancePublicPorts registers a new resource with the given unique name, arguments, and options.
    74  func NewInstancePublicPorts(ctx *pulumi.Context,
    75  	name string, args *InstancePublicPortsArgs, opts ...pulumi.ResourceOption) (*InstancePublicPorts, error) {
    76  	if args == nil {
    77  		return nil, errors.New("missing one or more required arguments")
    78  	}
    79  
    80  	if args.InstanceName == nil {
    81  		return nil, errors.New("invalid value for required argument 'InstanceName'")
    82  	}
    83  	if args.PortInfos == nil {
    84  		return nil, errors.New("invalid value for required argument 'PortInfos'")
    85  	}
    86  	opts = internal.PkgResourceDefaultOpts(opts)
    87  	var resource InstancePublicPorts
    88  	err := ctx.RegisterResource("aws:lightsail/instancePublicPorts:InstancePublicPorts", name, args, &resource, opts...)
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  	return &resource, nil
    93  }
    94  
    95  // GetInstancePublicPorts gets an existing InstancePublicPorts resource's state with the given name, ID, and optional
    96  // state properties that are used to uniquely qualify the lookup (nil if not required).
    97  func GetInstancePublicPorts(ctx *pulumi.Context,
    98  	name string, id pulumi.IDInput, state *InstancePublicPortsState, opts ...pulumi.ResourceOption) (*InstancePublicPorts, error) {
    99  	var resource InstancePublicPorts
   100  	err := ctx.ReadResource("aws:lightsail/instancePublicPorts:InstancePublicPorts", name, id, state, &resource, opts...)
   101  	if err != nil {
   102  		return nil, err
   103  	}
   104  	return &resource, nil
   105  }
   106  
   107  // Input properties used for looking up and filtering InstancePublicPorts resources.
   108  type instancePublicPortsState struct {
   109  	// Name of the Lightsail Instance.
   110  	InstanceName *string `pulumi:"instanceName"`
   111  	// Configuration block with port information. AWS closes all currently open ports that are not included in the `portInfo`. Detailed below.
   112  	PortInfos []InstancePublicPortsPortInfo `pulumi:"portInfos"`
   113  }
   114  
   115  type InstancePublicPortsState struct {
   116  	// Name of the Lightsail Instance.
   117  	InstanceName pulumi.StringPtrInput
   118  	// Configuration block with port information. AWS closes all currently open ports that are not included in the `portInfo`. Detailed below.
   119  	PortInfos InstancePublicPortsPortInfoArrayInput
   120  }
   121  
   122  func (InstancePublicPortsState) ElementType() reflect.Type {
   123  	return reflect.TypeOf((*instancePublicPortsState)(nil)).Elem()
   124  }
   125  
   126  type instancePublicPortsArgs struct {
   127  	// Name of the Lightsail Instance.
   128  	InstanceName string `pulumi:"instanceName"`
   129  	// Configuration block with port information. AWS closes all currently open ports that are not included in the `portInfo`. Detailed below.
   130  	PortInfos []InstancePublicPortsPortInfo `pulumi:"portInfos"`
   131  }
   132  
   133  // The set of arguments for constructing a InstancePublicPorts resource.
   134  type InstancePublicPortsArgs struct {
   135  	// Name of the Lightsail Instance.
   136  	InstanceName pulumi.StringInput
   137  	// Configuration block with port information. AWS closes all currently open ports that are not included in the `portInfo`. Detailed below.
   138  	PortInfos InstancePublicPortsPortInfoArrayInput
   139  }
   140  
   141  func (InstancePublicPortsArgs) ElementType() reflect.Type {
   142  	return reflect.TypeOf((*instancePublicPortsArgs)(nil)).Elem()
   143  }
   144  
   145  type InstancePublicPortsInput interface {
   146  	pulumi.Input
   147  
   148  	ToInstancePublicPortsOutput() InstancePublicPortsOutput
   149  	ToInstancePublicPortsOutputWithContext(ctx context.Context) InstancePublicPortsOutput
   150  }
   151  
   152  func (*InstancePublicPorts) ElementType() reflect.Type {
   153  	return reflect.TypeOf((**InstancePublicPorts)(nil)).Elem()
   154  }
   155  
   156  func (i *InstancePublicPorts) ToInstancePublicPortsOutput() InstancePublicPortsOutput {
   157  	return i.ToInstancePublicPortsOutputWithContext(context.Background())
   158  }
   159  
   160  func (i *InstancePublicPorts) ToInstancePublicPortsOutputWithContext(ctx context.Context) InstancePublicPortsOutput {
   161  	return pulumi.ToOutputWithContext(ctx, i).(InstancePublicPortsOutput)
   162  }
   163  
   164  // InstancePublicPortsArrayInput is an input type that accepts InstancePublicPortsArray and InstancePublicPortsArrayOutput values.
   165  // You can construct a concrete instance of `InstancePublicPortsArrayInput` via:
   166  //
   167  //	InstancePublicPortsArray{ InstancePublicPortsArgs{...} }
   168  type InstancePublicPortsArrayInput interface {
   169  	pulumi.Input
   170  
   171  	ToInstancePublicPortsArrayOutput() InstancePublicPortsArrayOutput
   172  	ToInstancePublicPortsArrayOutputWithContext(context.Context) InstancePublicPortsArrayOutput
   173  }
   174  
   175  type InstancePublicPortsArray []InstancePublicPortsInput
   176  
   177  func (InstancePublicPortsArray) ElementType() reflect.Type {
   178  	return reflect.TypeOf((*[]*InstancePublicPorts)(nil)).Elem()
   179  }
   180  
   181  func (i InstancePublicPortsArray) ToInstancePublicPortsArrayOutput() InstancePublicPortsArrayOutput {
   182  	return i.ToInstancePublicPortsArrayOutputWithContext(context.Background())
   183  }
   184  
   185  func (i InstancePublicPortsArray) ToInstancePublicPortsArrayOutputWithContext(ctx context.Context) InstancePublicPortsArrayOutput {
   186  	return pulumi.ToOutputWithContext(ctx, i).(InstancePublicPortsArrayOutput)
   187  }
   188  
   189  // InstancePublicPortsMapInput is an input type that accepts InstancePublicPortsMap and InstancePublicPortsMapOutput values.
   190  // You can construct a concrete instance of `InstancePublicPortsMapInput` via:
   191  //
   192  //	InstancePublicPortsMap{ "key": InstancePublicPortsArgs{...} }
   193  type InstancePublicPortsMapInput interface {
   194  	pulumi.Input
   195  
   196  	ToInstancePublicPortsMapOutput() InstancePublicPortsMapOutput
   197  	ToInstancePublicPortsMapOutputWithContext(context.Context) InstancePublicPortsMapOutput
   198  }
   199  
   200  type InstancePublicPortsMap map[string]InstancePublicPortsInput
   201  
   202  func (InstancePublicPortsMap) ElementType() reflect.Type {
   203  	return reflect.TypeOf((*map[string]*InstancePublicPorts)(nil)).Elem()
   204  }
   205  
   206  func (i InstancePublicPortsMap) ToInstancePublicPortsMapOutput() InstancePublicPortsMapOutput {
   207  	return i.ToInstancePublicPortsMapOutputWithContext(context.Background())
   208  }
   209  
   210  func (i InstancePublicPortsMap) ToInstancePublicPortsMapOutputWithContext(ctx context.Context) InstancePublicPortsMapOutput {
   211  	return pulumi.ToOutputWithContext(ctx, i).(InstancePublicPortsMapOutput)
   212  }
   213  
   214  type InstancePublicPortsOutput struct{ *pulumi.OutputState }
   215  
   216  func (InstancePublicPortsOutput) ElementType() reflect.Type {
   217  	return reflect.TypeOf((**InstancePublicPorts)(nil)).Elem()
   218  }
   219  
   220  func (o InstancePublicPortsOutput) ToInstancePublicPortsOutput() InstancePublicPortsOutput {
   221  	return o
   222  }
   223  
   224  func (o InstancePublicPortsOutput) ToInstancePublicPortsOutputWithContext(ctx context.Context) InstancePublicPortsOutput {
   225  	return o
   226  }
   227  
   228  // Name of the Lightsail Instance.
   229  func (o InstancePublicPortsOutput) InstanceName() pulumi.StringOutput {
   230  	return o.ApplyT(func(v *InstancePublicPorts) pulumi.StringOutput { return v.InstanceName }).(pulumi.StringOutput)
   231  }
   232  
   233  // Configuration block with port information. AWS closes all currently open ports that are not included in the `portInfo`. Detailed below.
   234  func (o InstancePublicPortsOutput) PortInfos() InstancePublicPortsPortInfoArrayOutput {
   235  	return o.ApplyT(func(v *InstancePublicPorts) InstancePublicPortsPortInfoArrayOutput { return v.PortInfos }).(InstancePublicPortsPortInfoArrayOutput)
   236  }
   237  
   238  type InstancePublicPortsArrayOutput struct{ *pulumi.OutputState }
   239  
   240  func (InstancePublicPortsArrayOutput) ElementType() reflect.Type {
   241  	return reflect.TypeOf((*[]*InstancePublicPorts)(nil)).Elem()
   242  }
   243  
   244  func (o InstancePublicPortsArrayOutput) ToInstancePublicPortsArrayOutput() InstancePublicPortsArrayOutput {
   245  	return o
   246  }
   247  
   248  func (o InstancePublicPortsArrayOutput) ToInstancePublicPortsArrayOutputWithContext(ctx context.Context) InstancePublicPortsArrayOutput {
   249  	return o
   250  }
   251  
   252  func (o InstancePublicPortsArrayOutput) Index(i pulumi.IntInput) InstancePublicPortsOutput {
   253  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *InstancePublicPorts {
   254  		return vs[0].([]*InstancePublicPorts)[vs[1].(int)]
   255  	}).(InstancePublicPortsOutput)
   256  }
   257  
   258  type InstancePublicPortsMapOutput struct{ *pulumi.OutputState }
   259  
   260  func (InstancePublicPortsMapOutput) ElementType() reflect.Type {
   261  	return reflect.TypeOf((*map[string]*InstancePublicPorts)(nil)).Elem()
   262  }
   263  
   264  func (o InstancePublicPortsMapOutput) ToInstancePublicPortsMapOutput() InstancePublicPortsMapOutput {
   265  	return o
   266  }
   267  
   268  func (o InstancePublicPortsMapOutput) ToInstancePublicPortsMapOutputWithContext(ctx context.Context) InstancePublicPortsMapOutput {
   269  	return o
   270  }
   271  
   272  func (o InstancePublicPortsMapOutput) MapIndex(k pulumi.StringInput) InstancePublicPortsOutput {
   273  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *InstancePublicPorts {
   274  		return vs[0].(map[string]*InstancePublicPorts)[vs[1].(string)]
   275  	}).(InstancePublicPortsOutput)
   276  }
   277  
   278  func init() {
   279  	pulumi.RegisterInputType(reflect.TypeOf((*InstancePublicPortsInput)(nil)).Elem(), &InstancePublicPorts{})
   280  	pulumi.RegisterInputType(reflect.TypeOf((*InstancePublicPortsArrayInput)(nil)).Elem(), InstancePublicPortsArray{})
   281  	pulumi.RegisterInputType(reflect.TypeOf((*InstancePublicPortsMapInput)(nil)).Elem(), InstancePublicPortsMap{})
   282  	pulumi.RegisterOutputType(InstancePublicPortsOutput{})
   283  	pulumi.RegisterOutputType(InstancePublicPortsArrayOutput{})
   284  	pulumi.RegisterOutputType(InstancePublicPortsMapOutput{})
   285  }