github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/lightsail/lbCertificateAttachment.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  // Attaches a Lightsail Load Balancer Certificate to a Lightsail Load Balancer.
    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/lightsail"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			test, err := lightsail.NewLb(ctx, "test", &lightsail.LbArgs{
    33  //				Name:            pulumi.String("test-load-balancer"),
    34  //				HealthCheckPath: pulumi.String("/"),
    35  //				InstancePort:    pulumi.Int(80),
    36  //				Tags: pulumi.StringMap{
    37  //					"foo": pulumi.String("bar"),
    38  //				},
    39  //			})
    40  //			if err != nil {
    41  //				return err
    42  //			}
    43  //			testLbCertificate, err := lightsail.NewLbCertificate(ctx, "test", &lightsail.LbCertificateArgs{
    44  //				Name:       pulumi.String("test-load-balancer-certificate"),
    45  //				LbName:     test.ID(),
    46  //				DomainName: pulumi.String("test.com"),
    47  //			})
    48  //			if err != nil {
    49  //				return err
    50  //			}
    51  //			_, err = lightsail.NewLbCertificateAttachment(ctx, "test", &lightsail.LbCertificateAttachmentArgs{
    52  //				LbName:          test.Name,
    53  //				CertificateName: testLbCertificate.Name,
    54  //			})
    55  //			if err != nil {
    56  //				return err
    57  //			}
    58  //			return nil
    59  //		})
    60  //	}
    61  //
    62  // ```
    63  // <!--End PulumiCodeChooser -->
    64  //
    65  // ## Import
    66  //
    67  // Using `pulumi import`, import `aws_lightsail_lb_certificate_attachment` using the name attribute. For example:
    68  //
    69  // ```sh
    70  // $ pulumi import aws:lightsail/lbCertificateAttachment:LbCertificateAttachment test example-load-balancer,example-certificate
    71  // ```
    72  type LbCertificateAttachment struct {
    73  	pulumi.CustomResourceState
    74  
    75  	// The name of your SSL/TLS certificate.
    76  	CertificateName pulumi.StringOutput `pulumi:"certificateName"`
    77  	// The name of the load balancer to which you want to associate the SSL/TLS certificate.
    78  	LbName pulumi.StringOutput `pulumi:"lbName"`
    79  }
    80  
    81  // NewLbCertificateAttachment registers a new resource with the given unique name, arguments, and options.
    82  func NewLbCertificateAttachment(ctx *pulumi.Context,
    83  	name string, args *LbCertificateAttachmentArgs, opts ...pulumi.ResourceOption) (*LbCertificateAttachment, error) {
    84  	if args == nil {
    85  		return nil, errors.New("missing one or more required arguments")
    86  	}
    87  
    88  	if args.CertificateName == nil {
    89  		return nil, errors.New("invalid value for required argument 'CertificateName'")
    90  	}
    91  	if args.LbName == nil {
    92  		return nil, errors.New("invalid value for required argument 'LbName'")
    93  	}
    94  	opts = internal.PkgResourceDefaultOpts(opts)
    95  	var resource LbCertificateAttachment
    96  	err := ctx.RegisterResource("aws:lightsail/lbCertificateAttachment:LbCertificateAttachment", name, args, &resource, opts...)
    97  	if err != nil {
    98  		return nil, err
    99  	}
   100  	return &resource, nil
   101  }
   102  
   103  // GetLbCertificateAttachment gets an existing LbCertificateAttachment resource's state with the given name, ID, and optional
   104  // state properties that are used to uniquely qualify the lookup (nil if not required).
   105  func GetLbCertificateAttachment(ctx *pulumi.Context,
   106  	name string, id pulumi.IDInput, state *LbCertificateAttachmentState, opts ...pulumi.ResourceOption) (*LbCertificateAttachment, error) {
   107  	var resource LbCertificateAttachment
   108  	err := ctx.ReadResource("aws:lightsail/lbCertificateAttachment:LbCertificateAttachment", name, id, state, &resource, opts...)
   109  	if err != nil {
   110  		return nil, err
   111  	}
   112  	return &resource, nil
   113  }
   114  
   115  // Input properties used for looking up and filtering LbCertificateAttachment resources.
   116  type lbCertificateAttachmentState struct {
   117  	// The name of your SSL/TLS certificate.
   118  	CertificateName *string `pulumi:"certificateName"`
   119  	// The name of the load balancer to which you want to associate the SSL/TLS certificate.
   120  	LbName *string `pulumi:"lbName"`
   121  }
   122  
   123  type LbCertificateAttachmentState struct {
   124  	// The name of your SSL/TLS certificate.
   125  	CertificateName pulumi.StringPtrInput
   126  	// The name of the load balancer to which you want to associate the SSL/TLS certificate.
   127  	LbName pulumi.StringPtrInput
   128  }
   129  
   130  func (LbCertificateAttachmentState) ElementType() reflect.Type {
   131  	return reflect.TypeOf((*lbCertificateAttachmentState)(nil)).Elem()
   132  }
   133  
   134  type lbCertificateAttachmentArgs struct {
   135  	// The name of your SSL/TLS certificate.
   136  	CertificateName string `pulumi:"certificateName"`
   137  	// The name of the load balancer to which you want to associate the SSL/TLS certificate.
   138  	LbName string `pulumi:"lbName"`
   139  }
   140  
   141  // The set of arguments for constructing a LbCertificateAttachment resource.
   142  type LbCertificateAttachmentArgs struct {
   143  	// The name of your SSL/TLS certificate.
   144  	CertificateName pulumi.StringInput
   145  	// The name of the load balancer to which you want to associate the SSL/TLS certificate.
   146  	LbName pulumi.StringInput
   147  }
   148  
   149  func (LbCertificateAttachmentArgs) ElementType() reflect.Type {
   150  	return reflect.TypeOf((*lbCertificateAttachmentArgs)(nil)).Elem()
   151  }
   152  
   153  type LbCertificateAttachmentInput interface {
   154  	pulumi.Input
   155  
   156  	ToLbCertificateAttachmentOutput() LbCertificateAttachmentOutput
   157  	ToLbCertificateAttachmentOutputWithContext(ctx context.Context) LbCertificateAttachmentOutput
   158  }
   159  
   160  func (*LbCertificateAttachment) ElementType() reflect.Type {
   161  	return reflect.TypeOf((**LbCertificateAttachment)(nil)).Elem()
   162  }
   163  
   164  func (i *LbCertificateAttachment) ToLbCertificateAttachmentOutput() LbCertificateAttachmentOutput {
   165  	return i.ToLbCertificateAttachmentOutputWithContext(context.Background())
   166  }
   167  
   168  func (i *LbCertificateAttachment) ToLbCertificateAttachmentOutputWithContext(ctx context.Context) LbCertificateAttachmentOutput {
   169  	return pulumi.ToOutputWithContext(ctx, i).(LbCertificateAttachmentOutput)
   170  }
   171  
   172  // LbCertificateAttachmentArrayInput is an input type that accepts LbCertificateAttachmentArray and LbCertificateAttachmentArrayOutput values.
   173  // You can construct a concrete instance of `LbCertificateAttachmentArrayInput` via:
   174  //
   175  //	LbCertificateAttachmentArray{ LbCertificateAttachmentArgs{...} }
   176  type LbCertificateAttachmentArrayInput interface {
   177  	pulumi.Input
   178  
   179  	ToLbCertificateAttachmentArrayOutput() LbCertificateAttachmentArrayOutput
   180  	ToLbCertificateAttachmentArrayOutputWithContext(context.Context) LbCertificateAttachmentArrayOutput
   181  }
   182  
   183  type LbCertificateAttachmentArray []LbCertificateAttachmentInput
   184  
   185  func (LbCertificateAttachmentArray) ElementType() reflect.Type {
   186  	return reflect.TypeOf((*[]*LbCertificateAttachment)(nil)).Elem()
   187  }
   188  
   189  func (i LbCertificateAttachmentArray) ToLbCertificateAttachmentArrayOutput() LbCertificateAttachmentArrayOutput {
   190  	return i.ToLbCertificateAttachmentArrayOutputWithContext(context.Background())
   191  }
   192  
   193  func (i LbCertificateAttachmentArray) ToLbCertificateAttachmentArrayOutputWithContext(ctx context.Context) LbCertificateAttachmentArrayOutput {
   194  	return pulumi.ToOutputWithContext(ctx, i).(LbCertificateAttachmentArrayOutput)
   195  }
   196  
   197  // LbCertificateAttachmentMapInput is an input type that accepts LbCertificateAttachmentMap and LbCertificateAttachmentMapOutput values.
   198  // You can construct a concrete instance of `LbCertificateAttachmentMapInput` via:
   199  //
   200  //	LbCertificateAttachmentMap{ "key": LbCertificateAttachmentArgs{...} }
   201  type LbCertificateAttachmentMapInput interface {
   202  	pulumi.Input
   203  
   204  	ToLbCertificateAttachmentMapOutput() LbCertificateAttachmentMapOutput
   205  	ToLbCertificateAttachmentMapOutputWithContext(context.Context) LbCertificateAttachmentMapOutput
   206  }
   207  
   208  type LbCertificateAttachmentMap map[string]LbCertificateAttachmentInput
   209  
   210  func (LbCertificateAttachmentMap) ElementType() reflect.Type {
   211  	return reflect.TypeOf((*map[string]*LbCertificateAttachment)(nil)).Elem()
   212  }
   213  
   214  func (i LbCertificateAttachmentMap) ToLbCertificateAttachmentMapOutput() LbCertificateAttachmentMapOutput {
   215  	return i.ToLbCertificateAttachmentMapOutputWithContext(context.Background())
   216  }
   217  
   218  func (i LbCertificateAttachmentMap) ToLbCertificateAttachmentMapOutputWithContext(ctx context.Context) LbCertificateAttachmentMapOutput {
   219  	return pulumi.ToOutputWithContext(ctx, i).(LbCertificateAttachmentMapOutput)
   220  }
   221  
   222  type LbCertificateAttachmentOutput struct{ *pulumi.OutputState }
   223  
   224  func (LbCertificateAttachmentOutput) ElementType() reflect.Type {
   225  	return reflect.TypeOf((**LbCertificateAttachment)(nil)).Elem()
   226  }
   227  
   228  func (o LbCertificateAttachmentOutput) ToLbCertificateAttachmentOutput() LbCertificateAttachmentOutput {
   229  	return o
   230  }
   231  
   232  func (o LbCertificateAttachmentOutput) ToLbCertificateAttachmentOutputWithContext(ctx context.Context) LbCertificateAttachmentOutput {
   233  	return o
   234  }
   235  
   236  // The name of your SSL/TLS certificate.
   237  func (o LbCertificateAttachmentOutput) CertificateName() pulumi.StringOutput {
   238  	return o.ApplyT(func(v *LbCertificateAttachment) pulumi.StringOutput { return v.CertificateName }).(pulumi.StringOutput)
   239  }
   240  
   241  // The name of the load balancer to which you want to associate the SSL/TLS certificate.
   242  func (o LbCertificateAttachmentOutput) LbName() pulumi.StringOutput {
   243  	return o.ApplyT(func(v *LbCertificateAttachment) pulumi.StringOutput { return v.LbName }).(pulumi.StringOutput)
   244  }
   245  
   246  type LbCertificateAttachmentArrayOutput struct{ *pulumi.OutputState }
   247  
   248  func (LbCertificateAttachmentArrayOutput) ElementType() reflect.Type {
   249  	return reflect.TypeOf((*[]*LbCertificateAttachment)(nil)).Elem()
   250  }
   251  
   252  func (o LbCertificateAttachmentArrayOutput) ToLbCertificateAttachmentArrayOutput() LbCertificateAttachmentArrayOutput {
   253  	return o
   254  }
   255  
   256  func (o LbCertificateAttachmentArrayOutput) ToLbCertificateAttachmentArrayOutputWithContext(ctx context.Context) LbCertificateAttachmentArrayOutput {
   257  	return o
   258  }
   259  
   260  func (o LbCertificateAttachmentArrayOutput) Index(i pulumi.IntInput) LbCertificateAttachmentOutput {
   261  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *LbCertificateAttachment {
   262  		return vs[0].([]*LbCertificateAttachment)[vs[1].(int)]
   263  	}).(LbCertificateAttachmentOutput)
   264  }
   265  
   266  type LbCertificateAttachmentMapOutput struct{ *pulumi.OutputState }
   267  
   268  func (LbCertificateAttachmentMapOutput) ElementType() reflect.Type {
   269  	return reflect.TypeOf((*map[string]*LbCertificateAttachment)(nil)).Elem()
   270  }
   271  
   272  func (o LbCertificateAttachmentMapOutput) ToLbCertificateAttachmentMapOutput() LbCertificateAttachmentMapOutput {
   273  	return o
   274  }
   275  
   276  func (o LbCertificateAttachmentMapOutput) ToLbCertificateAttachmentMapOutputWithContext(ctx context.Context) LbCertificateAttachmentMapOutput {
   277  	return o
   278  }
   279  
   280  func (o LbCertificateAttachmentMapOutput) MapIndex(k pulumi.StringInput) LbCertificateAttachmentOutput {
   281  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *LbCertificateAttachment {
   282  		return vs[0].(map[string]*LbCertificateAttachment)[vs[1].(string)]
   283  	}).(LbCertificateAttachmentOutput)
   284  }
   285  
   286  func init() {
   287  	pulumi.RegisterInputType(reflect.TypeOf((*LbCertificateAttachmentInput)(nil)).Elem(), &LbCertificateAttachment{})
   288  	pulumi.RegisterInputType(reflect.TypeOf((*LbCertificateAttachmentArrayInput)(nil)).Elem(), LbCertificateAttachmentArray{})
   289  	pulumi.RegisterInputType(reflect.TypeOf((*LbCertificateAttachmentMapInput)(nil)).Elem(), LbCertificateAttachmentMap{})
   290  	pulumi.RegisterOutputType(LbCertificateAttachmentOutput{})
   291  	pulumi.RegisterOutputType(LbCertificateAttachmentArrayOutput{})
   292  	pulumi.RegisterOutputType(LbCertificateAttachmentMapOutput{})
   293  }