github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iam/signingCertificate.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 iam
     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 an IAM Signing Certificate resource to upload Signing Certificates.
    16  //
    17  // > **Note:** All arguments including the certificate body will be stored in the raw state as plain-text.
    18  // ## Example Usage
    19  //
    20  // **Using certs on file:**
    21  //
    22  // <!--Start PulumiCodeChooser -->
    23  // ```go
    24  // package main
    25  //
    26  // import (
    27  //
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    29  //	"github.com/pulumi/pulumi-std/sdk/go/std"
    30  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    31  //
    32  // )
    33  //
    34  //	func main() {
    35  //		pulumi.Run(func(ctx *pulumi.Context) error {
    36  //			invokeFile, err := std.File(ctx, &std.FileArgs{
    37  //				Input: "self-ca-cert.pem",
    38  //			}, nil)
    39  //			if err != nil {
    40  //				return err
    41  //			}
    42  //			_, err = iam.NewSigningCertificate(ctx, "test_cert", &iam.SigningCertificateArgs{
    43  //				Username:        pulumi.String("some_test_cert"),
    44  //				CertificateBody: invokeFile.Result,
    45  //			})
    46  //			if err != nil {
    47  //				return err
    48  //			}
    49  //			return nil
    50  //		})
    51  //	}
    52  //
    53  // ```
    54  // <!--End PulumiCodeChooser -->
    55  //
    56  // **Example with cert in-line:**
    57  //
    58  // <!--Start PulumiCodeChooser -->
    59  // ```go
    60  // package main
    61  //
    62  // import (
    63  //
    64  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    65  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    66  //
    67  // )
    68  //
    69  //	func main() {
    70  //		pulumi.Run(func(ctx *pulumi.Context) error {
    71  //			_, err := iam.NewSigningCertificate(ctx, "test_cert_alt", &iam.SigningCertificateArgs{
    72  //				Username:        pulumi.String("some_test_cert"),
    73  //				CertificateBody: pulumi.String("-----BEGIN CERTIFICATE-----\n[......] # cert contents\n-----END CERTIFICATE-----\n"),
    74  //			})
    75  //			if err != nil {
    76  //				return err
    77  //			}
    78  //			return nil
    79  //		})
    80  //	}
    81  //
    82  // ```
    83  // <!--End PulumiCodeChooser -->
    84  //
    85  // ## Import
    86  //
    87  // Using `pulumi import`, import IAM Signing Certificates using the `id`. For example:
    88  //
    89  // ```sh
    90  // $ pulumi import aws:iam/signingCertificate:SigningCertificate certificate IDIDIDIDID:user-name
    91  // ```
    92  type SigningCertificate struct {
    93  	pulumi.CustomResourceState
    94  
    95  	// The contents of the signing certificate in PEM-encoded format.
    96  	CertificateBody pulumi.StringOutput `pulumi:"certificateBody"`
    97  	// The ID for the signing certificate.
    98  	CertificateId pulumi.StringOutput `pulumi:"certificateId"`
    99  	// The status you want to assign to the certificate. `Active` means that the certificate can be used for programmatic calls to Amazon Web Services `Inactive` means that the certificate cannot be used.
   100  	Status pulumi.StringPtrOutput `pulumi:"status"`
   101  	// The name of the user the signing certificate is for.
   102  	UserName pulumi.StringOutput `pulumi:"userName"`
   103  }
   104  
   105  // NewSigningCertificate registers a new resource with the given unique name, arguments, and options.
   106  func NewSigningCertificate(ctx *pulumi.Context,
   107  	name string, args *SigningCertificateArgs, opts ...pulumi.ResourceOption) (*SigningCertificate, error) {
   108  	if args == nil {
   109  		return nil, errors.New("missing one or more required arguments")
   110  	}
   111  
   112  	if args.CertificateBody == nil {
   113  		return nil, errors.New("invalid value for required argument 'CertificateBody'")
   114  	}
   115  	if args.UserName == nil {
   116  		return nil, errors.New("invalid value for required argument 'UserName'")
   117  	}
   118  	opts = internal.PkgResourceDefaultOpts(opts)
   119  	var resource SigningCertificate
   120  	err := ctx.RegisterResource("aws:iam/signingCertificate:SigningCertificate", name, args, &resource, opts...)
   121  	if err != nil {
   122  		return nil, err
   123  	}
   124  	return &resource, nil
   125  }
   126  
   127  // GetSigningCertificate gets an existing SigningCertificate resource's state with the given name, ID, and optional
   128  // state properties that are used to uniquely qualify the lookup (nil if not required).
   129  func GetSigningCertificate(ctx *pulumi.Context,
   130  	name string, id pulumi.IDInput, state *SigningCertificateState, opts ...pulumi.ResourceOption) (*SigningCertificate, error) {
   131  	var resource SigningCertificate
   132  	err := ctx.ReadResource("aws:iam/signingCertificate:SigningCertificate", name, id, state, &resource, opts...)
   133  	if err != nil {
   134  		return nil, err
   135  	}
   136  	return &resource, nil
   137  }
   138  
   139  // Input properties used for looking up and filtering SigningCertificate resources.
   140  type signingCertificateState struct {
   141  	// The contents of the signing certificate in PEM-encoded format.
   142  	CertificateBody *string `pulumi:"certificateBody"`
   143  	// The ID for the signing certificate.
   144  	CertificateId *string `pulumi:"certificateId"`
   145  	// The status you want to assign to the certificate. `Active` means that the certificate can be used for programmatic calls to Amazon Web Services `Inactive` means that the certificate cannot be used.
   146  	Status *string `pulumi:"status"`
   147  	// The name of the user the signing certificate is for.
   148  	UserName *string `pulumi:"userName"`
   149  }
   150  
   151  type SigningCertificateState struct {
   152  	// The contents of the signing certificate in PEM-encoded format.
   153  	CertificateBody pulumi.StringPtrInput
   154  	// The ID for the signing certificate.
   155  	CertificateId pulumi.StringPtrInput
   156  	// The status you want to assign to the certificate. `Active` means that the certificate can be used for programmatic calls to Amazon Web Services `Inactive` means that the certificate cannot be used.
   157  	Status pulumi.StringPtrInput
   158  	// The name of the user the signing certificate is for.
   159  	UserName pulumi.StringPtrInput
   160  }
   161  
   162  func (SigningCertificateState) ElementType() reflect.Type {
   163  	return reflect.TypeOf((*signingCertificateState)(nil)).Elem()
   164  }
   165  
   166  type signingCertificateArgs struct {
   167  	// The contents of the signing certificate in PEM-encoded format.
   168  	CertificateBody string `pulumi:"certificateBody"`
   169  	// The status you want to assign to the certificate. `Active` means that the certificate can be used for programmatic calls to Amazon Web Services `Inactive` means that the certificate cannot be used.
   170  	Status *string `pulumi:"status"`
   171  	// The name of the user the signing certificate is for.
   172  	UserName string `pulumi:"userName"`
   173  }
   174  
   175  // The set of arguments for constructing a SigningCertificate resource.
   176  type SigningCertificateArgs struct {
   177  	// The contents of the signing certificate in PEM-encoded format.
   178  	CertificateBody pulumi.StringInput
   179  	// The status you want to assign to the certificate. `Active` means that the certificate can be used for programmatic calls to Amazon Web Services `Inactive` means that the certificate cannot be used.
   180  	Status pulumi.StringPtrInput
   181  	// The name of the user the signing certificate is for.
   182  	UserName pulumi.StringInput
   183  }
   184  
   185  func (SigningCertificateArgs) ElementType() reflect.Type {
   186  	return reflect.TypeOf((*signingCertificateArgs)(nil)).Elem()
   187  }
   188  
   189  type SigningCertificateInput interface {
   190  	pulumi.Input
   191  
   192  	ToSigningCertificateOutput() SigningCertificateOutput
   193  	ToSigningCertificateOutputWithContext(ctx context.Context) SigningCertificateOutput
   194  }
   195  
   196  func (*SigningCertificate) ElementType() reflect.Type {
   197  	return reflect.TypeOf((**SigningCertificate)(nil)).Elem()
   198  }
   199  
   200  func (i *SigningCertificate) ToSigningCertificateOutput() SigningCertificateOutput {
   201  	return i.ToSigningCertificateOutputWithContext(context.Background())
   202  }
   203  
   204  func (i *SigningCertificate) ToSigningCertificateOutputWithContext(ctx context.Context) SigningCertificateOutput {
   205  	return pulumi.ToOutputWithContext(ctx, i).(SigningCertificateOutput)
   206  }
   207  
   208  // SigningCertificateArrayInput is an input type that accepts SigningCertificateArray and SigningCertificateArrayOutput values.
   209  // You can construct a concrete instance of `SigningCertificateArrayInput` via:
   210  //
   211  //	SigningCertificateArray{ SigningCertificateArgs{...} }
   212  type SigningCertificateArrayInput interface {
   213  	pulumi.Input
   214  
   215  	ToSigningCertificateArrayOutput() SigningCertificateArrayOutput
   216  	ToSigningCertificateArrayOutputWithContext(context.Context) SigningCertificateArrayOutput
   217  }
   218  
   219  type SigningCertificateArray []SigningCertificateInput
   220  
   221  func (SigningCertificateArray) ElementType() reflect.Type {
   222  	return reflect.TypeOf((*[]*SigningCertificate)(nil)).Elem()
   223  }
   224  
   225  func (i SigningCertificateArray) ToSigningCertificateArrayOutput() SigningCertificateArrayOutput {
   226  	return i.ToSigningCertificateArrayOutputWithContext(context.Background())
   227  }
   228  
   229  func (i SigningCertificateArray) ToSigningCertificateArrayOutputWithContext(ctx context.Context) SigningCertificateArrayOutput {
   230  	return pulumi.ToOutputWithContext(ctx, i).(SigningCertificateArrayOutput)
   231  }
   232  
   233  // SigningCertificateMapInput is an input type that accepts SigningCertificateMap and SigningCertificateMapOutput values.
   234  // You can construct a concrete instance of `SigningCertificateMapInput` via:
   235  //
   236  //	SigningCertificateMap{ "key": SigningCertificateArgs{...} }
   237  type SigningCertificateMapInput interface {
   238  	pulumi.Input
   239  
   240  	ToSigningCertificateMapOutput() SigningCertificateMapOutput
   241  	ToSigningCertificateMapOutputWithContext(context.Context) SigningCertificateMapOutput
   242  }
   243  
   244  type SigningCertificateMap map[string]SigningCertificateInput
   245  
   246  func (SigningCertificateMap) ElementType() reflect.Type {
   247  	return reflect.TypeOf((*map[string]*SigningCertificate)(nil)).Elem()
   248  }
   249  
   250  func (i SigningCertificateMap) ToSigningCertificateMapOutput() SigningCertificateMapOutput {
   251  	return i.ToSigningCertificateMapOutputWithContext(context.Background())
   252  }
   253  
   254  func (i SigningCertificateMap) ToSigningCertificateMapOutputWithContext(ctx context.Context) SigningCertificateMapOutput {
   255  	return pulumi.ToOutputWithContext(ctx, i).(SigningCertificateMapOutput)
   256  }
   257  
   258  type SigningCertificateOutput struct{ *pulumi.OutputState }
   259  
   260  func (SigningCertificateOutput) ElementType() reflect.Type {
   261  	return reflect.TypeOf((**SigningCertificate)(nil)).Elem()
   262  }
   263  
   264  func (o SigningCertificateOutput) ToSigningCertificateOutput() SigningCertificateOutput {
   265  	return o
   266  }
   267  
   268  func (o SigningCertificateOutput) ToSigningCertificateOutputWithContext(ctx context.Context) SigningCertificateOutput {
   269  	return o
   270  }
   271  
   272  // The contents of the signing certificate in PEM-encoded format.
   273  func (o SigningCertificateOutput) CertificateBody() pulumi.StringOutput {
   274  	return o.ApplyT(func(v *SigningCertificate) pulumi.StringOutput { return v.CertificateBody }).(pulumi.StringOutput)
   275  }
   276  
   277  // The ID for the signing certificate.
   278  func (o SigningCertificateOutput) CertificateId() pulumi.StringOutput {
   279  	return o.ApplyT(func(v *SigningCertificate) pulumi.StringOutput { return v.CertificateId }).(pulumi.StringOutput)
   280  }
   281  
   282  // The status you want to assign to the certificate. `Active` means that the certificate can be used for programmatic calls to Amazon Web Services `Inactive` means that the certificate cannot be used.
   283  func (o SigningCertificateOutput) Status() pulumi.StringPtrOutput {
   284  	return o.ApplyT(func(v *SigningCertificate) pulumi.StringPtrOutput { return v.Status }).(pulumi.StringPtrOutput)
   285  }
   286  
   287  // The name of the user the signing certificate is for.
   288  func (o SigningCertificateOutput) UserName() pulumi.StringOutput {
   289  	return o.ApplyT(func(v *SigningCertificate) pulumi.StringOutput { return v.UserName }).(pulumi.StringOutput)
   290  }
   291  
   292  type SigningCertificateArrayOutput struct{ *pulumi.OutputState }
   293  
   294  func (SigningCertificateArrayOutput) ElementType() reflect.Type {
   295  	return reflect.TypeOf((*[]*SigningCertificate)(nil)).Elem()
   296  }
   297  
   298  func (o SigningCertificateArrayOutput) ToSigningCertificateArrayOutput() SigningCertificateArrayOutput {
   299  	return o
   300  }
   301  
   302  func (o SigningCertificateArrayOutput) ToSigningCertificateArrayOutputWithContext(ctx context.Context) SigningCertificateArrayOutput {
   303  	return o
   304  }
   305  
   306  func (o SigningCertificateArrayOutput) Index(i pulumi.IntInput) SigningCertificateOutput {
   307  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SigningCertificate {
   308  		return vs[0].([]*SigningCertificate)[vs[1].(int)]
   309  	}).(SigningCertificateOutput)
   310  }
   311  
   312  type SigningCertificateMapOutput struct{ *pulumi.OutputState }
   313  
   314  func (SigningCertificateMapOutput) ElementType() reflect.Type {
   315  	return reflect.TypeOf((*map[string]*SigningCertificate)(nil)).Elem()
   316  }
   317  
   318  func (o SigningCertificateMapOutput) ToSigningCertificateMapOutput() SigningCertificateMapOutput {
   319  	return o
   320  }
   321  
   322  func (o SigningCertificateMapOutput) ToSigningCertificateMapOutputWithContext(ctx context.Context) SigningCertificateMapOutput {
   323  	return o
   324  }
   325  
   326  func (o SigningCertificateMapOutput) MapIndex(k pulumi.StringInput) SigningCertificateOutput {
   327  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SigningCertificate {
   328  		return vs[0].(map[string]*SigningCertificate)[vs[1].(string)]
   329  	}).(SigningCertificateOutput)
   330  }
   331  
   332  func init() {
   333  	pulumi.RegisterInputType(reflect.TypeOf((*SigningCertificateInput)(nil)).Elem(), &SigningCertificate{})
   334  	pulumi.RegisterInputType(reflect.TypeOf((*SigningCertificateArrayInput)(nil)).Elem(), SigningCertificateArray{})
   335  	pulumi.RegisterInputType(reflect.TypeOf((*SigningCertificateMapInput)(nil)).Elem(), SigningCertificateMap{})
   336  	pulumi.RegisterOutputType(SigningCertificateOutput{})
   337  	pulumi.RegisterOutputType(SigningCertificateArrayOutput{})
   338  	pulumi.RegisterOutputType(SigningCertificateMapOutput{})
   339  }