AWS code-library documentation change
Summary
Added Swift SDK code example for creating AWS Glue jobs including IAM role parameter and job configuration details
Security assessment
The change adds documentation about specifying IAM roles when creating Glue jobs, which is a security best practice. However, there is no evidence this addresses a specific security vulnerability or incident - it's a routine example addition showing proper role usage.
Diff
diff --git a/code-library/latest/ug/glue_example_glue_CreateJob_section.md b/code-library/latest/ug/glue_example_glue_CreateJob_section.md index 37319309f..1de27a37c 100644 --- a//code-library/latest/ug/glue_example_glue_CreateJob_section.md +++ b//code-library/latest/ug/glue_example_glue_CreateJob_section.md @@ -594,0 +595,56 @@ There's more on GitHub. Find the complete example and learn how to set up and ru +Swift + + +**SDK for Swift** + + +###### Note + +There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/swift/example_code/glue#code-examples). + + + import AWSClientRuntime + import AWSGlue + + /// Create a new AWS Glue job. + /// + /// - Parameters: + /// - glueClient: The AWS Glue client to use. + /// - jobName: The name to give the new job. + /// - role: The IAM role for the job to use when accessing AWS services. + /// - scriptLocation: The AWS S3 URI of the script to be run by the job. + /// + /// - Returns: `true` if the job is created successfully, otherwise `false`. + func createJob(glueClient: GlueClient, name jobName: String, role: String, + scriptLocation: String) async -> Bool { + let command = GlueClientTypes.JobCommand( + name: "glueetl", + pythonVersion: "3", + scriptLocation: scriptLocation + ) + + do { + _ = try await glueClient.createJob( + input: CreateJobInput( + command: command, + description: "Created by the AWS SDK for Swift Glue basic scenario example.", + glueVersion: "3.0", + name: jobName, + numberOfWorkers: 10, + role: role, + workerType: .g1x + ) + ) + } catch { + return false + } + return true + } + + + + * For API details, see [CreateJob](https://sdk.amazonaws.com/swift/api/awsglue/latest/documentation/awsglue/glueclient/createjob\(input:\)) in _AWS SDK for Swift API reference_. + + + +