UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

455 lines (454 loc) • 13.6 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Use this data source to generate a Glue script from a Directed Acyclic Graph (DAG). * * ## Example Usage * * ### Generate Python Script * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = aws.glue.getScript({ * language: "PYTHON", * dagEdges: [ * { * source: "datasource0", * target: "applymapping1", * }, * { * source: "applymapping1", * target: "selectfields2", * }, * { * source: "selectfields2", * target: "resolvechoice3", * }, * { * source: "resolvechoice3", * target: "datasink4", * }, * ], * dagNodes: [ * { * id: "datasource0", * nodeType: "DataSource", * args: [ * { * name: "database", * value: `"${source.name}"`, * }, * { * name: "table_name", * value: `"${sourceAwsGlueCatalogTable.name}"`, * }, * ], * }, * { * id: "applymapping1", * nodeType: "ApplyMapping", * args: [{ * name: "mapping", * value: "[(\"column1\", \"string\", \"column1\", \"string\")]", * }], * }, * { * id: "selectfields2", * nodeType: "SelectFields", * args: [{ * name: "paths", * value: "[\"column1\"]", * }], * }, * { * id: "resolvechoice3", * nodeType: "ResolveChoice", * args: [ * { * name: "choice", * value: "\"MATCH_CATALOG\"", * }, * { * name: "database", * value: `"${destination.name}"`, * }, * { * name: "table_name", * value: `"${destinationAwsGlueCatalogTable.name}"`, * }, * ], * }, * { * id: "datasink4", * nodeType: "DataSink", * args: [ * { * name: "database", * value: `"${destination.name}"`, * }, * { * name: "table_name", * value: `"${destinationAwsGlueCatalogTable.name}"`, * }, * ], * }, * ], * }); * export const pythonScript = example.then(example => example.pythonScript); * ``` * * ### Generate Scala Code * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = aws.glue.getScript({ * language: "SCALA", * dagEdges: [ * { * source: "datasource0", * target: "applymapping1", * }, * { * source: "applymapping1", * target: "selectfields2", * }, * { * source: "selectfields2", * target: "resolvechoice3", * }, * { * source: "resolvechoice3", * target: "datasink4", * }, * ], * dagNodes: [ * { * id: "datasource0", * nodeType: "DataSource", * args: [ * { * name: "database", * value: `"${source.name}"`, * }, * { * name: "table_name", * value: `"${sourceAwsGlueCatalogTable.name}"`, * }, * ], * }, * { * id: "applymapping1", * nodeType: "ApplyMapping", * args: [{ * name: "mappings", * value: "[(\"column1\", \"string\", \"column1\", \"string\")]", * }], * }, * { * id: "selectfields2", * nodeType: "SelectFields", * args: [{ * name: "paths", * value: "[\"column1\"]", * }], * }, * { * id: "resolvechoice3", * nodeType: "ResolveChoice", * args: [ * { * name: "choice", * value: "\"MATCH_CATALOG\"", * }, * { * name: "database", * value: `"${destination.name}"`, * }, * { * name: "table_name", * value: `"${destinationAwsGlueCatalogTable.name}"`, * }, * ], * }, * { * id: "datasink4", * nodeType: "DataSink", * args: [ * { * name: "database", * value: `"${destination.name}"`, * }, * { * name: "table_name", * value: `"${destinationAwsGlueCatalogTable.name}"`, * }, * ], * }, * ], * }); * export const scalaCode = example.then(example => example.scalaCode); * ``` */ export declare function getScript(args: GetScriptArgs, opts?: pulumi.InvokeOptions): Promise<GetScriptResult>; /** * A collection of arguments for invoking getScript. */ export interface GetScriptArgs { /** * List of the edges in the DAG. Defined below. */ dagEdges: inputs.glue.GetScriptDagEdge[]; /** * List of the nodes in the DAG. Defined below. */ dagNodes: inputs.glue.GetScriptDagNode[]; /** * Programming language of the resulting code from the DAG. Defaults to `PYTHON`. Valid values are `PYTHON` and `SCALA`. */ language?: string; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: string; } /** * A collection of values returned by getScript. */ export interface GetScriptResult { readonly dagEdges: outputs.glue.GetScriptDagEdge[]; readonly dagNodes: outputs.glue.GetScriptDagNode[]; /** * The provider-assigned unique ID for this managed resource. */ readonly id: string; readonly language?: string; /** * Python script generated from the DAG when the `language` argument is set to `PYTHON`. */ readonly pythonScript: string; readonly region: string; /** * Scala code generated from the DAG when the `language` argument is set to `SCALA`. */ readonly scalaCode: string; } /** * Use this data source to generate a Glue script from a Directed Acyclic Graph (DAG). * * ## Example Usage * * ### Generate Python Script * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = aws.glue.getScript({ * language: "PYTHON", * dagEdges: [ * { * source: "datasource0", * target: "applymapping1", * }, * { * source: "applymapping1", * target: "selectfields2", * }, * { * source: "selectfields2", * target: "resolvechoice3", * }, * { * source: "resolvechoice3", * target: "datasink4", * }, * ], * dagNodes: [ * { * id: "datasource0", * nodeType: "DataSource", * args: [ * { * name: "database", * value: `"${source.name}"`, * }, * { * name: "table_name", * value: `"${sourceAwsGlueCatalogTable.name}"`, * }, * ], * }, * { * id: "applymapping1", * nodeType: "ApplyMapping", * args: [{ * name: "mapping", * value: "[(\"column1\", \"string\", \"column1\", \"string\")]", * }], * }, * { * id: "selectfields2", * nodeType: "SelectFields", * args: [{ * name: "paths", * value: "[\"column1\"]", * }], * }, * { * id: "resolvechoice3", * nodeType: "ResolveChoice", * args: [ * { * name: "choice", * value: "\"MATCH_CATALOG\"", * }, * { * name: "database", * value: `"${destination.name}"`, * }, * { * name: "table_name", * value: `"${destinationAwsGlueCatalogTable.name}"`, * }, * ], * }, * { * id: "datasink4", * nodeType: "DataSink", * args: [ * { * name: "database", * value: `"${destination.name}"`, * }, * { * name: "table_name", * value: `"${destinationAwsGlueCatalogTable.name}"`, * }, * ], * }, * ], * }); * export const pythonScript = example.then(example => example.pythonScript); * ``` * * ### Generate Scala Code * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = aws.glue.getScript({ * language: "SCALA", * dagEdges: [ * { * source: "datasource0", * target: "applymapping1", * }, * { * source: "applymapping1", * target: "selectfields2", * }, * { * source: "selectfields2", * target: "resolvechoice3", * }, * { * source: "resolvechoice3", * target: "datasink4", * }, * ], * dagNodes: [ * { * id: "datasource0", * nodeType: "DataSource", * args: [ * { * name: "database", * value: `"${source.name}"`, * }, * { * name: "table_name", * value: `"${sourceAwsGlueCatalogTable.name}"`, * }, * ], * }, * { * id: "applymapping1", * nodeType: "ApplyMapping", * args: [{ * name: "mappings", * value: "[(\"column1\", \"string\", \"column1\", \"string\")]", * }], * }, * { * id: "selectfields2", * nodeType: "SelectFields", * args: [{ * name: "paths", * value: "[\"column1\"]", * }], * }, * { * id: "resolvechoice3", * nodeType: "ResolveChoice", * args: [ * { * name: "choice", * value: "\"MATCH_CATALOG\"", * }, * { * name: "database", * value: `"${destination.name}"`, * }, * { * name: "table_name", * value: `"${destinationAwsGlueCatalogTable.name}"`, * }, * ], * }, * { * id: "datasink4", * nodeType: "DataSink", * args: [ * { * name: "database", * value: `"${destination.name}"`, * }, * { * name: "table_name", * value: `"${destinationAwsGlueCatalogTable.name}"`, * }, * ], * }, * ], * }); * export const scalaCode = example.then(example => example.scalaCode); * ``` */ export declare function getScriptOutput(args: GetScriptOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output<GetScriptResult>; /** * A collection of arguments for invoking getScript. */ export interface GetScriptOutputArgs { /** * List of the edges in the DAG. Defined below. */ dagEdges: pulumi.Input<pulumi.Input<inputs.glue.GetScriptDagEdgeArgs>[]>; /** * List of the nodes in the DAG. Defined below. */ dagNodes: pulumi.Input<pulumi.Input<inputs.glue.GetScriptDagNodeArgs>[]>; /** * Programming language of the resulting code from the DAG. Defaults to `PYTHON`. Valid values are `PYTHON` and `SCALA`. */ language?: pulumi.Input<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; }