ibm-cloud-sdk-core 4.0.6 → 4.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/Authentication.md +2 -1
  2. package/CHANGELOG.md +14 -0
  3. package/auth/authenticators/basic-authenticator.d.ts +1 -1
  4. package/auth/authenticators/basic-authenticator.js +4 -4
  5. package/auth/authenticators/bearer-token-authenticator.d.ts +1 -1
  6. package/auth/authenticators/bearer-token-authenticator.js +3 -3
  7. package/auth/authenticators/cloud-pak-for-data-authenticator.d.ts +2 -2
  8. package/auth/authenticators/cloud-pak-for-data-authenticator.js +3 -3
  9. package/auth/authenticators/container-authenticator.d.ts +2 -2
  10. package/auth/authenticators/container-authenticator.js +3 -3
  11. package/auth/authenticators/iam-authenticator.d.ts +2 -2
  12. package/auth/authenticators/iam-authenticator.js +5 -5
  13. package/auth/authenticators/iam-request-based-authenticator.d.ts +2 -2
  14. package/auth/authenticators/iam-request-based-authenticator.js +3 -3
  15. package/auth/authenticators/index.d.ts +2 -2
  16. package/auth/authenticators/index.js +1 -1
  17. package/auth/authenticators/token-request-based-authenticator.d.ts +2 -2
  18. package/auth/authenticators/token-request-based-authenticator.js +3 -3
  19. package/auth/authenticators/vpc-instance-authenticator.d.ts +2 -2
  20. package/auth/authenticators/vpc-instance-authenticator.js +3 -3
  21. package/auth/token-managers/container-token-manager.d.ts +11 -1
  22. package/auth/token-managers/container-token-manager.js +41 -17
  23. package/auth/token-managers/cp4d-token-manager.d.ts +1 -1
  24. package/auth/token-managers/cp4d-token-manager.js +3 -3
  25. package/auth/token-managers/iam-request-based-token-manager.d.ts +1 -1
  26. package/auth/token-managers/iam-request-based-token-manager.js +6 -6
  27. package/auth/token-managers/iam-token-manager.d.ts +1 -1
  28. package/auth/token-managers/iam-token-manager.js +3 -3
  29. package/auth/token-managers/token-manager.d.ts +1 -1
  30. package/auth/token-managers/token-manager.js +4 -4
  31. package/auth/token-managers/vpc-instance-token-manager.js +2 -2
  32. package/auth/utils/file-reading-helpers.d.ts +1 -1
  33. package/auth/utils/file-reading-helpers.js +9 -13
  34. package/build/docs/ibm-cloud-sdk-core.atleastone.md +2 -2
  35. package/build/docs/ibm-cloud-sdk-core.atmostone.md +2 -2
  36. package/build/docs/ibm-cloud-sdk-core.authenticator._constructor_.md +1 -1
  37. package/build/docs/ibm-cloud-sdk-core.authenticator.authenticate.md +2 -2
  38. package/build/docs/ibm-cloud-sdk-core.authenticator.authenticationtype.md +2 -2
  39. package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_basic.md +1 -1
  40. package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_bearertoken.md +1 -1
  41. package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_container.md +1 -1
  42. package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_cp4d.md +1 -1
  43. package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_iam.md +1 -1
  44. package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_noauth.md +1 -1
  45. package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_unknown.md +1 -1
  46. package/build/docs/ibm-cloud-sdk-core.authenticator.authtype_vpc.md +1 -1
  47. package/build/docs/ibm-cloud-sdk-core.authenticator.md +2 -2
  48. package/build/docs/ibm-cloud-sdk-core.authenticatorinterface.authenticate.md +2 -2
  49. package/build/docs/ibm-cloud-sdk-core.authenticatorinterface.authenticationtype.md +2 -2
  50. package/build/docs/ibm-cloud-sdk-core.authenticatorinterface.md +1 -1
  51. package/build/docs/ibm-cloud-sdk-core.baseservice._constructor_.md +1 -1
  52. package/build/docs/ibm-cloud-sdk-core.baseservice.baseoptions.md +1 -1
  53. package/build/docs/ibm-cloud-sdk-core.baseservice.configureservice.md +2 -2
  54. package/build/docs/ibm-cloud-sdk-core.baseservice.createrequest.md +2 -2
  55. package/build/docs/ibm-cloud-sdk-core.baseservice.default_service_name.md +1 -1
  56. package/build/docs/ibm-cloud-sdk-core.baseservice.default_service_url.md +1 -1
  57. package/build/docs/ibm-cloud-sdk-core.baseservice.disableretries.md +2 -2
  58. package/build/docs/ibm-cloud-sdk-core.baseservice.enableretries.md +3 -3
  59. package/build/docs/ibm-cloud-sdk-core.baseservice.getauthenticator.md +2 -2
  60. package/build/docs/ibm-cloud-sdk-core.baseservice.gethttpclient.md +2 -2
  61. package/build/docs/ibm-cloud-sdk-core.baseservice.md +1 -1
  62. package/build/docs/ibm-cloud-sdk-core.baseservice.setdefaultheaders.md +2 -2
  63. package/build/docs/ibm-cloud-sdk-core.baseservice.setenablegzipcompression.md +2 -2
  64. package/build/docs/ibm-cloud-sdk-core.baseservice.setserviceurl.md +2 -2
  65. package/build/docs/ibm-cloud-sdk-core.basicauthenticator._constructor_.md +1 -1
  66. package/build/docs/ibm-cloud-sdk-core.basicauthenticator.authenticate.md +2 -2
  67. package/build/docs/ibm-cloud-sdk-core.basicauthenticator.authenticationtype.md +2 -2
  68. package/build/docs/ibm-cloud-sdk-core.basicauthenticator.authheader.md +1 -1
  69. package/build/docs/ibm-cloud-sdk-core.basicauthenticator.md +2 -2
  70. package/build/docs/ibm-cloud-sdk-core.basicauthenticator.requiredoptions.md +1 -1
  71. package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator._constructor_.md +1 -1
  72. package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.authenticate.md +2 -2
  73. package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.authenticationtype.md +2 -2
  74. package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.md +2 -2
  75. package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.requiredoptions.md +1 -1
  76. package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.setbearertoken.md +2 -2
  77. package/build/docs/ibm-cloud-sdk-core.buildrequestfileobject.md +2 -2
  78. package/build/docs/ibm-cloud-sdk-core.checkcredentials.md +2 -2
  79. package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator._constructor_.md +1 -1
  80. package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator.authenticationtype.md +2 -2
  81. package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator.md +2 -2
  82. package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator.requiredoptions.md +1 -1
  83. package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator.tokenmanager.md +1 -1
  84. package/build/docs/ibm-cloud-sdk-core.computebasicauthheader.md +2 -2
  85. package/build/docs/ibm-cloud-sdk-core.constructfilepath.md +2 -2
  86. package/build/docs/ibm-cloud-sdk-core.constructserviceurl.md +2 -2
  87. package/build/docs/ibm-cloud-sdk-core.containerauthenticator._constructor_.md +1 -1
  88. package/build/docs/ibm-cloud-sdk-core.containerauthenticator.authenticationtype.md +2 -2
  89. package/build/docs/ibm-cloud-sdk-core.containerauthenticator.md +2 -2
  90. package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setcrtokenfilename.md +2 -2
  91. package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setiamprofileid.md +2 -2
  92. package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setiamprofilename.md +2 -2
  93. package/build/docs/ibm-cloud-sdk-core.containerauthenticator.tokenmanager.md +1 -1
  94. package/build/docs/ibm-cloud-sdk-core.containertokenmanager._constructor_.md +1 -1
  95. package/build/docs/ibm-cloud-sdk-core.containertokenmanager.getcrtoken.md +19 -0
  96. package/build/docs/ibm-cloud-sdk-core.containertokenmanager.md +3 -2
  97. package/build/docs/ibm-cloud-sdk-core.containertokenmanager.requesttoken.md +2 -2
  98. package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setcrtokenfilename.md +2 -2
  99. package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setiamprofileid.md +2 -2
  100. package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setiamprofilename.md +2 -2
  101. package/build/docs/ibm-cloud-sdk-core.contenttype.md +1 -1
  102. package/build/docs/ibm-cloud-sdk-core.cp4dtokenmanager._constructor_.md +1 -1
  103. package/build/docs/ibm-cloud-sdk-core.cp4dtokenmanager.md +2 -2
  104. package/build/docs/ibm-cloud-sdk-core.cp4dtokenmanager.requesttoken.md +2 -2
  105. package/build/docs/ibm-cloud-sdk-core.cp4dtokenmanager.requiredoptions.md +1 -1
  106. package/build/docs/ibm-cloud-sdk-core.fileexistsatpath.md +2 -2
  107. package/build/docs/ibm-cloud-sdk-core.fileobject.md +2 -2
  108. package/build/docs/ibm-cloud-sdk-core.fileobject.options.md +1 -1
  109. package/build/docs/ibm-cloud-sdk-core.fileobject.value.md +1 -1
  110. package/build/docs/ibm-cloud-sdk-core.fileoptions.contenttype.md +1 -1
  111. package/build/docs/ibm-cloud-sdk-core.fileoptions.filename.md +1 -1
  112. package/build/docs/ibm-cloud-sdk-core.fileoptions.md +3 -3
  113. package/build/docs/ibm-cloud-sdk-core.filestream.md +2 -2
  114. package/build/docs/ibm-cloud-sdk-core.filestream.path.md +1 -1
  115. package/build/docs/ibm-cloud-sdk-core.filewithmetadata.contenttype.md +1 -1
  116. package/build/docs/ibm-cloud-sdk-core.filewithmetadata.data.md +1 -1
  117. package/build/docs/ibm-cloud-sdk-core.filewithmetadata.filename.md +1 -1
  118. package/build/docs/ibm-cloud-sdk-core.filewithmetadata.md +1 -1
  119. package/build/docs/ibm-cloud-sdk-core.getauthenticatorfromenvironment.md +2 -2
  120. package/build/docs/ibm-cloud-sdk-core.getcontenttype.md +2 -2
  121. package/build/docs/ibm-cloud-sdk-core.getcurrenttime.md +2 -2
  122. package/build/docs/ibm-cloud-sdk-core.getformat.md +2 -2
  123. package/build/docs/ibm-cloud-sdk-core.getmissingparams.md +2 -2
  124. package/build/docs/ibm-cloud-sdk-core.getnewlogger.md +2 -2
  125. package/build/docs/ibm-cloud-sdk-core.getqueryparam.md +2 -2
  126. package/build/docs/ibm-cloud-sdk-core.iamauthenticator._constructor_.md +1 -1
  127. package/build/docs/ibm-cloud-sdk-core.iamauthenticator.authenticationtype.md +2 -2
  128. package/build/docs/ibm-cloud-sdk-core.iamauthenticator.md +2 -2
  129. package/build/docs/ibm-cloud-sdk-core.iamauthenticator.requiredoptions.md +1 -1
  130. package/build/docs/ibm-cloud-sdk-core.iamauthenticator.tokenmanager.md +1 -1
  131. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator._constructor_.md +1 -1
  132. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.clientid.md +1 -1
  133. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.clientsecret.md +1 -1
  134. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.getrefreshtoken.md +2 -2
  135. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.md +2 -2
  136. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.scope.md +1 -1
  137. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.setclientidandsecret.md +2 -2
  138. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.setscope.md +2 -2
  139. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.tokenmanager.md +1 -1
  140. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager._constructor_.md +1 -1
  141. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.formdata.md +1 -1
  142. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.getrefreshtoken.md +2 -2
  143. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.md +2 -2
  144. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.refreshtoken.md +1 -1
  145. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.requesttoken.md +2 -2
  146. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.savetokeninfo.md +2 -2
  147. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.setclientidandsecret.md +2 -2
  148. package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.setscope.md +2 -2
  149. package/build/docs/ibm-cloud-sdk-core.iamrequestoptions.clientid.md +1 -1
  150. package/build/docs/ibm-cloud-sdk-core.iamrequestoptions.clientsecret.md +1 -1
  151. package/build/docs/ibm-cloud-sdk-core.iamrequestoptions.md +5 -5
  152. package/build/docs/ibm-cloud-sdk-core.iamrequestoptions.scope.md +1 -1
  153. package/build/docs/ibm-cloud-sdk-core.iamtokenmanager._constructor_.md +1 -1
  154. package/build/docs/ibm-cloud-sdk-core.iamtokenmanager.md +2 -2
  155. package/build/docs/ibm-cloud-sdk-core.iamtokenmanager.requiredoptions.md +1 -1
  156. package/build/docs/ibm-cloud-sdk-core.isemptyobject.md +2 -2
  157. package/build/docs/ibm-cloud-sdk-core.isfiledata.md +2 -2
  158. package/build/docs/ibm-cloud-sdk-core.isfilewithmetadata.md +2 -2
  159. package/build/docs/ibm-cloud-sdk-core.ishtml.md +2 -2
  160. package/build/docs/ibm-cloud-sdk-core.isjsonmimetype.md +2 -2
  161. package/build/docs/ibm-cloud-sdk-core.jwttokenmanager._constructor_.md +1 -1
  162. package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.md +2 -2
  163. package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.requesttoken.md +2 -2
  164. package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.savetokeninfo.md +2 -2
  165. package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.tokeninfo.md +1 -1
  166. package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.tokenname.md +1 -1
  167. package/build/docs/ibm-cloud-sdk-core.jwttokenmanageroptions.md +2 -2
  168. package/build/docs/ibm-cloud-sdk-core.noauthauthenticator.authenticate.md +2 -2
  169. package/build/docs/ibm-cloud-sdk-core.noauthauthenticator.authenticationtype.md +2 -2
  170. package/build/docs/ibm-cloud-sdk-core.noauthauthenticator.md +2 -2
  171. package/build/docs/ibm-cloud-sdk-core.onlyone.md +2 -2
  172. package/build/docs/ibm-cloud-sdk-core.qs.md +1 -1
  173. package/build/docs/ibm-cloud-sdk-core.readcredentialsfile.md +2 -2
  174. package/build/docs/ibm-cloud-sdk-core.readcrtokenfile.md +2 -2
  175. package/build/docs/ibm-cloud-sdk-core.readexternalsources.md +2 -2
  176. package/build/docs/ibm-cloud-sdk-core.removesuffix.md +2 -2
  177. package/build/docs/ibm-cloud-sdk-core.sdklogger.debug.md +1 -1
  178. package/build/docs/ibm-cloud-sdk-core.sdklogger.error.md +1 -1
  179. package/build/docs/ibm-cloud-sdk-core.sdklogger.info.md +1 -1
  180. package/build/docs/ibm-cloud-sdk-core.sdklogger.md +1 -1
  181. package/build/docs/ibm-cloud-sdk-core.sdklogger.verbose.md +1 -1
  182. package/build/docs/ibm-cloud-sdk-core.sdklogger.warn.md +1 -1
  183. package/build/docs/ibm-cloud-sdk-core.streamtopromise.md +2 -2
  184. package/build/docs/ibm-cloud-sdk-core.striptrailingslash.md +2 -2
  185. package/build/docs/ibm-cloud-sdk-core.tokenmanager._constructor_.md +1 -1
  186. package/build/docs/ibm-cloud-sdk-core.tokenmanager.accesstoken.md +1 -1
  187. package/build/docs/ibm-cloud-sdk-core.tokenmanager.disablesslverification.md +1 -1
  188. package/build/docs/ibm-cloud-sdk-core.tokenmanager.expiretime.md +1 -1
  189. package/build/docs/ibm-cloud-sdk-core.tokenmanager.gettoken.md +2 -2
  190. package/build/docs/ibm-cloud-sdk-core.tokenmanager.headers.md +1 -1
  191. package/build/docs/ibm-cloud-sdk-core.tokenmanager.md +1 -1
  192. package/build/docs/ibm-cloud-sdk-core.tokenmanager.pacedrequesttoken.md +2 -2
  193. package/build/docs/ibm-cloud-sdk-core.tokenmanager.refreshtime.md +1 -1
  194. package/build/docs/ibm-cloud-sdk-core.tokenmanager.requesttoken.md +2 -2
  195. package/build/docs/ibm-cloud-sdk-core.tokenmanager.requestwrapperinstance.md +1 -1
  196. package/build/docs/ibm-cloud-sdk-core.tokenmanager.savetokeninfo.md +2 -2
  197. package/build/docs/ibm-cloud-sdk-core.tokenmanager.setdisablesslverification.md +2 -2
  198. package/build/docs/ibm-cloud-sdk-core.tokenmanager.setheaders.md +2 -2
  199. package/build/docs/ibm-cloud-sdk-core.tokenmanager.url.md +1 -1
  200. package/build/docs/ibm-cloud-sdk-core.tokenmanageroptions.md +1 -1
  201. package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator._constructor_.md +1 -1
  202. package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.authenticate.md +2 -2
  203. package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.disablesslverification.md +1 -1
  204. package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.headers.md +1 -1
  205. package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.md +2 -2
  206. package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.setdisablesslverification.md +2 -2
  207. package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.setheaders.md +2 -2
  208. package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.tokenmanager.md +1 -1
  209. package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.url.md +1 -1
  210. package/build/docs/ibm-cloud-sdk-core.tolowerkeys.md +2 -2
  211. package/build/docs/ibm-cloud-sdk-core.unittestutils.checkforsuccessfulexecution.md +2 -2
  212. package/build/docs/ibm-cloud-sdk-core.unittestutils.checkmediaheaders.md +2 -2
  213. package/build/docs/ibm-cloud-sdk-core.unittestutils.checkurlandmethod.md +2 -2
  214. package/build/docs/ibm-cloud-sdk-core.unittestutils.checkuserheader.md +2 -2
  215. package/build/docs/ibm-cloud-sdk-core.unittestutils.expecttobepromise.md +2 -2
  216. package/build/docs/ibm-cloud-sdk-core.unittestutils.getoptions.md +2 -2
  217. package/build/docs/ibm-cloud-sdk-core.useroptions.authenticator.md +1 -1
  218. package/build/docs/ibm-cloud-sdk-core.useroptions.disablesslverification.md +1 -1
  219. package/build/docs/ibm-cloud-sdk-core.useroptions.headers.md +1 -1
  220. package/build/docs/ibm-cloud-sdk-core.useroptions.jar.md +1 -1
  221. package/build/docs/ibm-cloud-sdk-core.useroptions.md +8 -8
  222. package/build/docs/ibm-cloud-sdk-core.useroptions.serviceurl.md +1 -1
  223. package/build/docs/ibm-cloud-sdk-core.useroptions.url.md +1 -1
  224. package/build/docs/ibm-cloud-sdk-core.useroptions.version.md +1 -1
  225. package/build/docs/ibm-cloud-sdk-core.validateinput.md +2 -2
  226. package/build/docs/ibm-cloud-sdk-core.validateparams.md +2 -2
  227. package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator._constructor_.md +1 -1
  228. package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.authenticationtype.md +2 -2
  229. package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.md +2 -2
  230. package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.setiamprofilecrn.md +2 -2
  231. package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.setiamprofileid.md +2 -2
  232. package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.tokenmanager.md +1 -1
  233. package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager._constructor_.md +1 -1
  234. package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.md +2 -2
  235. package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.requesttoken.md +2 -2
  236. package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.setiamprofilecrn.md +2 -2
  237. package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.setiamprofileid.md +2 -2
  238. package/docs/ibm-cloud-sdk-core.api.json +187 -43
  239. package/es/auth/authenticators/basic-authenticator.d.ts +1 -1
  240. package/es/auth/authenticators/basic-authenticator.js +2 -2
  241. package/es/auth/authenticators/bearer-token-authenticator.d.ts +1 -1
  242. package/es/auth/authenticators/bearer-token-authenticator.js +2 -2
  243. package/es/auth/authenticators/cloud-pak-for-data-authenticator.d.ts +2 -2
  244. package/es/auth/authenticators/cloud-pak-for-data-authenticator.js +2 -2
  245. package/es/auth/authenticators/container-authenticator.d.ts +2 -2
  246. package/es/auth/authenticators/container-authenticator.js +2 -2
  247. package/es/auth/authenticators/iam-authenticator.d.ts +2 -2
  248. package/es/auth/authenticators/iam-authenticator.js +3 -3
  249. package/es/auth/authenticators/iam-request-based-authenticator.d.ts +2 -2
  250. package/es/auth/authenticators/iam-request-based-authenticator.js +2 -2
  251. package/es/auth/authenticators/index.d.ts +2 -2
  252. package/es/auth/authenticators/index.js +1 -1
  253. package/es/auth/authenticators/token-request-based-authenticator.d.ts +2 -2
  254. package/es/auth/authenticators/token-request-based-authenticator.js +2 -2
  255. package/es/auth/authenticators/vpc-instance-authenticator.d.ts +2 -2
  256. package/es/auth/authenticators/vpc-instance-authenticator.js +2 -2
  257. package/es/auth/token-managers/container-token-manager.d.ts +11 -1
  258. package/es/auth/token-managers/container-token-manager.js +40 -12
  259. package/es/auth/token-managers/cp4d-token-manager.d.ts +1 -1
  260. package/es/auth/token-managers/cp4d-token-manager.js +2 -2
  261. package/es/auth/token-managers/iam-request-based-token-manager.d.ts +1 -1
  262. package/es/auth/token-managers/iam-request-based-token-manager.js +2 -2
  263. package/es/auth/token-managers/iam-token-manager.d.ts +1 -1
  264. package/es/auth/token-managers/iam-token-manager.js +2 -2
  265. package/es/auth/token-managers/token-manager.d.ts +1 -1
  266. package/es/auth/token-managers/token-manager.js +1 -1
  267. package/es/auth/token-managers/vpc-instance-token-manager.js +1 -1
  268. package/es/auth/utils/file-reading-helpers.d.ts +1 -1
  269. package/es/auth/utils/file-reading-helpers.js +9 -13
  270. package/es/tsdoc-metadata.json +1 -1
  271. package/etc/ibm-cloud-sdk-core.api.md +1 -0
  272. package/ibm-cloud-sdk-core.d.ts +11 -1
  273. package/package.json +1 -1
  274. package/temp/ibm-cloud-sdk-core.api.json +187 -43
  275. package/temp/ibm-cloud-sdk-core.api.md +1 -0
