getPlan method

Future<GetPlanResponse> getPlan({
  1. required List<MappingEntry> mapping,
  2. required CatalogEntry source,
  3. Map<String, String>? additionalPlanOptionsMap,
  4. Language? language,
  5. Location? location,
  6. List<CatalogEntry>? sinks,
})

Gets code to perform a specified mapping.

May throw InvalidInputException. May throw InternalServiceException. May throw OperationTimeoutException.

Parameter mapping : The list of mappings from a source table to target tables.

Parameter source : The source table.

Parameter additionalPlanOptionsMap : A map to hold additional optional key-value parameters.

Currently, these key-value pairs are supported:

  • inferSchema  —  Specifies whether to set inferSchema to true or false for the default script generated by an AWS Glue job. For example, to set inferSchema to true, pass the following key value pair:

    --additional-plan-options-map '{"inferSchema":"true"}'

Parameter language : The programming language of the code to perform the mapping.

Parameter location : The parameters for the mapping.

Parameter sinks : The target tables.

Implementation

Future<GetPlanResponse> getPlan({
  required List<MappingEntry> mapping,
  required CatalogEntry source,
  Map<String, String>? additionalPlanOptionsMap,
  Language? language,
  Location? location,
  List<CatalogEntry>? sinks,
}) async {
  ArgumentError.checkNotNull(mapping, 'mapping');
  ArgumentError.checkNotNull(source, 'source');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSGlue.GetPlan'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Mapping': mapping,
      'Source': source,
      if (additionalPlanOptionsMap != null)
        'AdditionalPlanOptionsMap': additionalPlanOptionsMap,
      if (language != null) 'Language': language.toValue(),
      if (location != null) 'Location': location,
      if (sinks != null) 'Sinks': sinks,
    },
  );

  return GetPlanResponse.fromJson(jsonResponse.body);
}