1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package ec2
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/ec2/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12	"time"
13)
14
15// Submits feedback about the status of an instance. The instance must be in the
16// running state. If your experience with the instance differs from the instance
17// status returned by DescribeInstanceStatus, use ReportInstanceStatus to report
18// your experience with the instance. Amazon EC2 collects this information to
19// improve the accuracy of status checks. Use of this action does not change the
20// value returned by DescribeInstanceStatus.
21func (c *Client) ReportInstanceStatus(ctx context.Context, params *ReportInstanceStatusInput, optFns ...func(*Options)) (*ReportInstanceStatusOutput, error) {
22	if params == nil {
23		params = &ReportInstanceStatusInput{}
24	}
25
26	result, metadata, err := c.invokeOperation(ctx, "ReportInstanceStatus", params, optFns, addOperationReportInstanceStatusMiddlewares)
27	if err != nil {
28		return nil, err
29	}
30
31	out := result.(*ReportInstanceStatusOutput)
32	out.ResultMetadata = metadata
33	return out, nil
34}
35
36type ReportInstanceStatusInput struct {
37
38	// The instances.
39	//
40	// This member is required.
41	Instances []string
42
43	// The reason codes that describe the health state of your instance.
44	//
45	// *
46	// instance-stuck-in-state: My instance is stuck in a state.
47	//
48	// * unresponsive: My
49	// instance is unresponsive.
50	//
51	// * not-accepting-credentials: My instance is not
52	// accepting my credentials.
53	//
54	// * password-not-available: A password is not available
55	// for my instance.
56	//
57	// * performance-network: My instance is experiencing performance
58	// problems that I believe are network related.
59	//
60	// * performance-instance-store: My
61	// instance is experiencing performance problems that I believe are related to the
62	// instance stores.
63	//
64	// * performance-ebs-volume: My instance is experiencing
65	// performance problems that I believe are related to an EBS volume.
66	//
67	// *
68	// performance-other: My instance is experiencing performance problems.
69	//
70	// * other:
71	// [explain using the description parameter]
72	//
73	// This member is required.
74	ReasonCodes []types.ReportInstanceReasonCodes
75
76	// The status of all instances listed.
77	//
78	// This member is required.
79	Status types.ReportStatusType
80
81	// Descriptive text about the health state of your instance.
82	Description *string
83
84	// Checks whether you have the required permissions for the action, without
85	// actually making the request, and provides an error response. If you have the
86	// required permissions, the error response is DryRunOperation. Otherwise, it is
87	// UnauthorizedOperation.
88	DryRun bool
89
90	// The time at which the reported instance health state ended.
91	EndTime *time.Time
92
93	// The time at which the reported instance health state began.
94	StartTime *time.Time
95}
96
97type ReportInstanceStatusOutput struct {
98	// Metadata pertaining to the operation's result.
99	ResultMetadata middleware.Metadata
100}
101
102func addOperationReportInstanceStatusMiddlewares(stack *middleware.Stack, options Options) (err error) {
103	err = stack.Serialize.Add(&awsEc2query_serializeOpReportInstanceStatus{}, middleware.After)
104	if err != nil {
105		return err
106	}
107	err = stack.Deserialize.Add(&awsEc2query_deserializeOpReportInstanceStatus{}, middleware.After)
108	if err != nil {
109		return err
110	}
111	if err = addSetLoggerMiddleware(stack, options); err != nil {
112		return err
113	}
114	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
115		return err
116	}
117	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
118		return err
119	}
120	if err = addResolveEndpointMiddleware(stack, options); err != nil {
121		return err
122	}
123	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
124		return err
125	}
126	if err = addRetryMiddlewares(stack, options); err != nil {
127		return err
128	}
129	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
130		return err
131	}
132	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
133		return err
134	}
135	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
136		return err
137	}
138	if err = addClientUserAgent(stack); err != nil {
139		return err
140	}
141	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
142		return err
143	}
144	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
145		return err
146	}
147	if err = addOpReportInstanceStatusValidationMiddleware(stack); err != nil {
148		return err
149	}
150	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opReportInstanceStatus(options.Region), middleware.Before); err != nil {
151		return err
152	}
153	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
154		return err
155	}
156	if err = addResponseErrorMiddleware(stack); err != nil {
157		return err
158	}
159	if err = addRequestResponseLogging(stack, options); err != nil {
160		return err
161	}
162	return nil
163}
164
165func newServiceMetadataMiddleware_opReportInstanceStatus(region string) *awsmiddleware.RegisterServiceMetadata {
166	return &awsmiddleware.RegisterServiceMetadata{
167		Region:        region,
168		ServiceID:     ServiceID,
169		SigningName:   "ec2",
170		OperationName: "ReportInstanceStatus",
171	}
172}
173