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

package batch

import (
	"context"
	"github.com/aws/aws-sdk-go-v2/service/batch/types"
	"github.com/aws/smithy-go/middleware"
	smithyhttp "github.com/aws/smithy-go/transport/http"
)

// Provides a snapshot of job queue state, including ordering of RUNNABLE jobs, as
// well as capacity utilization for already dispatched jobs. The first 100 RUNNABLE
// jobs in the job queue are listed in order of dispatch. For job queues with an
// attached quota-share policy, the first RUNNABLE job in each quota share is also
// listed. Capacity utilization for the job queue is provided, as well as break
// downs by share for job queues with attached fair-share or quota-share scheduling
// policies.
func (c *Client) GetJobQueueSnapshot(ctx context.Context, params *GetJobQueueSnapshotInput, optFns ...func(*Options)) (*GetJobQueueSnapshotOutput, error) {
	if params == nil {
		params = &GetJobQueueSnapshotInput{}
	}

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

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

type GetJobQueueSnapshotInput struct {

	// The job queue’s name or full queue Amazon Resource Name (ARN).
	//
	// This member is required.
	JobQueue *string

	noSmithyDocumentSerde
}

type GetJobQueueSnapshotOutput struct {

	// The list of the first 100 RUNNABLE jobs in each job queue. For
	// first-in-first-out (FIFO) job queues, jobs are ordered based on their submission
	// time. For job queues with an attached fair-share scheduling (FSS) or quota-share
	// policy, jobs are ordered based on their job priority and share usage.
	FrontOfQueue *types.FrontOfQueueDetail

	// The first RUNNABLE job in each quota share. Jobs are ordered based on their job
	// priority and share usage.
	FrontOfQuotaShares *types.FrontOfQuotaSharesDetail

	// The job queue's capacity utilization, including total usage and breakdown per
	// given share.
	QueueUtilization *types.QueueSnapshotUtilizationDetail

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

	noSmithyDocumentSerde
}

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

	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
		return err
	}
	if err = addComputeContentLength(stack); 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); err != nil {
		return err
	}
	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = addCredentialSource(stack, options); err != nil {
		return err
	}
	if err = addOpGetJobQueueSnapshotValidationMiddleware(stack); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "GetJobQueueSnapshot"), middleware.Before); 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
}
