diff --git a/packages/@aws-cdk/aws-pipes-targets-alpha/lib/sagemaker.ts b/packages/@aws-cdk/aws-pipes-targets-alpha/lib/sagemaker.ts index 9cdf5564124c1..5ff6d27594870 100644 --- a/packages/@aws-cdk/aws-pipes-targets-alpha/lib/sagemaker.ts +++ b/packages/@aws-cdk/aws-pipes-targets-alpha/lib/sagemaker.ts @@ -17,31 +17,12 @@ export interface SageMakerTargetParameters { /** * List of parameter names and values for SageMaker Model Building Pipeline execution. * + * The Name/Value pairs are passed to start execution of the pipeline. + * * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipetargetsagemakerpipelineparameters.html#cfn-pipes-pipe-pipetargetsagemakerpipelineparameters-pipelineparameterlist * @default - none */ - readonly pipelineParameterList?: SageMakerPipelineParameter[]; -} - -/** - * The name/value pair of a parameter to start execution of a SageMaker Model Building Pipeline. - * - * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kinesisfirehose-deliverystream-processorparameter.html - */ -export interface SageMakerPipelineParameter { - /** - * Name of parameter to start execution of a SageMaker Model Building Pipeline. - * - * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-sagemakerpipelineparameter.html#cfn-pipes-pipe-sagemakerpipelineparameter-name - */ - readonly name: string; - - /** - * Value of parameter to start execution of a SageMaker Model Building Pipeline. - * - * @ see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-sagemakerpipelineparameter.html#cfn-pipes-pipe-sagemakerpipelineparameter-value - */ - readonly value: string; + readonly pipelineParameterList?: Record; } /** @@ -50,12 +31,14 @@ export interface SageMakerPipelineParameter { export class SageMakerTarget implements ITarget { private pipeline: IPipeline; private sagemakerParameters?: SageMakerTargetParameters; + private pipelineParameterList?: Record; public readonly targetArn: string; constructor(pipeline: IPipeline, parameters?: SageMakerTargetParameters) { this.pipeline = pipeline; this.targetArn = pipeline.pipelineArn; this.sagemakerParameters = parameters; + this.pipelineParameterList = this.sagemakerParameters?.pipelineParameterList; } grantPush(grantee: IRole): void { @@ -72,7 +55,13 @@ export class SageMakerTarget implements ITarget { return { targetParameters: { inputTemplate: this.sagemakerParameters.inputTransformation?.bind(pipe).inputTemplate, - sageMakerPipelineParameters: this.sagemakerParameters, + sageMakerPipelineParameters: { + pipelineParameterList: this.pipelineParameterList ? + Object.entries(this.pipelineParameterList).map(([key, value]) => ({ + name: key, + value: value, + })) : undefined, + }, }, }; } diff --git a/packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.sagemaker.ts b/packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.sagemaker.ts index 803a04c70af10..8fe9ae73c8fe4 100644 --- a/packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.sagemaker.ts +++ b/packages/@aws-cdk/aws-pipes-targets-alpha/test/integ.sagemaker.ts @@ -135,12 +135,9 @@ const targetPipeline = new FakePipeline(stack, 'Pipeline', { new Pipe(stack, 'Pipe', { source: new TestSource(sourceQueue), target: new SageMakerTarget(targetPipeline, { - pipelineParameterList: [ - { - name: 'foor', - value: 'bar', - }, - ], + pipelineParameterList: { + foor: 'bar', + }, }), }); diff --git a/packages/@aws-cdk/aws-pipes-targets-alpha/test/sagemaker.test.ts b/packages/@aws-cdk/aws-pipes-targets-alpha/test/sagemaker.test.ts index 14569e3924902..f203f528c7469 100644 --- a/packages/@aws-cdk/aws-pipes-targets-alpha/test/sagemaker.test.ts +++ b/packages/@aws-cdk/aws-pipes-targets-alpha/test/sagemaker.test.ts @@ -39,12 +39,9 @@ describe('SageMaker', () => { it('should have target parameters', () => { // ARRANGE const target = new SageMakerTarget(pipeline, { - pipelineParameterList: [ - { - name: 'foo', - value: 'bar', - }, - ], + pipelineParameterList: { + foo: 'bar', + }, }); new Pipe(stack, 'MyPipe', {