github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/lightsail/certificate.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  // Provides a lightsail certificate.
    15  //
    16  // ## Example Usage
    17  //
    18  // <!--Start PulumiCodeChooser -->
    19  // ```go
    20  // package main
    21  //
    22  // import (
    23  //
    24  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lightsail"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  //
    29  //	func main() {
    30  //		pulumi.Run(func(ctx *pulumi.Context) error {
    31  //			_, err := lightsail.NewCertificate(ctx, "test", &lightsail.CertificateArgs{
    32  //				Name:       pulumi.String("test"),
    33  //				DomainName: pulumi.String("testdomain.com"),
    34  //				SubjectAlternativeNames: pulumi.StringArray{
    35  //					pulumi.String("www.testdomain.com"),
    36  //				},
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			return nil
    42  //		})
    43  //	}
    44  //
    45  // ```
    46  // <!--End PulumiCodeChooser -->
    47  //
    48  // ## Import
    49  //
    50  // Using `pulumi import`, import `aws_lightsail_certificate` using the certificate name. For example:
    51  //
    52  // ```sh
    53  // $ pulumi import aws:lightsail/certificate:Certificate test CertificateName
    54  // ```
    55  type Certificate struct {
    56  	pulumi.CustomResourceState
    57  
    58  	// The ARN of the lightsail certificate.
    59  	Arn pulumi.StringOutput `pulumi:"arn"`
    60  	// The timestamp when the instance was created.
    61  	CreatedAt pulumi.StringOutput `pulumi:"createdAt"`
    62  	// A domain name for which the certificate should be issued.
    63  	DomainName pulumi.StringOutput `pulumi:"domainName"`
    64  	// Set of domain validation objects which can be used to complete certificate validation. Can have more than one element, e.g., if SANs are defined.
    65  	DomainValidationOptions CertificateDomainValidationOptionArrayOutput `pulumi:"domainValidationOptions"`
    66  	// The name of the Lightsail load balancer.
    67  	Name pulumi.StringOutput `pulumi:"name"`
    68  	// Set of domains that should be SANs in the issued certificate. `domainName` attribute is automatically added as a Subject Alternative Name.
    69  	SubjectAlternativeNames pulumi.StringArrayOutput `pulumi:"subjectAlternativeNames"`
    70  	// A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    71  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    72  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    73  	//
    74  	// Deprecated: Please use `tags` instead.
    75  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    76  }
    77  
    78  // NewCertificate registers a new resource with the given unique name, arguments, and options.
    79  func NewCertificate(ctx *pulumi.Context,
    80  	name string, args *CertificateArgs, opts ...pulumi.ResourceOption) (*Certificate, error) {
    81  	if args == nil {
    82  		args = &CertificateArgs{}
    83  	}
    84  
    85  	opts = internal.PkgResourceDefaultOpts(opts)
    86  	var resource Certificate
    87  	err := ctx.RegisterResource("aws:lightsail/certificate:Certificate", name, args, &resource, opts...)
    88  	if err != nil {
    89  		return nil, err
    90  	}
    91  	return &resource, nil
    92  }
    93  
    94  // GetCertificate gets an existing Certificate resource's state with the given name, ID, and optional
    95  // state properties that are used to uniquely qualify the lookup (nil if not required).
    96  func GetCertificate(ctx *pulumi.Context,
    97  	name string, id pulumi.IDInput, state *CertificateState, opts ...pulumi.ResourceOption) (*Certificate, error) {
    98  	var resource Certificate
    99  	err := ctx.ReadResource("aws:lightsail/certificate:Certificate", name, id, state, &resource, opts...)
   100  	if err != nil {
   101  		return nil, err
   102  	}
   103  	return &resource, nil
   104  }
   105  
   106  // Input properties used for looking up and filtering Certificate resources.
   107  type certificateState struct {
   108  	// The ARN of the lightsail certificate.
   109  	Arn *string `pulumi:"arn"`
   110  	// The timestamp when the instance was created.
   111  	CreatedAt *string `pulumi:"createdAt"`
   112  	// A domain name for which the certificate should be issued.
   113  	DomainName *string `pulumi:"domainName"`
   114  	// Set of domain validation objects which can be used to complete certificate validation. Can have more than one element, e.g., if SANs are defined.
   115  	DomainValidationOptions []CertificateDomainValidationOption `pulumi:"domainValidationOptions"`
   116  	// The name of the Lightsail load balancer.
   117  	Name *string `pulumi:"name"`
   118  	// Set of domains that should be SANs in the issued certificate. `domainName` attribute is automatically added as a Subject Alternative Name.
   119  	SubjectAlternativeNames []string `pulumi:"subjectAlternativeNames"`
   120  	// A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   121  	Tags map[string]string `pulumi:"tags"`
   122  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   123  	//
   124  	// Deprecated: Please use `tags` instead.
   125  	TagsAll map[string]string `pulumi:"tagsAll"`
   126  }
   127  
   128  type CertificateState struct {
   129  	// The ARN of the lightsail certificate.
   130  	Arn pulumi.StringPtrInput
   131  	// The timestamp when the instance was created.
   132  	CreatedAt pulumi.StringPtrInput
   133  	// A domain name for which the certificate should be issued.
   134  	DomainName pulumi.StringPtrInput
   135  	// Set of domain validation objects which can be used to complete certificate validation. Can have more than one element, e.g., if SANs are defined.
   136  	DomainValidationOptions CertificateDomainValidationOptionArrayInput
   137  	// The name of the Lightsail load balancer.
   138  	Name pulumi.StringPtrInput
   139  	// Set of domains that should be SANs in the issued certificate. `domainName` attribute is automatically added as a Subject Alternative Name.
   140  	SubjectAlternativeNames pulumi.StringArrayInput
   141  	// A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   142  	Tags pulumi.StringMapInput
   143  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   144  	//
   145  	// Deprecated: Please use `tags` instead.
   146  	TagsAll pulumi.StringMapInput
   147  }
   148  
   149  func (CertificateState) ElementType() reflect.Type {
   150  	return reflect.TypeOf((*certificateState)(nil)).Elem()
   151  }
   152  
   153  type certificateArgs struct {
   154  	// A domain name for which the certificate should be issued.
   155  	DomainName *string `pulumi:"domainName"`
   156  	// The name of the Lightsail load balancer.
   157  	Name *string `pulumi:"name"`
   158  	// Set of domains that should be SANs in the issued certificate. `domainName` attribute is automatically added as a Subject Alternative Name.
   159  	SubjectAlternativeNames []string `pulumi:"subjectAlternativeNames"`
   160  	// A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   161  	Tags map[string]string `pulumi:"tags"`
   162  }
   163  
   164  // The set of arguments for constructing a Certificate resource.
   165  type CertificateArgs struct {
   166  	// A domain name for which the certificate should be issued.
   167  	DomainName pulumi.StringPtrInput
   168  	// The name of the Lightsail load balancer.
   169  	Name pulumi.StringPtrInput
   170  	// Set of domains that should be SANs in the issued certificate. `domainName` attribute is automatically added as a Subject Alternative Name.
   171  	SubjectAlternativeNames pulumi.StringArrayInput
   172  	// A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   173  	Tags pulumi.StringMapInput
   174  }
   175  
   176  func (CertificateArgs) ElementType() reflect.Type {
   177  	return reflect.TypeOf((*certificateArgs)(nil)).Elem()
   178  }
   179  
   180  type CertificateInput interface {
   181  	pulumi.Input
   182  
   183  	ToCertificateOutput() CertificateOutput
   184  	ToCertificateOutputWithContext(ctx context.Context) CertificateOutput
   185  }
   186  
   187  func (*Certificate) ElementType() reflect.Type {
   188  	return reflect.TypeOf((**Certificate)(nil)).Elem()
   189  }
   190  
   191  func (i *Certificate) ToCertificateOutput() CertificateOutput {
   192  	return i.ToCertificateOutputWithContext(context.Background())
   193  }
   194  
   195  func (i *Certificate) ToCertificateOutputWithContext(ctx context.Context) CertificateOutput {
   196  	return pulumi.ToOutputWithContext(ctx, i).(CertificateOutput)
   197  }
   198  
   199  // CertificateArrayInput is an input type that accepts CertificateArray and CertificateArrayOutput values.
   200  // You can construct a concrete instance of `CertificateArrayInput` via:
   201  //
   202  //	CertificateArray{ CertificateArgs{...} }
   203  type CertificateArrayInput interface {
   204  	pulumi.Input
   205  
   206  	ToCertificateArrayOutput() CertificateArrayOutput
   207  	ToCertificateArrayOutputWithContext(context.Context) CertificateArrayOutput
   208  }
   209  
   210  type CertificateArray []CertificateInput
   211  
   212  func (CertificateArray) ElementType() reflect.Type {
   213  	return reflect.TypeOf((*[]*Certificate)(nil)).Elem()
   214  }
   215  
   216  func (i CertificateArray) ToCertificateArrayOutput() CertificateArrayOutput {
   217  	return i.ToCertificateArrayOutputWithContext(context.Background())
   218  }
   219  
   220  func (i CertificateArray) ToCertificateArrayOutputWithContext(ctx context.Context) CertificateArrayOutput {
   221  	return pulumi.ToOutputWithContext(ctx, i).(CertificateArrayOutput)
   222  }
   223  
   224  // CertificateMapInput is an input type that accepts CertificateMap and CertificateMapOutput values.
   225  // You can construct a concrete instance of `CertificateMapInput` via:
   226  //
   227  //	CertificateMap{ "key": CertificateArgs{...} }
   228  type CertificateMapInput interface {
   229  	pulumi.Input
   230  
   231  	ToCertificateMapOutput() CertificateMapOutput
   232  	ToCertificateMapOutputWithContext(context.Context) CertificateMapOutput
   233  }
   234  
   235  type CertificateMap map[string]CertificateInput
   236  
   237  func (CertificateMap) ElementType() reflect.Type {
   238  	return reflect.TypeOf((*map[string]*Certificate)(nil)).Elem()
   239  }
   240  
   241  func (i CertificateMap) ToCertificateMapOutput() CertificateMapOutput {
   242  	return i.ToCertificateMapOutputWithContext(context.Background())
   243  }
   244  
   245  func (i CertificateMap) ToCertificateMapOutputWithContext(ctx context.Context) CertificateMapOutput {
   246  	return pulumi.ToOutputWithContext(ctx, i).(CertificateMapOutput)
   247  }
   248  
   249  type CertificateOutput struct{ *pulumi.OutputState }
   250  
   251  func (CertificateOutput) ElementType() reflect.Type {
   252  	return reflect.TypeOf((**Certificate)(nil)).Elem()
   253  }
   254  
   255  func (o CertificateOutput) ToCertificateOutput() CertificateOutput {
   256  	return o
   257  }
   258  
   259  func (o CertificateOutput) ToCertificateOutputWithContext(ctx context.Context) CertificateOutput {
   260  	return o
   261  }
   262  
   263  // The ARN of the lightsail certificate.
   264  func (o CertificateOutput) Arn() pulumi.StringOutput {
   265  	return o.ApplyT(func(v *Certificate) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   266  }
   267  
   268  // The timestamp when the instance was created.
   269  func (o CertificateOutput) CreatedAt() pulumi.StringOutput {
   270  	return o.ApplyT(func(v *Certificate) pulumi.StringOutput { return v.CreatedAt }).(pulumi.StringOutput)
   271  }
   272  
   273  // A domain name for which the certificate should be issued.
   274  func (o CertificateOutput) DomainName() pulumi.StringOutput {
   275  	return o.ApplyT(func(v *Certificate) pulumi.StringOutput { return v.DomainName }).(pulumi.StringOutput)
   276  }
   277  
   278  // Set of domain validation objects which can be used to complete certificate validation. Can have more than one element, e.g., if SANs are defined.
   279  func (o CertificateOutput) DomainValidationOptions() CertificateDomainValidationOptionArrayOutput {
   280  	return o.ApplyT(func(v *Certificate) CertificateDomainValidationOptionArrayOutput { return v.DomainValidationOptions }).(CertificateDomainValidationOptionArrayOutput)
   281  }
   282  
   283  // The name of the Lightsail load balancer.
   284  func (o CertificateOutput) Name() pulumi.StringOutput {
   285  	return o.ApplyT(func(v *Certificate) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   286  }
   287  
   288  // Set of domains that should be SANs in the issued certificate. `domainName` attribute is automatically added as a Subject Alternative Name.
   289  func (o CertificateOutput) SubjectAlternativeNames() pulumi.StringArrayOutput {
   290  	return o.ApplyT(func(v *Certificate) pulumi.StringArrayOutput { return v.SubjectAlternativeNames }).(pulumi.StringArrayOutput)
   291  }
   292  
   293  // A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   294  func (o CertificateOutput) Tags() pulumi.StringMapOutput {
   295  	return o.ApplyT(func(v *Certificate) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   296  }
   297  
   298  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   299  //
   300  // Deprecated: Please use `tags` instead.
   301  func (o CertificateOutput) TagsAll() pulumi.StringMapOutput {
   302  	return o.ApplyT(func(v *Certificate) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   303  }
   304  
   305  type CertificateArrayOutput struct{ *pulumi.OutputState }
   306  
   307  func (CertificateArrayOutput) ElementType() reflect.Type {
   308  	return reflect.TypeOf((*[]*Certificate)(nil)).Elem()
   309  }
   310  
   311  func (o CertificateArrayOutput) ToCertificateArrayOutput() CertificateArrayOutput {
   312  	return o
   313  }
   314  
   315  func (o CertificateArrayOutput) ToCertificateArrayOutputWithContext(ctx context.Context) CertificateArrayOutput {
   316  	return o
   317  }
   318  
   319  func (o CertificateArrayOutput) Index(i pulumi.IntInput) CertificateOutput {
   320  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Certificate {
   321  		return vs[0].([]*Certificate)[vs[1].(int)]
   322  	}).(CertificateOutput)
   323  }
   324  
   325  type CertificateMapOutput struct{ *pulumi.OutputState }
   326  
   327  func (CertificateMapOutput) ElementType() reflect.Type {
   328  	return reflect.TypeOf((*map[string]*Certificate)(nil)).Elem()
   329  }
   330  
   331  func (o CertificateMapOutput) ToCertificateMapOutput() CertificateMapOutput {
   332  	return o
   333  }
   334  
   335  func (o CertificateMapOutput) ToCertificateMapOutputWithContext(ctx context.Context) CertificateMapOutput {
   336  	return o
   337  }
   338  
   339  func (o CertificateMapOutput) MapIndex(k pulumi.StringInput) CertificateOutput {
   340  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Certificate {
   341  		return vs[0].(map[string]*Certificate)[vs[1].(string)]
   342  	}).(CertificateOutput)
   343  }
   344  
   345  func init() {
   346  	pulumi.RegisterInputType(reflect.TypeOf((*CertificateInput)(nil)).Elem(), &Certificate{})
   347  	pulumi.RegisterInputType(reflect.TypeOf((*CertificateArrayInput)(nil)).Elem(), CertificateArray{})
   348  	pulumi.RegisterInputType(reflect.TypeOf((*CertificateMapInput)(nil)).Elem(), CertificateMap{})
   349  	pulumi.RegisterOutputType(CertificateOutput{})
   350  	pulumi.RegisterOutputType(CertificateArrayOutput{})
   351  	pulumi.RegisterOutputType(CertificateMapOutput{})
   352  }