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// Lists the paths to the specified product. A path is how the user has access to a 16// specified product, and is necessary when provisioning a product. A path also 17// determines the constraints put on the product. 18func (c *Client) ListLaunchPaths(ctx context.Context, params *ListLaunchPathsInput, optFns ...func(*Options)) (*ListLaunchPathsOutput, error) { 19 if params == nil { 20 params = &ListLaunchPathsInput{} 21 } 22 23 result, metadata, err := c.invokeOperation(ctx, "ListLaunchPaths", params, optFns, addOperationListLaunchPathsMiddlewares) 24 if err != nil { 25 return nil, err 26 } 27 28 out := result.(*ListLaunchPathsOutput) 29 out.ResultMetadata = metadata 30 return out, nil 31} 32 33type ListLaunchPathsInput struct { 34 35 // The product identifier. 36 // 37 // This member is required. 38 ProductId *string 39 40 // The language code. 41 // 42 // * en - English (default) 43 // 44 // * jp - Japanese 45 // 46 // * zh - Chinese 47 AcceptLanguage *string 48 49 // The maximum number of items to return with this call. 50 PageSize int32 51 52 // The page token for the next set of results. To retrieve the first set of 53 // results, use null. 54 PageToken *string 55} 56 57type ListLaunchPathsOutput struct { 58 59 // Information about the launch path. 60 LaunchPathSummaries []types.LaunchPathSummary 61 62 // The page token to use to retrieve the next set of results. If there are no 63 // additional results, this value is null. 64 NextPageToken *string 65 66 // Metadata pertaining to the operation's result. 67 ResultMetadata middleware.Metadata 68} 69 70func addOperationListLaunchPathsMiddlewares(stack *middleware.Stack, options Options) (err error) { 71 err = stack.Serialize.Add(&awsAwsjson11_serializeOpListLaunchPaths{}, middleware.After) 72 if err != nil { 73 return err 74 } 75 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListLaunchPaths{}, middleware.After) 76 if err != nil { 77 return err 78 } 79 if err = addSetLoggerMiddleware(stack, options); err != nil { 80 return err 81 } 82 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 83 return err 84 } 85 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 86 return err 87 } 88 if err = addResolveEndpointMiddleware(stack, options); err != nil { 89 return err 90 } 91 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 92 return err 93 } 94 if err = addRetryMiddlewares(stack, options); err != nil { 95 return err 96 } 97 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 98 return err 99 } 100 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 101 return err 102 } 103 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 104 return err 105 } 106 if err = addClientUserAgent(stack); err != nil { 107 return err 108 } 109 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 110 return err 111 } 112 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 113 return err 114 } 115 if err = addOpListLaunchPathsValidationMiddleware(stack); err != nil { 116 return err 117 } 118 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListLaunchPaths(options.Region), middleware.Before); err != nil { 119 return err 120 } 121 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 122 return err 123 } 124 if err = addResponseErrorMiddleware(stack); err != nil { 125 return err 126 } 127 if err = addRequestResponseLogging(stack, options); err != nil { 128 return err 129 } 130 return nil 131} 132 133// ListLaunchPathsAPIClient is a client that implements the ListLaunchPaths 134// operation. 135type ListLaunchPathsAPIClient interface { 136 ListLaunchPaths(context.Context, *ListLaunchPathsInput, ...func(*Options)) (*ListLaunchPathsOutput, error) 137} 138 139var _ ListLaunchPathsAPIClient = (*Client)(nil) 140 141// ListLaunchPathsPaginatorOptions is the paginator options for ListLaunchPaths 142type ListLaunchPathsPaginatorOptions struct { 143 // The maximum number of items to return with this call. 144 Limit int32 145 146 // Set to true if pagination should stop if the service returns a pagination token 147 // that matches the most recent token provided to the service. 148 StopOnDuplicateToken bool 149} 150 151// ListLaunchPathsPaginator is a paginator for ListLaunchPaths 152type ListLaunchPathsPaginator struct { 153 options ListLaunchPathsPaginatorOptions 154 client ListLaunchPathsAPIClient 155 params *ListLaunchPathsInput 156 nextToken *string 157 firstPage bool 158} 159 160// NewListLaunchPathsPaginator returns a new ListLaunchPathsPaginator 161func NewListLaunchPathsPaginator(client ListLaunchPathsAPIClient, params *ListLaunchPathsInput, optFns ...func(*ListLaunchPathsPaginatorOptions)) *ListLaunchPathsPaginator { 162 options := ListLaunchPathsPaginatorOptions{} 163 if params.PageSize != 0 { 164 options.Limit = params.PageSize 165 } 166 167 for _, fn := range optFns { 168 fn(&options) 169 } 170 171 if params == nil { 172 params = &ListLaunchPathsInput{} 173 } 174 175 return &ListLaunchPathsPaginator{ 176 options: options, 177 client: client, 178 params: params, 179 firstPage: true, 180 } 181} 182 183// HasMorePages returns a boolean indicating whether more pages are available 184func (p *ListLaunchPathsPaginator) HasMorePages() bool { 185 return p.firstPage || p.nextToken != nil 186} 187 188// NextPage retrieves the next ListLaunchPaths page. 189func (p *ListLaunchPathsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListLaunchPathsOutput, error) { 190 if !p.HasMorePages() { 191 return nil, fmt.Errorf("no more pages available") 192 } 193 194 params := *p.params 195 params.PageToken = p.nextToken 196 197 params.PageSize = p.options.Limit 198 199 result, err := p.client.ListLaunchPaths(ctx, ¶ms, optFns...) 200 if err != nil { 201 return nil, err 202 } 203 p.firstPage = false 204 205 prevToken := p.nextToken 206 p.nextToken = result.NextPageToken 207 208 if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { 209 p.nextToken = nil 210 } 211 212 return result, nil 213} 214 215func newServiceMetadataMiddleware_opListLaunchPaths(region string) *awsmiddleware.RegisterServiceMetadata { 216 return &awsmiddleware.RegisterServiceMetadata{ 217 Region: region, 218 ServiceID: ServiceID, 219 SigningName: "servicecatalog", 220 OperationName: "ListLaunchPaths", 221 } 222} 223