1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package applicationdiscoveryservice
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/applicationdiscoveryservice/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Lists agents or connectors as specified by ID or other filters. All
15// agents/connectors associated with your user account can be listed if you call
16// DescribeAgents as is without passing any parameters.
17func (c *Client) DescribeAgents(ctx context.Context, params *DescribeAgentsInput, optFns ...func(*Options)) (*DescribeAgentsOutput, error) {
18	if params == nil {
19		params = &DescribeAgentsInput{}
20	}
21
22	result, metadata, err := c.invokeOperation(ctx, "DescribeAgents", params, optFns, addOperationDescribeAgentsMiddlewares)
23	if err != nil {
24		return nil, err
25	}
26
27	out := result.(*DescribeAgentsOutput)
28	out.ResultMetadata = metadata
29	return out, nil
30}
31
32type DescribeAgentsInput struct {
33
34	// The agent or the Connector IDs for which you want information. If you specify no
35	// IDs, the system returns information about all agents/Connectors associated with
36	// your AWS user account.
37	AgentIds []string
38
39	// You can filter the request using various logical operators and a key-value
40	// format. For example: {"key": "collectionStatus", "value": "STARTED"}
41	Filters []types.Filter
42
43	// The total number of agents/Connectors to return in a single page of output. The
44	// maximum value is 100.
45	MaxResults int32
46
47	// Token to retrieve the next set of results. For example, if you previously
48	// specified 100 IDs for DescribeAgentsRequest$agentIds but set
49	// DescribeAgentsRequest$maxResults to 10, you received a set of 10 results along
50	// with a token. Use that token in this query to get the next set of 10.
51	NextToken *string
52}
53
54type DescribeAgentsOutput struct {
55
56	// Lists agents or the Connector by ID or lists all agents/Connectors associated
57	// with your user account if you did not specify an agent/Connector ID. The output
58	// includes agent/Connector IDs, IP addresses, media access control (MAC)
59	// addresses, agent/Connector health, host name where the agent/Connector resides,
60	// and the version number of each agent/Connector.
61	AgentsInfo []types.AgentInfo
62
63	// Token to retrieve the next set of results. For example, if you specified 100 IDs
64	// for DescribeAgentsRequest$agentIds but set DescribeAgentsRequest$maxResults to
65	// 10, you received a set of 10 results along with this token. Use this token in
66	// the next query to retrieve the next set of 10.
67	NextToken *string
68
69	// Metadata pertaining to the operation's result.
70	ResultMetadata middleware.Metadata
71}
72
73func addOperationDescribeAgentsMiddlewares(stack *middleware.Stack, options Options) (err error) {
74	err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeAgents{}, middleware.After)
75	if err != nil {
76		return err
77	}
78	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeAgents{}, middleware.After)
79	if err != nil {
80		return err
81	}
82	if err = addSetLoggerMiddleware(stack, options); err != nil {
83		return err
84	}
85	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
86		return err
87	}
88	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
89		return err
90	}
91	if err = addResolveEndpointMiddleware(stack, options); err != nil {
92		return err
93	}
94	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
95		return err
96	}
97	if err = addRetryMiddlewares(stack, options); err != nil {
98		return err
99	}
100	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
101		return err
102	}
103	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
104		return err
105	}
106	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
107		return err
108	}
109	if err = addClientUserAgent(stack); err != nil {
110		return err
111	}
112	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
113		return err
114	}
115	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
116		return err
117	}
118	if err = addOpDescribeAgentsValidationMiddleware(stack); err != nil {
119		return err
120	}
121	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeAgents(options.Region), middleware.Before); err != nil {
122		return err
123	}
124	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
125		return err
126	}
127	if err = addResponseErrorMiddleware(stack); err != nil {
128		return err
129	}
130	if err = addRequestResponseLogging(stack, options); err != nil {
131		return err
132	}
133	return nil
134}
135
136func newServiceMetadataMiddleware_opDescribeAgents(region string) *awsmiddleware.RegisterServiceMetadata {
137	return &awsmiddleware.RegisterServiceMetadata{
138		Region:        region,
139		ServiceID:     ServiceID,
140		SigningName:   "discovery",
141		OperationName: "DescribeAgents",
142	}
143}
144