putPipelineDefinition method

Future<PutPipelineDefinitionOutput> putPipelineDefinition({
  1. required String pipelineId,
  2. required List<PipelineObject> pipelineObjects,
  3. List<ParameterObject>? parameterObjects,
  4. List<ParameterValue>? parameterValues,
})

Adds tasks, schedules, and preconditions to the specified pipeline. You can use PutPipelineDefinition to populate a new pipeline.

PutPipelineDefinition also validates the configuration as it adds it to the pipeline. Changes to the pipeline are saved unless one of the following three validation errors exists in the pipeline.

  1. An object is missing a name or identifier field.
  2. A string or reference field is empty.
  3. The number of objects in the pipeline exceeds the maximum allowed objects.
  4. The pipeline is in a FINISHED state.
Pipeline object definitions are passed to the PutPipelineDefinition action and returned by the GetPipelineDefinition action.

May throw InternalServiceError. May throw InvalidRequestException. May throw PipelineNotFoundException. May throw PipelineDeletedException.

Parameter pipelineId : The ID of the pipeline.

Parameter pipelineObjects : The objects that define the pipeline. These objects overwrite the existing pipeline definition.

Parameter parameterObjects : The parameter objects used with the pipeline.

Parameter parameterValues : The parameter values used with the pipeline.

Implementation

Future<PutPipelineDefinitionOutput> putPipelineDefinition({
  required String pipelineId,
  required List<PipelineObject> pipelineObjects,
  List<ParameterObject>? parameterObjects,
  List<ParameterValue>? parameterValues,
}) async {
  ArgumentError.checkNotNull(pipelineId, 'pipelineId');
  _s.validateStringLength(
    'pipelineId',
    pipelineId,
    1,
    1024,
    isRequired: true,
  );
  ArgumentError.checkNotNull(pipelineObjects, 'pipelineObjects');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DataPipeline.PutPipelineDefinition'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'pipelineId': pipelineId,
      'pipelineObjects': pipelineObjects,
      if (parameterObjects != null) 'parameterObjects': parameterObjects,
      if (parameterValues != null) 'parameterValues': parameterValues,
    },
  );

  return PutPipelineDefinitionOutput.fromJson(jsonResponse.body);
}