1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package datasync
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/datasync/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12	"time"
13)
14
15// Returns metadata such as the name, the network interfaces, and the status (that
16// is, whether the agent is running or not) for an agent. To specify which agent to
17// describe, use the Amazon Resource Name (ARN) of the agent in your request.
18func (c *Client) DescribeAgent(ctx context.Context, params *DescribeAgentInput, optFns ...func(*Options)) (*DescribeAgentOutput, error) {
19	if params == nil {
20		params = &DescribeAgentInput{}
21	}
22
23	result, metadata, err := c.invokeOperation(ctx, "DescribeAgent", params, optFns, c.addOperationDescribeAgentMiddlewares)
24	if err != nil {
25		return nil, err
26	}
27
28	out := result.(*DescribeAgentOutput)
29	out.ResultMetadata = metadata
30	return out, nil
31}
32
33// DescribeAgent
34type DescribeAgentInput struct {
35
36	// The Amazon Resource Name (ARN) of the agent to describe.
37	//
38	// This member is required.
39	AgentArn *string
40
41	noSmithyDocumentSerde
42}
43
44// DescribeAgentResponse
45type DescribeAgentOutput struct {
46
47	// The Amazon Resource Name (ARN) of the agent.
48	AgentArn *string
49
50	// The time that the agent was activated (that is, created in your account).
51	CreationTime *time.Time
52
53	// The type of endpoint that your agent is connected to. If the endpoint is a VPC
54	// endpoint, the agent is not accessible over the public internet.
55	EndpointType types.EndpointType
56
57	// The time that the agent last connected to DataSync.
58	LastConnectionTime *time.Time
59
60	// The name of the agent.
61	Name *string
62
63	// The subnet and the security group that DataSync used to access a VPC endpoint.
64	PrivateLinkConfig *types.PrivateLinkConfig
65
66	// The status of the agent. If the status is ONLINE, then the agent is configured
67	// properly and is available to use. The Running status is the normal running
68	// status for an agent. If the status is OFFLINE, the agent's VM is turned off or
69	// the agent is in an unhealthy state. When the issue that caused the unhealthy
70	// state is resolved, the agent returns to ONLINE status.
71	Status types.AgentStatus
72
73	// Metadata pertaining to the operation's result.
74	ResultMetadata middleware.Metadata
75
76	noSmithyDocumentSerde
77}
78
79func (c *Client) addOperationDescribeAgentMiddlewares(stack *middleware.Stack, options Options) (err error) {
80	err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeAgent{}, middleware.After)
81	if err != nil {
82		return err
83	}
84	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeAgent{}, middleware.After)
85	if err != nil {
86		return err
87	}
88	if err = addSetLoggerMiddleware(stack, options); err != nil {
89		return err
90	}
91	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
92		return err
93	}
94	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
95		return err
96	}
97	if err = addResolveEndpointMiddleware(stack, options); err != nil {
98		return err
99	}
100	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
101		return err
102	}
103	if err = addRetryMiddlewares(stack, options); err != nil {
104		return err
105	}
106	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
107		return err
108	}
109	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
110		return err
111	}
112	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
113		return err
114	}
115	if err = addClientUserAgent(stack); err != nil {
116		return err
117	}
118	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
119		return err
120	}
121	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
122		return err
123	}
124	if err = addOpDescribeAgentValidationMiddleware(stack); err != nil {
125		return err
126	}
127	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeAgent(options.Region), middleware.Before); err != nil {
128		return err
129	}
130	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
131		return err
132	}
133	if err = addResponseErrorMiddleware(stack); err != nil {
134		return err
135	}
136	if err = addRequestResponseLogging(stack, options); err != nil {
137		return err
138	}
139	return nil
140}
141
142func newServiceMetadataMiddleware_opDescribeAgent(region string) *awsmiddleware.RegisterServiceMetadata {
143	return &awsmiddleware.RegisterServiceMetadata{
144		Region:        region,
145		ServiceID:     ServiceID,
146		SigningName:   "datasync",
147		OperationName: "DescribeAgent",
148	}
149}
150