From 5a0d655fa5def8a0b3ca445b16457a35bbaab92a Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Mon, 5 Jan 2026 14:31:18 +0100 Subject: [PATCH 1/5] chore(sagemaker): reference interfaces Reference interfaces for L2s, like https://github.com/aws/aws-cdk/pull/35271. "chore" because I plan to make a lot of these PRs and they're not adding value to the changelog. (Generated with AI) --- packages/aws-cdk-lib/aws-ecs/test/cluster.test.ts | 10 +++++----- packages/aws-cdk-lib/aws-sagemaker/lib/endpoint.ts | 8 +++++++- packages/aws-cdk-lib/aws-sagemaker/lib/pipeline.ts | 8 +++++++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/packages/aws-cdk-lib/aws-ecs/test/cluster.test.ts b/packages/aws-cdk-lib/aws-ecs/test/cluster.test.ts index 5766bddee2808..07a30f8c52a97 100644 --- a/packages/aws-cdk-lib/aws-ecs/test/cluster.test.ts +++ b/packages/aws-cdk-lib/aws-ecs/test/cluster.test.ts @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/unbound-method */ + import { testDeprecated } from '@aws-cdk/cdk-build-tools'; import { Match, Template } from '../../assertions'; import * as autoscaling from '../../aws-autoscaling'; @@ -95,7 +95,7 @@ describe('cluster', () => { { Ref: 'EcsCluster97242B84', }, - // eslint-disable-next-line max-len + ' >> /etc/ecs/ecs.config', ], ], @@ -264,7 +264,7 @@ describe('cluster', () => { { Ref: 'EcsCluster97242B84', }, - // eslint-disable-next-line max-len + ' >> /etc/ecs/ecs.config', ], ], @@ -790,7 +790,7 @@ describe('cluster', () => { { Ref: 'EcsCluster97242B84', }, - // eslint-disable-next-line max-len + ' >> /etc/ecs/ecs.config', ], ], @@ -1783,7 +1783,7 @@ describe('cluster', () => { { Ref: 'EcsCluster97242B84', }, - // eslint-disable-next-line max-len + ' >> /etc/ecs/ecs.config', ], ], diff --git a/packages/aws-cdk-lib/aws-sagemaker/lib/endpoint.ts b/packages/aws-cdk-lib/aws-sagemaker/lib/endpoint.ts index a336427caf629..48fe5f47c4af1 100644 --- a/packages/aws-cdk-lib/aws-sagemaker/lib/endpoint.ts +++ b/packages/aws-cdk-lib/aws-sagemaker/lib/endpoint.ts @@ -1,10 +1,11 @@ import * as iam from '../../aws-iam'; import { IResource } from '../../core'; +import { IEndpointRef } from '../../interfaces/generated/aws-sagemaker-interfaces.generated'; /** * The interface for a SageMaker Endpoint resource. */ -export interface IEndpoint extends IResource { +export interface IEndpoint extends IResource, IEndpointRef { /** * The ARN of the endpoint. * @@ -19,6 +20,11 @@ export interface IEndpoint extends IResource { */ readonly endpointName: string; + /** + * A reference to this Endpoint resource. + */ + readonly endpointRef: import('../../interfaces/generated/aws-sagemaker-interfaces.generated').EndpointReference; + /** * Permits an IAM principal to invoke this endpoint * @param grantee The principal to grant access to diff --git a/packages/aws-cdk-lib/aws-sagemaker/lib/pipeline.ts b/packages/aws-cdk-lib/aws-sagemaker/lib/pipeline.ts index cb2e152a9693f..50c43b96aca71 100644 --- a/packages/aws-cdk-lib/aws-sagemaker/lib/pipeline.ts +++ b/packages/aws-cdk-lib/aws-sagemaker/lib/pipeline.ts @@ -1,10 +1,11 @@ import { Grant, IGrantable } from '../../aws-iam'; import { IResource } from '../../core'; +import { IPipelineRef } from '../../interfaces/generated/aws-sagemaker-interfaces.generated'; /** * The interface for a SageMaker Pipeline resource. */ -export interface IPipeline extends IResource { +export interface IPipeline extends IResource, IPipelineRef { /** * The ARN of the pipeline. * @@ -19,6 +20,11 @@ export interface IPipeline extends IResource { */ readonly pipelineName: string; + /** + * A reference to this Pipeline resource. + */ + readonly pipelineRef: import('../../interfaces/generated/aws-sagemaker-interfaces.generated').PipelineReference; + /** * Permits an IAM principal to start this pipeline execution * @param grantee The principal to grant access to From 627206cb36d5a11bf5ca3ce8e912788a17feaa38 Mon Sep 17 00:00:00 2001 From: Rico Hermans Date: Wed, 7 Jan 2026 13:58:51 +0000 Subject: [PATCH 2/5] update tests --- .../aws-apigateway/test/integrations/sagemaker.test.ts | 4 ++++ packages/aws-cdk-lib/aws-sagemaker/lib/endpoint.ts | 5 ----- packages/aws-cdk-lib/aws-sagemaker/lib/pipeline.ts | 5 ----- .../test/sage-maker-start-pipeline-execution.test.ts | 6 +++++- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/aws-cdk-lib/aws-apigateway/test/integrations/sagemaker.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/integrations/sagemaker.test.ts index 14e53f89d974f..fd92b56425d5f 100644 --- a/packages/aws-cdk-lib/aws-apigateway/test/integrations/sagemaker.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/integrations/sagemaker.test.ts @@ -53,4 +53,8 @@ class FakeEndpoint extends cdk.Resource implements sagemaker.IEndpoint { resourceArns: [this.endpointArn], }); } + + public get endpointRef(): sagemaker.EndpointReference { + return { endpointArn: this.endpointArn }; + } } diff --git a/packages/aws-cdk-lib/aws-sagemaker/lib/endpoint.ts b/packages/aws-cdk-lib/aws-sagemaker/lib/endpoint.ts index 48fe5f47c4af1..36063e5388b14 100644 --- a/packages/aws-cdk-lib/aws-sagemaker/lib/endpoint.ts +++ b/packages/aws-cdk-lib/aws-sagemaker/lib/endpoint.ts @@ -20,11 +20,6 @@ export interface IEndpoint extends IResource, IEndpointRef { */ readonly endpointName: string; - /** - * A reference to this Endpoint resource. - */ - readonly endpointRef: import('../../interfaces/generated/aws-sagemaker-interfaces.generated').EndpointReference; - /** * Permits an IAM principal to invoke this endpoint * @param grantee The principal to grant access to diff --git a/packages/aws-cdk-lib/aws-sagemaker/lib/pipeline.ts b/packages/aws-cdk-lib/aws-sagemaker/lib/pipeline.ts index 50c43b96aca71..564fc6a7ca0f5 100644 --- a/packages/aws-cdk-lib/aws-sagemaker/lib/pipeline.ts +++ b/packages/aws-cdk-lib/aws-sagemaker/lib/pipeline.ts @@ -20,11 +20,6 @@ export interface IPipeline extends IResource, IPipelineRef { */ readonly pipelineName: string; - /** - * A reference to this Pipeline resource. - */ - readonly pipelineRef: import('../../interfaces/generated/aws-sagemaker-interfaces.generated').PipelineReference; - /** * Permits an IAM principal to start this pipeline execution * @param grantee The principal to grant access to diff --git a/packages/aws-cdk-lib/aws-scheduler-targets/test/sage-maker-start-pipeline-execution.test.ts b/packages/aws-cdk-lib/aws-scheduler-targets/test/sage-maker-start-pipeline-execution.test.ts index 40d732c1e97e3..60101f076b6a3 100644 --- a/packages/aws-cdk-lib/aws-scheduler-targets/test/sage-maker-start-pipeline-execution.test.ts +++ b/packages/aws-cdk-lib/aws-scheduler-targets/test/sage-maker-start-pipeline-execution.test.ts @@ -1,6 +1,6 @@ import { Template } from '../../assertions'; import { AccountRootPrincipal, Grant, IGrantable, Role } from '../../aws-iam'; -import { IPipeline } from '../../aws-sagemaker'; +import { IPipeline, PipelineReference } from '../../aws-sagemaker'; import { ScheduleExpression, Schedule, ScheduleGroup } from '../../aws-scheduler'; import * as sqs from '../../aws-sqs'; import { App, Duration, Resource, Stack } from '../../core'; @@ -592,6 +592,10 @@ class FakePipeline extends Resource implements IPipeline { this.pipelineName = props.pipelineName; } + public get pipelineRef(): PipelineReference { + return { pipelineName: this.pipelineName }; + } + public grantStartPipelineExecution(grantee: IGrantable): Grant { return Grant.addToPrincipal({ grantee, From aa7f1ae34ed45aa67b7b343abfe84bbc481c5368 Mon Sep 17 00:00:00 2001 From: Rico Hermans Date: Thu, 8 Jan 2026 14:31:28 +0000 Subject: [PATCH 3/5] Implement here as well --- packages/@aws-cdk/aws-sagemaker-alpha/lib/endpoint.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/@aws-cdk/aws-sagemaker-alpha/lib/endpoint.ts b/packages/@aws-cdk/aws-sagemaker-alpha/lib/endpoint.ts index 242f9e2c05bd4..cc777bc328e32 100644 --- a/packages/@aws-cdk/aws-sagemaker-alpha/lib/endpoint.ts +++ b/packages/@aws-cdk/aws-sagemaker-alpha/lib/endpoint.ts @@ -304,6 +304,12 @@ abstract class EndpointBase extends cdk.Resource implements IEndpoint { resourceArns: [this.endpointArn], }); } + + public get endpointRef(): sagemaker.EndpointReference { + return { + endpointArn: this.endpointArn, + }; + } } /** From ed13ee4034d3ed568204059a5b15199ccedca0da Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Thu, 8 Jan 2026 16:49:24 +0100 Subject: [PATCH 4/5] Implement this as well --- .../aws-pipes-targets-alpha/test/integ.sagemaker.ts | 3 +++ .../@aws-cdk/aws-pipes-targets-alpha/test/sagemaker.test.ts | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) 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 3121ef140f8b0..af6a5b093bd84 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 @@ -42,6 +42,7 @@ interface FakePipelineProps { } class FakePipeline extends cdk.Resource implements sagemaker.IPipeline { + public readonly pipelineRef: sagemaker.PipelineReference; public readonly pipelineArn; public readonly pipelineName; @@ -125,6 +126,8 @@ class FakePipeline extends cdk.Resource implements sagemaker.IPipeline { resourceName: pipeline.pipelineName, arnFormat: cdk.ArnFormat.SLASH_RESOURCE_NAME, }); + + this.pipelineRef = { pipelineName: this.pipelineName }; } public grantStartPipelineExecution(grantee: iam.IGrantable): iam.Grant { 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 0c7944e3bfd83..5e1040f50a243 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 @@ -2,7 +2,7 @@ import { InputTransformation, Pipe } from '@aws-cdk/aws-pipes-alpha'; import { App, Stack, Resource } from 'aws-cdk-lib'; import { Template } from 'aws-cdk-lib/assertions'; import * as iam from 'aws-cdk-lib/aws-iam'; -import { IPipeline } from 'aws-cdk-lib/aws-sagemaker'; +import { IPipeline, PipelineReference } from 'aws-cdk-lib/aws-sagemaker'; import { TestSource } from './test-classes'; import { SageMakerTarget } from '../lib'; @@ -131,4 +131,8 @@ class FakePipeline extends Resource implements IPipeline { resourceArns: [this.pipelineArn], }); } + + public get pipelineRef(): PipelineReference { + return { pipelineName: this.pipelineName }; + } } From d96671d5aad7d66f0931691301f39ab02af99fb5 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Fri, 9 Jan 2026 11:08:02 +0100 Subject: [PATCH 5/5] Fakepipeline --- .../test/integ.sage-maker-start-pipeline-execution.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-scheduler-targets/test/integ.sage-maker-start-pipeline-execution.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-scheduler-targets/test/integ.sage-maker-start-pipeline-execution.ts index 0edd9cb06cd83..2ebd4ad93fbf2 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-scheduler-targets/test/integ.sage-maker-start-pipeline-execution.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-scheduler-targets/test/integ.sage-maker-start-pipeline-execution.ts @@ -94,6 +94,10 @@ class FakePipeline extends cdk.Resource implements sagemaker.IPipeline { }); } + public get pipelineRef(): cdk.aws_sagemaker.PipelineReference { + return { pipelineName: this.pipelineName }; + } + public grantStartPipelineExecution(grantee: IGrantable): Grant { return Grant.addToPrincipal({ grantee,