api_op_GetCertificates.go raw

   1  // Code generated by smithy-go-codegen DO NOT EDIT.
   2  
   3  package lightsail
   4  
   5  import (
   6  	"context"
   7  	"fmt"
   8  	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
   9  	"github.com/aws/aws-sdk-go-v2/service/lightsail/types"
  10  	"github.com/aws/smithy-go/middleware"
  11  	smithyhttp "github.com/aws/smithy-go/transport/http"
  12  )
  13  
  14  // Returns information about one or more Amazon Lightsail SSL/TLS certificates.
  15  //
  16  // To get a summary of a certificate, omit includeCertificateDetails from your
  17  // request. The response will include only the certificate Amazon Resource Name
  18  // (ARN), certificate name, domain name, and tags.
  19  func (c *Client) GetCertificates(ctx context.Context, params *GetCertificatesInput, optFns ...func(*Options)) (*GetCertificatesOutput, error) {
  20  	if params == nil {
  21  		params = &GetCertificatesInput{}
  22  	}
  23  
  24  	result, metadata, err := c.invokeOperation(ctx, "GetCertificates", params, optFns, c.addOperationGetCertificatesMiddlewares)
  25  	if err != nil {
  26  		return nil, err
  27  	}
  28  
  29  	out := result.(*GetCertificatesOutput)
  30  	out.ResultMetadata = metadata
  31  	return out, nil
  32  }
  33  
  34  type GetCertificatesInput struct {
  35  
  36  	// The name for the certificate for which to return information.
  37  	//
  38  	// When omitted, the response includes all of your certificates in the Amazon Web
  39  	// Services Region where the request is made.
  40  	CertificateName *string
  41  
  42  	// The status of the certificates for which to return information.
  43  	//
  44  	// For example, specify ISSUED to return only certificates with an ISSUED status.
  45  	//
  46  	// When omitted, the response includes all of your certificates in the Amazon Web
  47  	// Services Region where the request is made, regardless of their current status.
  48  	CertificateStatuses []types.CertificateStatus
  49  
  50  	// Indicates whether to include detailed information about the certificates in the
  51  	// response.
  52  	//
  53  	// When omitted, the response includes only the certificate names, Amazon Resource
  54  	// Names (ARNs), domain names, and tags.
  55  	IncludeCertificateDetails bool
  56  
  57  	// The token to advance to the next page of results from your request.
  58  	//
  59  	// To get a page token, perform an initial GetCertificates request. If your
  60  	// results are paginated, the response will return a next page token that you can
  61  	// specify as the page token in a subsequent request.
  62  	PageToken *string
  63  
  64  	noSmithyDocumentSerde
  65  }
  66  
  67  type GetCertificatesOutput struct {
  68  
  69  	// An object that describes certificates.
  70  	Certificates []types.CertificateSummary
  71  
  72  	// If NextPageToken is returned there are more results available. The value of
  73  	// NextPageToken is a unique pagination token for each page. Make the call again
  74  	// using the returned token to retrieve the next page. Keep all other arguments
  75  	// unchanged.
  76  	NextPageToken *string
  77  
  78  	// Metadata pertaining to the operation's result.
  79  	ResultMetadata middleware.Metadata
  80  
  81  	noSmithyDocumentSerde
  82  }
  83  
  84  func (c *Client) addOperationGetCertificatesMiddlewares(stack *middleware.Stack, options Options) (err error) {
  85  	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
  86  		return err
  87  	}
  88  	err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetCertificates{}, middleware.After)
  89  	if err != nil {
  90  		return err
  91  	}
  92  	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetCertificates{}, middleware.After)
  93  	if err != nil {
  94  		return err
  95  	}
  96  	if err := addProtocolFinalizerMiddlewares(stack, options, "GetCertificates"); err != nil {
  97  		return fmt.Errorf("add protocol finalizers: %v", err)
  98  	}
  99  
 100  	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
 101  		return err
 102  	}
 103  	if err = addSetLoggerMiddleware(stack, options); err != nil {
 104  		return err
 105  	}
 106  	if err = addClientRequestID(stack); err != nil {
 107  		return err
 108  	}
 109  	if err = addComputeContentLength(stack); err != nil {
 110  		return err
 111  	}
 112  	if err = addResolveEndpointMiddleware(stack, options); err != nil {
 113  		return err
 114  	}
 115  	if err = addComputePayloadSHA256(stack); err != nil {
 116  		return err
 117  	}
 118  	if err = addRetry(stack, options); err != nil {
 119  		return err
 120  	}
 121  	if err = addRawResponseToMetadata(stack); err != nil {
 122  		return err
 123  	}
 124  	if err = addRecordResponseTiming(stack); err != nil {
 125  		return err
 126  	}
 127  	if err = addSpanRetryLoop(stack, options); err != nil {
 128  		return err
 129  	}
 130  	if err = addClientUserAgent(stack, options); err != nil {
 131  		return err
 132  	}
 133  	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
 134  		return err
 135  	}
 136  	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
 137  		return err
 138  	}
 139  	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
 140  		return err
 141  	}
 142  	if err = addTimeOffsetBuild(stack, c); err != nil {
 143  		return err
 144  	}
 145  	if err = addUserAgentRetryMode(stack, options); err != nil {
 146  		return err
 147  	}
 148  	if err = addCredentialSource(stack, options); err != nil {
 149  		return err
 150  	}
 151  	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetCertificates(options.Region), middleware.Before); err != nil {
 152  		return err
 153  	}
 154  	if err = addRecursionDetection(stack); err != nil {
 155  		return err
 156  	}
 157  	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
 158  		return err
 159  	}
 160  	if err = addResponseErrorMiddleware(stack); err != nil {
 161  		return err
 162  	}
 163  	if err = addRequestResponseLogging(stack, options); err != nil {
 164  		return err
 165  	}
 166  	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
 167  		return err
 168  	}
 169  	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
 170  		return err
 171  	}
 172  	if err = addInterceptAttempt(stack, options); err != nil {
 173  		return err
 174  	}
 175  	if err = addInterceptors(stack, options); err != nil {
 176  		return err
 177  	}
 178  	return nil
 179  }
 180  
 181  func newServiceMetadataMiddleware_opGetCertificates(region string) *awsmiddleware.RegisterServiceMetadata {
 182  	return &awsmiddleware.RegisterServiceMetadata{
 183  		Region:        region,
 184  		ServiceID:     ServiceID,
 185  		OperationName: "GetCertificates",
 186  	}
 187  }
 188