github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iam/getServerCertificate.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  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Use this data source to lookup information about IAM Server Certificates.
    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/elb"
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			my_domain, err := iam.LookupServerCertificate(ctx, &iam.LookupServerCertificateArgs{
    33  //				NamePrefix: pulumi.StringRef("my-domain.org"),
    34  //				Latest:     pulumi.BoolRef(true),
    35  //			}, nil)
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			_, err = elb.NewLoadBalancer(ctx, "elb", &elb.LoadBalancerArgs{
    40  //				Name: pulumi.String("my-domain-elb"),
    41  //				Listeners: elb.LoadBalancerListenerArray{
    42  //					&elb.LoadBalancerListenerArgs{
    43  //						InstancePort:     pulumi.Int(8000),
    44  //						InstanceProtocol: pulumi.String("https"),
    45  //						LbPort:           pulumi.Int(443),
    46  //						LbProtocol:       pulumi.String("https"),
    47  //						SslCertificateId: pulumi.String(my_domain.Arn),
    48  //					},
    49  //				},
    50  //			})
    51  //			if err != nil {
    52  //				return err
    53  //			}
    54  //			return nil
    55  //		})
    56  //	}
    57  //
    58  // ```
    59  // <!--End PulumiCodeChooser -->
    60  func LookupServerCertificate(ctx *pulumi.Context, args *LookupServerCertificateArgs, opts ...pulumi.InvokeOption) (*LookupServerCertificateResult, error) {
    61  	opts = internal.PkgInvokeDefaultOpts(opts)
    62  	var rv LookupServerCertificateResult
    63  	err := ctx.Invoke("aws:iam/getServerCertificate:getServerCertificate", args, &rv, opts...)
    64  	if err != nil {
    65  		return nil, err
    66  	}
    67  	return &rv, nil
    68  }
    69  
    70  // A collection of arguments for invoking getServerCertificate.
    71  type LookupServerCertificateArgs struct {
    72  	// sort results by expiration date. returns the certificate with expiration date in furthest in the future.
    73  	Latest *bool `pulumi:"latest"`
    74  	// exact name of the cert to lookup
    75  	Name *string `pulumi:"name"`
    76  	// prefix of cert to filter by
    77  	NamePrefix *string `pulumi:"namePrefix"`
    78  	// prefix of path to filter by
    79  	PathPrefix *string `pulumi:"pathPrefix"`
    80  }
    81  
    82  // A collection of values returned by getServerCertificate.
    83  type LookupServerCertificateResult struct {
    84  	// is set to the ARN of the IAM Server Certificate
    85  	Arn string `pulumi:"arn"`
    86  	// is the public key certificate (PEM-encoded). This is useful when [configuring back-end instance authentication](http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-create-https-ssl-load-balancer.html) policy for load balancer
    87  	CertificateBody string `pulumi:"certificateBody"`
    88  	// is the public key certificate chain (PEM-encoded) if exists, empty otherwise
    89  	CertificateChain string `pulumi:"certificateChain"`
    90  	// is set to the expiration date of the IAM Server Certificate
    91  	ExpirationDate string `pulumi:"expirationDate"`
    92  	// The provider-assigned unique ID for this managed resource.
    93  	Id         string  `pulumi:"id"`
    94  	Latest     *bool   `pulumi:"latest"`
    95  	Name       string  `pulumi:"name"`
    96  	NamePrefix *string `pulumi:"namePrefix"`
    97  	// is set to the path of the IAM Server Certificate
    98  	Path       string  `pulumi:"path"`
    99  	PathPrefix *string `pulumi:"pathPrefix"`
   100  	// is the date when the server certificate was uploaded
   101  	UploadDate string `pulumi:"uploadDate"`
   102  }
   103  
   104  func LookupServerCertificateOutput(ctx *pulumi.Context, args LookupServerCertificateOutputArgs, opts ...pulumi.InvokeOption) LookupServerCertificateResultOutput {
   105  	return pulumi.ToOutputWithContext(context.Background(), args).
   106  		ApplyT(func(v interface{}) (LookupServerCertificateResult, error) {
   107  			args := v.(LookupServerCertificateArgs)
   108  			r, err := LookupServerCertificate(ctx, &args, opts...)
   109  			var s LookupServerCertificateResult
   110  			if r != nil {
   111  				s = *r
   112  			}
   113  			return s, err
   114  		}).(LookupServerCertificateResultOutput)
   115  }
   116  
   117  // A collection of arguments for invoking getServerCertificate.
   118  type LookupServerCertificateOutputArgs struct {
   119  	// sort results by expiration date. returns the certificate with expiration date in furthest in the future.
   120  	Latest pulumi.BoolPtrInput `pulumi:"latest"`
   121  	// exact name of the cert to lookup
   122  	Name pulumi.StringPtrInput `pulumi:"name"`
   123  	// prefix of cert to filter by
   124  	NamePrefix pulumi.StringPtrInput `pulumi:"namePrefix"`
   125  	// prefix of path to filter by
   126  	PathPrefix pulumi.StringPtrInput `pulumi:"pathPrefix"`
   127  }
   128  
   129  func (LookupServerCertificateOutputArgs) ElementType() reflect.Type {
   130  	return reflect.TypeOf((*LookupServerCertificateArgs)(nil)).Elem()
   131  }
   132  
   133  // A collection of values returned by getServerCertificate.
   134  type LookupServerCertificateResultOutput struct{ *pulumi.OutputState }
   135  
   136  func (LookupServerCertificateResultOutput) ElementType() reflect.Type {
   137  	return reflect.TypeOf((*LookupServerCertificateResult)(nil)).Elem()
   138  }
   139  
   140  func (o LookupServerCertificateResultOutput) ToLookupServerCertificateResultOutput() LookupServerCertificateResultOutput {
   141  	return o
   142  }
   143  
   144  func (o LookupServerCertificateResultOutput) ToLookupServerCertificateResultOutputWithContext(ctx context.Context) LookupServerCertificateResultOutput {
   145  	return o
   146  }
   147  
   148  // is set to the ARN of the IAM Server Certificate
   149  func (o LookupServerCertificateResultOutput) Arn() pulumi.StringOutput {
   150  	return o.ApplyT(func(v LookupServerCertificateResult) string { return v.Arn }).(pulumi.StringOutput)
   151  }
   152  
   153  // is the public key certificate (PEM-encoded). This is useful when [configuring back-end instance authentication](http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-create-https-ssl-load-balancer.html) policy for load balancer
   154  func (o LookupServerCertificateResultOutput) CertificateBody() pulumi.StringOutput {
   155  	return o.ApplyT(func(v LookupServerCertificateResult) string { return v.CertificateBody }).(pulumi.StringOutput)
   156  }
   157  
   158  // is the public key certificate chain (PEM-encoded) if exists, empty otherwise
   159  func (o LookupServerCertificateResultOutput) CertificateChain() pulumi.StringOutput {
   160  	return o.ApplyT(func(v LookupServerCertificateResult) string { return v.CertificateChain }).(pulumi.StringOutput)
   161  }
   162  
   163  // is set to the expiration date of the IAM Server Certificate
   164  func (o LookupServerCertificateResultOutput) ExpirationDate() pulumi.StringOutput {
   165  	return o.ApplyT(func(v LookupServerCertificateResult) string { return v.ExpirationDate }).(pulumi.StringOutput)
   166  }
   167  
   168  // The provider-assigned unique ID for this managed resource.
   169  func (o LookupServerCertificateResultOutput) Id() pulumi.StringOutput {
   170  	return o.ApplyT(func(v LookupServerCertificateResult) string { return v.Id }).(pulumi.StringOutput)
   171  }
   172  
   173  func (o LookupServerCertificateResultOutput) Latest() pulumi.BoolPtrOutput {
   174  	return o.ApplyT(func(v LookupServerCertificateResult) *bool { return v.Latest }).(pulumi.BoolPtrOutput)
   175  }
   176  
   177  func (o LookupServerCertificateResultOutput) Name() pulumi.StringOutput {
   178  	return o.ApplyT(func(v LookupServerCertificateResult) string { return v.Name }).(pulumi.StringOutput)
   179  }
   180  
   181  func (o LookupServerCertificateResultOutput) NamePrefix() pulumi.StringPtrOutput {
   182  	return o.ApplyT(func(v LookupServerCertificateResult) *string { return v.NamePrefix }).(pulumi.StringPtrOutput)
   183  }
   184  
   185  // is set to the path of the IAM Server Certificate
   186  func (o LookupServerCertificateResultOutput) Path() pulumi.StringOutput {
   187  	return o.ApplyT(func(v LookupServerCertificateResult) string { return v.Path }).(pulumi.StringOutput)
   188  }
   189  
   190  func (o LookupServerCertificateResultOutput) PathPrefix() pulumi.StringPtrOutput {
   191  	return o.ApplyT(func(v LookupServerCertificateResult) *string { return v.PathPrefix }).(pulumi.StringPtrOutput)
   192  }
   193  
   194  // is the date when the server certificate was uploaded
   195  func (o LookupServerCertificateResultOutput) UploadDate() pulumi.StringOutput {
   196  	return o.ApplyT(func(v LookupServerCertificateResult) string { return v.UploadDate }).(pulumi.StringOutput)
   197  }
   198  
   199  func init() {
   200  	pulumi.RegisterOutputType(LookupServerCertificateResultOutput{})
   201  }