getScript function
Use this data source to generate a Glue script from a Directed Acyclic Graph (DAG).
Example Usage
Generate Python Script
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.glue.getScript({
dagEdges: [
{
source: "datasource0",
target: "applymapping1",
},
{
source: "applymapping1",
target: "selectfields2",
},
{
source: "selectfields2",
target: "resolvechoice3",
},
{
source: "resolvechoice3",
target: "datasink4",
},
],
dagNodes: [
{
args: [
{
name: "database",
value: `"${source.name}"`,
},
{
name: "table_name",
value: `"${sourceAwsGlueCatalogTable.name}"`,
},
],
id: "datasource0",
nodeType: "DataSource",
},
{
args: [{
name: "mapping",
value: "[(\"column1\", \"string\", \"column1\", \"string\")]",
}],
id: "applymapping1",
nodeType: "ApplyMapping",
},
{
args: [{
name: "paths",
value: "[\"column1\"]",
}],
id: "selectfields2",
nodeType: "SelectFields",
},
{
args: [
{
name: "choice",
value: "\"MATCH_CATALOG\"",
},
{
name: "database",
value: `"${destination.name}"`,
},
{
name: "table_name",
value: `"${destinationAwsGlueCatalogTable.name}"`,
},
],
id: "resolvechoice3",
nodeType: "ResolveChoice",
},
{
args: [
{
name: "database",
value: `"${destination.name}"`,
},
{
name: "table_name",
value: `"${destinationAwsGlueCatalogTable.name}"`,
},
],
id: "datasink4",
nodeType: "DataSink",
},
],
language: "PYTHON",
});
export const pythonScript = example.then(example => example.pythonScript);
import pulumi
import pulumi_aws as aws
example = aws.glue.get_script(dag_edges=[
{
"source": "datasource0",
"target": "applymapping1",
},
{
"source": "applymapping1",
"target": "selectfields2",
},
{
"source": "selectfields2",
"target": "resolvechoice3",
},
{
"source": "resolvechoice3",
"target": "datasink4",
},
],
dag_nodes=[
{
"args": [
{
"name": "database",
"value": f"\"{source['name']}\"",
},
{
"name": "table_name",
"value": f"\"{source_aws_glue_catalog_table['name']}\"",
},
],
"id": "datasource0",
"node_type": "DataSource",
},
{
"args": [{
"name": "mapping",
"value": "[(\"column1\", \"string\", \"column1\", \"string\")]",
}],
"id": "applymapping1",
"node_type": "ApplyMapping",
},
{
"args": [{
"name": "paths",
"value": "[\"column1\"]",
}],
"id": "selectfields2",
"node_type": "SelectFields",
},
{
"args": [
{
"name": "choice",
"value": "\"MATCH_CATALOG\"",
},
{
"name": "database",
"value": f"\"{destination['name']}\"",
},
{
"name": "table_name",
"value": f"\"{destination_aws_glue_catalog_table['name']}\"",
},
],
"id": "resolvechoice3",
"node_type": "ResolveChoice",
},
{
"args": [
{
"name": "database",
"value": f"\"{destination['name']}\"",
},
{
"name": "table_name",
"value": f"\"{destination_aws_glue_catalog_table['name']}\"",
},
],
"id": "datasink4",
"node_type": "DataSink",
},
],
language="PYTHON")
pulumi.export("pythonScript", example.python_script)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = Aws.Glue.GetScript.Invoke(new()
{
DagEdges = new[]
{
new Aws.Glue.Inputs.GetScriptDagEdgeInputArgs
{
Source = "datasource0",
Target = "applymapping1",
},
new Aws.Glue.Inputs.GetScriptDagEdgeInputArgs
{
Source = "applymapping1",
Target = "selectfields2",
},
new Aws.Glue.Inputs.GetScriptDagEdgeInputArgs
{
Source = "selectfields2",
Target = "resolvechoice3",
},
new Aws.Glue.Inputs.GetScriptDagEdgeInputArgs
{
Source = "resolvechoice3",
Target = "datasink4",
},
},
DagNodes = new[]
{
new Aws.Glue.Inputs.GetScriptDagNodeInputArgs
{
Args = new[]
{
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "database",
Value = $"\"{source.Name}\"",
},
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "table_name",
Value = $"\"{sourceAwsGlueCatalogTable.Name}\"",
},
},
Id = "datasource0",
NodeType = "DataSource",
},
new Aws.Glue.Inputs.GetScriptDagNodeInputArgs
{
Args = new[]
{
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "mapping",
Value = "[(\"column1\", \"string\", \"column1\", \"string\")]",
},
},
Id = "applymapping1",
NodeType = "ApplyMapping",
},
new Aws.Glue.Inputs.GetScriptDagNodeInputArgs
{
Args = new[]
{
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "paths",
Value = "[\"column1\"]",
},
},
Id = "selectfields2",
NodeType = "SelectFields",
},
new Aws.Glue.Inputs.GetScriptDagNodeInputArgs
{
Args = new[]
{
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "choice",
Value = "\"MATCH_CATALOG\"",
},
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "database",
Value = $"\"{destination.Name}\"",
},
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "table_name",
Value = $"\"{destinationAwsGlueCatalogTable.Name}\"",
},
},
Id = "resolvechoice3",
NodeType = "ResolveChoice",
},
new Aws.Glue.Inputs.GetScriptDagNodeInputArgs
{
Args = new[]
{
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "database",
Value = $"\"{destination.Name}\"",
},
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "table_name",
Value = $"\"{destinationAwsGlueCatalogTable.Name}\"",
},
},
Id = "datasink4",
NodeType = "DataSink",
},
},
Language = "PYTHON",
});
return new Dictionary<string, object?>
{
["pythonScript"] = example.Apply(getScriptResult => getScriptResult.PythonScript),
};
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/glue"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := glue.GetScript(ctx, &glue.GetScriptArgs{
DagEdges: []glue.GetScriptDagEdge{
{
Source: "datasource0",
Target: "applymapping1",
},
{
Source: "applymapping1",
Target: "selectfields2",
},
{
Source: "selectfields2",
Target: "resolvechoice3",
},
{
Source: "resolvechoice3",
Target: "datasink4",
},
},
DagNodes: []glue.GetScriptDagNode{
{
Args: []glue.GetScriptDagNodeArg{
{
Name: "database",
Value: fmt.Sprintf("\"%v\"", source.Name),
},
{
Name: "table_name",
Value: fmt.Sprintf("\"%v\"", sourceAwsGlueCatalogTable.Name),
},
},
Id: "datasource0",
NodeType: "DataSource",
},
{
Args: []glue.GetScriptDagNodeArg{
{
Name: "mapping",
Value: "[(\"column1\", \"string\", \"column1\", \"string\")]",
},
},
Id: "applymapping1",
NodeType: "ApplyMapping",
},
{
Args: []glue.GetScriptDagNodeArg{
{
Name: "paths",
Value: "[\"column1\"]",
},
},
Id: "selectfields2",
NodeType: "SelectFields",
},
{
Args: []glue.GetScriptDagNodeArg{
{
Name: "choice",
Value: "\"MATCH_CATALOG\"",
},
{
Name: "database",
Value: fmt.Sprintf("\"%v\"", destination.Name),
},
{
Name: "table_name",
Value: fmt.Sprintf("\"%v\"", destinationAwsGlueCatalogTable.Name),
},
},
Id: "resolvechoice3",
NodeType: "ResolveChoice",
},
{
Args: []glue.GetScriptDagNodeArg{
{
Name: "database",
Value: fmt.Sprintf("\"%v\"", destination.Name),
},
{
Name: "table_name",
Value: fmt.Sprintf("\"%v\"", destinationAwsGlueCatalogTable.Name),
},
},
Id: "datasink4",
NodeType: "DataSink",
},
},
Language: pulumi.StringRef("PYTHON"),
}, nil)
if err != nil {
return err
}
ctx.Export("pythonScript", example.PythonScript)
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_glue_getscript" "example" {
dag_edges {
source = "datasource0"
target = "applymapping1"
}
dag_edges {
source = "applymapping1"
target = "selectfields2"
}
dag_edges {
source = "selectfields2"
target = "resolvechoice3"
}
dag_edges {
source = "resolvechoice3"
target = "datasink4"
}
dag_nodes {
args {
name = "database"
value =""${source.name}""
}
args {
name = "table_name"
value =""${sourceAwsGlueCatalogTable.name}""
}
id = "datasource0"
node_type = "DataSource"
}
dag_nodes {
args {
name = "mapping"
value = "[(\"column1\", \"string\", \"column1\", \"string\")]"
}
id = "applymapping1"
node_type = "ApplyMapping"
}
dag_nodes {
args {
name = "paths"
value = "[\"column1\"]"
}
id = "selectfields2"
node_type = "SelectFields"
}
dag_nodes {
args {
name = "choice"
value = "\"MATCH_CATALOG\""
}
args {
name = "database"
value =""${destination.name}""
}
args {
name = "table_name"
value =""${destinationAwsGlueCatalogTable.name}""
}
id = "resolvechoice3"
node_type = "ResolveChoice"
}
dag_nodes {
args {
name = "database"
value =""${destination.name}""
}
args {
name = "table_name"
value =""${destinationAwsGlueCatalogTable.name}""
}
id = "datasink4"
node_type = "DataSink"
}
language = "PYTHON"
}
output "pythonScript" {
value = data.aws_glue_getscript.example.python_script
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.glue.GlueFunctions;
import com.pulumi.aws.glue.inputs.GetScriptArgs;
import com.pulumi.aws.glue.inputs.GetScriptDagEdgeArgs;
import com.pulumi.aws.glue.inputs.GetScriptDagNodeArgs;
import com.pulumi.aws.glue.inputs.GetScriptDagNodeArgArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var example = GlueFunctions.getScript(GetScriptArgs.builder()
.dagEdges(
GetScriptDagEdgeArgs.builder()
.source("datasource0")
.target("applymapping1")
.build(),
GetScriptDagEdgeArgs.builder()
.source("applymapping1")
.target("selectfields2")
.build(),
GetScriptDagEdgeArgs.builder()
.source("selectfields2")
.target("resolvechoice3")
.build(),
GetScriptDagEdgeArgs.builder()
.source("resolvechoice3")
.target("datasink4")
.build())
.dagNodes(
GetScriptDagNodeArgs.builder()
.args(
GetScriptDagNodeArgArgs.builder()
.name("database")
.value(String.format("\"%s\"", source.name()))
.build(),
GetScriptDagNodeArgArgs.builder()
.name("table_name")
.value(String.format("\"%s\"", sourceAwsGlueCatalogTable.name()))
.build())
.id("datasource0")
.nodeType("DataSource")
.build(),
GetScriptDagNodeArgs.builder()
.args(GetScriptDagNodeArgArgs.builder()
.name("mapping")
.value("[(\"column1\", \"string\", \"column1\", \"string\")]")
.build())
.id("applymapping1")
.nodeType("ApplyMapping")
.build(),
GetScriptDagNodeArgs.builder()
.args(GetScriptDagNodeArgArgs.builder()
.name("paths")
.value("[\"column1\"]")
.build())
.id("selectfields2")
.nodeType("SelectFields")
.build(),
GetScriptDagNodeArgs.builder()
.args(
GetScriptDagNodeArgArgs.builder()
.name("choice")
.value("\"MATCH_CATALOG\"")
.build(),
GetScriptDagNodeArgArgs.builder()
.name("database")
.value(String.format("\"%s\"", destination.name()))
.build(),
GetScriptDagNodeArgArgs.builder()
.name("table_name")
.value(String.format("\"%s\"", destinationAwsGlueCatalogTable.name()))
.build())
.id("resolvechoice3")
.nodeType("ResolveChoice")
.build(),
GetScriptDagNodeArgs.builder()
.args(
GetScriptDagNodeArgArgs.builder()
.name("database")
.value(String.format("\"%s\"", destination.name()))
.build(),
GetScriptDagNodeArgArgs.builder()
.name("table_name")
.value(String.format("\"%s\"", destinationAwsGlueCatalogTable.name()))
.build())
.id("datasink4")
.nodeType("DataSink")
.build())
.language("PYTHON")
.build());
ctx.export("pythonScript", example.pythonScript());
}
}
variables:
example:
fn::invoke:
function: aws:glue:getScript
arguments:
dagEdges:
- source: datasource0
target: applymapping1
- source: applymapping1
target: selectfields2
- source: selectfields2
target: resolvechoice3
- source: resolvechoice3
target: datasink4
dagNodes:
- args:
- name: database
value: '"${source.name}"'
- name: table_name
value: '"${sourceAwsGlueCatalogTable.name}"'
id: datasource0
nodeType: DataSource
- args:
- name: mapping
value: '[("column1", "string", "column1", "string")]'
id: applymapping1
nodeType: ApplyMapping
- args:
- name: paths
value: '["column1"]'
id: selectfields2
nodeType: SelectFields
- args:
- name: choice
value: '"MATCH_CATALOG"'
- name: database
value: '"${destination.name}"'
- name: table_name
value: '"${destinationAwsGlueCatalogTable.name}"'
id: resolvechoice3
nodeType: ResolveChoice
- args:
- name: database
value: '"${destination.name}"'
- name: table_name
value: '"${destinationAwsGlueCatalogTable.name}"'
id: datasink4
nodeType: DataSink
language: PYTHON
outputs:
pythonScript: ${example.pythonScript}
Generate Scala Code
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.glue.getScript({
dagEdges: [
{
source: "datasource0",
target: "applymapping1",
},
{
source: "applymapping1",
target: "selectfields2",
},
{
source: "selectfields2",
target: "resolvechoice3",
},
{
source: "resolvechoice3",
target: "datasink4",
},
],
dagNodes: [
{
args: [
{
name: "database",
value: `"${source.name}"`,
},
{
name: "table_name",
value: `"${sourceAwsGlueCatalogTable.name}"`,
},
],
id: "datasource0",
nodeType: "DataSource",
},
{
args: [{
name: "mappings",
value: "[(\"column1\", \"string\", \"column1\", \"string\")]",
}],
id: "applymapping1",
nodeType: "ApplyMapping",
},
{
args: [{
name: "paths",
value: "[\"column1\"]",
}],
id: "selectfields2",
nodeType: "SelectFields",
},
{
args: [
{
name: "choice",
value: "\"MATCH_CATALOG\"",
},
{
name: "database",
value: `"${destination.name}"`,
},
{
name: "table_name",
value: `"${destinationAwsGlueCatalogTable.name}"`,
},
],
id: "resolvechoice3",
nodeType: "ResolveChoice",
},
{
args: [
{
name: "database",
value: `"${destination.name}"`,
},
{
name: "table_name",
value: `"${destinationAwsGlueCatalogTable.name}"`,
},
],
id: "datasink4",
nodeType: "DataSink",
},
],
language: "SCALA",
});
export const scalaCode = example.then(example => example.scalaCode);
import pulumi
import pulumi_aws as aws
example = aws.glue.get_script(dag_edges=[
{
"source": "datasource0",
"target": "applymapping1",
},
{
"source": "applymapping1",
"target": "selectfields2",
},
{
"source": "selectfields2",
"target": "resolvechoice3",
},
{
"source": "resolvechoice3",
"target": "datasink4",
},
],
dag_nodes=[
{
"args": [
{
"name": "database",
"value": f"\"{source['name']}\"",
},
{
"name": "table_name",
"value": f"\"{source_aws_glue_catalog_table['name']}\"",
},
],
"id": "datasource0",
"node_type": "DataSource",
},
{
"args": [{
"name": "mappings",
"value": "[(\"column1\", \"string\", \"column1\", \"string\")]",
}],
"id": "applymapping1",
"node_type": "ApplyMapping",
},
{
"args": [{
"name": "paths",
"value": "[\"column1\"]",
}],
"id": "selectfields2",
"node_type": "SelectFields",
},
{
"args": [
{
"name": "choice",
"value": "\"MATCH_CATALOG\"",
},
{
"name": "database",
"value": f"\"{destination['name']}\"",
},
{
"name": "table_name",
"value": f"\"{destination_aws_glue_catalog_table['name']}\"",
},
],
"id": "resolvechoice3",
"node_type": "ResolveChoice",
},
{
"args": [
{
"name": "database",
"value": f"\"{destination['name']}\"",
},
{
"name": "table_name",
"value": f"\"{destination_aws_glue_catalog_table['name']}\"",
},
],
"id": "datasink4",
"node_type": "DataSink",
},
],
language="SCALA")
pulumi.export("scalaCode", example.scala_code)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = Aws.Glue.GetScript.Invoke(new()
{
DagEdges = new[]
{
new Aws.Glue.Inputs.GetScriptDagEdgeInputArgs
{
Source = "datasource0",
Target = "applymapping1",
},
new Aws.Glue.Inputs.GetScriptDagEdgeInputArgs
{
Source = "applymapping1",
Target = "selectfields2",
},
new Aws.Glue.Inputs.GetScriptDagEdgeInputArgs
{
Source = "selectfields2",
Target = "resolvechoice3",
},
new Aws.Glue.Inputs.GetScriptDagEdgeInputArgs
{
Source = "resolvechoice3",
Target = "datasink4",
},
},
DagNodes = new[]
{
new Aws.Glue.Inputs.GetScriptDagNodeInputArgs
{
Args = new[]
{
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "database",
Value = $"\"{source.Name}\"",
},
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "table_name",
Value = $"\"{sourceAwsGlueCatalogTable.Name}\"",
},
},
Id = "datasource0",
NodeType = "DataSource",
},
new Aws.Glue.Inputs.GetScriptDagNodeInputArgs
{
Args = new[]
{
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "mappings",
Value = "[(\"column1\", \"string\", \"column1\", \"string\")]",
},
},
Id = "applymapping1",
NodeType = "ApplyMapping",
},
new Aws.Glue.Inputs.GetScriptDagNodeInputArgs
{
Args = new[]
{
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "paths",
Value = "[\"column1\"]",
},
},
Id = "selectfields2",
NodeType = "SelectFields",
},
new Aws.Glue.Inputs.GetScriptDagNodeInputArgs
{
Args = new[]
{
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "choice",
Value = "\"MATCH_CATALOG\"",
},
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "database",
Value = $"\"{destination.Name}\"",
},
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "table_name",
Value = $"\"{destinationAwsGlueCatalogTable.Name}\"",
},
},
Id = "resolvechoice3",
NodeType = "ResolveChoice",
},
new Aws.Glue.Inputs.GetScriptDagNodeInputArgs
{
Args = new[]
{
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "database",
Value = $"\"{destination.Name}\"",
},
new Aws.Glue.Inputs.GetScriptDagNodeArgInputArgs
{
Name = "table_name",
Value = $"\"{destinationAwsGlueCatalogTable.Name}\"",
},
},
Id = "datasink4",
NodeType = "DataSink",
},
},
Language = "SCALA",
});
return new Dictionary<string, object?>
{
["scalaCode"] = example.Apply(getScriptResult => getScriptResult.ScalaCode),
};
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/glue"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := glue.GetScript(ctx, &glue.GetScriptArgs{
DagEdges: []glue.GetScriptDagEdge{
{
Source: "datasource0",
Target: "applymapping1",
},
{
Source: "applymapping1",
Target: "selectfields2",
},
{
Source: "selectfields2",
Target: "resolvechoice3",
},
{
Source: "resolvechoice3",
Target: "datasink4",
},
},
DagNodes: []glue.GetScriptDagNode{
{
Args: []glue.GetScriptDagNodeArg{
{
Name: "database",
Value: fmt.Sprintf("\"%v\"", source.Name),
},
{
Name: "table_name",
Value: fmt.Sprintf("\"%v\"", sourceAwsGlueCatalogTable.Name),
},
},
Id: "datasource0",
NodeType: "DataSource",
},
{
Args: []glue.GetScriptDagNodeArg{
{
Name: "mappings",
Value: "[(\"column1\", \"string\", \"column1\", \"string\")]",
},
},
Id: "applymapping1",
NodeType: "ApplyMapping",
},
{
Args: []glue.GetScriptDagNodeArg{
{
Name: "paths",
Value: "[\"column1\"]",
},
},
Id: "selectfields2",
NodeType: "SelectFields",
},
{
Args: []glue.GetScriptDagNodeArg{
{
Name: "choice",
Value: "\"MATCH_CATALOG\"",
},
{
Name: "database",
Value: fmt.Sprintf("\"%v\"", destination.Name),
},
{
Name: "table_name",
Value: fmt.Sprintf("\"%v\"", destinationAwsGlueCatalogTable.Name),
},
},
Id: "resolvechoice3",
NodeType: "ResolveChoice",
},
{
Args: []glue.GetScriptDagNodeArg{
{
Name: "database",
Value: fmt.Sprintf("\"%v\"", destination.Name),
},
{
Name: "table_name",
Value: fmt.Sprintf("\"%v\"", destinationAwsGlueCatalogTable.Name),
},
},
Id: "datasink4",
NodeType: "DataSink",
},
},
Language: pulumi.StringRef("SCALA"),
}, nil)
if err != nil {
return err
}
ctx.Export("scalaCode", example.ScalaCode)
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_glue_getscript" "example" {
dag_edges {
source = "datasource0"
target = "applymapping1"
}
dag_edges {
source = "applymapping1"
target = "selectfields2"
}
dag_edges {
source = "selectfields2"
target = "resolvechoice3"
}
dag_edges {
source = "resolvechoice3"
target = "datasink4"
}
dag_nodes {
args {
name = "database"
value =""${source.name}""
}
args {
name = "table_name"
value =""${sourceAwsGlueCatalogTable.name}""
}
id = "datasource0"
node_type = "DataSource"
}
dag_nodes {
args {
name = "mappings"
value = "[(\"column1\", \"string\", \"column1\", \"string\")]"
}
id = "applymapping1"
node_type = "ApplyMapping"
}
dag_nodes {
args {
name = "paths"
value = "[\"column1\"]"
}
id = "selectfields2"
node_type = "SelectFields"
}
dag_nodes {
args {
name = "choice"
value = "\"MATCH_CATALOG\""
}
args {
name = "database"
value =""${destination.name}""
}
args {
name = "table_name"
value =""${destinationAwsGlueCatalogTable.name}""
}
id = "resolvechoice3"
node_type = "ResolveChoice"
}
dag_nodes {
args {
name = "database"
value =""${destination.name}""
}
args {
name = "table_name"
value =""${destinationAwsGlueCatalogTable.name}""
}
id = "datasink4"
node_type = "DataSink"
}
language = "SCALA"
}
output "scalaCode" {
value = data.aws_glue_getscript.example.scala_code
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.glue.GlueFunctions;
import com.pulumi.aws.glue.inputs.GetScriptArgs;
import com.pulumi.aws.glue.inputs.GetScriptDagEdgeArgs;
import com.pulumi.aws.glue.inputs.GetScriptDagNodeArgs;
import com.pulumi.aws.glue.inputs.GetScriptDagNodeArgArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var example = GlueFunctions.getScript(GetScriptArgs.builder()
.dagEdges(
GetScriptDagEdgeArgs.builder()
.source("datasource0")
.target("applymapping1")
.build(),
GetScriptDagEdgeArgs.builder()
.source("applymapping1")
.target("selectfields2")
.build(),
GetScriptDagEdgeArgs.builder()
.source("selectfields2")
.target("resolvechoice3")
.build(),
GetScriptDagEdgeArgs.builder()
.source("resolvechoice3")
.target("datasink4")
.build())
.dagNodes(
GetScriptDagNodeArgs.builder()
.args(
GetScriptDagNodeArgArgs.builder()
.name("database")
.value(String.format("\"%s\"", source.name()))
.build(),
GetScriptDagNodeArgArgs.builder()
.name("table_name")
.value(String.format("\"%s\"", sourceAwsGlueCatalogTable.name()))
.build())
.id("datasource0")
.nodeType("DataSource")
.build(),
GetScriptDagNodeArgs.builder()
.args(GetScriptDagNodeArgArgs.builder()
.name("mappings")
.value("[(\"column1\", \"string\", \"column1\", \"string\")]")
.build())
.id("applymapping1")
.nodeType("ApplyMapping")
.build(),
GetScriptDagNodeArgs.builder()
.args(GetScriptDagNodeArgArgs.builder()
.name("paths")
.value("[\"column1\"]")
.build())
.id("selectfields2")
.nodeType("SelectFields")
.build(),
GetScriptDagNodeArgs.builder()
.args(
GetScriptDagNodeArgArgs.builder()
.name("choice")
.value("\"MATCH_CATALOG\"")
.build(),
GetScriptDagNodeArgArgs.builder()
.name("database")
.value(String.format("\"%s\"", destination.name()))
.build(),
GetScriptDagNodeArgArgs.builder()
.name("table_name")
.value(String.format("\"%s\"", destinationAwsGlueCatalogTable.name()))
.build())
.id("resolvechoice3")
.nodeType("ResolveChoice")
.build(),
GetScriptDagNodeArgs.builder()
.args(
GetScriptDagNodeArgArgs.builder()
.name("database")
.value(String.format("\"%s\"", destination.name()))
.build(),
GetScriptDagNodeArgArgs.builder()
.name("table_name")
.value(String.format("\"%s\"", destinationAwsGlueCatalogTable.name()))
.build())
.id("datasink4")
.nodeType("DataSink")
.build())
.language("SCALA")
.build());
ctx.export("scalaCode", example.scalaCode());
}
}
variables:
example:
fn::invoke:
function: aws:glue:getScript
arguments:
dagEdges:
- source: datasource0
target: applymapping1
- source: applymapping1
target: selectfields2
- source: selectfields2
target: resolvechoice3
- source: resolvechoice3
target: datasink4
dagNodes:
- args:
- name: database
value: '"${source.name}"'
- name: table_name
value: '"${sourceAwsGlueCatalogTable.name}"'
id: datasource0
nodeType: DataSource
- args:
- name: mappings
value: '[("column1", "string", "column1", "string")]'
id: applymapping1
nodeType: ApplyMapping
- args:
- name: paths
value: '["column1"]'
id: selectfields2
nodeType: SelectFields
- args:
- name: choice
value: '"MATCH_CATALOG"'
- name: database
value: '"${destination.name}"'
- name: table_name
value: '"${destinationAwsGlueCatalogTable.name}"'
id: resolvechoice3
nodeType: ResolveChoice
- args:
- name: database
value: '"${destination.name}"'
- name: table_name
value: '"${destinationAwsGlueCatalogTable.name}"'
id: datasink4
nodeType: DataSink
language: SCALA
outputs:
scalaCode: ${example.scalaCode}
args Arguments passed to this invoke. Arguments for getScript.
options Invoke options controlling this call.
Implementation
Future<GetScriptResult> getScript(
GetScriptArgs args, {
pulumi.InvokeOptions? options,
}) async {
final deployment = pulumi.Deployment.instance;
final result = await deployment.invoke<Map<String, dynamic>>(
'aws:glue/getScript:getScript',
args.toMap(),
options: pulumi.toDeploymentInvokeOptions(options),
);
return GetScriptResult.fromMap(result);
}