1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package codedeploy
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/codedeploy/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Gets a list of names for one or more on-premises instances. Unless otherwise
15// specified, both registered and deregistered on-premises instance names are
16// listed. To list only registered or deregistered on-premises instance names, use
17// the registration status parameter.
18func (c *Client) ListOnPremisesInstances(ctx context.Context, params *ListOnPremisesInstancesInput, optFns ...func(*Options)) (*ListOnPremisesInstancesOutput, error) {
19	if params == nil {
20		params = &ListOnPremisesInstancesInput{}
21	}
22
23	result, metadata, err := c.invokeOperation(ctx, "ListOnPremisesInstances", params, optFns, addOperationListOnPremisesInstancesMiddlewares)
24	if err != nil {
25		return nil, err
26	}
27
28	out := result.(*ListOnPremisesInstancesOutput)
29	out.ResultMetadata = metadata
30	return out, nil
31}
32
33// Represents the input of a ListOnPremisesInstances operation.
34type ListOnPremisesInstancesInput struct {
35
36	// An identifier returned from the previous list on-premises instances call. It can
37	// be used to return the next set of on-premises instances in the list.
38	NextToken *string
39
40	// The registration status of the on-premises instances:
41	//
42	// * Deregistered: Include
43	// deregistered on-premises instances in the resulting list.
44	//
45	// * Registered: Include
46	// registered on-premises instances in the resulting list.
47	RegistrationStatus types.RegistrationStatus
48
49	// The on-premises instance tags that are used to restrict the on-premises instance
50	// names returned.
51	TagFilters []types.TagFilter
52}
53
54// Represents the output of the list on-premises instances operation.
55type ListOnPremisesInstancesOutput struct {
56
57	// The list of matching on-premises instance names.
58	InstanceNames []string
59
60	// If a large amount of information is returned, an identifier is also returned. It
61	// can be used in a subsequent list on-premises instances call to return the next
62	// set of on-premises instances in the list.
63	NextToken *string
64
65	// Metadata pertaining to the operation's result.
66	ResultMetadata middleware.Metadata
67}
68
69func addOperationListOnPremisesInstancesMiddlewares(stack *middleware.Stack, options Options) (err error) {
70	err = stack.Serialize.Add(&awsAwsjson11_serializeOpListOnPremisesInstances{}, middleware.After)
71	if err != nil {
72		return err
73	}
74	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListOnPremisesInstances{}, middleware.After)
75	if err != nil {
76		return err
77	}
78	if err = addSetLoggerMiddleware(stack, options); err != nil {
79		return err
80	}
81	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
82		return err
83	}
84	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
85		return err
86	}
87	if err = addResolveEndpointMiddleware(stack, options); err != nil {
88		return err
89	}
90	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
91		return err
92	}
93	if err = addRetryMiddlewares(stack, options); err != nil {
94		return err
95	}
96	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
97		return err
98	}
99	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
100		return err
101	}
102	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
103		return err
104	}
105	if err = addClientUserAgent(stack); err != nil {
106		return err
107	}
108	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
109		return err
110	}
111	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
112		return err
113	}
114	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListOnPremisesInstances(options.Region), middleware.Before); err != nil {
115		return err
116	}
117	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
118		return err
119	}
120	if err = addResponseErrorMiddleware(stack); err != nil {
121		return err
122	}
123	if err = addRequestResponseLogging(stack, options); err != nil {
124		return err
125	}
126	return nil
127}
128
129func newServiceMetadataMiddleware_opListOnPremisesInstances(region string) *awsmiddleware.RegisterServiceMetadata {
130	return &awsmiddleware.RegisterServiceMetadata{
131		Region:        region,
132		ServiceID:     ServiceID,
133		SigningName:   "codedeploy",
134		OperationName: "ListOnPremisesInstances",
135	}
136}
137