@@ -262,6 +262,8 @@ class Apigw {
262262 }
263263
264264 async setupApiUsagePlan ( { usagePlan } ) {
265+ console . log ( 'usagePlan' , usagePlan )
266+
265267 const usageInputs = {
266268 usagePlanName : usagePlan . usagePlanName || '' ,
267269 usagePlanDesc : usagePlan . usagePlanDesc || '' ,
@@ -271,22 +273,22 @@ class Apigw {
271273
272274 const usagePlanOutput = {
273275 created : usagePlan . created || false ,
274- id : usagePlan . id
276+ usagePlanId : usagePlan . usagePlanId
275277 }
276278
277- if ( ! usagePlan . id ) {
279+ if ( ! usagePlan . usagePlanId ) {
278280 const createUsagePlan = await this . request ( {
279281 Action : 'CreateUsagePlan' ,
280282 ...usageInputs
281283 } )
282- usagePlanOutput . id = createUsagePlan . usagePlanId
284+ usagePlanOutput . usagePlanId = createUsagePlan . usagePlanId
283285 usagePlanOutput . created = true
284286 console . log ( `Usage plan with ID ${ usagePlanOutput . id } created.` )
285287 } else {
286288 console . log ( `Updating usage plan with id ${ usagePlan . usagePlanId } .` )
287289 await this . request ( {
288290 Action : 'ModifyUsagePlan' ,
289- usagePlanId : usagePlanOutput . id ,
291+ usagePlanId : usagePlanOutput . usagePlanId ,
290292 ...usageInputs
291293 } )
292294 }
@@ -407,21 +409,21 @@ class Apigw {
407409 apiIds : [ apiId ]
408410 } )
409411
410- const oldUsagePlan = usagePlanList . find ( ( item ) => item . usagePlanId === usagePlan . id )
412+ const oldUsagePlan = usagePlanList . find ( ( item ) => item . usagePlanId === usagePlan . usagePlanId )
411413 if ( oldUsagePlan ) {
412414 console . log (
413- `Usage plan with id ${ usagePlan . id } already bind to api id ${ apiId } path ${ endpoint . method } ${ endpoint . path } .`
415+ `Usage plan with id ${ usagePlan . usagePlanId } already bind to api id ${ apiId } path ${ endpoint . method } ${ endpoint . path } .`
414416 )
415417 } else {
416418 console . log (
417- `Binding usage plan with id ${ usagePlan . id } to api id ${ apiId } path ${ endpoint . method } ${ endpoint . path } .`
419+ `Binding usage plan with id ${ usagePlan . usagePlanId } to api id ${ apiId } path ${ endpoint . method } ${ endpoint . path } .`
418420 )
419421 await this . request ( {
420422 Action : 'BindEnvironment' ,
421423 serviceId,
422424 environment,
423425 bindType : bindType ,
424- usagePlanIds : [ usagePlan . id ] ,
426+ usagePlanIds : [ usagePlan . usagePlanId ] ,
425427 apiIds : [ apiId ]
426428 } )
427429 console . log ( 'Binding successed.' )
@@ -477,16 +479,16 @@ class Apigw {
477479 secretIds
478480 } )
479481 const unboundSecretIds = await this . getUnboundSecretIds ( {
480- usagePlanId : usagePlan . id ,
482+ usagePlanId : usagePlan . usagePlanId ,
481483 secretIds : secrets . secretIds
482484 } )
483485 if ( unboundSecretIds . length > 0 ) {
484486 console . log (
485- `Binding secret key ${ unboundSecretIds } to usage plan with id ${ usagePlan . id } .`
487+ `Binding secret key ${ unboundSecretIds } to usage plan with id ${ usagePlan . usagePlanId } .`
486488 )
487489 await this . request ( {
488490 Action : 'BindSecretIds' ,
489- usagePlanId : usagePlan . id ,
491+ usagePlanId : usagePlan . usagePlanId ,
490492 secretIds : unboundSecretIds
491493 } )
492494 console . log ( 'Binding secret key successed.' )
@@ -557,9 +559,9 @@ class Apigw {
557559 await this . request ( {
558560 Action : 'UnBindSecretIds' ,
559561 secretIds : secrets . secretIds ,
560- usagePlanId : curApi . usagePlan . id
562+ usagePlanId : curApi . usagePlan . usagePlanId
561563 } )
562- console . log ( `Unbinding secret key to usage plan with ID ${ curApi . usagePlan . id } .` )
564+ console . log ( `Unbinding secret key to usage plan with ID ${ curApi . usagePlan . usagePlanId } .` )
563565
564566 // delelet all created api key
565567 if ( curApi . usagePlan . secrets . created === true ) {
@@ -582,21 +584,23 @@ class Apigw {
582584 await this . request ( {
583585 Action : 'UnBindEnvironment' ,
584586 serviceId,
585- usagePlanIds : [ curApi . usagePlan . id ] ,
587+ usagePlanIds : [ curApi . usagePlan . usagePlanId ] ,
586588 environment,
587589 bindType : curApi . bindType ,
588590 apiIds : [ curApi . apiId ]
589591 } )
590592 console . log (
591- `Unbinding usage plan with ID ${ curApi . usagePlan . id } to service with ID ${ serviceId } .`
593+ `Unbinding usage plan with ID ${ curApi . usagePlan . usagePlanId } to service with ID ${ serviceId } .`
592594 )
593595
594596 // 1.3 delete created usage plan
595597 if ( curApi . usagePlan . created === true ) {
596- console . log ( `Removing any previously deployed usage plan ids ${ curApi . usagePlan . id } ` )
598+ console . log (
599+ `Removing any previously deployed usage plan ids ${ curApi . usagePlan . usagePlanId } `
600+ )
597601 await this . request ( {
598602 Action : 'DeleteUsagePlan' ,
599- usagePlanId : curApi . usagePlan . id
603+ usagePlanId : curApi . usagePlan . usagePlanId
600604 } )
601605 }
602606 }
0 commit comments