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

package batch

import (
	"context"
	"github.com/aws/smithy-go/middleware"
	smithyhttp "github.com/aws/smithy-go/transport/http"
)

// Updates the priority of a specified service job in an Batch job queue.
func (c *Client) UpdateServiceJob(ctx context.Context, params *UpdateServiceJobInput, optFns ...func(*Options)) (*UpdateServiceJobOutput, error) {
	if params == nil {
		params = &UpdateServiceJobInput{}
	}

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

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

type UpdateServiceJobInput struct {

	// The Batch job ID of the job to update.
	//
	// This member is required.
	JobId *string

	// The scheduling priority for the job. This only affects jobs in job queues with
	// a quota-share or fair-share scheduling policy. Jobs with a higher scheduling
	// priority are scheduled before jobs with a lower scheduling priority within a
	// share.
	//
	// The minimum supported value is 0 and the maximum supported value is 9999.
	//
	// This member is required.
	SchedulingPriority *int32

	noSmithyDocumentSerde
}

type UpdateServiceJobOutput struct {

	// The Amazon Resource Name (ARN) for the job.
	JobArn *string

	// The unique identifier for the job.
	JobId *string

	// The name of the job.
	JobName *string

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

	noSmithyDocumentSerde
}

func (c *Client) addOperationUpdateServiceJobMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateServiceJob{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateServiceJob{}, 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, options); 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 = addOpUpdateServiceJobValidationMiddleware(stack); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "UpdateServiceJob"), 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
}
