github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/elb/loadBalancerBackendServerPolicy.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 elb
     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  // Attaches a load balancer policy to an ELB backend server.
    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/elb"
    26  //	"github.com/pulumi/pulumi-std/sdk/go/std"
    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 := elb.NewLoadBalancer(ctx, "wu-tang", &elb.LoadBalancerArgs{
    34  //				Name: pulumi.String("wu-tang"),
    35  //				AvailabilityZones: pulumi.StringArray{
    36  //					pulumi.String("us-east-1a"),
    37  //				},
    38  //				Listeners: elb.LoadBalancerListenerArray{
    39  //					&elb.LoadBalancerListenerArgs{
    40  //						InstancePort:     pulumi.Int(443),
    41  //						InstanceProtocol: pulumi.String("http"),
    42  //						LbPort:           pulumi.Int(443),
    43  //						LbProtocol:       pulumi.String("https"),
    44  //						SslCertificateId: pulumi.String("arn:aws:iam::000000000000:server-certificate/wu-tang.net"),
    45  //					},
    46  //				},
    47  //				Tags: pulumi.StringMap{
    48  //					"Name": pulumi.String("wu-tang"),
    49  //				},
    50  //			})
    51  //			if err != nil {
    52  //				return err
    53  //			}
    54  //			invokeFile, err := std.File(ctx, &std.FileArgs{
    55  //				Input: "wu-tang-pubkey",
    56  //			}, nil)
    57  //			if err != nil {
    58  //				return err
    59  //			}
    60  //			_, err = elb.NewLoadBalancerPolicy(ctx, "wu-tang-ca-pubkey-policy", &elb.LoadBalancerPolicyArgs{
    61  //				LoadBalancerName: wu_tang.Name,
    62  //				PolicyName:       pulumi.String("wu-tang-ca-pubkey-policy"),
    63  //				PolicyTypeName:   pulumi.String("PublicKeyPolicyType"),
    64  //				PolicyAttributes: elb.LoadBalancerPolicyPolicyAttributeArray{
    65  //					&elb.LoadBalancerPolicyPolicyAttributeArgs{
    66  //						Name:  pulumi.String("PublicKey"),
    67  //						Value: invokeFile.Result,
    68  //					},
    69  //				},
    70  //			})
    71  //			if err != nil {
    72  //				return err
    73  //			}
    74  //			_, err = elb.NewLoadBalancerPolicy(ctx, "wu-tang-root-ca-backend-auth-policy", &elb.LoadBalancerPolicyArgs{
    75  //				LoadBalancerName: wu_tang.Name,
    76  //				PolicyName:       pulumi.String("wu-tang-root-ca-backend-auth-policy"),
    77  //				PolicyTypeName:   pulumi.String("BackendServerAuthenticationPolicyType"),
    78  //				PolicyAttributes: elb.LoadBalancerPolicyPolicyAttributeArray{
    79  //					&elb.LoadBalancerPolicyPolicyAttributeArgs{
    80  //						Name:  pulumi.String("PublicKeyPolicyName"),
    81  //						Value: pulumi.Any(wu_tang_root_ca_pubkey_policy.PolicyName),
    82  //					},
    83  //				},
    84  //			})
    85  //			if err != nil {
    86  //				return err
    87  //			}
    88  //			_, err = elb.NewLoadBalancerBackendServerPolicy(ctx, "wu-tang-backend-auth-policies-443", &elb.LoadBalancerBackendServerPolicyArgs{
    89  //				LoadBalancerName: wu_tang.Name,
    90  //				InstancePort:     pulumi.Int(443),
    91  //				PolicyNames: pulumi.StringArray{
    92  //					wu_tang_root_ca_backend_auth_policy.PolicyName,
    93  //				},
    94  //			})
    95  //			if err != nil {
    96  //				return err
    97  //			}
    98  //			return nil
    99  //		})
   100  //	}
   101  //
   102  // ```
   103  // <!--End PulumiCodeChooser -->
   104  type LoadBalancerBackendServerPolicy struct {
   105  	pulumi.CustomResourceState
   106  
   107  	// The instance port to apply the policy to.
   108  	InstancePort pulumi.IntOutput `pulumi:"instancePort"`
   109  	// The load balancer to attach the policy to.
   110  	LoadBalancerName pulumi.StringOutput `pulumi:"loadBalancerName"`
   111  	// List of Policy Names to apply to the backend server.
   112  	PolicyNames pulumi.StringArrayOutput `pulumi:"policyNames"`
   113  }
   114  
   115  // NewLoadBalancerBackendServerPolicy registers a new resource with the given unique name, arguments, and options.
   116  func NewLoadBalancerBackendServerPolicy(ctx *pulumi.Context,
   117  	name string, args *LoadBalancerBackendServerPolicyArgs, opts ...pulumi.ResourceOption) (*LoadBalancerBackendServerPolicy, error) {
   118  	if args == nil {
   119  		return nil, errors.New("missing one or more required arguments")
   120  	}
   121  
   122  	if args.InstancePort == nil {
   123  		return nil, errors.New("invalid value for required argument 'InstancePort'")
   124  	}
   125  	if args.LoadBalancerName == nil {
   126  		return nil, errors.New("invalid value for required argument 'LoadBalancerName'")
   127  	}
   128  	aliases := pulumi.Aliases([]pulumi.Alias{
   129  		{
   130  			Type: pulumi.String("aws:elasticloadbalancing/loadBalancerBackendServerPolicy:LoadBalancerBackendServerPolicy"),
   131  		},
   132  	})
   133  	opts = append(opts, aliases)
   134  	opts = internal.PkgResourceDefaultOpts(opts)
   135  	var resource LoadBalancerBackendServerPolicy
   136  	err := ctx.RegisterResource("aws:elb/loadBalancerBackendServerPolicy:LoadBalancerBackendServerPolicy", name, args, &resource, opts...)
   137  	if err != nil {
   138  		return nil, err
   139  	}
   140  	return &resource, nil
   141  }
   142  
   143  // GetLoadBalancerBackendServerPolicy gets an existing LoadBalancerBackendServerPolicy resource's state with the given name, ID, and optional
   144  // state properties that are used to uniquely qualify the lookup (nil if not required).
   145  func GetLoadBalancerBackendServerPolicy(ctx *pulumi.Context,
   146  	name string, id pulumi.IDInput, state *LoadBalancerBackendServerPolicyState, opts ...pulumi.ResourceOption) (*LoadBalancerBackendServerPolicy, error) {
   147  	var resource LoadBalancerBackendServerPolicy
   148  	err := ctx.ReadResource("aws:elb/loadBalancerBackendServerPolicy:LoadBalancerBackendServerPolicy", name, id, state, &resource, opts...)
   149  	if err != nil {
   150  		return nil, err
   151  	}
   152  	return &resource, nil
   153  }
   154  
   155  // Input properties used for looking up and filtering LoadBalancerBackendServerPolicy resources.
   156  type loadBalancerBackendServerPolicyState struct {
   157  	// The instance port to apply the policy to.
   158  	InstancePort *int `pulumi:"instancePort"`
   159  	// The load balancer to attach the policy to.
   160  	LoadBalancerName *string `pulumi:"loadBalancerName"`
   161  	// List of Policy Names to apply to the backend server.
   162  	PolicyNames []string `pulumi:"policyNames"`
   163  }
   164  
   165  type LoadBalancerBackendServerPolicyState struct {
   166  	// The instance port to apply the policy to.
   167  	InstancePort pulumi.IntPtrInput
   168  	// The load balancer to attach the policy to.
   169  	LoadBalancerName pulumi.StringPtrInput
   170  	// List of Policy Names to apply to the backend server.
   171  	PolicyNames pulumi.StringArrayInput
   172  }
   173  
   174  func (LoadBalancerBackendServerPolicyState) ElementType() reflect.Type {
   175  	return reflect.TypeOf((*loadBalancerBackendServerPolicyState)(nil)).Elem()
   176  }
   177  
   178  type loadBalancerBackendServerPolicyArgs struct {
   179  	// The instance port to apply the policy to.
   180  	InstancePort int `pulumi:"instancePort"`
   181  	// The load balancer to attach the policy to.
   182  	LoadBalancerName string `pulumi:"loadBalancerName"`
   183  	// List of Policy Names to apply to the backend server.
   184  	PolicyNames []string `pulumi:"policyNames"`
   185  }
   186  
   187  // The set of arguments for constructing a LoadBalancerBackendServerPolicy resource.
   188  type LoadBalancerBackendServerPolicyArgs struct {
   189  	// The instance port to apply the policy to.
   190  	InstancePort pulumi.IntInput
   191  	// The load balancer to attach the policy to.
   192  	LoadBalancerName pulumi.StringInput
   193  	// List of Policy Names to apply to the backend server.
   194  	PolicyNames pulumi.StringArrayInput
   195  }
   196  
   197  func (LoadBalancerBackendServerPolicyArgs) ElementType() reflect.Type {
   198  	return reflect.TypeOf((*loadBalancerBackendServerPolicyArgs)(nil)).Elem()
   199  }
   200  
   201  type LoadBalancerBackendServerPolicyInput interface {
   202  	pulumi.Input
   203  
   204  	ToLoadBalancerBackendServerPolicyOutput() LoadBalancerBackendServerPolicyOutput
   205  	ToLoadBalancerBackendServerPolicyOutputWithContext(ctx context.Context) LoadBalancerBackendServerPolicyOutput
   206  }
   207  
   208  func (*LoadBalancerBackendServerPolicy) ElementType() reflect.Type {
   209  	return reflect.TypeOf((**LoadBalancerBackendServerPolicy)(nil)).Elem()
   210  }
   211  
   212  func (i *LoadBalancerBackendServerPolicy) ToLoadBalancerBackendServerPolicyOutput() LoadBalancerBackendServerPolicyOutput {
   213  	return i.ToLoadBalancerBackendServerPolicyOutputWithContext(context.Background())
   214  }
   215  
   216  func (i *LoadBalancerBackendServerPolicy) ToLoadBalancerBackendServerPolicyOutputWithContext(ctx context.Context) LoadBalancerBackendServerPolicyOutput {
   217  	return pulumi.ToOutputWithContext(ctx, i).(LoadBalancerBackendServerPolicyOutput)
   218  }
   219  
   220  // LoadBalancerBackendServerPolicyArrayInput is an input type that accepts LoadBalancerBackendServerPolicyArray and LoadBalancerBackendServerPolicyArrayOutput values.
   221  // You can construct a concrete instance of `LoadBalancerBackendServerPolicyArrayInput` via:
   222  //
   223  //	LoadBalancerBackendServerPolicyArray{ LoadBalancerBackendServerPolicyArgs{...} }
   224  type LoadBalancerBackendServerPolicyArrayInput interface {
   225  	pulumi.Input
   226  
   227  	ToLoadBalancerBackendServerPolicyArrayOutput() LoadBalancerBackendServerPolicyArrayOutput
   228  	ToLoadBalancerBackendServerPolicyArrayOutputWithContext(context.Context) LoadBalancerBackendServerPolicyArrayOutput
   229  }
   230  
   231  type LoadBalancerBackendServerPolicyArray []LoadBalancerBackendServerPolicyInput
   232  
   233  func (LoadBalancerBackendServerPolicyArray) ElementType() reflect.Type {
   234  	return reflect.TypeOf((*[]*LoadBalancerBackendServerPolicy)(nil)).Elem()
   235  }
   236  
   237  func (i LoadBalancerBackendServerPolicyArray) ToLoadBalancerBackendServerPolicyArrayOutput() LoadBalancerBackendServerPolicyArrayOutput {
   238  	return i.ToLoadBalancerBackendServerPolicyArrayOutputWithContext(context.Background())
   239  }
   240  
   241  func (i LoadBalancerBackendServerPolicyArray) ToLoadBalancerBackendServerPolicyArrayOutputWithContext(ctx context.Context) LoadBalancerBackendServerPolicyArrayOutput {
   242  	return pulumi.ToOutputWithContext(ctx, i).(LoadBalancerBackendServerPolicyArrayOutput)
   243  }
   244  
   245  // LoadBalancerBackendServerPolicyMapInput is an input type that accepts LoadBalancerBackendServerPolicyMap and LoadBalancerBackendServerPolicyMapOutput values.
   246  // You can construct a concrete instance of `LoadBalancerBackendServerPolicyMapInput` via:
   247  //
   248  //	LoadBalancerBackendServerPolicyMap{ "key": LoadBalancerBackendServerPolicyArgs{...} }
   249  type LoadBalancerBackendServerPolicyMapInput interface {
   250  	pulumi.Input
   251  
   252  	ToLoadBalancerBackendServerPolicyMapOutput() LoadBalancerBackendServerPolicyMapOutput
   253  	ToLoadBalancerBackendServerPolicyMapOutputWithContext(context.Context) LoadBalancerBackendServerPolicyMapOutput
   254  }
   255  
   256  type LoadBalancerBackendServerPolicyMap map[string]LoadBalancerBackendServerPolicyInput
   257  
   258  func (LoadBalancerBackendServerPolicyMap) ElementType() reflect.Type {
   259  	return reflect.TypeOf((*map[string]*LoadBalancerBackendServerPolicy)(nil)).Elem()
   260  }
   261  
   262  func (i LoadBalancerBackendServerPolicyMap) ToLoadBalancerBackendServerPolicyMapOutput() LoadBalancerBackendServerPolicyMapOutput {
   263  	return i.ToLoadBalancerBackendServerPolicyMapOutputWithContext(context.Background())
   264  }
   265  
   266  func (i LoadBalancerBackendServerPolicyMap) ToLoadBalancerBackendServerPolicyMapOutputWithContext(ctx context.Context) LoadBalancerBackendServerPolicyMapOutput {
   267  	return pulumi.ToOutputWithContext(ctx, i).(LoadBalancerBackendServerPolicyMapOutput)
   268  }
   269  
   270  type LoadBalancerBackendServerPolicyOutput struct{ *pulumi.OutputState }
   271  
   272  func (LoadBalancerBackendServerPolicyOutput) ElementType() reflect.Type {
   273  	return reflect.TypeOf((**LoadBalancerBackendServerPolicy)(nil)).Elem()
   274  }
   275  
   276  func (o LoadBalancerBackendServerPolicyOutput) ToLoadBalancerBackendServerPolicyOutput() LoadBalancerBackendServerPolicyOutput {
   277  	return o
   278  }
   279  
   280  func (o LoadBalancerBackendServerPolicyOutput) ToLoadBalancerBackendServerPolicyOutputWithContext(ctx context.Context) LoadBalancerBackendServerPolicyOutput {
   281  	return o
   282  }
   283  
   284  // The instance port to apply the policy to.
   285  func (o LoadBalancerBackendServerPolicyOutput) InstancePort() pulumi.IntOutput {
   286  	return o.ApplyT(func(v *LoadBalancerBackendServerPolicy) pulumi.IntOutput { return v.InstancePort }).(pulumi.IntOutput)
   287  }
   288  
   289  // The load balancer to attach the policy to.
   290  func (o LoadBalancerBackendServerPolicyOutput) LoadBalancerName() pulumi.StringOutput {
   291  	return o.ApplyT(func(v *LoadBalancerBackendServerPolicy) pulumi.StringOutput { return v.LoadBalancerName }).(pulumi.StringOutput)
   292  }
   293  
   294  // List of Policy Names to apply to the backend server.
   295  func (o LoadBalancerBackendServerPolicyOutput) PolicyNames() pulumi.StringArrayOutput {
   296  	return o.ApplyT(func(v *LoadBalancerBackendServerPolicy) pulumi.StringArrayOutput { return v.PolicyNames }).(pulumi.StringArrayOutput)
   297  }
   298  
   299  type LoadBalancerBackendServerPolicyArrayOutput struct{ *pulumi.OutputState }
   300  
   301  func (LoadBalancerBackendServerPolicyArrayOutput) ElementType() reflect.Type {
   302  	return reflect.TypeOf((*[]*LoadBalancerBackendServerPolicy)(nil)).Elem()
   303  }
   304  
   305  func (o LoadBalancerBackendServerPolicyArrayOutput) ToLoadBalancerBackendServerPolicyArrayOutput() LoadBalancerBackendServerPolicyArrayOutput {
   306  	return o
   307  }
   308  
   309  func (o LoadBalancerBackendServerPolicyArrayOutput) ToLoadBalancerBackendServerPolicyArrayOutputWithContext(ctx context.Context) LoadBalancerBackendServerPolicyArrayOutput {
   310  	return o
   311  }
   312  
   313  func (o LoadBalancerBackendServerPolicyArrayOutput) Index(i pulumi.IntInput) LoadBalancerBackendServerPolicyOutput {
   314  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *LoadBalancerBackendServerPolicy {
   315  		return vs[0].([]*LoadBalancerBackendServerPolicy)[vs[1].(int)]
   316  	}).(LoadBalancerBackendServerPolicyOutput)
   317  }
   318  
   319  type LoadBalancerBackendServerPolicyMapOutput struct{ *pulumi.OutputState }
   320  
   321  func (LoadBalancerBackendServerPolicyMapOutput) ElementType() reflect.Type {
   322  	return reflect.TypeOf((*map[string]*LoadBalancerBackendServerPolicy)(nil)).Elem()
   323  }
   324  
   325  func (o LoadBalancerBackendServerPolicyMapOutput) ToLoadBalancerBackendServerPolicyMapOutput() LoadBalancerBackendServerPolicyMapOutput {
   326  	return o
   327  }
   328  
   329  func (o LoadBalancerBackendServerPolicyMapOutput) ToLoadBalancerBackendServerPolicyMapOutputWithContext(ctx context.Context) LoadBalancerBackendServerPolicyMapOutput {
   330  	return o
   331  }
   332  
   333  func (o LoadBalancerBackendServerPolicyMapOutput) MapIndex(k pulumi.StringInput) LoadBalancerBackendServerPolicyOutput {
   334  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *LoadBalancerBackendServerPolicy {
   335  		return vs[0].(map[string]*LoadBalancerBackendServerPolicy)[vs[1].(string)]
   336  	}).(LoadBalancerBackendServerPolicyOutput)
   337  }
   338  
   339  func init() {
   340  	pulumi.RegisterInputType(reflect.TypeOf((*LoadBalancerBackendServerPolicyInput)(nil)).Elem(), &LoadBalancerBackendServerPolicy{})
   341  	pulumi.RegisterInputType(reflect.TypeOf((*LoadBalancerBackendServerPolicyArrayInput)(nil)).Elem(), LoadBalancerBackendServerPolicyArray{})
   342  	pulumi.RegisterInputType(reflect.TypeOf((*LoadBalancerBackendServerPolicyMapInput)(nil)).Elem(), LoadBalancerBackendServerPolicyMap{})
   343  	pulumi.RegisterOutputType(LoadBalancerBackendServerPolicyOutput{})
   344  	pulumi.RegisterOutputType(LoadBalancerBackendServerPolicyArrayOutput{})
   345  	pulumi.RegisterOutputType(LoadBalancerBackendServerPolicyMapOutput{})
   346  }