@@ -6,7 +6,7 @@ import * as s3 from 'aws-cdk-lib/aws-s3';
66import * as s3assets from 'aws-cdk-lib/aws-s3-assets' ;
77import { propertyInjectable } from 'aws-cdk-lib/core/lib/prop-injectable' ;
88import { Construct } from 'constructs' ;
9- import { ImageBuilderData } from './imagebuilder-data ' ;
9+ import * as yaml from 'yaml ' ;
1010import { OSVersion , Platform } from './os-version' ;
1111
1212const COMPONENT_SYMBOL = Symbol . for ( '@aws-cdk/aws-imagebuilder-alpha.Component' ) ;
@@ -640,7 +640,7 @@ export enum ComponentSchemaVersion {
640640/**
641641 * Helper class for referencing and uploading component data
642642 */
643- export abstract class ComponentData extends ImageBuilderData {
643+ export abstract class ComponentData {
644644 /**
645645 * Uploads component data from a local file to S3 to use as the component data
646646 *
@@ -655,7 +655,7 @@ export abstract class ComponentData extends ImageBuilderData {
655655 path : string ,
656656 options : s3assets . AssetOptions = { } ,
657657 ) : S3ComponentData {
658- const asset = this . createAsset ( scope , id , path , options ) ;
658+ const asset = new s3assets . Asset ( scope , id , { ... options , path } ) ;
659659 return new S3ComponentDataFromAsset ( asset ) ;
660660 }
661661
@@ -675,7 +675,7 @@ export abstract class ComponentData extends ImageBuilderData {
675675 * @param data An inline JSON object representing the component data
676676 */
677677 public static fromJsonObject ( data : { [ key : string ] : any } ) : ComponentData {
678- const inlineData = this . createInlineYaml ( data ) ;
678+ const inlineData = yaml . stringify ( data , { indent : 2 } ) ;
679679 return new InlineComponentData ( inlineData ) ;
680680 }
681681
@@ -721,6 +721,20 @@ export abstract class ComponentData extends ImageBuilderData {
721721 public static fromInline ( data : string ) : ComponentData {
722722 return new InlineComponentData ( data ) ;
723723 }
724+
725+ /**
726+ * Indicates that the provided component data is an S3 reference
727+ */
728+ abstract readonly isS3Reference : boolean ;
729+
730+ /**
731+ * The resulting inline string or S3 URL which references the component data
732+ */
733+ public readonly value : string ;
734+
735+ protected constructor ( value : string ) {
736+ this . value = value ;
737+ }
724738}
725739
726740/**
@@ -742,7 +756,7 @@ export abstract class S3ComponentData extends ComponentData {
742756 /**
743757 * Grant put permissions to the given grantee for the component data in S3
744758 *
745- * @param grantee - The principal
759+ * @param grantee The principal
746760 */
747761 public grantPut ( grantee : iam . IGrantable ) : iam . Grant {
748762 return this . bucket . grantPut ( grantee , this . key ) ;
@@ -751,7 +765,7 @@ export abstract class S3ComponentData extends ComponentData {
751765 /**
752766 * Grant read permissions to the given grantee for the component data in S3
753767 *
754- * @param grantee - The principal
768+ * @param grantee The principal
755769 */
756770 public grantRead ( grantee : iam . IGrantable ) : iam . Grant {
757771 return this . bucket . grantRead ( grantee , this . key ) ;
0 commit comments