1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package batch 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/batch/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Creates an AWS Batch job queue. When you create a job queue, you associate one 15// or more compute environments to the queue and assign an order of preference for 16// the compute environments. You also set a priority to the job queue that 17// determines the order that the AWS Batch scheduler places jobs onto its 18// associated compute environments. For example, if a compute environment is 19// associated with more than one job queue, the job queue with a higher priority is 20// given preference for scheduling jobs to that compute environment. 21func (c *Client) CreateJobQueue(ctx context.Context, params *CreateJobQueueInput, optFns ...func(*Options)) (*CreateJobQueueOutput, error) { 22 if params == nil { 23 params = &CreateJobQueueInput{} 24 } 25 26 result, metadata, err := c.invokeOperation(ctx, "CreateJobQueue", params, optFns, addOperationCreateJobQueueMiddlewares) 27 if err != nil { 28 return nil, err 29 } 30 31 out := result.(*CreateJobQueueOutput) 32 out.ResultMetadata = metadata 33 return out, nil 34} 35 36// Contains the parameters for CreateJobQueue. 37type CreateJobQueueInput struct { 38 39 // The set of compute environments mapped to a job queue and their order relative 40 // to each other. The job scheduler uses this parameter to determine which compute 41 // environment should run a specific job. Compute environments must be in the VALID 42 // state before you can associate them with a job queue. You can associate up to 43 // three compute environments with a job queue. All of the compute environments 44 // must be either EC2 (EC2 or SPOT) or Fargate (FARGATE or FARGATE_SPOT); EC2 and 45 // Fargate compute environments can't be mixed. All compute environments that are 46 // associated with a job queue must share the same architecture. AWS Batch doesn't 47 // support mixing compute environment architecture types in a single job queue. 48 // 49 // This member is required. 50 ComputeEnvironmentOrder []types.ComputeEnvironmentOrder 51 52 // The name of the job queue. Up to 128 letters (uppercase and lowercase), numbers, 53 // and underscores are allowed. 54 // 55 // This member is required. 56 JobQueueName *string 57 58 // The priority of the job queue. Job queues with a higher priority (or a higher 59 // integer value for the priority parameter) are evaluated first when associated 60 // with the same compute environment. Priority is determined in descending order. 61 // For example, a job queue with a priority value of 10 is given scheduling 62 // preference over a job queue with a priority value of 1. All of the compute 63 // environments must be either EC2 (EC2 or SPOT) or Fargate (FARGATE or 64 // FARGATE_SPOT); EC2 and Fargate compute environments cannot be mixed. 65 // 66 // This member is required. 67 Priority int32 68 69 // The state of the job queue. If the job queue state is ENABLED, it is able to 70 // accept jobs. If the job queue state is DISABLED, new jobs can't be added to the 71 // queue, but jobs already in the queue can finish. 72 State types.JQState 73 74 // The tags that you apply to the job queue to help you categorize and organize 75 // your resources. Each tag consists of a key and an optional value. For more 76 // information, see Tagging your AWS Batch resources 77 // (https://docs.aws.amazon.com/batch/latest/userguide/using-tags.html) in AWS 78 // Batch User Guide. 79 Tags map[string]string 80} 81 82type CreateJobQueueOutput struct { 83 84 // The Amazon Resource Name (ARN) of the job queue. 85 // 86 // This member is required. 87 JobQueueArn *string 88 89 // The name of the job queue. 90 // 91 // This member is required. 92 JobQueueName *string 93 94 // Metadata pertaining to the operation's result. 95 ResultMetadata middleware.Metadata 96} 97 98func addOperationCreateJobQueueMiddlewares(stack *middleware.Stack, options Options) (err error) { 99 err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateJobQueue{}, middleware.After) 100 if err != nil { 101 return err 102 } 103 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateJobQueue{}, middleware.After) 104 if err != nil { 105 return err 106 } 107 if err = addSetLoggerMiddleware(stack, options); err != nil { 108 return err 109 } 110 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 111 return err 112 } 113 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 114 return err 115 } 116 if err = addResolveEndpointMiddleware(stack, options); err != nil { 117 return err 118 } 119 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 120 return err 121 } 122 if err = addRetryMiddlewares(stack, options); err != nil { 123 return err 124 } 125 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 126 return err 127 } 128 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 129 return err 130 } 131 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 132 return err 133 } 134 if err = addClientUserAgent(stack); err != nil { 135 return err 136 } 137 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 138 return err 139 } 140 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 141 return err 142 } 143 if err = addOpCreateJobQueueValidationMiddleware(stack); err != nil { 144 return err 145 } 146 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateJobQueue(options.Region), middleware.Before); err != nil { 147 return err 148 } 149 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 150 return err 151 } 152 if err = addResponseErrorMiddleware(stack); err != nil { 153 return err 154 } 155 if err = addRequestResponseLogging(stack, options); err != nil { 156 return err 157 } 158 return nil 159} 160 161func newServiceMetadataMiddleware_opCreateJobQueue(region string) *awsmiddleware.RegisterServiceMetadata { 162 return &awsmiddleware.RegisterServiceMetadata{ 163 Region: region, 164 ServiceID: ServiceID, 165 SigningName: "batch", 166 OperationName: "CreateJobQueue", 167 } 168} 169