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 an AWS Glue machine learning transform. This operation creates the 15// transform and all the necessary parameters to train it. Call this operation as 16// the first step in the process of using a machine learning transform (such as the 17// FindMatches transform) for deduplicating data. You can provide an optional 18// Description, in addition to the parameters that you want to use for your 19// algorithm. You must also specify certain parameters for the tasks that AWS Glue 20// runs on your behalf as part of learning from your data and creating a 21// high-quality machine learning transform. These parameters include Role, and 22// optionally, AllocatedCapacity, Timeout, and MaxRetries. For more information, 23// see Jobs 24// (https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-jobs-job.html). 25func (c *Client) CreateMLTransform(ctx context.Context, params *CreateMLTransformInput, optFns ...func(*Options)) (*CreateMLTransformOutput, error) { 26 if params == nil { 27 params = &CreateMLTransformInput{} 28 } 29 30 result, metadata, err := c.invokeOperation(ctx, "CreateMLTransform", params, optFns, addOperationCreateMLTransformMiddlewares) 31 if err != nil { 32 return nil, err 33 } 34 35 out := result.(*CreateMLTransformOutput) 36 out.ResultMetadata = metadata 37 return out, nil 38} 39 40type CreateMLTransformInput struct { 41 42 // A list of AWS Glue table definitions used by the transform. 43 // 44 // This member is required. 45 InputRecordTables []types.GlueTable 46 47 // The unique name that you give the transform when you create it. 48 // 49 // This member is required. 50 Name *string 51 52 // The algorithmic parameters that are specific to the transform type used. 53 // Conditionally dependent on the transform type. 54 // 55 // This member is required. 56 Parameters *types.TransformParameters 57 58 // The name or Amazon Resource Name (ARN) of the IAM role with the required 59 // permissions. The required permissions include both AWS Glue service role 60 // permissions to AWS Glue resources, and Amazon S3 permissions required by the 61 // transform. 62 // 63 // * This role needs AWS Glue service role permissions to allow access 64 // to resources in AWS Glue. See Attach a Policy to IAM Users That Access AWS Glue 65 // (https://docs.aws.amazon.com/glue/latest/dg/attach-policy-iam-user.html). 66 // 67 // * 68 // This role needs permission to your Amazon Simple Storage Service (Amazon S3) 69 // sources, targets, temporary directory, scripts, and any libraries used by the 70 // task run for this transform. 71 // 72 // This member is required. 73 Role *string 74 75 // A description of the machine learning transform that is being defined. The 76 // default is an empty string. 77 Description *string 78 79 // This value determines which version of AWS Glue this machine learning transform 80 // is compatible with. Glue 1.0 is recommended for most customers. If the value is 81 // not set, the Glue compatibility defaults to Glue 0.9. For more information, see 82 // AWS Glue Versions 83 // (https://docs.aws.amazon.com/glue/latest/dg/release-notes.html#release-notes-versions) 84 // in the developer guide. 85 GlueVersion *string 86 87 // The number of AWS Glue data processing units (DPUs) that are allocated to task 88 // runs for this transform. You can allocate from 2 to 100 DPUs; the default is 10. 89 // A DPU is a relative measure of processing power that consists of 4 vCPUs of 90 // compute capacity and 16 GB of memory. For more information, see the AWS Glue 91 // pricing page (https://aws.amazon.com/glue/pricing/). MaxCapacity is a mutually 92 // exclusive option with NumberOfWorkers and WorkerType. 93 // 94 // * If either 95 // NumberOfWorkers or WorkerType is set, then MaxCapacity cannot be set. 96 // 97 // * If 98 // MaxCapacity is set then neither NumberOfWorkers or WorkerType can be set. 99 // 100 // * If 101 // WorkerType is set, then NumberOfWorkers is required (and vice versa). 102 // 103 // * 104 // MaxCapacity and NumberOfWorkers must both be at least 1. 105 // 106 // When the WorkerType 107 // field is set to a value other than Standard, the MaxCapacity field is set 108 // automatically and becomes read-only. When the WorkerType field is set to a value 109 // other than Standard, the MaxCapacity field is set automatically and becomes 110 // read-only. 111 MaxCapacity *float64 112 113 // The maximum number of times to retry a task for this transform after a task run 114 // fails. 115 MaxRetries *int32 116 117 // The number of workers of a defined workerType that are allocated when this task 118 // runs. If WorkerType is set, then NumberOfWorkers is required (and vice versa). 119 NumberOfWorkers *int32 120 121 // The tags to use with this machine learning transform. You may use tags to limit 122 // access to the machine learning transform. For more information about tags in AWS 123 // Glue, see AWS Tags in AWS Glue 124 // (https://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html) in the developer 125 // guide. 126 Tags map[string]string 127 128 // The timeout of the task run for this transform in minutes. This is the maximum 129 // time that a task run for this transform can consume resources before it is 130 // terminated and enters TIMEOUT status. The default is 2,880 minutes (48 hours). 131 Timeout *int32 132 133 // The encryption-at-rest settings of the transform that apply to accessing user 134 // data. Machine learning transforms can access user data encrypted in Amazon S3 135 // using KMS. 136 TransformEncryption *types.TransformEncryption 137 138 // The type of predefined worker that is allocated when this task runs. Accepts a 139 // value of Standard, G.1X, or G.2X. 140 // 141 // * For the Standard worker type, each worker 142 // provides 4 vCPU, 16 GB of memory and a 50GB disk, and 2 executors per worker. 143 // 144 // * 145 // For the G.1X worker type, each worker provides 4 vCPU, 16 GB of memory and a 146 // 64GB disk, and 1 executor per worker. 147 // 148 // * For the G.2X worker type, each worker 149 // provides 8 vCPU, 32 GB of memory and a 128GB disk, and 1 executor per 150 // worker. 151 // 152 // MaxCapacity is a mutually exclusive option with NumberOfWorkers and 153 // WorkerType. 154 // 155 // * If either NumberOfWorkers or WorkerType is set, then MaxCapacity 156 // cannot be set. 157 // 158 // * If MaxCapacity is set then neither NumberOfWorkers or 159 // WorkerType can be set. 160 // 161 // * If WorkerType is set, then NumberOfWorkers is required 162 // (and vice versa). 163 // 164 // * MaxCapacity and NumberOfWorkers must both be at least 1. 165 WorkerType types.WorkerType 166} 167 168type CreateMLTransformOutput struct { 169 170 // A unique identifier that is generated for the transform. 171 TransformId *string 172 173 // Metadata pertaining to the operation's result. 174 ResultMetadata middleware.Metadata 175} 176 177func addOperationCreateMLTransformMiddlewares(stack *middleware.Stack, options Options) (err error) { 178 err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateMLTransform{}, middleware.After) 179 if err != nil { 180 return err 181 } 182 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateMLTransform{}, middleware.After) 183 if err != nil { 184 return err 185 } 186 if err = addSetLoggerMiddleware(stack, options); err != nil { 187 return err 188 } 189 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 190 return err 191 } 192 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 193 return err 194 } 195 if err = addResolveEndpointMiddleware(stack, options); err != nil { 196 return err 197 } 198 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 199 return err 200 } 201 if err = addRetryMiddlewares(stack, options); err != nil { 202 return err 203 } 204 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 205 return err 206 } 207 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 208 return err 209 } 210 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 211 return err 212 } 213 if err = addClientUserAgent(stack); err != nil { 214 return err 215 } 216 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 217 return err 218 } 219 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 220 return err 221 } 222 if err = addOpCreateMLTransformValidationMiddleware(stack); err != nil { 223 return err 224 } 225 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateMLTransform(options.Region), middleware.Before); err != nil { 226 return err 227 } 228 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 229 return err 230 } 231 if err = addResponseErrorMiddleware(stack); err != nil { 232 return err 233 } 234 if err = addRequestResponseLogging(stack, options); err != nil { 235 return err 236 } 237 return nil 238} 239 240func newServiceMetadataMiddleware_opCreateMLTransform(region string) *awsmiddleware.RegisterServiceMetadata { 241 return &awsmiddleware.RegisterServiceMetadata{ 242 Region: region, 243 ServiceID: ServiceID, 244 SigningName: "glue", 245 OperationName: "CreateMLTransform", 246 } 247} 248