@@ -24,8 +24,8 @@ export class MicrocksContainer extends GenericContainer {
2424 private snapshots : string [ ] = [ ] ;
2525 private mainArtifacts : string [ ] = [ ] ;
2626 private secondaryArtifacts : string [ ] = [ ] ;
27- private mainRemoteArtifacts : string [ ] = [ ] ;
28- private secondaryRemoteArtifacts : string [ ] = [ ] ;
27+ private mainRemoteArtifacts : RemoteArtifact [ ] = [ ] ;
28+ private secondaryRemoteArtifacts : RemoteArtifact [ ] = [ ] ;
2929 private secrets : Secret [ ] = [ ] ;
3030
3131 constructor ( image = "quay.io/microcks/microcks-uber:1.11.0" ) {
@@ -62,7 +62,7 @@ export class MicrocksContainer extends GenericContainer {
6262 * @param {[String] } remoteArtifactUrls The urls or remote artifacts (OpenAPI, Postman collection, Protobuf, GraphQL schema, ...)
6363 * @returns this
6464 */
65- public withMainRemoteArtifacts ( remoteArtifactUrls : string [ ] ) : this {
65+ public withMainRemoteArtifacts ( remoteArtifactUrls : RemoteArtifact [ ] ) : this {
6666 this . mainRemoteArtifacts = this . mainRemoteArtifacts . concat ( remoteArtifactUrls ) ;
6767 return this ;
6868 }
@@ -73,7 +73,7 @@ export class MicrocksContainer extends GenericContainer {
7373 * @param {[String] } remoteArtifactUrls The furls or remote (OpenAPI, Postman collection, Protobuf, GraphQL schema, ...)
7474 * @returns this
7575 */
76- public withSecondaryRemoteArtifacts ( remoteArtifactUrls : string [ ] ) : this {
76+ public withSecondaryRemoteArtifacts ( remoteArtifactUrls : RemoteArtifact [ ] ) : this {
7777 this . secondaryRemoteArtifacts = this . secondaryRemoteArtifacts . concat ( remoteArtifactUrls ) ;
7878 return this ;
7979 }
@@ -115,10 +115,12 @@ export class MicrocksContainer extends GenericContainer {
115115 }
116116 // Load remote artifacts before local ones.
117117 for ( let i = 0 ; i < this . mainRemoteArtifacts . length ; i ++ ) {
118- await startedContainer . downloadAsMainArtifact ( this . mainRemoteArtifacts [ i ] ) ;
118+ const { url , secretName} = this . mainRemoteArtifacts [ i ] ;
119+ await startedContainer . downloadAsMainArtifact ( url , secretName ) ;
119120 }
120121 for ( let i = 0 ; i < this . secondaryRemoteArtifacts . length ; i ++ ) {
121- await startedContainer . downloadAsSecondaryArtifact ( this . secondaryRemoteArtifacts [ i ] ) ;
122+ const { url , secretName} = this . mainRemoteArtifacts [ i ] ;
123+ await startedContainer . downloadAsSecondaryArtifact ( url , secretName ) ;
122124 }
123125 // Import artifacts declared in configuration.
124126 for ( let i = 0 ; i < this . mainArtifacts . length ; i ++ ) {
@@ -287,6 +289,11 @@ export interface DailyInvocationStatistic {
287289 minuteCount : { string : number } ;
288290}
289291
292+ export interface RemoteArtifact {
293+ url : string ;
294+ secretName ?: string ;
295+ }
296+
290297
291298export class StartedMicrocksContainer extends AbstractStartedContainer {
292299 private readonly httpPort : number ;
@@ -439,17 +446,17 @@ export class StartedMicrocksContainer extends AbstractStartedContainer {
439446 * @param {String } remoteArtifactUrl The URL to remote artifact (OpenAPI, Postman collection, Protobuf, GraphQL schema, ...)
440447 * @returns Success or error via Promise
441448 */
442- public async downloadAsMainArtifact ( remoteArtifactUrl : string ) : Promise < void > {
443- return this . downloadArtifact ( remoteArtifactUrl , true ) ;
449+ public async downloadAsMainArtifact ( remoteArtifactUrl : string , secretName ?: string ) : Promise < void > {
450+ return this . downloadArtifact ( remoteArtifactUrl , true , secretName ) ;
444451 }
445452
446453 /**
447454 * Download a remote artifact as a secondary one within the Microcks container.
448455 * @param {String } remoteArtifactUrl The URL to remote artifact (OpenAPI, Postman collection, Protobuf, GraphQL schema, ...)
449456 * @returns Success or error via Promise
450457 */
451- public async downloadAsSecondaryArtifact ( remoteArtifactUrl : string ) : Promise < void > {
452- return this . downloadArtifact ( remoteArtifactUrl , false ) ;
458+ public async downloadAsSecondaryArtifact ( remoteArtifactUrl : string , secretName ?: string ) : Promise < void > {
459+ return this . downloadArtifact ( remoteArtifactUrl , false , secretName ) ;
453460 }
454461
455462 /**
@@ -613,11 +620,14 @@ export class StartedMicrocksContainer extends AbstractStartedContainer {
613620 }
614621 }
615622
616- private async downloadArtifact ( remoteArtifactUrl : string , mainArtifact : boolean ) : Promise < void > {
623+ private async downloadArtifact ( remoteArtifactUrl : string , mainArtifact : boolean , secretName ?: string ) : Promise < void > {
617624 let formBody = new URLSearchParams ( {
618625 "mainArtifact" : String ( mainArtifact ) ,
619626 "url" : remoteArtifactUrl
620627 } ) ;
628+ if ( secretName ) {
629+ formBody . append ( "secretName" , secretName ) ;
630+ }
621631
622632 // Prepare headers with content type and length.
623633 const headers : Record < string , string > = {
0 commit comments