1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package kinesisanalytics
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/kinesisanalytics/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// This documentation is for version 1 of the Amazon Kinesis Data Analytics API,
15// which only supports SQL applications. Version 2 of the API supports SQL and Java
16// applications. For more information about version 2, see Amazon Kinesis Data
17// Analytics API V2 Documentation. Returns a list of Amazon Kinesis Analytics
18// applications in your account. For each application, the response includes the
19// application name, Amazon Resource Name (ARN), and status. If the response
20// returns the HasMoreApplications value as true,
21//
22// you can send another request by
23// adding the ExclusiveStartApplicationName in the request body, and set the value
24// of this to the last application name from the previous response. If you want
25// detailed information about a specific application, use DescribeApplication
26// (https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_DescribeApplication.html).
27// This operation requires permissions to perform the
28// kinesisanalytics:ListApplications action.
29func (c *Client) ListApplications(ctx context.Context, params *ListApplicationsInput, optFns ...func(*Options)) (*ListApplicationsOutput, error) {
30	if params == nil {
31		params = &ListApplicationsInput{}
32	}
33
34	result, metadata, err := c.invokeOperation(ctx, "ListApplications", params, optFns, addOperationListApplicationsMiddlewares)
35	if err != nil {
36		return nil, err
37	}
38
39	out := result.(*ListApplicationsOutput)
40	out.ResultMetadata = metadata
41	return out, nil
42}
43
44//
45type ListApplicationsInput struct {
46
47	// Name of the application to start the list with. When using pagination to
48	// retrieve the list, you don't need to specify this parameter in the first
49	// request. However, in subsequent requests, you add the last application name from
50	// the previous response to get the next page of applications.
51	ExclusiveStartApplicationName *string
52
53	// Maximum number of applications to list.
54	Limit *int32
55}
56
57//
58type ListApplicationsOutput struct {
59
60	// List of ApplicationSummary objects.
61	//
62	// This member is required.
63	ApplicationSummaries []types.ApplicationSummary
64
65	// Returns true if there are more applications to retrieve.
66	//
67	// This member is required.
68	HasMoreApplications *bool
69
70	// Metadata pertaining to the operation's result.
71	ResultMetadata middleware.Metadata
72}
73
74func addOperationListApplicationsMiddlewares(stack *middleware.Stack, options Options) (err error) {
75	err = stack.Serialize.Add(&awsAwsjson11_serializeOpListApplications{}, middleware.After)
76	if err != nil {
77		return err
78	}
79	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListApplications{}, middleware.After)
80	if err != nil {
81		return err
82	}
83	if err = addSetLoggerMiddleware(stack, options); err != nil {
84		return err
85	}
86	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
87		return err
88	}
89	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
90		return err
91	}
92	if err = addResolveEndpointMiddleware(stack, options); err != nil {
93		return err
94	}
95	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
96		return err
97	}
98	if err = addRetryMiddlewares(stack, options); err != nil {
99		return err
100	}
101	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
102		return err
103	}
104	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
105		return err
106	}
107	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
108		return err
109	}
110	if err = addClientUserAgent(stack); err != nil {
111		return err
112	}
113	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
114		return err
115	}
116	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
117		return err
118	}
119	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListApplications(options.Region), middleware.Before); err != nil {
120		return err
121	}
122	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
123		return err
124	}
125	if err = addResponseErrorMiddleware(stack); err != nil {
126		return err
127	}
128	if err = addRequestResponseLogging(stack, options); err != nil {
129		return err
130	}
131	return nil
132}
133
134func newServiceMetadataMiddleware_opListApplications(region string) *awsmiddleware.RegisterServiceMetadata {
135	return &awsmiddleware.RegisterServiceMetadata{
136		Region:        region,
137		ServiceID:     ServiceID,
138		SigningName:   "kinesisanalytics",
139		OperationName: "ListApplications",
140	}
141}
142