api_op_GetBlueprints.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 the list of available instance images, or blueprints. You can use a
  15  // blueprint to create a new instance already running a specific operating system,
  16  // as well as a preinstalled app or development stack. The software each instance
  17  // is running depends on the blueprint image you choose.
  18  //
  19  // Use active blueprints when creating new instances. Inactive blueprints are
  20  // listed to support customers with existing instances and are not necessarily
  21  // available to create new instances. Blueprints are marked inactive when they
  22  // become outdated due to operating system updates or new application releases.
  23  func (c *Client) GetBlueprints(ctx context.Context, params *GetBlueprintsInput, optFns ...func(*Options)) (*GetBlueprintsOutput, error) {
  24  	if params == nil {
  25  		params = &GetBlueprintsInput{}
  26  	}
  27  
  28  	result, metadata, err := c.invokeOperation(ctx, "GetBlueprints", params, optFns, c.addOperationGetBlueprintsMiddlewares)
  29  	if err != nil {
  30  		return nil, err
  31  	}
  32  
  33  	out := result.(*GetBlueprintsOutput)
  34  	out.ResultMetadata = metadata
  35  	return out, nil
  36  }
  37  
  38  type GetBlueprintsInput struct {
  39  
  40  	// Returns a list of blueprints that are specific to Lightsail for Research.
  41  	//
  42  	// You must use this parameter to view Lightsail for Research blueprints.
  43  	AppCategory types.AppCategory
  44  
  45  	// A Boolean value that indicates whether to include inactive (unavailable)
  46  	// blueprints in the response of your request.
  47  	IncludeInactive *bool
  48  
  49  	// The token to advance to the next page of results from your request.
  50  	//
  51  	// To get a page token, perform an initial GetBlueprints request. If your results
  52  	// are paginated, the response will return a next page token that you can specify
  53  	// as the page token in a subsequent request.
  54  	PageToken *string
  55  
  56  	noSmithyDocumentSerde
  57  }
  58  
  59  type GetBlueprintsOutput struct {
  60  
  61  	// An array of key-value pairs that contains information about the available
  62  	// blueprints.
  63  	Blueprints []types.Blueprint
  64  
  65  	// The token to advance to the next page of results from your request.
  66  	//
  67  	// A next page token is not returned if there are no more results to display.
  68  	//
  69  	// To get the next page of results, perform another GetBlueprints request and
  70  	// specify the next page token using the pageToken parameter.
  71  	NextPageToken *string
  72  
  73  	// Metadata pertaining to the operation's result.
  74  	ResultMetadata middleware.Metadata
  75  
  76  	noSmithyDocumentSerde
  77  }
  78  
  79  func (c *Client) addOperationGetBlueprintsMiddlewares(stack *middleware.Stack, options Options) (err error) {
  80  	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
  81  		return err
  82  	}
  83  	err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetBlueprints{}, middleware.After)
  84  	if err != nil {
  85  		return err
  86  	}
  87  	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetBlueprints{}, middleware.After)
  88  	if err != nil {
  89  		return err
  90  	}
  91  	if err := addProtocolFinalizerMiddlewares(stack, options, "GetBlueprints"); err != nil {
  92  		return fmt.Errorf("add protocol finalizers: %v", err)
  93  	}
  94  
  95  	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
  96  		return err
  97  	}
  98  	if err = addSetLoggerMiddleware(stack, options); err != nil {
  99  		return err
 100  	}
 101  	if err = addClientRequestID(stack); err != nil {
 102  		return err
 103  	}
 104  	if err = addComputeContentLength(stack); err != nil {
 105  		return err
 106  	}
 107  	if err = addResolveEndpointMiddleware(stack, options); err != nil {
 108  		return err
 109  	}
 110  	if err = addComputePayloadSHA256(stack); err != nil {
 111  		return err
 112  	}
 113  	if err = addRetry(stack, options); err != nil {
 114  		return err
 115  	}
 116  	if err = addRawResponseToMetadata(stack); err != nil {
 117  		return err
 118  	}
 119  	if err = addRecordResponseTiming(stack); err != nil {
 120  		return err
 121  	}
 122  	if err = addSpanRetryLoop(stack, options); err != nil {
 123  		return err
 124  	}
 125  	if err = addClientUserAgent(stack, options); err != nil {
 126  		return err
 127  	}
 128  	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
 129  		return err
 130  	}
 131  	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
 132  		return err
 133  	}
 134  	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
 135  		return err
 136  	}
 137  	if err = addTimeOffsetBuild(stack, c); err != nil {
 138  		return err
 139  	}
 140  	if err = addUserAgentRetryMode(stack, options); err != nil {
 141  		return err
 142  	}
 143  	if err = addCredentialSource(stack, options); err != nil {
 144  		return err
 145  	}
 146  	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetBlueprints(options.Region), middleware.Before); err != nil {
 147  		return err
 148  	}
 149  	if err = addRecursionDetection(stack); err != nil {
 150  		return err
 151  	}
 152  	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
 153  		return err
 154  	}
 155  	if err = addResponseErrorMiddleware(stack); err != nil {
 156  		return err
 157  	}
 158  	if err = addRequestResponseLogging(stack, options); err != nil {
 159  		return err
 160  	}
 161  	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
 162  		return err
 163  	}
 164  	if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
 165  		return err
 166  	}
 167  	if err = addInterceptAttempt(stack, options); err != nil {
 168  		return err
 169  	}
 170  	if err = addInterceptors(stack, options); err != nil {
 171  		return err
 172  	}
 173  	return nil
 174  }
 175  
 176  func newServiceMetadataMiddleware_opGetBlueprints(region string) *awsmiddleware.RegisterServiceMetadata {
 177  	return &awsmiddleware.RegisterServiceMetadata{
 178  		Region:        region,
 179  		ServiceID:     ServiceID,
 180  		OperationName: "GetBlueprints",
 181  	}
 182  }
 183