ibm-cloud-sdk-core 4.2.5 → 4.3.1
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.
- package/.secrets.baseline +17 -17
- package/CHANGELOG.md +14 -0
- package/auth/token-managers/container-token-manager.d.ts +1 -1
- package/auth/token-managers/container-token-manager.js +3 -1
- package/auth/token-managers/cp4d-token-manager.d.ts +1 -1
- package/auth/token-managers/cp4d-token-manager.js +4 -1
- package/auth/token-managers/iam-request-based-token-manager.js +2 -1
- package/auth/token-managers/iam-token-manager.d.ts +1 -1
- package/auth/token-managers/iam-token-manager.js +3 -1
- package/auth/token-managers/mcsp-token-manager.d.ts +1 -1
- package/auth/token-managers/mcsp-token-manager.js +4 -1
- package/auth/token-managers/token-manager.d.ts +1 -0
- package/auth/token-managers/vpc-instance-token-manager.js +4 -0
- package/auth/utils/file-reading-helpers.d.ts +1 -1
- package/auth/utils/file-reading-helpers.js +1 -1
- package/auth/utils/read-external-sources.js +4 -4
- package/build/docs/ibm-cloud-sdk-core.atleastone.md +48 -4
- package/build/docs/ibm-cloud-sdk-core.atmostone.md +48 -4
- package/build/docs/ibm-cloud-sdk-core.authenticator.authenticate.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.authenticator.md +270 -18
- package/build/docs/ibm-cloud-sdk-core.authenticatorinterface.authenticate.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.authenticatorinterface.md +33 -4
- package/build/docs/ibm-cloud-sdk-core.baseservice._constructor_.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.baseservice.configureservice.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.baseservice.convertmodel.md +64 -5
- package/build/docs/ibm-cloud-sdk-core.baseservice.createrequest.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.baseservice.createrequestanddeserializeresponse.md +64 -5
- package/build/docs/ibm-cloud-sdk-core.baseservice.enableretries.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.baseservice.md +288 -21
- package/build/docs/ibm-cloud-sdk-core.baseservice.setdefaultheaders.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.baseservice.setenablegzipcompression.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.baseservice.setserviceurl.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator._constructor_.md +33 -3
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator.authenticate.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.basicauthenticator.md +137 -11
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator._constructor_.md +33 -3
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.authenticate.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.md +132 -11
- package/build/docs/ibm-cloud-sdk-core.bearertokenauthenticator.setbearertoken.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.buildrequestfileobject.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.checkcredentials.md +48 -4
- package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator._constructor_.md +33 -3
- package/build/docs/ibm-cloud-sdk-core.cloudpakfordataauthenticator.md +121 -10
- package/build/docs/ibm-cloud-sdk-core.computebasicauthheader.md +48 -4
- package/build/docs/ibm-cloud-sdk-core.constructfilepath.md +30 -3
- package/build/docs/ibm-cloud-sdk-core.constructserviceurl.md +64 -5
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator._constructor_.md +33 -3
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.md +144 -12
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setcrtokenfilename.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setiamprofileid.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.containerauthenticator.setiamprofilename.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager._constructor_.md +33 -3
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.md +121 -10
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setcrtokenfilename.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setiamprofileid.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.containertokenmanager.setiamprofilename.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.cp4dtokenmanager._constructor_.md +33 -3
- package/build/docs/ibm-cloud-sdk-core.cp4dtokenmanager.md +102 -9
- package/build/docs/ibm-cloud-sdk-core.fileexistsatpath.md +30 -3
- package/build/docs/ibm-cloud-sdk-core.fileobject.md +57 -4
- package/build/docs/ibm-cloud-sdk-core.fileoptions.md +59 -4
- package/build/docs/ibm-cloud-sdk-core.filestream.md +38 -3
- package/build/docs/ibm-cloud-sdk-core.filewithmetadata.md +72 -5
- package/build/docs/ibm-cloud-sdk-core.getauthenticatorfromenvironment.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.getcontenttype.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.getformat.md +46 -4
- package/build/docs/ibm-cloud-sdk-core.getmissingparams.md +48 -4
- package/build/docs/ibm-cloud-sdk-core.getnewlogger.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.getqueryparam.md +48 -4
- package/build/docs/ibm-cloud-sdk-core.iamauthenticator._constructor_.md +33 -3
- package/build/docs/ibm-cloud-sdk-core.iamauthenticator.md +121 -10
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator._constructor_.md +33 -3
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.md +187 -14
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.setclientidandsecret.md +48 -4
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedauthenticator.setscope.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager._constructor_.md +33 -3
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.md +197 -15
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.savetokeninfo.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.setclientidandsecret.md +48 -4
- package/build/docs/ibm-cloud-sdk-core.iamrequestbasedtokenmanager.setscope.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.iamrequestoptions.md +78 -5
- package/build/docs/ibm-cloud-sdk-core.iamtokenmanager._constructor_.md +33 -3
- package/build/docs/ibm-cloud-sdk-core.iamtokenmanager.md +71 -6
- package/build/docs/ibm-cloud-sdk-core.isemptyobject.md +30 -3
- package/build/docs/ibm-cloud-sdk-core.isfiledata.md +30 -3
- package/build/docs/ibm-cloud-sdk-core.isfilewithmetadata.md +30 -3
- package/build/docs/ibm-cloud-sdk-core.ishtml.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.isjsonmimetype.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager._constructor_.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.md +139 -11
- package/build/docs/ibm-cloud-sdk-core.jwttokenmanager.savetokeninfo.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.mcspauthenticator._constructor_.md +33 -3
- package/build/docs/ibm-cloud-sdk-core.mcspauthenticator.md +121 -10
- package/build/docs/ibm-cloud-sdk-core.mcsptokenmanager._constructor_.md +33 -3
- package/build/docs/ibm-cloud-sdk-core.mcsptokenmanager.md +102 -9
- package/build/docs/ibm-cloud-sdk-core.md +794 -75
- package/build/docs/ibm-cloud-sdk-core.noauthauthenticator.authenticate.md +30 -3
- package/build/docs/ibm-cloud-sdk-core.noauthauthenticator.md +42 -4
- package/build/docs/ibm-cloud-sdk-core.onlyone.md +48 -4
- package/build/docs/ibm-cloud-sdk-core.readcrtokenfile.md +30 -3
- package/build/docs/ibm-cloud-sdk-core.readexternalsources.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.removesuffix.md +48 -4
- package/build/docs/ibm-cloud-sdk-core.sdklogger.md +106 -7
- package/build/docs/ibm-cloud-sdk-core.streamtopromise.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.striptrailingslash.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.tokenmanager._constructor_.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.md +329 -21
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.savetokeninfo.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.setdisablesslverification.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.setheaders.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.tokenmanager.useragent.md +11 -0
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator._constructor_.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.authenticate.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.md +189 -14
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.setdisablesslverification.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.tokenrequestbasedauthenticator.setheaders.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.tolowerkeys.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkforsuccessfulexecution.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkmediaheaders.md +64 -5
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkurlandmethod.md +64 -5
- package/build/docs/ibm-cloud-sdk-core.unittestutils.checkuserheader.md +64 -5
- package/build/docs/ibm-cloud-sdk-core.unittestutils.expecttobepromise.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.unittestutils.getoptions.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.unittestutils.md +77 -8
- package/build/docs/ibm-cloud-sdk-core.useroptions.md +154 -9
- package/build/docs/ibm-cloud-sdk-core.validateinput.md +48 -4
- package/build/docs/ibm-cloud-sdk-core.validateparams.md +64 -5
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator._constructor_.md +33 -3
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.md +130 -11
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.setiamprofilecrn.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.vpcinstanceauthenticator.setiamprofileid.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager._constructor_.md +33 -3
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.md +105 -9
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.setiamprofilecrn.md +32 -3
- package/build/docs/ibm-cloud-sdk-core.vpcinstancetokenmanager.setiamprofileid.md +32 -3
- package/build/docs/index.md +20 -3
- package/docs/ibm-cloud-sdk-core.api.json +31 -1
- package/es/auth/token-managers/container-token-manager.d.ts +1 -1
- package/es/auth/token-managers/container-token-manager.js +3 -1
- package/es/auth/token-managers/cp4d-token-manager.d.ts +1 -1
- package/es/auth/token-managers/cp4d-token-manager.js +4 -1
- package/es/auth/token-managers/iam-request-based-token-manager.js +2 -1
- package/es/auth/token-managers/iam-token-manager.d.ts +1 -1
- package/es/auth/token-managers/iam-token-manager.js +3 -1
- package/es/auth/token-managers/mcsp-token-manager.d.ts +1 -1
- package/es/auth/token-managers/mcsp-token-manager.js +4 -1
- package/es/auth/token-managers/token-manager.d.ts +1 -0
- package/es/auth/token-managers/vpc-instance-token-manager.js +4 -0
- package/es/auth/utils/file-reading-helpers.d.ts +1 -1
- package/es/auth/utils/file-reading-helpers.js +1 -1
- package/es/auth/utils/read-external-sources.js +4 -4
- package/es/lib/base-service.d.ts +2 -1
- package/es/lib/base-service.js +9 -1
- package/es/lib/build-user-agent.d.ts +21 -0
- package/es/lib/build-user-agent.js +27 -0
- package/es/tsdoc-metadata.json +1 -1
- package/etc/ibm-cloud-sdk-core.api.md +2 -0
- package/ibm-cloud-sdk-core.d.ts +3 -1
- package/lib/base-service.d.ts +2 -1
- package/lib/base-service.js +9 -1
- package/lib/build-user-agent.d.ts +21 -0
- package/lib/build-user-agent.js +32 -0
- package/package.json +9 -10
- package/temp/ibm-cloud-sdk-core.api.json +31 -1
- package/temp/ibm-cloud-sdk-core.api.md +2 -0
- package/.nvmrc +0 -1
|
@@ -14,9 +14,39 @@ constructor(options: Options);
|
|
|
14
14
|
|
|
15
15
|
## Parameters
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
options
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
Options
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
Configuration options. This should be an object containing these fields: - url: (optional) the endpoint URL for the VPC Instance Metadata Service (default value: "http://169.254.169.254") - iamProfileCrn: (optional) the CRN of the linked IAM trusted profile to be used to obtain the IAM access token - iamProfileId: (optional) the ID of the linked IAM trusted profile to be used to obtain the IAM access token
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
</tbody></table>
|
|
20
50
|
|
|
21
51
|
## Remarks
|
|
22
52
|
|
|
@@ -15,16 +15,112 @@ export declare class VpcInstanceTokenManager extends JwtTokenManager
|
|
|
15
15
|
|
|
16
16
|
## Constructors
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
<table><thead><tr><th>
|
|
19
|
+
|
|
20
|
+
Constructor
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
</th><th>
|
|
24
|
+
|
|
25
|
+
Modifiers
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
</th><th>
|
|
29
|
+
|
|
30
|
+
Description
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
</th></tr></thead>
|
|
34
|
+
<tbody><tr><td>
|
|
35
|
+
|
|
36
|
+
[(constructor)(options)](./ibm-cloud-sdk-core.vpcinstancetokenmanager._constructor_.md)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
</td><td>
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
</td><td>
|
|
43
|
+
|
|
44
|
+
Create a new VpcInstanceTokenManager instance.
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
</td></tr>
|
|
48
|
+
</tbody></table>
|
|
21
49
|
|
|
22
50
|
## Methods
|
|
23
51
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
52
|
+
<table><thead><tr><th>
|
|
53
|
+
|
|
54
|
+
Method
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
</th><th>
|
|
58
|
+
|
|
59
|
+
Modifiers
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
</th><th>
|
|
63
|
+
|
|
64
|
+
Description
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
</th></tr></thead>
|
|
68
|
+
<tbody><tr><td>
|
|
69
|
+
|
|
70
|
+
[isTokenExpired()](./ibm-cloud-sdk-core.vpcinstancetokenmanager.istokenexpired.md)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
</td><td>
|
|
74
|
+
|
|
75
|
+
`protected`
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
</td><td>
|
|
79
|
+
|
|
80
|
+
Returns true iff the currently-cached IAM access token is expired. We'll consider an access token as expired when we reach its IAM server-reported expiration time minus our expiration window (10 secs). We do this to avoid using an access token that might expire in the middle of a long-running transaction within an IBM Cloud service.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
</td></tr>
|
|
84
|
+
<tr><td>
|
|
85
|
+
|
|
86
|
+
[requestToken()](./ibm-cloud-sdk-core.vpcinstancetokenmanager.requesttoken.md)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
</td><td>
|
|
90
|
+
|
|
91
|
+
`protected`
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
</td><td>
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
</td></tr>
|
|
98
|
+
<tr><td>
|
|
99
|
+
|
|
100
|
+
[setIamProfileCrn(iamProfileCrn)](./ibm-cloud-sdk-core.vpcinstancetokenmanager.setiamprofilecrn.md)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
</td><td>
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
</td><td>
|
|
107
|
+
|
|
108
|
+
Sets the CRN of the IAM trusted profile to use when fetching the access token from the IAM token server.
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
</td></tr>
|
|
112
|
+
<tr><td>
|
|
113
|
+
|
|
114
|
+
[setIamProfileId(iamProfileId)](./ibm-cloud-sdk-core.vpcinstancetokenmanager.setiamprofileid.md)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
</td><td>
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
</td><td>
|
|
121
|
+
|
|
122
|
+
Sets the Id of the IAM trusted profile to use when fetching the access token from the IAM token server.
|
|
123
|
+
|
|
30
124
|
|
|
125
|
+
</td></tr>
|
|
126
|
+
</tbody></table>
|
|
@@ -14,10 +14,39 @@ setIamProfileCrn(iamProfileCrn: string): void;
|
|
|
14
14
|
|
|
15
15
|
## Parameters
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
| --- | --- | --- |
|
|
19
|
-
| iamProfileCrn | string | the CRN of the IAM trusted profile |
|
|
17
|
+
<table><thead><tr><th>
|
|
20
18
|
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
iamProfileCrn
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
string
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
the CRN of the IAM trusted profile
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
</tbody></table>
|
|
21
50
|
**Returns:**
|
|
22
51
|
|
|
23
52
|
void
|
|
@@ -14,10 +14,39 @@ setIamProfileId(iamProfileId: string): void;
|
|
|
14
14
|
|
|
15
15
|
## Parameters
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
| --- | --- | --- |
|
|
19
|
-
| iamProfileId | string | the ID of the IAM trusted profile |
|
|
17
|
+
<table><thead><tr><th>
|
|
20
18
|
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
iamProfileId
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
string
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
the ID of the IAM trusted profile
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
</tbody></table>
|
|
21
50
|
**Returns:**
|
|
22
51
|
|
|
23
52
|
void
|
package/build/docs/index.md
CHANGED
|
@@ -6,7 +6,24 @@
|
|
|
6
6
|
|
|
7
7
|
## Packages
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
| --- | --- |
|
|
11
|
-
| [ibm-cloud-sdk-core](./ibm-cloud-sdk-core.md) | |
|
|
9
|
+
<table><thead><tr><th>
|
|
12
10
|
|
|
11
|
+
Package
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
</th><th>
|
|
15
|
+
|
|
16
|
+
Description
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
</th></tr></thead>
|
|
20
|
+
<tbody><tr><td>
|
|
21
|
+
|
|
22
|
+
[ibm-cloud-sdk-core](./ibm-cloud-sdk-core.md)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
</td><td>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
</td></tr>
|
|
29
|
+
</tbody></table>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"metadata": {
|
|
3
3
|
"toolPackage": "@microsoft/api-extractor",
|
|
4
|
-
"toolVersion": "7.
|
|
4
|
+
"toolVersion": "7.43.1",
|
|
5
5
|
"schemaVersion": 1011,
|
|
6
6
|
"oldestForwardsCompatibleVersion": 1001,
|
|
7
7
|
"tsdocConfig": {
|
|
@@ -6951,6 +6951,36 @@
|
|
|
6951
6951
|
"isStatic": false,
|
|
6952
6952
|
"isProtected": true,
|
|
6953
6953
|
"isAbstract": false
|
|
6954
|
+
},
|
|
6955
|
+
{
|
|
6956
|
+
"kind": "Property",
|
|
6957
|
+
"canonicalReference": "ibm-cloud-sdk-core!TokenManager#userAgent:member",
|
|
6958
|
+
"docComment": "",
|
|
6959
|
+
"excerptTokens": [
|
|
6960
|
+
{
|
|
6961
|
+
"kind": "Content",
|
|
6962
|
+
"text": "protected userAgent: "
|
|
6963
|
+
},
|
|
6964
|
+
{
|
|
6965
|
+
"kind": "Content",
|
|
6966
|
+
"text": "string"
|
|
6967
|
+
},
|
|
6968
|
+
{
|
|
6969
|
+
"kind": "Content",
|
|
6970
|
+
"text": ";"
|
|
6971
|
+
}
|
|
6972
|
+
],
|
|
6973
|
+
"isReadonly": false,
|
|
6974
|
+
"isOptional": false,
|
|
6975
|
+
"releaseTag": "Public",
|
|
6976
|
+
"name": "userAgent",
|
|
6977
|
+
"propertyTypeTokenRange": {
|
|
6978
|
+
"startIndex": 1,
|
|
6979
|
+
"endIndex": 2
|
|
6980
|
+
},
|
|
6981
|
+
"isStatic": false,
|
|
6982
|
+
"isProtected": true,
|
|
6983
|
+
"isAbstract": false
|
|
6954
6984
|
}
|
|
6955
6985
|
],
|
|
6956
6986
|
"implementsTokenRanges": []
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* (C) Copyright IBM Corp. 2021, 2024.
|
|
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.
|
|
@@ -24,6 +24,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
24
24
|
};
|
|
25
25
|
import { atLeastOne } from '../utils/helpers';
|
|
26
26
|
import { readCrTokenFile } from '../utils/file-reading-helpers';
|
|
27
|
+
import { buildUserAgent } from '../../lib/build-user-agent';
|
|
27
28
|
import { IamRequestBasedTokenManager } from './iam-request-based-token-manager';
|
|
28
29
|
const DEFAULT_CR_TOKEN_FILEPATH1 = '/var/run/secrets/tokens/vault-token';
|
|
29
30
|
const DEFAULT_CR_TOKEN_FILEPATH2 = '/var/run/secrets/tokens/sa-token';
|
|
@@ -71,6 +72,7 @@ export class ContainerTokenManager extends IamRequestBasedTokenManager {
|
|
|
71
72
|
}
|
|
72
73
|
// construct form data for the cr token use case of iam token management
|
|
73
74
|
this.formData.grant_type = 'urn:ibm:params:oauth:grant-type:cr-token';
|
|
75
|
+
this.userAgent = buildUserAgent('container-authenticator');
|
|
74
76
|
}
|
|
75
77
|
/**
|
|
76
78
|
* Sets the "crTokenFilename" field
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2019,
|
|
2
|
+
* (C) Copyright IBM Corp. 2019, 2024.
|
|
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,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import extend from 'extend';
|
|
17
17
|
import { validateInput } from '../utils/helpers';
|
|
18
|
+
import { buildUserAgent } from '../../lib/build-user-agent';
|
|
18
19
|
import { JwtTokenManager } from './jwt-token-manager';
|
|
19
20
|
/**
|
|
20
21
|
* Token Manager of CloudPak for data.
|
|
@@ -54,11 +55,13 @@ export class Cp4dTokenManager extends JwtTokenManager {
|
|
|
54
55
|
this.username = options.username;
|
|
55
56
|
this.password = options.password;
|
|
56
57
|
this.apikey = options.apikey;
|
|
58
|
+
this.userAgent = buildUserAgent('cp4d-authenticator');
|
|
57
59
|
}
|
|
58
60
|
requestToken() {
|
|
59
61
|
// these cannot be overwritten
|
|
60
62
|
const requiredHeaders = {
|
|
61
63
|
'Content-Type': 'application/json',
|
|
64
|
+
'User-Agent': this.userAgent,
|
|
62
65
|
};
|
|
63
66
|
const parameters = {
|
|
64
67
|
options: {
|
|
@@ -125,7 +125,8 @@ export class IamRequestBasedTokenManager extends JwtTokenManager {
|
|
|
125
125
|
requestToken() {
|
|
126
126
|
// these cannot be overwritten
|
|
127
127
|
const requiredHeaders = {
|
|
128
|
-
'Content-
|
|
128
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
129
|
+
'User-Agent': this.userAgent,
|
|
129
130
|
};
|
|
130
131
|
// If both the clientId and secret were specified by the user, then use them.
|
|
131
132
|
if (this.clientId && this.clientSecret) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2019,
|
|
2
|
+
* (C) Copyright IBM Corp. 2019, 2024.
|
|
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.
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { validateInput } from '../utils/helpers';
|
|
17
|
+
import { buildUserAgent } from '../../lib/build-user-agent';
|
|
17
18
|
import { IamRequestBasedTokenManager } from './iam-request-based-token-manager';
|
|
18
19
|
/**
|
|
19
20
|
* The IAMTokenManager takes an api key and performs the necessary interactions with
|
|
@@ -49,5 +50,6 @@ export class IamTokenManager extends IamRequestBasedTokenManager {
|
|
|
49
50
|
this.formData.apikey = this.apikey;
|
|
50
51
|
this.formData.grant_type = 'urn:ibm:params:oauth:grant-type:apikey';
|
|
51
52
|
this.formData.response_type = 'cloud_iam';
|
|
53
|
+
this.userAgent = buildUserAgent('iam-authenticator');
|
|
52
54
|
}
|
|
53
55
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2023.
|
|
2
|
+
* (C) Copyright IBM Corp. 2023, 2024.
|
|
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,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import extend from 'extend';
|
|
17
17
|
import { validateInput } from '../utils/helpers';
|
|
18
|
+
import { buildUserAgent } from '../../lib/build-user-agent';
|
|
18
19
|
import { JwtTokenManager } from './jwt-token-manager';
|
|
19
20
|
/**
|
|
20
21
|
* This is the path associated with the operation used to obtain
|
|
@@ -47,11 +48,13 @@ export class McspTokenManager extends JwtTokenManager {
|
|
|
47
48
|
this.tokenName = 'token';
|
|
48
49
|
validateInput(options, this.requiredOptions);
|
|
49
50
|
this.apikey = options.apikey;
|
|
51
|
+
this.userAgent = buildUserAgent('mcsp-authenticator');
|
|
50
52
|
}
|
|
51
53
|
requestToken() {
|
|
52
54
|
const requiredHeaders = {
|
|
53
55
|
Accept: 'application/json',
|
|
54
56
|
'Content-Type': 'application/json',
|
|
57
|
+
'User-Agent': this.userAgent,
|
|
55
58
|
};
|
|
56
59
|
const parameters = {
|
|
57
60
|
options: {
|
|
@@ -39,6 +39,7 @@ export type TokenManagerOptions = {
|
|
|
39
39
|
*/
|
|
40
40
|
export declare class TokenManager {
|
|
41
41
|
protected url: string;
|
|
42
|
+
protected userAgent: string;
|
|
42
43
|
protected disableSslVerification: boolean;
|
|
43
44
|
protected headers: OutgoingHttpHeaders;
|
|
44
45
|
protected requestWrapperInstance: RequestWrapper;
|
|
@@ -24,6 +24,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
24
24
|
};
|
|
25
25
|
import logger from '../../lib/logger';
|
|
26
26
|
import { atMostOne, getCurrentTime } from '../utils/helpers';
|
|
27
|
+
import { buildUserAgent } from '../../lib/build-user-agent';
|
|
27
28
|
import { JwtTokenManager } from './jwt-token-manager';
|
|
28
29
|
const DEFAULT_IMS_ENDPOINT = 'http://169.254.169.254';
|
|
29
30
|
const METADATA_SERVICE_VERSION = '2022-03-01';
|
|
@@ -59,6 +60,7 @@ export class VpcInstanceTokenManager extends JwtTokenManager {
|
|
|
59
60
|
if (options.iamProfileId) {
|
|
60
61
|
this.iamProfileId = options.iamProfileId;
|
|
61
62
|
}
|
|
63
|
+
this.userAgent = buildUserAgent('vpc-instance-authenticator');
|
|
62
64
|
}
|
|
63
65
|
/**
|
|
64
66
|
* Sets the CRN of the IAM trusted profile to use when fetching the access token from the IAM token server.
|
|
@@ -99,6 +101,7 @@ export class VpcInstanceTokenManager extends JwtTokenManager {
|
|
|
99
101
|
method: 'POST',
|
|
100
102
|
headers: {
|
|
101
103
|
'Content-Type': 'application/json',
|
|
104
|
+
'User-Agent': this.userAgent,
|
|
102
105
|
Accept: 'application/json',
|
|
103
106
|
Authorization: `Bearer ${instanceIdentityToken}`,
|
|
104
107
|
},
|
|
@@ -122,6 +125,7 @@ export class VpcInstanceTokenManager extends JwtTokenManager {
|
|
|
122
125
|
method: 'PUT',
|
|
123
126
|
headers: {
|
|
124
127
|
'Content-Type': 'application/json',
|
|
128
|
+
'User-Agent': this.userAgent,
|
|
125
129
|
Accept: 'application/json',
|
|
126
130
|
'Metadata-Flavor': 'ibm',
|
|
127
131
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-restricted-syntax */
|
|
2
2
|
/**
|
|
3
|
-
* (C) Copyright IBM Corp. 2019,
|
|
3
|
+
* (C) Copyright IBM Corp. 2019, 2024.
|
|
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.
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import camelcase from 'camelcase';
|
|
18
|
-
import isEmpty from 'lodash.isempty';
|
|
19
18
|
import logger from '../../lib/logger';
|
|
19
|
+
import { isEmptyObject } from '../../lib/helper';
|
|
20
20
|
import { readCredentialsFile } from './file-reading-helpers';
|
|
21
21
|
/**
|
|
22
22
|
* Read properties stored in external sources like Environment Variables,
|
|
@@ -42,10 +42,10 @@ function getProperties(serviceName) {
|
|
|
42
42
|
// only get properties from one source, return null if none found
|
|
43
43
|
let properties = null;
|
|
44
44
|
properties = filterPropertiesByServiceName(readCredentialsFile(), serviceName);
|
|
45
|
-
if (
|
|
45
|
+
if (isEmptyObject(properties)) {
|
|
46
46
|
properties = filterPropertiesByServiceName(process.env, serviceName);
|
|
47
47
|
}
|
|
48
|
-
if (
|
|
48
|
+
if (isEmptyObject(properties)) {
|
|
49
49
|
properties = getPropertiesFromVCAP(serviceName);
|
|
50
50
|
}
|
|
51
51
|
return properties;
|
package/es/lib/base-service.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2014,
|
|
2
|
+
* (C) Copyright IBM Corp. 2014, 2024.
|
|
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.
|
|
@@ -61,6 +61,7 @@ export declare class BaseService {
|
|
|
61
61
|
protected baseOptions: BaseServiceOptions;
|
|
62
62
|
private authenticator;
|
|
63
63
|
private requestWrapperInstance;
|
|
64
|
+
private defaultUserAgent;
|
|
64
65
|
/**
|
|
65
66
|
* Configuration values for a service.
|
|
66
67
|
*
|
package/es/lib/base-service.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* (C) Copyright IBM Corp. 2014,
|
|
2
|
+
* (C) Copyright IBM Corp. 2014, 2024.
|
|
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,10 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import extend from 'extend';
|
|
16
17
|
import { checkCredentials, readExternalSources } from '../auth';
|
|
17
18
|
import { stripTrailingSlash } from './helper';
|
|
18
19
|
import logger from './logger';
|
|
19
20
|
import { RequestWrapper } from './request-wrapper';
|
|
21
|
+
import { buildUserAgent } from './build-user-agent';
|
|
20
22
|
/**
|
|
21
23
|
* Common functionality shared by generated service classes.
|
|
22
24
|
*
|
|
@@ -70,6 +72,7 @@ export class BaseService {
|
|
|
70
72
|
throw new Error('Authenticator must be set.');
|
|
71
73
|
}
|
|
72
74
|
this.authenticator = options.authenticator;
|
|
75
|
+
this.defaultUserAgent = buildUserAgent();
|
|
73
76
|
}
|
|
74
77
|
/**
|
|
75
78
|
* Get the instance of the authenticator set on the service.
|
|
@@ -197,6 +200,11 @@ export class BaseService {
|
|
|
197
200
|
if (!serviceUrl || typeof serviceUrl !== 'string') {
|
|
198
201
|
return Promise.reject(new Error('The service URL is required'));
|
|
199
202
|
}
|
|
203
|
+
// make sure the outbound request contains a User-Agent header
|
|
204
|
+
const userAgent = {
|
|
205
|
+
'User-Agent': this.defaultUserAgent,
|
|
206
|
+
};
|
|
207
|
+
parameters.defaultOptions.headers = extend(true, {}, userAgent, parameters.defaultOptions.headers);
|
|
200
208
|
return this.authenticator.authenticate(parameters.defaultOptions).then(() =>
|
|
201
209
|
// resolve() handles rejection as well, so resolving the result of sendRequest should allow for proper handling later
|
|
202
210
|
this.requestWrapperInstance.sendRequest(parameters));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (C) Copyright IBM Corp. 2024.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Returns a string suitable as a value for the User-Agent header
|
|
18
|
+
* @param componentName optional name of a component to be included in the returned string
|
|
19
|
+
* @returns the user agent header value
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildUserAgent(componentName?: string): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (C) Copyright IBM Corp. 2024.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
const os = require('os');
|
|
17
|
+
const { version } = require('../package.json');
|
|
18
|
+
/**
|
|
19
|
+
* Returns a string suitable as a value for the User-Agent header
|
|
20
|
+
* @param componentName optional name of a component to be included in the returned string
|
|
21
|
+
* @returns the user agent header value
|
|
22
|
+
*/
|
|
23
|
+
export function buildUserAgent(componentName = null) {
|
|
24
|
+
const subComponent = componentName ? `/${componentName}` : '';
|
|
25
|
+
const userAgent = `ibm-node-sdk-core${subComponent}-${version} os.name=${os.platform()} os.version=${os.release()} node.version=${process.version}`;
|
|
26
|
+
return userAgent;
|
|
27
|
+
}
|