createPipeline method

Future<CreatePipelineResponse> createPipeline({
  1. required String pipelineDefinition,
  2. required String pipelineName,
  3. required String roleArn,
  4. String? clientRequestToken,
  5. String? pipelineDescription,
  6. String? pipelineDisplayName,
  7. List<Tag>? tags,
})

Creates a pipeline using a JSON pipeline definition.

May throw ResourceNotFound. May throw ResourceLimitExceeded.

Parameter pipelineDefinition : The JSON pipeline definition of the pipeline.

Parameter pipelineName : The name of the pipeline.

Parameter roleArn : The Amazon Resource Name (ARN) of the role used by the pipeline to access and create resources.

Parameter clientRequestToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the operation. An idempotent operation completes no more than one time.

Parameter pipelineDescription : A description of the pipeline.

Parameter pipelineDisplayName : The display name of the pipeline.

Parameter tags : A list of tags to apply to the created pipeline.

Implementation

Future<CreatePipelineResponse> createPipeline({
  required String pipelineDefinition,
  required String pipelineName,
  required String roleArn,
  String? clientRequestToken,
  String? pipelineDescription,
  String? pipelineDisplayName,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(pipelineDefinition, 'pipelineDefinition');
  _s.validateStringLength(
    'pipelineDefinition',
    pipelineDefinition,
    1,
    1048576,
    isRequired: true,
  );
  ArgumentError.checkNotNull(pipelineName, 'pipelineName');
  _s.validateStringLength(
    'pipelineName',
    pipelineName,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(roleArn, 'roleArn');
  _s.validateStringLength(
    'roleArn',
    roleArn,
    20,
    2048,
    isRequired: true,
  );
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    32,
    128,
  );
  _s.validateStringLength(
    'pipelineDescription',
    pipelineDescription,
    0,
    3072,
  );
  _s.validateStringLength(
    'pipelineDisplayName',
    pipelineDisplayName,
    1,
    256,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreatePipeline'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'PipelineDefinition': pipelineDefinition,
      'PipelineName': pipelineName,
      'RoleArn': roleArn,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (pipelineDescription != null)
        'PipelineDescription': pipelineDescription,
      if (pipelineDisplayName != null)
        'PipelineDisplayName': pipelineDisplayName,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreatePipelineResponse.fromJson(jsonResponse.body);
}