简体   繁体   中英

Programmatically creating aws API key and adding it to a usage plan in single function?

I need to:

  1. Create API keys
  2. Add newly created API Keys to Usage Plans

Following the documentation , I can generate an API key by calling apigateway.createApiKey() and then can add usage plan for that generated api key by calling another function. apigateway.createUsagePlanKey() seems most appropriate function for later case.

Can I perform both the functionalities in single function rather than calling two functions separately like any function that generates a new API Key and adds it a usage plan as well?

The ImportApiKeys API allows you to both create API Keys in bulk and attach the keys to Usage Plans in the same call.

Input is a CSV in the following format

Name,key,description,Enabled,usageplanIds
MyFirstApiKey,apikey1234abcdefghij0123456789,An imported key,TRUE,c7y23b

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM