// Code generated by smithy-go-codegen DO NOT EDIT.

package ec2

import (
	"context"
	"github.com/aws/aws-sdk-go-v2/service/ec2/types"
	"github.com/aws/smithy-go/middleware"
)

// Describes the SQL Server High Availability states for Amazon EC2 instances that
// are enabled for Amazon EC2 High Availability for SQL Server monitoring.
func (c *Client) DescribeInstanceSqlHaStates(ctx context.Context, params *DescribeInstanceSqlHaStatesInput, optFns ...func(*Options)) (*DescribeInstanceSqlHaStatesOutput, error) {
	if params == nil {
		params = &DescribeInstanceSqlHaStatesInput{}
	}

	result, metadata, err := c.invokeOperation(ctx, "DescribeInstanceSqlHaStates", params, optFns, c.addOperationDescribeInstanceSqlHaStatesMiddlewares)
	if err != nil {
		return nil, err
	}

	out := result.(*DescribeInstanceSqlHaStatesOutput)
	out.ResultMetadata = metadata
	return out, nil
}

type DescribeInstanceSqlHaStatesInput struct {

	// Checks whether you have the required permissions for the action, without
	// actually making the request, and provides an error response. If you have the
	// required permissions, the error response is DryRunOperation . Otherwise, it is
	// UnauthorizedOperation .
	DryRun *bool

	// One or more filters to apply to the results. Supported filters include:
	//
	//   - tag: - The tag key and value pair assigned to the instance. For example, to
	//   find all instances tagged with Owner:TeamA , specify tag:Owner for the filter
	//   name and TeamA for the filter value.
	//
	//   - tag-key - The tag key assigned to the instance.
	//
	//   - haStatus - The SQL Server High Availability status of the SQL Server High
	//   Availability instance ( processing | active | standby | invalid ).
	//
	//   - sqlServerLicenseUsage - The license type for the SQL Server license ( full |
	//   waived ).
	Filters []types.Filter

	// The IDs of the SQL Server High Availability instances to describe. If omitted,
	// the API returns SQL Server High Availability states for all SQL Server High
	// Availability instances.
	InstanceIds []string

	// The maximum number of results to return for the request in a single page. The
	// remaining results can be seen by sending another request with the returned
	// nextToken value.
	MaxResults *int32

	// The token to use to retrieve the next page of results.
	NextToken *string

	noSmithyDocumentSerde
}

type DescribeInstanceSqlHaStatesOutput struct {

	// Information about the SQL Server High Availability instances.
	Instances []types.RegisteredInstance

	// The token to use to retrieve the next page of results. This value is null when
	// there are no more results to return.
	NextToken *string

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

func (c *Client) addOperationDescribeInstanceSqlHaStatesMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsEc2query_serializeOpDescribeInstanceSqlHaStates{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsEc2query_deserializeOpDescribeInstanceSqlHaStates{}, middleware.After)
	if err != nil {
		return err
	}

	if err = addResolveEndpointMiddleware(stack, options); err != nil {
		return err
	}
	if err = addComputePayloadSHA256(stack); err != nil {
		return err
	}
	if err = addRecordResponseTiming(stack, options); err != nil {
		return err
	}
	if err = addCredentialSource(stack, options); err != nil {
		return err
	}
	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
		return err
	}
	if err = addResponseErrorMiddleware(stack); err != nil {
		return err
	}
	if err = addRequestResponseLogging(stack, options); err != nil {
		return err
	}
	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
		return err
	}
	if err = addInterceptors(stack, options); err != nil {
		return err
	}
	return nil
}
