From b55e911b0bcf2bded7280ad8d1245c0ae07b5c21 Mon Sep 17 00:00:00 2001 From: Momo Kornher Date: Mon, 20 Jan 2025 10:53:26 +0000 Subject: [PATCH 1/2] feat: interoperable Cloud Assembly contract --- lib/cloud-assembly/schema.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/cloud-assembly/schema.ts b/lib/cloud-assembly/schema.ts index 6e4f56e..e0ac0d9 100644 --- a/lib/cloud-assembly/schema.ts +++ b/lib/cloud-assembly/schema.ts @@ -2,6 +2,30 @@ import { ArtifactProperties } from './artifact-schema'; import { ContextProvider, ContextQueryProperties } from './context-queries'; import { MetadataEntry } from './metadata-schema'; +/** + * Interoperable representation of a deployable cloud application. + * + * The external and interoperable contract for a Cloud Assembly is + * a directory containing a valid Cloud Assembly. + * + * Implementations should use the directory to load the Cloud Assembly from disk. + * It is recommended that implementations validate loaded manifest files using + * the provided functionality from this package. + * Within an implementation, it may be prudent to keep (parts of) the Cloud Assembly + * in memory during execution and use an implementation-specific contract. + * However when an implementation is providing an external contract, + * this interface should be used. + */ +export interface ICloudAssembly { + /** + * The directory of the cloud assembly. + * + * This directory will be used to read the Cloud Assembly from. + * Its contents (in particular `manifest.json`) must comply with the schema defined in this package. + */ + readonly directory: string; +} + /** * Type of cloud artifact. */ From dc972d53d10c8378cc0639ed73393bfb13562f9a Mon Sep 17 00:00:00 2001 From: Momo Kornher Date: Mon, 20 Jan 2025 11:48:52 +0000 Subject: [PATCH 2/2] move interface around --- lib/cloud-assembly/index.ts | 1 + lib/cloud-assembly/interfaces.ts | 31 +++++++++++++++++++++++++++++++ lib/cloud-assembly/schema.ts | 24 ------------------------ 3 files changed, 32 insertions(+), 24 deletions(-) create mode 100644 lib/cloud-assembly/interfaces.ts diff --git a/lib/cloud-assembly/index.ts b/lib/cloud-assembly/index.ts index 931538d..9905f44 100644 --- a/lib/cloud-assembly/index.ts +++ b/lib/cloud-assembly/index.ts @@ -2,3 +2,4 @@ export * from './schema'; export * from './metadata-schema'; export * from './artifact-schema'; export * from './context-queries'; +export * from './interfaces'; diff --git a/lib/cloud-assembly/interfaces.ts b/lib/cloud-assembly/interfaces.ts new file mode 100644 index 0000000..838fbf9 --- /dev/null +++ b/lib/cloud-assembly/interfaces.ts @@ -0,0 +1,31 @@ +// The interfaces in this file, mainly exist __here__ because this is a convenient place to put them. +// The Assembly Schema package is already a jsii package and a dependency of `aws-cdk-lib`. +// It is effectively the only place we can put shared interfaces to be used across the jsii ecosystem. +// +// Putting a shared interface in here should be a huge exception. +// It needs to be justified by great benefits it provides to the ecosystems. +// All interfaces should be as minimal as possible. + +/** + * Interoperable representation of a deployable cloud application. + * + * The external and interoperable contract for a Cloud Assembly is + * a directory containing a valid Cloud Assembly. + * + * Implementations should use the directory to load the Cloud Assembly from disk. + * It is recommended that implementations validate loaded manifest files using + * the provided functionality from this package. + * Within an implementation, it may be prudent to keep (parts of) the Cloud Assembly + * in memory during execution and use an implementation-specific contract. + * However when an implementation is providing an external contract, + * this interface should be used. + */ +export interface ICloudAssembly { + /** + * The directory of the cloud assembly. + * + * This directory will be used to read the Cloud Assembly from. + * Its contents (in particular `manifest.json`) must comply with the schema defined in this package. + */ + readonly directory: string; +} diff --git a/lib/cloud-assembly/schema.ts b/lib/cloud-assembly/schema.ts index e0ac0d9..6e4f56e 100644 --- a/lib/cloud-assembly/schema.ts +++ b/lib/cloud-assembly/schema.ts @@ -2,30 +2,6 @@ import { ArtifactProperties } from './artifact-schema'; import { ContextProvider, ContextQueryProperties } from './context-queries'; import { MetadataEntry } from './metadata-schema'; -/** - * Interoperable representation of a deployable cloud application. - * - * The external and interoperable contract for a Cloud Assembly is - * a directory containing a valid Cloud Assembly. - * - * Implementations should use the directory to load the Cloud Assembly from disk. - * It is recommended that implementations validate loaded manifest files using - * the provided functionality from this package. - * Within an implementation, it may be prudent to keep (parts of) the Cloud Assembly - * in memory during execution and use an implementation-specific contract. - * However when an implementation is providing an external contract, - * this interface should be used. - */ -export interface ICloudAssembly { - /** - * The directory of the cloud assembly. - * - * This directory will be used to read the Cloud Assembly from. - * Its contents (in particular `manifest.json`) must comply with the schema defined in this package. - */ - readonly directory: string; -} - /** * Type of cloud artifact. */