package/Authentication.md CHANGED
@@ -252,7 +252,8 @@ The IAM access token is added to each outbound request in the `Authorization` he
252
252
  ### Properties
253
253
 
254
254
  - crTokenFilename: (optional) the name of the file containing the injected CR token value.
255
- If not specified, then `/var/run/secrets/tokens/vault-token` is used as the default value.
255
+ If not specified, then the authenticator will first try `/var/run/secrets/tokens/vault-token`
256
+ and then `/var/run/secrets/tokens/sa-token` as the default value (first file found is used).
256
257
  The application must have `read` permissions on the file containing the CR token value.
257
258
 
258
259
  - iamProfileName: (optional) the name of the linked trusted IAM profile to be used when obtaining the
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [4.0.8](https://github.com/IBM/node-sdk-core/compare/v4.0.7...v4.0.8) (2023-05-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * refresh dependencies and address import cycles ([#244](https://github.com/IBM/node-sdk-core/issues/244)) ([72aa8d5](https://github.com/IBM/node-sdk-core/commit/72aa8d5f8308ea0e7d092e79b45743fc3f273506))
7
+
8
+ ## [4.0.7](https://github.com/IBM/node-sdk-core/compare/v4.0.6...v4.0.7) (2023-05-22)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **ContainerAuthenticator:** add sa-token as default CR token filename ([#241](https://github.com/IBM/node-sdk-core/issues/241)) ([91f9932](https://github.com/IBM/node-sdk-core/commit/91f9932ab0a74c11e1de5aecb46481dee3058018))
14
+
1
15
  ## [4.0.6](https://github.com/IBM/node-sdk-core/compare/v4.0.5...v4.0.6) (2023-05-18)
2
16
 
3
17
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2019, 2022.
2
+ * (C) Copyright IBM Corp. 2019, 2023.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * (C) Copyright IBM Corp. 2019, 2022.
3
+ * (C) Copyright IBM Corp. 2019, 2023.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.BasicAuthenticator = void 0;
37
37
  var extend_1 = __importDefault(require("extend"));
38
- var utils_1 = require("../utils");
38
+ var helpers_1 = require("../utils/helpers");
39
39
  var authenticator_1 = require("./authenticator");
40
40
  /**
41
41
  * The BasicAuthenticator is used to add basic authentication information to
@@ -61,9 +61,9 @@ var BasicAuthenticator = /** @class */ (function (_super) {
61
61
  function BasicAuthenticator(options) {
62
62
  var _this = _super.call(this) || this;
63
63
  _this.requiredOptions = ['username', 'password'];
64
- (0, utils_1.validateInput)(options, _this.requiredOptions);
64
+ (0, helpers_1.validateInput)(options, _this.requiredOptions);
65
65
  var username = options.username, password = options.password;
66
- var authHeaderString = (0, utils_1.computeBasicAuthHeader)(username, password);
66
+ var authHeaderString = (0, helpers_1.computeBasicAuthHeader)(username, password);
67
67
  _this.authHeader = { Authorization: authHeaderString };
68
68
  return _this;
69
69
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2019, 2022.
2
+ * (C) Copyright IBM Corp. 2019, 2023.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * (C) Copyright IBM Corp. 2019, 2022.
3
+ * (C) Copyright IBM Corp. 2019, 2023.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.BearerTokenAuthenticator = void 0;
37
37
  var extend_1 = __importDefault(require("extend"));
38
- var utils_1 = require("../utils");
38
+ var helpers_1 = require("../utils/helpers");
39
39
  var authenticator_1 = require("./authenticator");
40
40
  /**
41
41
  * The BearerTokenAuthenticator will set a user-provided bearer token
@@ -58,7 +58,7 @@ var BearerTokenAuthenticator = /** @class */ (function (_super) {
58
58
  function BearerTokenAuthenticator(options) {
59
59
  var _this = _super.call(this) || this;
60
60
  _this.requiredOptions = ['bearerToken'];
61
- (0, utils_1.validateInput)(options, _this.requiredOptions);
61
+ (0, helpers_1.validateInput)(options, _this.requiredOptions);
62
62
  _this.bearerToken = options.bearerToken;
63
63
  return _this;
64
64
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2019, 2022.
2
+ * (C) Copyright IBM Corp. 2019, 2023.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Cp4dTokenManager } from '../token-managers';
16
+ import { Cp4dTokenManager } from '../token-managers/cp4d-token-manager';
17
17
  import { BaseOptions, TokenRequestBasedAuthenticator } from './token-request-based-authenticator';
18
18
  /** Configuration options for CloudPakForData authentication. */
19
19
  export interface Options extends BaseOptions {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * (C) Copyright IBM Corp. 2019, 2022.
3
+ * (C) Copyright IBM Corp. 2019, 2023.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@ var __extends = (this && this.__extends) || (function () {
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.CloudPakForDataAuthenticator = void 0;
34
34
  var authenticator_1 = require("./authenticator");
35
- var token_managers_1 = require("../token-managers");
35
+ var cp4d_token_manager_1 = require("../token-managers/cp4d-token-manager");
36
36
  var token_request_based_authenticator_1 = require("./token-request-based-authenticator");
37
37
  /**
38
38
  * The CloudPakForDataAuthenticator will either use a username/password pair or a username/apikey pair to obtain
@@ -68,7 +68,7 @@ var CloudPakForDataAuthenticator = /** @class */ (function (_super) {
68
68
  // the param names are shared between the authenticator and the token
69
69
  // manager so we can just pass along the options object.
70
70
  // also, the token manager will handle input validation
71
- _this.tokenManager = new token_managers_1.Cp4dTokenManager(options);
71
+ _this.tokenManager = new cp4d_token_manager_1.Cp4dTokenManager(options);
72
72
  return _this;
73
73
  }
74
74
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2021, 2022 IBM Corp. All Rights Reserved.
2
+ * Copyright 2021, 202e IBM Corp. All Rights Reserved.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ContainerTokenManager } from '../token-managers';
16
+ import { ContainerTokenManager } from '../token-managers/container-token-manager';
17
17
  import { IamRequestOptions, IamRequestBasedAuthenticator } from './iam-request-based-authenticator';
18
18
  /** Configuration options for IAM authentication. */
19
19
  export interface Options extends IamRequestOptions {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright 2021, 2022 IBM Corp. All Rights Reserved.
3
+ * Copyright 2021, 202e IBM Corp. All Rights Reserved.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@ var __extends = (this && this.__extends) || (function () {
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.ContainerAuthenticator = void 0;
34
34
  var authenticator_1 = require("./authenticator");
35
- var token_managers_1 = require("../token-managers");
35
+ var container_token_manager_1 = require("../token-managers/container-token-manager");
36
36
  var iam_request_based_authenticator_1 = require("./iam-request-based-authenticator");
37
37
  /**
38
38
  * The ContainerAuthenticator will read a compute resource token from the file system
@@ -71,7 +71,7 @@ var ContainerAuthenticator = /** @class */ (function (_super) {
71
71
  // the param names are shared between the authenticator and the token
72
72
  // manager so we can just pass along the options object
73
73
  // the token manager will also handle the validation of required options
74
- _this.tokenManager = new token_managers_1.ContainerTokenManager(options);
74
+ _this.tokenManager = new container_token_manager_1.ContainerTokenManager(options);
75
75
  _this.crTokenFilename = options.crTokenFilename;
76
76
  _this.iamProfileName = options.iamProfileName;
77
77
  _this.iamProfileId = options.iamProfileId;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2019, 2022.
2
+ * (C) Copyright IBM Corp. 2019, 2023.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { IamTokenManager } from '../token-managers';
16
+ import { IamTokenManager } from '../token-managers/iam-token-manager';
17
17
  import { IamRequestOptions, IamRequestBasedAuthenticator } from './iam-request-based-authenticator';
18
18
  /** Configuration options for IAM authentication. */
19
19
  export interface Options extends IamRequestOptions {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * (C) Copyright IBM Corp. 2019, 2022.
3
+ * (C) Copyright IBM Corp. 2019, 2023.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -32,8 +32,8 @@ var __extends = (this && this.__extends) || (function () {
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.IamAuthenticator = void 0;
34
34
  var authenticator_1 = require("./authenticator");
35
- var token_managers_1 = require("../token-managers");
36
- var utils_1 = require("../utils");
35
+ var iam_token_manager_1 = require("../token-managers/iam-token-manager");
36
+ var helpers_1 = require("../utils/helpers");
37
37
  var iam_request_based_authenticator_1 = require("./iam-request-based-authenticator");
38
38
  /**
39
39
  * The IamAuthenticator will use the user-supplied `apikey`
@@ -70,11 +70,11 @@ var IamAuthenticator = /** @class */ (function (_super) {
70
70
  function IamAuthenticator(options) {
71
71
  var _this = _super.call(this, options) || this;
72
72
  _this.requiredOptions = ['apikey'];
73
- (0, utils_1.validateInput)(options, _this.requiredOptions);
73
+ (0, helpers_1.validateInput)(options, _this.requiredOptions);
74
74
  _this.apikey = options.apikey;
75
75
  // the param names are shared between the authenticator and the token
76
76
  // manager so we can just pass along the options object
77
- _this.tokenManager = new token_managers_1.IamTokenManager(options);
77
+ _this.tokenManager = new iam_token_manager_1.IamTokenManager(options);
78
78
  return _this;
79
79
  }
80
80
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2019, 2022.
2
+ * (C) Copyright IBM Corp. 2019, 202e.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { IamRequestBasedTokenManager } from '../token-managers';
16
+ import { IamRequestBasedTokenManager } from '../token-managers/iam-request-based-token-manager';
17
17
  import { BaseOptions, TokenRequestBasedAuthenticator } from './token-request-based-authenticator';
18
18
  /** Configuration options for IAM Request based authentication. */
19
19
  export interface IamRequestOptions extends BaseOptions {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * (C) Copyright IBM Corp. 2019, 2022.
3
+ * (C) Copyright IBM Corp. 2019, 202e.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ var __extends = (this && this.__extends) || (function () {
31
31
  })();
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.IamRequestBasedAuthenticator = void 0;
34
- var token_managers_1 = require("../token-managers");
34
+ var iam_request_based_token_manager_1 = require("../token-managers/iam-request-based-token-manager");
35
35
  var token_request_based_authenticator_1 = require("./token-request-based-authenticator");
36
36
  /**
37
37
  * The IamRequestBasedAuthenticator provides shared configuration and functionality
@@ -66,7 +66,7 @@ var IamRequestBasedAuthenticator = /** @class */ (function (_super) {
66
66
  _this.clientId = options.clientId;
67
67
  _this.clientSecret = options.clientSecret;
68
68
  _this.scope = options.scope;
69
- _this.tokenManager = new token_managers_1.IamRequestBasedTokenManager(options);
69
+ _this.tokenManager = new iam_request_based_token_manager_1.IamRequestBasedTokenManager(options);
70
70
  return _this;
71
71
  }
72
72
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2019, 2021.
2
+ * (C) Copyright IBM Corp. 2019, 2023.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
29
29
  * authentication type is implemented as an Authenticator for consumption by a service.
30
30
  *
31
31
  * classes:
32
- * AuthenticatorInterface: Implement this class to provide custom authentication schemes to services.
32
+ * AuthenticatorInterface: Implement this interface to provide custom authentication schemes to services.
33
33
  * Authenticator: Extend this class to provide custom authentication schemes to services.
34
34
  * BasicAuthenticator: Authenticator for passing supplied basic authentication information to service endpoint.
35
35
  * BearerTokenAuthenticator: Authenticator for passing supplied bearer token to service endpoint.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * (C) Copyright IBM Corp. 2019, 2021.
3
+ * (C) Copyright IBM Corp. 2019, 2023.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2019, 2022.
2
+ * (C) Copyright IBM Corp. 2019, 2023.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
15
15
  */
16
16
  /// <reference types="node" />
17
17
  import { OutgoingHttpHeaders } from 'http';
18
- import { JwtTokenManager } from '../token-managers';
18
+ import { JwtTokenManager } from '../token-managers/jwt-token-manager';
19
19
  import { Authenticator } from './authenticator';
20
20
  import { AuthenticateOptions } from './authenticator-interface';
21
21
  /** Configuration options for token-based authentication. */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * (C) Copyright IBM Corp. 2019, 2022.
3
+ * (C) Copyright IBM Corp. 2019, 2023.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.TokenRequestBasedAuthenticator = void 0;
37
37
  var extend_1 = __importDefault(require("extend"));
38
- var token_managers_1 = require("../token-managers");
38
+ var jwt_token_manager_1 = require("../token-managers/jwt-token-manager");
39
39
  var authenticator_1 = require("./authenticator");
40
40
  /**
41
41
  * Class for common functionality shared by token-request authenticators.
@@ -66,7 +66,7 @@ var TokenRequestBasedAuthenticator = /** @class */ (function (_super) {
66
66
  _this.url = options.url;
67
67
  // default to empty object
68
68
  _this.headers = options.headers || {};
69
- _this.tokenManager = new token_managers_1.JwtTokenManager(options);
69
+ _this.tokenManager = new jwt_token_manager_1.JwtTokenManager(options);
70
70
  return _this;
71
71
  }
72
72
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2021, 2022.
2
+ * (C) Copyright IBM Corp. 2021, 2023.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { VpcInstanceTokenManager } from '../token-managers';
16
+ import { VpcInstanceTokenManager } from '../token-managers/vpc-instance-token-manager';
17
17
  import { BaseOptions, TokenRequestBasedAuthenticator } from './token-request-based-authenticator';
18
18
  /** Configuration options for VpcInstance authentication. */
19
19
  export interface Options extends BaseOptions {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * (C) Copyright IBM Corp. 2021, 2022.
3
+ * (C) Copyright IBM Corp. 2021, 2023.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@ var __extends = (this && this.__extends) || (function () {
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.VpcInstanceAuthenticator = void 0;
34
34
  var authenticator_1 = require("./authenticator");
35
- var token_managers_1 = require("../token-managers");
35
+ var vpc_instance_token_manager_1 = require("../token-managers/vpc-instance-token-manager");
36
36
  var token_request_based_authenticator_1 = require("./token-request-based-authenticator");
37
37
  /**
38
38
  * The VpcInstanceAuthenticator implements an authentication scheme in which it retrieves an "instance identity token"
@@ -73,7 +73,7 @@ var VpcInstanceAuthenticator = /** @class */ (function (_super) {
73
73
  // the param names are shared between the authenticator and the token
74
74
  // manager so we can just pass along the options object.
75
75
  // also, the token manager will handle input validation
76
- _this.tokenManager = new token_managers_1.VpcInstanceTokenManager(options);
76
+ _this.tokenManager = new vpc_instance_token_manager_1.VpcInstanceTokenManager(options);
77
77
  return _this;
78
78
  }
79
79
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright 2021, 2022 IBM Corp. All Rights Reserved.
2
+ * Copyright 2021, 2023 IBM Corp. All Rights Reserved.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -69,5 +69,15 @@ export declare class ContainerTokenManager extends IamRequestBasedTokenManager {
69
69
  * Request an IAM token using a compute resource token.
70
70
  */
71
71
  protected requestToken(): Promise<any>;
72
+ /**
73
+ * Retrieves the CR token from a file using this search order:
74
+ * 1. User-specified filename (if specified)
75
+ * 2. Default file #1 (/var/run/secrets/tokens/vault-token)
76
+ * 3. Default file #2 (/var/run/secrets/tokens/sa-token)
77
+ * First one found wins.
78
+ *
79
+ * @returns the CR token value as a string
80
+ */
81
+ protected getCrToken(): string;
72
82
  }
73
83
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright 2021, 2022 IBM Corp. All Rights Reserved.
3
+ * Copyright 2021, 2023 IBM Corp. All Rights Reserved.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -65,15 +65,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
65
65
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
66
66
  }
67
67
  };
68
- var __importDefault = (this && this.__importDefault) || function (mod) {
69
- return (mod && mod.__esModule) ? mod : { "default": mod };
70
- };
71
68
  Object.defineProperty(exports, "__esModule", { value: true });
72
69
  exports.ContainerTokenManager = void 0;
73
- var logger_1 = __importDefault(require("../../lib/logger"));
74
- var utils_1 = require("../utils");
70
+ var helpers_1 = require("../utils/helpers");
71
+ var file_reading_helpers_1 = require("../utils/file-reading-helpers");
75
72
  var iam_request_based_token_manager_1 = require("./iam-request-based-token-manager");
76
- var DEFAULT_CR_TOKEN_FILEPATH = '/var/run/secrets/tokens/vault-token';
73
+ var DEFAULT_CR_TOKEN_FILEPATH1 = '/var/run/secrets/tokens/vault-token';
74
+ var DEFAULT_CR_TOKEN_FILEPATH2 = '/var/run/secrets/tokens/sa-token';
77
75
  /**
78
76
  * The ContainerTokenManager retrieves a compute resource token from a file on the container. This token
79
77
  * is used to perform the necessary interactions with the IAM token service to obtain and store a suitable
@@ -106,10 +104,12 @@ var ContainerTokenManager = /** @class */ (function (_super) {
106
104
  // all parameters are optional
107
105
  options = options || {};
108
106
  _this = _super.call(this, options) || this;
109
- if (!(0, utils_1.atLeastOne)(options.iamProfileId, options.iamProfileName)) {
107
+ if (!(0, helpers_1.atLeastOne)(options.iamProfileId, options.iamProfileName)) {
110
108
  throw new Error('At least one of `iamProfileName` or `iamProfileId` must be specified.');
111
109
  }
112
- _this.crTokenFilename = options.crTokenFilename || DEFAULT_CR_TOKEN_FILEPATH;
110
+ if (options.crTokenFilename) {
111
+ _this.crTokenFilename = options.crTokenFilename;
112
+ }
113
113
  if (options.iamProfileName) {
114
114
  _this.iamProfileName = options.iamProfileName;
115
115
  }
@@ -146,10 +146,8 @@ var ContainerTokenManager = /** @class */ (function (_super) {
146
146
  */
147
147
  ContainerTokenManager.prototype.requestToken = function () {
148
148
  return __awaiter(this, void 0, void 0, function () {
149
- var crToken;
150
149
  return __generator(this, function (_a) {
151
- crToken = getCrToken(this.crTokenFilename);
152
- this.formData.cr_token = crToken;
150
+ this.formData.cr_token = this.getCrToken();
153
151
  // these member variables can be reset, set them in the form data right
154
152
  // before making the request to ensure they're up to date
155
153
  if (this.iamProfileName) {
@@ -162,11 +160,37 @@ var ContainerTokenManager = /** @class */ (function (_super) {
162
160
  });
163
161
  });
164
162
  };
163
+ /**
164
+ * Retrieves the CR token from a file using this search order:
165
+ * 1. User-specified filename (if specified)
166
+ * 2. Default file #1 (/var/run/secrets/tokens/vault-token)
167
+ * 3. Default file #2 (/var/run/secrets/tokens/sa-token)
168
+ * First one found wins.
169
+ *
170
+ * @returns the CR token value as a string
171
+ */
172
+ ContainerTokenManager.prototype.getCrToken = function () {
173
+ try {
174
+ var crToken = null;
175
+ if (this.crTokenFilename) {
176
+ // If the user specified a filename, then try to read from that.
177
+ crToken = (0, file_reading_helpers_1.readCrTokenFile)(this.crTokenFilename);
178
+ }
179
+ else {
180
+ // If no filename was specified, then try our two default filenames.
181
+ try {
182
+ crToken = (0, file_reading_helpers_1.readCrTokenFile)(DEFAULT_CR_TOKEN_FILEPATH1);
183
+ }
184
+ catch (err) {
185
+ crToken = (0, file_reading_helpers_1.readCrTokenFile)(DEFAULT_CR_TOKEN_FILEPATH2);
186
+ }
187
+ }
188
+ return crToken;
189
+ }
190
+ catch (err) {
191
+ throw new Error("Error reading CR token file: ".concat(err.toString()));
192
+ }
193
+ };
165
194
  return ContainerTokenManager;
166
195
  }(iam_request_based_token_manager_1.IamRequestBasedTokenManager));
167
196
  exports.ContainerTokenManager = ContainerTokenManager;
168
- function getCrToken(filename) {
169
- logger_1.default.debug("Attempting to read CR token from file: ".concat(filename));
170
- // moving the actual read to another file to isolate usage of node-only packages like `fs`
171
- return (0, utils_1.readCrTokenFile)(filename);
172
- }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2019, 2022.
2
+ * (C) Copyright IBM Corp. 2019, 2023.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * (C) Copyright IBM Corp. 2019, 2022.
3
+ * (C) Copyright IBM Corp. 2019, 2023.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Cp4dTokenManager = void 0;
37
37
  var extend_1 = __importDefault(require("extend"));
38
- var utils_1 = require("../utils");
38
+ var helpers_1 = require("../utils/helpers");
39
39
  var jwt_token_manager_1 = require("./jwt-token-manager");
40
40
  /**
41
41
  * Token Manager of CloudPak for data.
@@ -67,7 +67,7 @@ var Cp4dTokenManager = /** @class */ (function (_super) {
67
67
  if ((!options.password && !options.apikey) || (options.password && options.apikey)) {
68
68
  throw new Error('Exactly one of `apikey` or `password` must be specified.');
69
69
  }
70
- (0, utils_1.validateInput)(options, _this.requiredOptions);
70
+ (0, helpers_1.validateInput)(options, _this.requiredOptions);
71
71
  var tokenApiPath = '/v1/authorize';
72
72
  // do not append the path if user already has
73
73
  if (_this.url && !_this.url.endsWith(tokenApiPath)) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2019, 2022.
2
+ * (C) Copyright IBM Corp. 2019, 2023.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * (C) Copyright IBM Corp. 2019, 2022.
3
+ * (C) Copyright IBM Corp. 2019, 2023.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.IamRequestBasedTokenManager = void 0;
37
37
  var extend_1 = __importDefault(require("extend"));
38
38
  var logger_1 = __importDefault(require("../../lib/logger"));
39
- var utils_1 = require("../utils");
39
+ var helpers_1 = require("../utils/helpers");
40
40
  var jwt_token_manager_1 = require("./jwt-token-manager");
41
41
  var CLIENT_ID_SECRET_WARNING = 'Warning: Client ID and Secret must BOTH be given, or the header will not be included.';
42
42
  var DEFAULT_IAM_URL = 'https://iam.cloud.ibm.com';
@@ -74,7 +74,7 @@ var IamRequestBasedTokenManager = /** @class */ (function (_super) {
74
74
  options = options || {};
75
75
  _this = _super.call(this, options) || this;
76
76
  // Canonicalize the URL by removing the operation path if it was specified by the user.
77
- _this.url = _this.url ? (0, utils_1.removeSuffix)(_this.url, OPERATION_PATH) : DEFAULT_IAM_URL;
77
+ _this.url = _this.url ? (0, helpers_1.removeSuffix)(_this.url, OPERATION_PATH) : DEFAULT_IAM_URL;
78
78
  if (options.clientId) {
79
79
  _this.clientId = options.clientId;
80
80
  }
@@ -84,7 +84,7 @@ var IamRequestBasedTokenManager = /** @class */ (function (_super) {
84
84
  if (options.scope) {
85
85
  _this.scope = options.scope;
86
86
  }
87
- if ((0, utils_1.onlyOne)(options.clientId, options.clientSecret)) {
87
+ if ((0, helpers_1.onlyOne)(options.clientId, options.clientSecret)) {
88
88
  // tslint:disable-next-line
89
89
  logger_1.default.warn(CLIENT_ID_SECRET_WARNING);
90
90
  }
@@ -114,7 +114,7 @@ var IamRequestBasedTokenManager = /** @class */ (function (_super) {
114
114
  IamRequestBasedTokenManager.prototype.setClientIdAndSecret = function (clientId, clientSecret) {
115
115
  this.clientId = clientId;
116
116
  this.clientSecret = clientSecret;
117
- if ((0, utils_1.onlyOne)(clientId, clientSecret)) {
117
+ if ((0, helpers_1.onlyOne)(clientId, clientSecret)) {
118
118
  // tslint:disable-next-line
119
119
  logger_1.default.warn(CLIENT_ID_SECRET_WARNING);
120
120
  }
@@ -152,7 +152,7 @@ var IamRequestBasedTokenManager = /** @class */ (function (_super) {
152
152
  };
153
153
  // If both the clientId and secret were specified by the user, then use them.
154
154
  if (this.clientId && this.clientSecret) {
155
- requiredHeaders.Authorization = (0, utils_1.computeBasicAuthHeader)(this.clientId, this.clientSecret);
155
+ requiredHeaders.Authorization = (0, helpers_1.computeBasicAuthHeader)(this.clientId, this.clientSecret);
156
156
  }
157
157
  if (this.scope) {
158
158
  this.formData.scope = this.scope;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * (C) Copyright IBM Corp. 2019, 2022.
2
+ * (C) Copyright IBM Corp. 2019, 2023.
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * (C) Copyright IBM Corp. 2019, 2022.
3
+ * (C) Copyright IBM Corp. 2019, 2023.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ var __extends = (this && this.__extends) || (function () {
31
31
  })();
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.IamTokenManager = void 0;
34
- var utils_1 = require("../utils");
34
+ var helpers_1 = require("../utils/helpers");
35
35
  var iam_request_based_token_manager_1 = require("./iam-request-based-token-manager");
36
36
  /**
37
37
  * The IAMTokenManager takes an api key and performs the necessary interactions with
@@ -62,7 +62,7 @@ var IamTokenManager = /** @class */ (function (_super) {
62
62
  function IamTokenManager(options) {
63
63
  var _this = _super.call(this, options) || this;
64
64
  _this.requiredOptions = ['apikey'];
65
- (0, utils_1.validateInput)(options, _this.requiredOptions);
65
+ (0, helpers_1.validateInput)(options, _this.requiredOptions);
66
66
  _this.apikey = options.apikey;
67
67
  // construct form data for the apikey use case of iam token management
68
68
  _this.formData.apikey = _this.apikey;