1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package servicecatalog 4 5import ( 6 "context" 7 "fmt" 8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 9 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 10 "github.com/aws/aws-sdk-go-v2/service/servicecatalog/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13) 14 15// This API takes either a ProvisonedProductId or a ProvisionedProductName, along 16// with a list of one or more output keys, and responds with the key/value pairs of 17// those outputs. 18func (c *Client) GetProvisionedProductOutputs(ctx context.Context, params *GetProvisionedProductOutputsInput, optFns ...func(*Options)) (*GetProvisionedProductOutputsOutput, error) { 19 if params == nil { 20 params = &GetProvisionedProductOutputsInput{} 21 } 22 23 result, metadata, err := c.invokeOperation(ctx, "GetProvisionedProductOutputs", params, optFns, addOperationGetProvisionedProductOutputsMiddlewares) 24 if err != nil { 25 return nil, err 26 } 27 28 out := result.(*GetProvisionedProductOutputsOutput) 29 out.ResultMetadata = metadata 30 return out, nil 31} 32 33type GetProvisionedProductOutputsInput struct { 34 35 // The language code. 36 // 37 // * en - English (default) 38 // 39 // * jp - Japanese 40 // 41 // * zh - Chinese 42 AcceptLanguage *string 43 44 // The list of keys that the API should return with their values. If none are 45 // provided, the API will return all outputs of the provisioned product. 46 OutputKeys []string 47 48 // The maximum number of items to return with this call. 49 PageSize int32 50 51 // The page token for the next set of results. To retrieve the first set of 52 // results, use null. 53 PageToken *string 54 55 // The identifier of the provisioned product that you want the outputs from. 56 ProvisionedProductId *string 57 58 // The name of the provisioned product that you want the outputs from. 59 ProvisionedProductName *string 60} 61 62type GetProvisionedProductOutputsOutput struct { 63 64 // The page token to use to retrieve the next set of results. If there are no 65 // additional results, this value is null. 66 NextPageToken *string 67 68 // Information about the product created as the result of a request. For example, 69 // the output for a CloudFormation-backed product that creates an S3 bucket would 70 // include the S3 bucket URL. 71 Outputs []types.RecordOutput 72 73 // Metadata pertaining to the operation's result. 74 ResultMetadata middleware.Metadata 75} 76 77func addOperationGetProvisionedProductOutputsMiddlewares(stack *middleware.Stack, options Options) (err error) { 78 err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetProvisionedProductOutputs{}, middleware.After) 79 if err != nil { 80 return err 81 } 82 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetProvisionedProductOutputs{}, middleware.After) 83 if err != nil { 84 return err 85 } 86 if err = addSetLoggerMiddleware(stack, options); err != nil { 87 return err 88 } 89 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 90 return err 91 } 92 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 93 return err 94 } 95 if err = addResolveEndpointMiddleware(stack, options); err != nil { 96 return err 97 } 98 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 99 return err 100 } 101 if err = addRetryMiddlewares(stack, options); err != nil { 102 return err 103 } 104 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 105 return err 106 } 107 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 108 return err 109 } 110 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 111 return err 112 } 113 if err = addClientUserAgent(stack); err != nil { 114 return err 115 } 116 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 117 return err 118 } 119 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 120 return err 121 } 122 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetProvisionedProductOutputs(options.Region), middleware.Before); err != nil { 123 return err 124 } 125 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 126 return err 127 } 128 if err = addResponseErrorMiddleware(stack); err != nil { 129 return err 130 } 131 if err = addRequestResponseLogging(stack, options); err != nil { 132 return err 133 } 134 return nil 135} 136 137// GetProvisionedProductOutputsAPIClient is a client that implements the 138// GetProvisionedProductOutputs operation. 139type GetProvisionedProductOutputsAPIClient interface { 140 GetProvisionedProductOutputs(context.Context, *GetProvisionedProductOutputsInput, ...func(*Options)) (*GetProvisionedProductOutputsOutput, error) 141} 142 143var _ GetProvisionedProductOutputsAPIClient = (*Client)(nil) 144 145// GetProvisionedProductOutputsPaginatorOptions is the paginator options for 146// GetProvisionedProductOutputs 147type GetProvisionedProductOutputsPaginatorOptions struct { 148 // The maximum number of items to return with this call. 149 Limit int32 150 151 // Set to true if pagination should stop if the service returns a pagination token 152 // that matches the most recent token provided to the service. 153 StopOnDuplicateToken bool 154} 155 156// GetProvisionedProductOutputsPaginator is a paginator for 157// GetProvisionedProductOutputs 158type GetProvisionedProductOutputsPaginator struct { 159 options GetProvisionedProductOutputsPaginatorOptions 160 client GetProvisionedProductOutputsAPIClient 161 params *GetProvisionedProductOutputsInput 162 nextToken *string 163 firstPage bool 164} 165 166// NewGetProvisionedProductOutputsPaginator returns a new 167// GetProvisionedProductOutputsPaginator 168func NewGetProvisionedProductOutputsPaginator(client GetProvisionedProductOutputsAPIClient, params *GetProvisionedProductOutputsInput, optFns ...func(*GetProvisionedProductOutputsPaginatorOptions)) *GetProvisionedProductOutputsPaginator { 169 options := GetProvisionedProductOutputsPaginatorOptions{} 170 if params.PageSize != 0 { 171 options.Limit = params.PageSize 172 } 173 174 for _, fn := range optFns { 175 fn(&options) 176 } 177 178 if params == nil { 179 params = &GetProvisionedProductOutputsInput{} 180 } 181 182 return &GetProvisionedProductOutputsPaginator{ 183 options: options, 184 client: client, 185 params: params, 186 firstPage: true, 187 } 188} 189 190// HasMorePages returns a boolean indicating whether more pages are available 191func (p *GetProvisionedProductOutputsPaginator) HasMorePages() bool { 192 return p.firstPage || p.nextToken != nil 193} 194 195// NextPage retrieves the next GetProvisionedProductOutputs page. 196func (p *GetProvisionedProductOutputsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*GetProvisionedProductOutputsOutput, error) { 197 if !p.HasMorePages() { 198 return nil, fmt.Errorf("no more pages available") 199 } 200 201 params := *p.params 202 params.PageToken = p.nextToken 203 204 params.PageSize = p.options.Limit 205 206 result, err := p.client.GetProvisionedProductOutputs(ctx, ¶ms, optFns...) 207 if err != nil { 208 return nil, err 209 } 210 p.firstPage = false 211 212 prevToken := p.nextToken 213 p.nextToken = result.NextPageToken 214 215 if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { 216 p.nextToken = nil 217 } 218 219 return result, nil 220} 221 222func newServiceMetadataMiddleware_opGetProvisionedProductOutputs(region string) *awsmiddleware.RegisterServiceMetadata { 223 return &awsmiddleware.RegisterServiceMetadata{ 224 Region: region, 225 ServiceID: ServiceID, 226 SigningName: "servicecatalog", 227 OperationName: "GetProvisionedProductOutputs", 228 } 229} 230