1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package cloudformation 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/cloudformation/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13) 14 15// Returns summary information about the results of a stack set operation. 16func (c *Client) ListStackSetOperationResults(ctx context.Context, params *ListStackSetOperationResultsInput, optFns ...func(*Options)) (*ListStackSetOperationResultsOutput, error) { 17 if params == nil { 18 params = &ListStackSetOperationResultsInput{} 19 } 20 21 result, metadata, err := c.invokeOperation(ctx, "ListStackSetOperationResults", params, optFns, addOperationListStackSetOperationResultsMiddlewares) 22 if err != nil { 23 return nil, err 24 } 25 26 out := result.(*ListStackSetOperationResultsOutput) 27 out.ResultMetadata = metadata 28 return out, nil 29} 30 31type ListStackSetOperationResultsInput struct { 32 33 // The ID of the stack set operation. 34 // 35 // This member is required. 36 OperationId *string 37 38 // The name or unique ID of the stack set that you want to get operation results 39 // for. 40 // 41 // This member is required. 42 StackSetName *string 43 44 // [Service-managed permissions] Specifies whether you are acting as an account 45 // administrator in the organization's management account or as a delegated 46 // administrator in a member account. By default, SELF is specified. Use SELF for 47 // stack sets with self-managed permissions. 48 // 49 // * If you are signed in to the 50 // management account, specify SELF. 51 // 52 // * If you are signed in to a delegated 53 // administrator account, specify DELEGATED_ADMIN. Your AWS account must be 54 // registered as a delegated administrator in the management account. For more 55 // information, see Register a delegated administrator 56 // (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-delegated-admin.html) 57 // in the AWS CloudFormation User Guide. 58 CallAs types.CallAs 59 60 // The maximum number of results to be returned with a single call. If the number 61 // of available results exceeds this maximum, the response includes a NextToken 62 // value that you can assign to the NextToken request parameter to get the next set 63 // of results. 64 MaxResults *int32 65 66 // If the previous request didn't return all of the remaining results, the response 67 // object's NextToken parameter value is set to a token. To retrieve the next set 68 // of results, call ListStackSetOperationResults again and assign that token to the 69 // request object's NextToken parameter. If there are no remaining results, the 70 // previous response object's NextToken parameter is set to null. 71 NextToken *string 72} 73 74type ListStackSetOperationResultsOutput struct { 75 76 // If the request doesn't return all results, NextToken is set to a token. To 77 // retrieve the next set of results, call ListOperationResults again and assign 78 // that token to the request object's NextToken parameter. If there are no 79 // remaining results, NextToken is set to null. 80 NextToken *string 81 82 // A list of StackSetOperationResultSummary structures that contain information 83 // about the specified operation results, for accounts and Regions that are 84 // included in the operation. 85 Summaries []types.StackSetOperationResultSummary 86 87 // Metadata pertaining to the operation's result. 88 ResultMetadata middleware.Metadata 89} 90 91func addOperationListStackSetOperationResultsMiddlewares(stack *middleware.Stack, options Options) (err error) { 92 err = stack.Serialize.Add(&awsAwsquery_serializeOpListStackSetOperationResults{}, middleware.After) 93 if err != nil { 94 return err 95 } 96 err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListStackSetOperationResults{}, middleware.After) 97 if err != nil { 98 return err 99 } 100 if err = addSetLoggerMiddleware(stack, options); err != nil { 101 return err 102 } 103 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 104 return err 105 } 106 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 107 return err 108 } 109 if err = addResolveEndpointMiddleware(stack, options); err != nil { 110 return err 111 } 112 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 113 return err 114 } 115 if err = addRetryMiddlewares(stack, options); err != nil { 116 return err 117 } 118 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 119 return err 120 } 121 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 122 return err 123 } 124 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 125 return err 126 } 127 if err = addClientUserAgent(stack); err != nil { 128 return err 129 } 130 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 131 return err 132 } 133 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 134 return err 135 } 136 if err = addOpListStackSetOperationResultsValidationMiddleware(stack); err != nil { 137 return err 138 } 139 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListStackSetOperationResults(options.Region), middleware.Before); err != nil { 140 return err 141 } 142 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 143 return err 144 } 145 if err = addResponseErrorMiddleware(stack); err != nil { 146 return err 147 } 148 if err = addRequestResponseLogging(stack, options); err != nil { 149 return err 150 } 151 return nil 152} 153 154// ListStackSetOperationResultsAPIClient is a client that implements the 155// ListStackSetOperationResults operation. 156type ListStackSetOperationResultsAPIClient interface { 157 ListStackSetOperationResults(context.Context, *ListStackSetOperationResultsInput, ...func(*Options)) (*ListStackSetOperationResultsOutput, error) 158} 159 160var _ ListStackSetOperationResultsAPIClient = (*Client)(nil) 161 162// ListStackSetOperationResultsPaginatorOptions is the paginator options for 163// ListStackSetOperationResults 164type ListStackSetOperationResultsPaginatorOptions struct { 165 // The maximum number of results to be returned with a single call. If the number 166 // of available results exceeds this maximum, the response includes a NextToken 167 // value that you can assign to the NextToken request parameter to get the next set 168 // of results. 169 Limit int32 170 171 // Set to true if pagination should stop if the service returns a pagination token 172 // that matches the most recent token provided to the service. 173 StopOnDuplicateToken bool 174} 175 176// ListStackSetOperationResultsPaginator is a paginator for 177// ListStackSetOperationResults 178type ListStackSetOperationResultsPaginator struct { 179 options ListStackSetOperationResultsPaginatorOptions 180 client ListStackSetOperationResultsAPIClient 181 params *ListStackSetOperationResultsInput 182 nextToken *string 183 firstPage bool 184} 185 186// NewListStackSetOperationResultsPaginator returns a new 187// ListStackSetOperationResultsPaginator 188func NewListStackSetOperationResultsPaginator(client ListStackSetOperationResultsAPIClient, params *ListStackSetOperationResultsInput, optFns ...func(*ListStackSetOperationResultsPaginatorOptions)) *ListStackSetOperationResultsPaginator { 189 if params == nil { 190 params = &ListStackSetOperationResultsInput{} 191 } 192 193 options := ListStackSetOperationResultsPaginatorOptions{} 194 if params.MaxResults != nil { 195 options.Limit = *params.MaxResults 196 } 197 198 for _, fn := range optFns { 199 fn(&options) 200 } 201 202 return &ListStackSetOperationResultsPaginator{ 203 options: options, 204 client: client, 205 params: params, 206 firstPage: true, 207 } 208} 209 210// HasMorePages returns a boolean indicating whether more pages are available 211func (p *ListStackSetOperationResultsPaginator) HasMorePages() bool { 212 return p.firstPage || p.nextToken != nil 213} 214 215// NextPage retrieves the next ListStackSetOperationResults page. 216func (p *ListStackSetOperationResultsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListStackSetOperationResultsOutput, error) { 217 if !p.HasMorePages() { 218 return nil, fmt.Errorf("no more pages available") 219 } 220 221 params := *p.params 222 params.NextToken = p.nextToken 223 224 var limit *int32 225 if p.options.Limit > 0 { 226 limit = &p.options.Limit 227 } 228 params.MaxResults = limit 229 230 result, err := p.client.ListStackSetOperationResults(ctx, ¶ms, optFns...) 231 if err != nil { 232 return nil, err 233 } 234 p.firstPage = false 235 236 prevToken := p.nextToken 237 p.nextToken = result.NextToken 238 239 if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { 240 p.nextToken = nil 241 } 242 243 return result, nil 244} 245 246func newServiceMetadataMiddleware_opListStackSetOperationResults(region string) *awsmiddleware.RegisterServiceMetadata { 247 return &awsmiddleware.RegisterServiceMetadata{ 248 Region: region, 249 ServiceID: ServiceID, 250 SigningName: "cloudformation", 251 OperationName: "ListStackSetOperationResults", 252 } 253} 254