github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/dms/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 dms
     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 DMS (Data Migration Service) certificate resource. DMS certificates can be created, deleted, and imported.
    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/dms"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			// Create a new certificate
    33  //			_, err := dms.NewCertificate(ctx, "test", &dms.CertificateArgs{
    34  //				CertificateId:  pulumi.String("test-dms-certificate-tf"),
    35  //				CertificatePem: pulumi.String("..."),
    36  //				Tags: pulumi.StringMap{
    37  //					"Name": pulumi.String("test"),
    38  //				},
    39  //			})
    40  //			if err != nil {
    41  //				return err
    42  //			}
    43  //			return nil
    44  //		})
    45  //	}
    46  //
    47  // ```
    48  // <!--End PulumiCodeChooser -->
    49  //
    50  // ## Import
    51  //
    52  // Using `pulumi import`, import certificates using the `certificate_id`. For example:
    53  //
    54  // ```sh
    55  // $ pulumi import aws:dms/certificate:Certificate test test-dms-certificate-tf
    56  // ```
    57  type Certificate struct {
    58  	pulumi.CustomResourceState
    59  
    60  	// The Amazon Resource Name (ARN) for the certificate.
    61  	CertificateArn pulumi.StringOutput `pulumi:"certificateArn"`
    62  	// The certificate identifier.
    63  	//
    64  	// - Must contain from 1 to 255 alphanumeric characters and hyphens.
    65  	CertificateId pulumi.StringOutput `pulumi:"certificateId"`
    66  	// The contents of the .pem X.509 certificate file for the certificate. Either `certificatePem` or `certificateWallet` must be set.
    67  	CertificatePem pulumi.StringPtrOutput `pulumi:"certificatePem"`
    68  	// The contents of the Oracle Wallet certificate for use with SSL, provided as a base64-encoded String. Either `certificatePem` or `certificateWallet` must be set.
    69  	CertificateWallet pulumi.StringPtrOutput `pulumi:"certificateWallet"`
    70  	// A map of tags to assign to the resource. 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  		return nil, errors.New("missing one or more required arguments")
    83  	}
    84  
    85  	if args.CertificateId == nil {
    86  		return nil, errors.New("invalid value for required argument 'CertificateId'")
    87  	}
    88  	if args.CertificatePem != nil {
    89  		args.CertificatePem = pulumi.ToSecret(args.CertificatePem).(pulumi.StringPtrInput)
    90  	}
    91  	if args.CertificateWallet != nil {
    92  		args.CertificateWallet = pulumi.ToSecret(args.CertificateWallet).(pulumi.StringPtrInput)
    93  	}
    94  	secrets := pulumi.AdditionalSecretOutputs([]string{
    95  		"certificatePem",
    96  		"certificateWallet",
    97  	})
    98  	opts = append(opts, secrets)
    99  	opts = internal.PkgResourceDefaultOpts(opts)
   100  	var resource Certificate
   101  	err := ctx.RegisterResource("aws:dms/certificate:Certificate", name, args, &resource, opts...)
   102  	if err != nil {
   103  		return nil, err
   104  	}
   105  	return &resource, nil
   106  }
   107  
   108  // GetCertificate gets an existing Certificate resource's state with the given name, ID, and optional
   109  // state properties that are used to uniquely qualify the lookup (nil if not required).
   110  func GetCertificate(ctx *pulumi.Context,
   111  	name string, id pulumi.IDInput, state *CertificateState, opts ...pulumi.ResourceOption) (*Certificate, error) {
   112  	var resource Certificate
   113  	err := ctx.ReadResource("aws:dms/certificate:Certificate", name, id, state, &resource, opts...)
   114  	if err != nil {
   115  		return nil, err
   116  	}
   117  	return &resource, nil
   118  }
   119  
   120  // Input properties used for looking up and filtering Certificate resources.
   121  type certificateState struct {
   122  	// The Amazon Resource Name (ARN) for the certificate.
   123  	CertificateArn *string `pulumi:"certificateArn"`
   124  	// The certificate identifier.
   125  	//
   126  	// - Must contain from 1 to 255 alphanumeric characters and hyphens.
   127  	CertificateId *string `pulumi:"certificateId"`
   128  	// The contents of the .pem X.509 certificate file for the certificate. Either `certificatePem` or `certificateWallet` must be set.
   129  	CertificatePem *string `pulumi:"certificatePem"`
   130  	// The contents of the Oracle Wallet certificate for use with SSL, provided as a base64-encoded String. Either `certificatePem` or `certificateWallet` must be set.
   131  	CertificateWallet *string `pulumi:"certificateWallet"`
   132  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   133  	Tags map[string]string `pulumi:"tags"`
   134  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   135  	//
   136  	// Deprecated: Please use `tags` instead.
   137  	TagsAll map[string]string `pulumi:"tagsAll"`
   138  }
   139  
   140  type CertificateState struct {
   141  	// The Amazon Resource Name (ARN) for the certificate.
   142  	CertificateArn pulumi.StringPtrInput
   143  	// The certificate identifier.
   144  	//
   145  	// - Must contain from 1 to 255 alphanumeric characters and hyphens.
   146  	CertificateId pulumi.StringPtrInput
   147  	// The contents of the .pem X.509 certificate file for the certificate. Either `certificatePem` or `certificateWallet` must be set.
   148  	CertificatePem pulumi.StringPtrInput
   149  	// The contents of the Oracle Wallet certificate for use with SSL, provided as a base64-encoded String. Either `certificatePem` or `certificateWallet` must be set.
   150  	CertificateWallet pulumi.StringPtrInput
   151  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   152  	Tags pulumi.StringMapInput
   153  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   154  	//
   155  	// Deprecated: Please use `tags` instead.
   156  	TagsAll pulumi.StringMapInput
   157  }
   158  
   159  func (CertificateState) ElementType() reflect.Type {
   160  	return reflect.TypeOf((*certificateState)(nil)).Elem()
   161  }
   162  
   163  type certificateArgs struct {
   164  	// The certificate identifier.
   165  	//
   166  	// - Must contain from 1 to 255 alphanumeric characters and hyphens.
   167  	CertificateId string `pulumi:"certificateId"`
   168  	// The contents of the .pem X.509 certificate file for the certificate. Either `certificatePem` or `certificateWallet` must be set.
   169  	CertificatePem *string `pulumi:"certificatePem"`
   170  	// The contents of the Oracle Wallet certificate for use with SSL, provided as a base64-encoded String. Either `certificatePem` or `certificateWallet` must be set.
   171  	CertificateWallet *string `pulumi:"certificateWallet"`
   172  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   173  	Tags map[string]string `pulumi:"tags"`
   174  }
   175  
   176  // The set of arguments for constructing a Certificate resource.
   177  type CertificateArgs struct {
   178  	// The certificate identifier.
   179  	//
   180  	// - Must contain from 1 to 255 alphanumeric characters and hyphens.
   181  	CertificateId pulumi.StringInput
   182  	// The contents of the .pem X.509 certificate file for the certificate. Either `certificatePem` or `certificateWallet` must be set.
   183  	CertificatePem pulumi.StringPtrInput
   184  	// The contents of the Oracle Wallet certificate for use with SSL, provided as a base64-encoded String. Either `certificatePem` or `certificateWallet` must be set.
   185  	CertificateWallet pulumi.StringPtrInput
   186  	// A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   187  	Tags pulumi.StringMapInput
   188  }
   189  
   190  func (CertificateArgs) ElementType() reflect.Type {
   191  	return reflect.TypeOf((*certificateArgs)(nil)).Elem()
   192  }
   193  
   194  type CertificateInput interface {
   195  	pulumi.Input
   196  
   197  	ToCertificateOutput() CertificateOutput
   198  	ToCertificateOutputWithContext(ctx context.Context) CertificateOutput
   199  }
   200  
   201  func (*Certificate) ElementType() reflect.Type {
   202  	return reflect.TypeOf((**Certificate)(nil)).Elem()
   203  }
   204  
   205  func (i *Certificate) ToCertificateOutput() CertificateOutput {
   206  	return i.ToCertificateOutputWithContext(context.Background())
   207  }
   208  
   209  func (i *Certificate) ToCertificateOutputWithContext(ctx context.Context) CertificateOutput {
   210  	return pulumi.ToOutputWithContext(ctx, i).(CertificateOutput)
   211  }
   212  
   213  // CertificateArrayInput is an input type that accepts CertificateArray and CertificateArrayOutput values.
   214  // You can construct a concrete instance of `CertificateArrayInput` via:
   215  //
   216  //	CertificateArray{ CertificateArgs{...} }
   217  type CertificateArrayInput interface {
   218  	pulumi.Input
   219  
   220  	ToCertificateArrayOutput() CertificateArrayOutput
   221  	ToCertificateArrayOutputWithContext(context.Context) CertificateArrayOutput
   222  }
   223  
   224  type CertificateArray []CertificateInput
   225  
   226  func (CertificateArray) ElementType() reflect.Type {
   227  	return reflect.TypeOf((*[]*Certificate)(nil)).Elem()
   228  }
   229  
   230  func (i CertificateArray) ToCertificateArrayOutput() CertificateArrayOutput {
   231  	return i.ToCertificateArrayOutputWithContext(context.Background())
   232  }
   233  
   234  func (i CertificateArray) ToCertificateArrayOutputWithContext(ctx context.Context) CertificateArrayOutput {
   235  	return pulumi.ToOutputWithContext(ctx, i).(CertificateArrayOutput)
   236  }
   237  
   238  // CertificateMapInput is an input type that accepts CertificateMap and CertificateMapOutput values.
   239  // You can construct a concrete instance of `CertificateMapInput` via:
   240  //
   241  //	CertificateMap{ "key": CertificateArgs{...} }
   242  type CertificateMapInput interface {
   243  	pulumi.Input
   244  
   245  	ToCertificateMapOutput() CertificateMapOutput
   246  	ToCertificateMapOutputWithContext(context.Context) CertificateMapOutput
   247  }
   248  
   249  type CertificateMap map[string]CertificateInput
   250  
   251  func (CertificateMap) ElementType() reflect.Type {
   252  	return reflect.TypeOf((*map[string]*Certificate)(nil)).Elem()
   253  }
   254  
   255  func (i CertificateMap) ToCertificateMapOutput() CertificateMapOutput {
   256  	return i.ToCertificateMapOutputWithContext(context.Background())
   257  }
   258  
   259  func (i CertificateMap) ToCertificateMapOutputWithContext(ctx context.Context) CertificateMapOutput {
   260  	return pulumi.ToOutputWithContext(ctx, i).(CertificateMapOutput)
   261  }
   262  
   263  type CertificateOutput struct{ *pulumi.OutputState }
   264  
   265  func (CertificateOutput) ElementType() reflect.Type {
   266  	return reflect.TypeOf((**Certificate)(nil)).Elem()
   267  }
   268  
   269  func (o CertificateOutput) ToCertificateOutput() CertificateOutput {
   270  	return o
   271  }
   272  
   273  func (o CertificateOutput) ToCertificateOutputWithContext(ctx context.Context) CertificateOutput {
   274  	return o
   275  }
   276  
   277  // The Amazon Resource Name (ARN) for the certificate.
   278  func (o CertificateOutput) CertificateArn() pulumi.StringOutput {
   279  	return o.ApplyT(func(v *Certificate) pulumi.StringOutput { return v.CertificateArn }).(pulumi.StringOutput)
   280  }
   281  
   282  // The certificate identifier.
   283  //
   284  // - Must contain from 1 to 255 alphanumeric characters and hyphens.
   285  func (o CertificateOutput) CertificateId() pulumi.StringOutput {
   286  	return o.ApplyT(func(v *Certificate) pulumi.StringOutput { return v.CertificateId }).(pulumi.StringOutput)
   287  }
   288  
   289  // The contents of the .pem X.509 certificate file for the certificate. Either `certificatePem` or `certificateWallet` must be set.
   290  func (o CertificateOutput) CertificatePem() pulumi.StringPtrOutput {
   291  	return o.ApplyT(func(v *Certificate) pulumi.StringPtrOutput { return v.CertificatePem }).(pulumi.StringPtrOutput)
   292  }
   293  
   294  // The contents of the Oracle Wallet certificate for use with SSL, provided as a base64-encoded String. Either `certificatePem` or `certificateWallet` must be set.
   295  func (o CertificateOutput) CertificateWallet() pulumi.StringPtrOutput {
   296  	return o.ApplyT(func(v *Certificate) pulumi.StringPtrOutput { return v.CertificateWallet }).(pulumi.StringPtrOutput)
   297  }
   298  
   299  // A map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   300  func (o CertificateOutput) Tags() pulumi.StringMapOutput {
   301  	return o.ApplyT(func(v *Certificate) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   302  }
   303  
   304  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   305  //
   306  // Deprecated: Please use `tags` instead.
   307  func (o CertificateOutput) TagsAll() pulumi.StringMapOutput {
   308  	return o.ApplyT(func(v *Certificate) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   309  }
   310  
   311  type CertificateArrayOutput struct{ *pulumi.OutputState }
   312  
   313  func (CertificateArrayOutput) ElementType() reflect.Type {
   314  	return reflect.TypeOf((*[]*Certificate)(nil)).Elem()
   315  }
   316  
   317  func (o CertificateArrayOutput) ToCertificateArrayOutput() CertificateArrayOutput {
   318  	return o
   319  }
   320  
   321  func (o CertificateArrayOutput) ToCertificateArrayOutputWithContext(ctx context.Context) CertificateArrayOutput {
   322  	return o
   323  }
   324  
   325  func (o CertificateArrayOutput) Index(i pulumi.IntInput) CertificateOutput {
   326  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Certificate {
   327  		return vs[0].([]*Certificate)[vs[1].(int)]
   328  	}).(CertificateOutput)
   329  }
   330  
   331  type CertificateMapOutput struct{ *pulumi.OutputState }
   332  
   333  func (CertificateMapOutput) ElementType() reflect.Type {
   334  	return reflect.TypeOf((*map[string]*Certificate)(nil)).Elem()
   335  }
   336  
   337  func (o CertificateMapOutput) ToCertificateMapOutput() CertificateMapOutput {
   338  	return o
   339  }
   340  
   341  func (o CertificateMapOutput) ToCertificateMapOutputWithContext(ctx context.Context) CertificateMapOutput {
   342  	return o
   343  }
   344  
   345  func (o CertificateMapOutput) MapIndex(k pulumi.StringInput) CertificateOutput {
   346  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Certificate {
   347  		return vs[0].(map[string]*Certificate)[vs[1].(string)]
   348  	}).(CertificateOutput)
   349  }
   350  
   351  func init() {
   352  	pulumi.RegisterInputType(reflect.TypeOf((*CertificateInput)(nil)).Elem(), &Certificate{})
   353  	pulumi.RegisterInputType(reflect.TypeOf((*CertificateArrayInput)(nil)).Elem(), CertificateArray{})
   354  	pulumi.RegisterInputType(reflect.TypeOf((*CertificateMapInput)(nil)).Elem(), CertificateMap{})
   355  	pulumi.RegisterOutputType(CertificateOutput{})
   356  	pulumi.RegisterOutputType(CertificateArrayOutput{})
   357  	pulumi.RegisterOutputType(CertificateMapOutput{})
   358  }