1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package glue
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/glue/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a new job definition.
15func (c *Client) CreateJob(ctx context.Context, params *CreateJobInput, optFns ...func(*Options)) (*CreateJobOutput, error) {
16	if params == nil {
17		params = &CreateJobInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "CreateJob", params, optFns, addOperationCreateJobMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*CreateJobOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30type CreateJobInput struct {
31
32	// The JobCommand that executes this job.
33	//
34	// This member is required.
35	Command *types.JobCommand
36
37	// The name you assign to this job definition. It must be unique in your account.
38	//
39	// This member is required.
40	Name *string
41
42	// The name or Amazon Resource Name (ARN) of the IAM role associated with this job.
43	//
44	// This member is required.
45	Role *string
46
47	// This parameter is deprecated. Use MaxCapacity instead. The number of AWS Glue
48	// data processing units (DPUs) to allocate to this Job. You can allocate from 2 to
49	// 100 DPUs; the default is 10. A DPU is a relative measure of processing power
50	// that consists of 4 vCPUs of compute capacity and 16 GB of memory. For more
51	// information, see the AWS Glue pricing page
52	// (https://aws.amazon.com/glue/pricing/).
53	//
54	// Deprecated: This property is deprecated, use MaxCapacity instead.
55	AllocatedCapacity int32
56
57	// The connections used for this job.
58	Connections *types.ConnectionsList
59
60	// The default arguments for this job. You can specify arguments here that your own
61	// job-execution script consumes, as well as arguments that AWS Glue itself
62	// consumes. For information about how to specify and consume your own Job
63	// arguments, see the Calling AWS Glue APIs in Python
64	// (https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html)
65	// topic in the developer guide. For information about the key-value pairs that AWS
66	// Glue consumes to set up your job, see the Special Parameters Used by AWS Glue
67	// (https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html)
68	// topic in the developer guide.
69	DefaultArguments map[string]string
70
71	// Description of the job being defined.
72	Description *string
73
74	// An ExecutionProperty specifying the maximum number of concurrent runs allowed
75	// for this job.
76	ExecutionProperty *types.ExecutionProperty
77
78	// Glue version determines the versions of Apache Spark and Python that AWS Glue
79	// supports. The Python version indicates the version supported for jobs of type
80	// Spark. For more information about the available AWS Glue versions and
81	// corresponding Spark and Python versions, see Glue version
82	// (https://docs.aws.amazon.com/glue/latest/dg/add-job.html) in the developer
83	// guide. Jobs that are created without specifying a Glue version default to Glue
84	// 0.9.
85	GlueVersion *string
86
87	// This field is reserved for future use.
88	LogUri *string
89
90	// The number of AWS Glue data processing units (DPUs) that can be allocated when
91	// this job runs. A DPU is a relative measure of processing power that consists of
92	// 4 vCPUs of compute capacity and 16 GB of memory. For more information, see the
93	// AWS Glue pricing page (https://aws.amazon.com/glue/pricing/). Do not set Max
94	// Capacity if using WorkerType and NumberOfWorkers. The value that can be
95	// allocated for MaxCapacity depends on whether you are running a Python shell job
96	// or an Apache Spark ETL job:
97	//
98	// * When you specify a Python shell job
99	// (JobCommand.Name="pythonshell"), you can allocate either 0.0625 or 1 DPU. The
100	// default is 0.0625 DPU.
101	//
102	// * When you specify an Apache Spark ETL job
103	// (JobCommand.Name="glueetl") or Apache Spark streaming ETL job
104	// (JobCommand.Name="gluestreaming"), you can allocate from 2 to 100 DPUs. The
105	// default is 10 DPUs. This job type cannot have a fractional DPU allocation.
106	MaxCapacity *float64
107
108	// The maximum number of times to retry this job if it fails.
109	MaxRetries int32
110
111	// Non-overridable arguments for this job, specified as name-value pairs.
112	NonOverridableArguments map[string]string
113
114	// Specifies configuration properties of a job notification.
115	NotificationProperty *types.NotificationProperty
116
117	// The number of workers of a defined workerType that are allocated when a job
118	// runs. The maximum number of workers you can define are 299 for G.1X, and 149 for
119	// G.2X.
120	NumberOfWorkers *int32
121
122	// The name of the SecurityConfiguration structure to be used with this job.
123	SecurityConfiguration *string
124
125	// The tags to use with this job. You may use tags to limit access to the job. For
126	// more information about tags in AWS Glue, see AWS Tags in AWS Glue
127	// (https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html) in the developer
128	// guide.
129	Tags map[string]string
130
131	// The job timeout in minutes. This is the maximum time that a job run can consume
132	// resources before it is terminated and enters TIMEOUT status. The default is
133	// 2,880 minutes (48 hours).
134	Timeout *int32
135
136	// The type of predefined worker that is allocated when a job runs. Accepts a value
137	// of Standard, G.1X, or G.2X.
138	//
139	// * For the Standard worker type, each worker
140	// provides 4 vCPU, 16 GB of memory and a 50GB disk, and 2 executors per worker.
141	//
142	// *
143	// For the G.1X worker type, each worker maps to 1 DPU (4 vCPU, 16 GB of memory, 64
144	// GB disk), and provides 1 executor per worker. We recommend this worker type for
145	// memory-intensive jobs.
146	//
147	// * For the G.2X worker type, each worker maps to 2 DPU (8
148	// vCPU, 32 GB of memory, 128 GB disk), and provides 1 executor per worker. We
149	// recommend this worker type for memory-intensive jobs.
150	WorkerType types.WorkerType
151}
152
153type CreateJobOutput struct {
154
155	// The unique name that was provided for this job definition.
156	Name *string
157
158	// Metadata pertaining to the operation's result.
159	ResultMetadata middleware.Metadata
160}
161
162func addOperationCreateJobMiddlewares(stack *middleware.Stack, options Options) (err error) {
163	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateJob{}, middleware.After)
164	if err != nil {
165		return err
166	}
167	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateJob{}, middleware.After)
168	if err != nil {
169		return err
170	}
171	if err = addSetLoggerMiddleware(stack, options); err != nil {
172		return err
173	}
174	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
175		return err
176	}
177	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
178		return err
179	}
180	if err = addResolveEndpointMiddleware(stack, options); err != nil {
181		return err
182	}
183	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
184		return err
185	}
186	if err = addRetryMiddlewares(stack, options); err != nil {
187		return err
188	}
189	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
190		return err
191	}
192	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
193		return err
194	}
195	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
196		return err
197	}
198	if err = addClientUserAgent(stack); err != nil {
199		return err
200	}
201	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
202		return err
203	}
204	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
205		return err
206	}
207	if err = addOpCreateJobValidationMiddleware(stack); err != nil {
208		return err
209	}
210	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateJob(options.Region), middleware.Before); err != nil {
211		return err
212	}
213	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
214		return err
215	}
216	if err = addResponseErrorMiddleware(stack); err != nil {
217		return err
218	}
219	if err = addRequestResponseLogging(stack, options); err != nil {
220		return err
221	}
222	return nil
223}
224
225func newServiceMetadataMiddleware_opCreateJob(region string) *awsmiddleware.RegisterServiceMetadata {
226	return &awsmiddleware.RegisterServiceMetadata{
227		Region:        region,
228		ServiceID:     ServiceID,
229		SigningName:   "glue",
230		OperationName: "CreateJob",
231	}
232}
233