github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/proxyProtocolPolicy.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 ec2
     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 proxy protocol policy, which allows an ELB to carry a client connection information to a backend.
    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/ec2"
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/elb"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			lb, err := elb.NewLoadBalancer(ctx, "lb", &elb.LoadBalancerArgs{
    34  //				Name: pulumi.String("test-lb"),
    35  //				AvailabilityZones: pulumi.StringArray{
    36  //					pulumi.String("us-east-1a"),
    37  //				},
    38  //				Listeners: elb.LoadBalancerListenerArray{
    39  //					&elb.LoadBalancerListenerArgs{
    40  //						InstancePort:     pulumi.Int(25),
    41  //						InstanceProtocol: pulumi.String("tcp"),
    42  //						LbPort:           pulumi.Int(25),
    43  //						LbProtocol:       pulumi.String("tcp"),
    44  //					},
    45  //					&elb.LoadBalancerListenerArgs{
    46  //						InstancePort:     pulumi.Int(587),
    47  //						InstanceProtocol: pulumi.String("tcp"),
    48  //						LbPort:           pulumi.Int(587),
    49  //						LbProtocol:       pulumi.String("tcp"),
    50  //					},
    51  //				},
    52  //			})
    53  //			if err != nil {
    54  //				return err
    55  //			}
    56  //			_, err = ec2.NewProxyProtocolPolicy(ctx, "smtp", &ec2.ProxyProtocolPolicyArgs{
    57  //				LoadBalancer: lb.Name,
    58  //				InstancePorts: pulumi.StringArray{
    59  //					pulumi.String("25"),
    60  //					pulumi.String("587"),
    61  //				},
    62  //			})
    63  //			if err != nil {
    64  //				return err
    65  //			}
    66  //			return nil
    67  //		})
    68  //	}
    69  //
    70  // ```
    71  // <!--End PulumiCodeChooser -->
    72  type ProxyProtocolPolicy struct {
    73  	pulumi.CustomResourceState
    74  
    75  	// List of instance ports to which the policy
    76  	// should be applied. This can be specified if the protocol is SSL or TCP.
    77  	InstancePorts pulumi.StringArrayOutput `pulumi:"instancePorts"`
    78  	// The load balancer to which the policy
    79  	// should be attached.
    80  	LoadBalancer pulumi.StringOutput `pulumi:"loadBalancer"`
    81  }
    82  
    83  // NewProxyProtocolPolicy registers a new resource with the given unique name, arguments, and options.
    84  func NewProxyProtocolPolicy(ctx *pulumi.Context,
    85  	name string, args *ProxyProtocolPolicyArgs, opts ...pulumi.ResourceOption) (*ProxyProtocolPolicy, error) {
    86  	if args == nil {
    87  		return nil, errors.New("missing one or more required arguments")
    88  	}
    89  
    90  	if args.InstancePorts == nil {
    91  		return nil, errors.New("invalid value for required argument 'InstancePorts'")
    92  	}
    93  	if args.LoadBalancer == nil {
    94  		return nil, errors.New("invalid value for required argument 'LoadBalancer'")
    95  	}
    96  	opts = internal.PkgResourceDefaultOpts(opts)
    97  	var resource ProxyProtocolPolicy
    98  	err := ctx.RegisterResource("aws:ec2/proxyProtocolPolicy:ProxyProtocolPolicy", name, args, &resource, opts...)
    99  	if err != nil {
   100  		return nil, err
   101  	}
   102  	return &resource, nil
   103  }
   104  
   105  // GetProxyProtocolPolicy gets an existing ProxyProtocolPolicy resource's state with the given name, ID, and optional
   106  // state properties that are used to uniquely qualify the lookup (nil if not required).
   107  func GetProxyProtocolPolicy(ctx *pulumi.Context,
   108  	name string, id pulumi.IDInput, state *ProxyProtocolPolicyState, opts ...pulumi.ResourceOption) (*ProxyProtocolPolicy, error) {
   109  	var resource ProxyProtocolPolicy
   110  	err := ctx.ReadResource("aws:ec2/proxyProtocolPolicy:ProxyProtocolPolicy", name, id, state, &resource, opts...)
   111  	if err != nil {
   112  		return nil, err
   113  	}
   114  	return &resource, nil
   115  }
   116  
   117  // Input properties used for looking up and filtering ProxyProtocolPolicy resources.
   118  type proxyProtocolPolicyState struct {
   119  	// List of instance ports to which the policy
   120  	// should be applied. This can be specified if the protocol is SSL or TCP.
   121  	InstancePorts []string `pulumi:"instancePorts"`
   122  	// The load balancer to which the policy
   123  	// should be attached.
   124  	LoadBalancer *string `pulumi:"loadBalancer"`
   125  }
   126  
   127  type ProxyProtocolPolicyState struct {
   128  	// List of instance ports to which the policy
   129  	// should be applied. This can be specified if the protocol is SSL or TCP.
   130  	InstancePorts pulumi.StringArrayInput
   131  	// The load balancer to which the policy
   132  	// should be attached.
   133  	LoadBalancer pulumi.StringPtrInput
   134  }
   135  
   136  func (ProxyProtocolPolicyState) ElementType() reflect.Type {
   137  	return reflect.TypeOf((*proxyProtocolPolicyState)(nil)).Elem()
   138  }
   139  
   140  type proxyProtocolPolicyArgs struct {
   141  	// List of instance ports to which the policy
   142  	// should be applied. This can be specified if the protocol is SSL or TCP.
   143  	InstancePorts []string `pulumi:"instancePorts"`
   144  	// The load balancer to which the policy
   145  	// should be attached.
   146  	LoadBalancer string `pulumi:"loadBalancer"`
   147  }
   148  
   149  // The set of arguments for constructing a ProxyProtocolPolicy resource.
   150  type ProxyProtocolPolicyArgs struct {
   151  	// List of instance ports to which the policy
   152  	// should be applied. This can be specified if the protocol is SSL or TCP.
   153  	InstancePorts pulumi.StringArrayInput
   154  	// The load balancer to which the policy
   155  	// should be attached.
   156  	LoadBalancer pulumi.StringInput
   157  }
   158  
   159  func (ProxyProtocolPolicyArgs) ElementType() reflect.Type {
   160  	return reflect.TypeOf((*proxyProtocolPolicyArgs)(nil)).Elem()
   161  }
   162  
   163  type ProxyProtocolPolicyInput interface {
   164  	pulumi.Input
   165  
   166  	ToProxyProtocolPolicyOutput() ProxyProtocolPolicyOutput
   167  	ToProxyProtocolPolicyOutputWithContext(ctx context.Context) ProxyProtocolPolicyOutput
   168  }
   169  
   170  func (*ProxyProtocolPolicy) ElementType() reflect.Type {
   171  	return reflect.TypeOf((**ProxyProtocolPolicy)(nil)).Elem()
   172  }
   173  
   174  func (i *ProxyProtocolPolicy) ToProxyProtocolPolicyOutput() ProxyProtocolPolicyOutput {
   175  	return i.ToProxyProtocolPolicyOutputWithContext(context.Background())
   176  }
   177  
   178  func (i *ProxyProtocolPolicy) ToProxyProtocolPolicyOutputWithContext(ctx context.Context) ProxyProtocolPolicyOutput {
   179  	return pulumi.ToOutputWithContext(ctx, i).(ProxyProtocolPolicyOutput)
   180  }
   181  
   182  // ProxyProtocolPolicyArrayInput is an input type that accepts ProxyProtocolPolicyArray and ProxyProtocolPolicyArrayOutput values.
   183  // You can construct a concrete instance of `ProxyProtocolPolicyArrayInput` via:
   184  //
   185  //	ProxyProtocolPolicyArray{ ProxyProtocolPolicyArgs{...} }
   186  type ProxyProtocolPolicyArrayInput interface {
   187  	pulumi.Input
   188  
   189  	ToProxyProtocolPolicyArrayOutput() ProxyProtocolPolicyArrayOutput
   190  	ToProxyProtocolPolicyArrayOutputWithContext(context.Context) ProxyProtocolPolicyArrayOutput
   191  }
   192  
   193  type ProxyProtocolPolicyArray []ProxyProtocolPolicyInput
   194  
   195  func (ProxyProtocolPolicyArray) ElementType() reflect.Type {
   196  	return reflect.TypeOf((*[]*ProxyProtocolPolicy)(nil)).Elem()
   197  }
   198  
   199  func (i ProxyProtocolPolicyArray) ToProxyProtocolPolicyArrayOutput() ProxyProtocolPolicyArrayOutput {
   200  	return i.ToProxyProtocolPolicyArrayOutputWithContext(context.Background())
   201  }
   202  
   203  func (i ProxyProtocolPolicyArray) ToProxyProtocolPolicyArrayOutputWithContext(ctx context.Context) ProxyProtocolPolicyArrayOutput {
   204  	return pulumi.ToOutputWithContext(ctx, i).(ProxyProtocolPolicyArrayOutput)
   205  }
   206  
   207  // ProxyProtocolPolicyMapInput is an input type that accepts ProxyProtocolPolicyMap and ProxyProtocolPolicyMapOutput values.
   208  // You can construct a concrete instance of `ProxyProtocolPolicyMapInput` via:
   209  //
   210  //	ProxyProtocolPolicyMap{ "key": ProxyProtocolPolicyArgs{...} }
   211  type ProxyProtocolPolicyMapInput interface {
   212  	pulumi.Input
   213  
   214  	ToProxyProtocolPolicyMapOutput() ProxyProtocolPolicyMapOutput
   215  	ToProxyProtocolPolicyMapOutputWithContext(context.Context) ProxyProtocolPolicyMapOutput
   216  }
   217  
   218  type ProxyProtocolPolicyMap map[string]ProxyProtocolPolicyInput
   219  
   220  func (ProxyProtocolPolicyMap) ElementType() reflect.Type {
   221  	return reflect.TypeOf((*map[string]*ProxyProtocolPolicy)(nil)).Elem()
   222  }
   223  
   224  func (i ProxyProtocolPolicyMap) ToProxyProtocolPolicyMapOutput() ProxyProtocolPolicyMapOutput {
   225  	return i.ToProxyProtocolPolicyMapOutputWithContext(context.Background())
   226  }
   227  
   228  func (i ProxyProtocolPolicyMap) ToProxyProtocolPolicyMapOutputWithContext(ctx context.Context) ProxyProtocolPolicyMapOutput {
   229  	return pulumi.ToOutputWithContext(ctx, i).(ProxyProtocolPolicyMapOutput)
   230  }
   231  
   232  type ProxyProtocolPolicyOutput struct{ *pulumi.OutputState }
   233  
   234  func (ProxyProtocolPolicyOutput) ElementType() reflect.Type {
   235  	return reflect.TypeOf((**ProxyProtocolPolicy)(nil)).Elem()
   236  }
   237  
   238  func (o ProxyProtocolPolicyOutput) ToProxyProtocolPolicyOutput() ProxyProtocolPolicyOutput {
   239  	return o
   240  }
   241  
   242  func (o ProxyProtocolPolicyOutput) ToProxyProtocolPolicyOutputWithContext(ctx context.Context) ProxyProtocolPolicyOutput {
   243  	return o
   244  }
   245  
   246  // List of instance ports to which the policy
   247  // should be applied. This can be specified if the protocol is SSL or TCP.
   248  func (o ProxyProtocolPolicyOutput) InstancePorts() pulumi.StringArrayOutput {
   249  	return o.ApplyT(func(v *ProxyProtocolPolicy) pulumi.StringArrayOutput { return v.InstancePorts }).(pulumi.StringArrayOutput)
   250  }
   251  
   252  // The load balancer to which the policy
   253  // should be attached.
   254  func (o ProxyProtocolPolicyOutput) LoadBalancer() pulumi.StringOutput {
   255  	return o.ApplyT(func(v *ProxyProtocolPolicy) pulumi.StringOutput { return v.LoadBalancer }).(pulumi.StringOutput)
   256  }
   257  
   258  type ProxyProtocolPolicyArrayOutput struct{ *pulumi.OutputState }
   259  
   260  func (ProxyProtocolPolicyArrayOutput) ElementType() reflect.Type {
   261  	return reflect.TypeOf((*[]*ProxyProtocolPolicy)(nil)).Elem()
   262  }
   263  
   264  func (o ProxyProtocolPolicyArrayOutput) ToProxyProtocolPolicyArrayOutput() ProxyProtocolPolicyArrayOutput {
   265  	return o
   266  }
   267  
   268  func (o ProxyProtocolPolicyArrayOutput) ToProxyProtocolPolicyArrayOutputWithContext(ctx context.Context) ProxyProtocolPolicyArrayOutput {
   269  	return o
   270  }
   271  
   272  func (o ProxyProtocolPolicyArrayOutput) Index(i pulumi.IntInput) ProxyProtocolPolicyOutput {
   273  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ProxyProtocolPolicy {
   274  		return vs[0].([]*ProxyProtocolPolicy)[vs[1].(int)]
   275  	}).(ProxyProtocolPolicyOutput)
   276  }
   277  
   278  type ProxyProtocolPolicyMapOutput struct{ *pulumi.OutputState }
   279  
   280  func (ProxyProtocolPolicyMapOutput) ElementType() reflect.Type {
   281  	return reflect.TypeOf((*map[string]*ProxyProtocolPolicy)(nil)).Elem()
   282  }
   283  
   284  func (o ProxyProtocolPolicyMapOutput) ToProxyProtocolPolicyMapOutput() ProxyProtocolPolicyMapOutput {
   285  	return o
   286  }
   287  
   288  func (o ProxyProtocolPolicyMapOutput) ToProxyProtocolPolicyMapOutputWithContext(ctx context.Context) ProxyProtocolPolicyMapOutput {
   289  	return o
   290  }
   291  
   292  func (o ProxyProtocolPolicyMapOutput) MapIndex(k pulumi.StringInput) ProxyProtocolPolicyOutput {
   293  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ProxyProtocolPolicy {
   294  		return vs[0].(map[string]*ProxyProtocolPolicy)[vs[1].(string)]
   295  	}).(ProxyProtocolPolicyOutput)
   296  }
   297  
   298  func init() {
   299  	pulumi.RegisterInputType(reflect.TypeOf((*ProxyProtocolPolicyInput)(nil)).Elem(), &ProxyProtocolPolicy{})
   300  	pulumi.RegisterInputType(reflect.TypeOf((*ProxyProtocolPolicyArrayInput)(nil)).Elem(), ProxyProtocolPolicyArray{})
   301  	pulumi.RegisterInputType(reflect.TypeOf((*ProxyProtocolPolicyMapInput)(nil)).Elem(), ProxyProtocolPolicyMap{})
   302  	pulumi.RegisterOutputType(ProxyProtocolPolicyOutput{})
   303  	pulumi.RegisterOutputType(ProxyProtocolPolicyArrayOutput{})
   304  	pulumi.RegisterOutputType(ProxyProtocolPolicyMapOutput{})
   305  }