createPipeline method

Future<CreatePipelineOutput> createPipeline({
  1. required String name,
  2. required String uniqueId,
  3. String? description,
  4. List<Tag>? tags,
})

Creates a new, empty pipeline. Use PutPipelineDefinition to populate the pipeline.

May throw InternalServiceError. May throw InvalidRequestException.

Parameter name : The name for the pipeline. You can use the same name for multiple pipelines associated with your AWS account, because AWS Data Pipeline assigns each pipeline a unique pipeline identifier.

Parameter uniqueId : A unique identifier. This identifier is not the same as the pipeline identifier assigned by AWS Data Pipeline. You are responsible for defining the format and ensuring the uniqueness of this identifier. You use this parameter to ensure idempotency during repeated calls to CreatePipeline. For example, if the first call to CreatePipeline does not succeed, you can pass in the same unique identifier and pipeline name combination on a subsequent call to CreatePipeline. CreatePipeline ensures that if a pipeline already exists with the same name and unique identifier, a new pipeline is not created. Instead, you'll receive the pipeline identifier from the previous attempt. The uniqueness of the name and unique identifier combination is scoped to the AWS account or IAM user credentials.

Parameter description : The description for the pipeline.

Parameter tags : A list of tags to associate with the pipeline at creation. Tags let you control access to pipelines. For more information, see Controlling User Access to Pipelines in the AWS Data Pipeline Developer Guide.

Implementation

Future<CreatePipelineOutput> createPipeline({
  required String name,
  required String uniqueId,
  String? description,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    1024,
    isRequired: true,
  );
  ArgumentError.checkNotNull(uniqueId, 'uniqueId');
  _s.validateStringLength(
    'uniqueId',
    uniqueId,
    1,
    1024,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    1024,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DataPipeline.CreatePipeline'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'name': name,
      'uniqueId': uniqueId,
      if (description != null) 'description': description,
      if (tags != null) 'tags': tags,
    },
  );

  return CreatePipelineOutput.fromJson(jsonResponse.body);
}