// 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 aggregated application health status for the specified instances.
// The following rules apply:
//
//   - The instance-level status is derived from all application status checks
//     with the aggregation setting set to included .
//
//   - Use DescribeApplicationStatusChecks to view the configuration of individual
//     checks.
//
//   - Use EnableApplicationStatusCheckSuppression to temporarily suppress health
//     check results from affecting the instance-level status.
func (c *Client) DescribeApplicationStatus(ctx context.Context, params *DescribeApplicationStatusInput, optFns ...func(*Options)) (*DescribeApplicationStatusOutput, error) {
	if params == nil {
		params = &DescribeApplicationStatusInput{}
	}

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

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

type DescribeApplicationStatusInput struct {

	// Checks whether you have the required permissions for the operation, 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

	// The filters.
	//
	//   - availability-zone-id – The ID of the Availability Zone.
	//
	//   - status – The instance-level application status. For valid values and their
	//   meanings, see ApplicationStatus .
	Filters []types.Filter

	// The IDs of the instances for which to describe application status.
	InstanceIds []string

	// The maximum number of items to return for this request. To get the next page of
	// items, make another request with the token returned in the output. For more
	// information, see [Pagination].
	//
	// [Pagination]: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Query-Requests.html#api-pagination
	MaxResults *int32

	// The token returned from a previous paginated request. Pagination continues from
	// the end of the items returned by the previous request.
	NextToken *string

	noSmithyDocumentSerde
}

type DescribeApplicationStatusOutput struct {

	// The application statuses for the specified instances.
	ApplicationStatuses *types.ApplicationStatusesResponseType

	// The token to include in another request to get the next page of items. This
	// value is null when there are no more items to return.
	NextToken *string

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

	noSmithyDocumentSerde
}

func (c *Client) addOperationDescribeApplicationStatusMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsEc2query_serializeOpDescribeApplicationStatus{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsEc2query_deserializeOpDescribeApplicationStatus{}, 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
}
