ibm-cloud-sdk-core 5.5.0 → 5.6.0

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.
@@ -21,6 +21,8 @@ export interface Options extends BaseOptions {
21
21
  iamProfileCrn?: string;
22
22
  /** The ID of the linked trusted IAM profile to be used when obtaining the IAM access token */
23
23
  iamProfileId?: string;
24
+ /** The name of the linked trusted IAM profile to be used when obtaining the IAM access token */
25
+ iamProfileName?: string;
24
26
  /** The version of the Instance Metadata Service to be used obtaining tokens */
25
27
  serviceVersion?: string;
26
28
  /** The lifetime of the Instance Identity Token */
@@ -40,6 +42,7 @@ export declare class VpcInstanceAuthenticator extends TokenRequestBasedAuthentic
40
42
  protected tokenManager: VpcInstanceTokenManager;
41
43
  private iamProfileCrn;
42
44
  private iamProfileId;
45
+ private iamProfileName;
43
46
  private serviceVersion;
44
47
  private tokenLifetime;
45
48
  /**
@@ -50,9 +53,10 @@ export declare class VpcInstanceAuthenticator extends TokenRequestBasedAuthentic
50
53
  * - url: (optional) the endpoint URL for the VPC Instance Metadata Service (default value: "http://169.254.169.254")
51
54
  * - iamProfileCrn: (optional) the CRN of the linked IAM trusted profile to be used to obtain the IAM access token
52
55
  * - iamProfileId: (optional) the ID of the linked IAM trusted profile to be used to obtain the IAM access token
56
+ * - iamProfileName: (optional) the name of the linked IAM trusted profile to be used to obtain the IAM access token
53
57
  *
54
58
  * @remarks
55
- * At most one of "iamProfileCrn" or "iamProfileId" may be specified. If neither one is specified,
59
+ * At most one of "iamProfileCrn", "iamProfileId" or "iamProfileName" may be specified. If neither one is specified,
56
60
  * then the default IAM profile defined for the compute resource will be used.
57
61
  */
58
62
  constructor(options: Options);
@@ -66,6 +70,11 @@ export declare class VpcInstanceAuthenticator extends TokenRequestBasedAuthentic
66
70
  * @param iamProfileId - the ID of the linked IAM trusted profile to use when obtaining an IAM access token
67
71
  */
68
72
  setIamProfileId(iamProfileId: string): void;
73
+ /**
74
+ * Sets the "iamProfileName" value to be used when obtaining an IAM access token
75
+ * @param iamProfileName - the name of the linked IAM trusted profile to use when obtaining an IAM access token
76
+ */
77
+ setIamProfileName(iamProfileName: string): void;
69
78
  setServiceVersion(serviceVersion: string): void;
70
79
  setTokenLifetime(tokenLifetime: number): void;
71
80
  /**
@@ -54,9 +54,10 @@ var VpcInstanceAuthenticator = /** @class */ (function (_super) {
54
54
  * - url: (optional) the endpoint URL for the VPC Instance Metadata Service (default value: "http://169.254.169.254")
55
55
  * - iamProfileCrn: (optional) the CRN of the linked IAM trusted profile to be used to obtain the IAM access token
56
56
  * - iamProfileId: (optional) the ID of the linked IAM trusted profile to be used to obtain the IAM access token
57
+ * - iamProfileName: (optional) the name of the linked IAM trusted profile to be used to obtain the IAM access token
57
58
  *
58
59
  * @remarks
59
- * At most one of "iamProfileCrn" or "iamProfileId" may be specified. If neither one is specified,
60
+ * At most one of "iamProfileCrn", "iamProfileId" or "iamProfileName" may be specified. If neither one is specified,
60
61
  * then the default IAM profile defined for the compute resource will be used.
61
62
  */
62
63
  function VpcInstanceAuthenticator(options) {
@@ -70,6 +71,9 @@ var VpcInstanceAuthenticator = /** @class */ (function (_super) {
70
71
  if (options.iamProfileId) {
71
72
  _this.iamProfileId = options.iamProfileId;
72
73
  }
74
+ if (options.iamProfileName) {
75
+ _this.iamProfileName = options.iamProfileName;
76
+ }
73
77
  if (options.serviceVersion) {
74
78
  _this.serviceVersion = options.serviceVersion;
75
79
  }
@@ -100,6 +104,15 @@ var VpcInstanceAuthenticator = /** @class */ (function (_super) {
100
104
  // update properties in token manager
101
105
  this.tokenManager.setIamProfileId(iamProfileId);
102
106
  };
107
+ /**
108
+ * Sets the "iamProfileName" value to be used when obtaining an IAM access token
109
+ * @param iamProfileName - the name of the linked IAM trusted profile to use when obtaining an IAM access token
110
+ */
111
+ VpcInstanceAuthenticator.prototype.setIamProfileName = function (iamProfileName) {
112
+ this.iamProfileName = iamProfileName;
113
+ // update properties in token manager
114
+ this.tokenManager.setIamProfileName(iamProfileName);
115
+ };
103
116
  VpcInstanceAuthenticator.prototype.setServiceVersion = function (serviceVersion) {
104
117
  this.serviceVersion = serviceVersion;
105
118
  this.tokenManager.setServiceVersion(serviceVersion);
@@ -20,6 +20,8 @@ interface Options extends JwtTokenManagerOptions {
20
20
  iamProfileCrn?: string;
21
21
  /** The ID of the linked trusted IAM profile to be used when obtaining the IAM access token */
22
22
  iamProfileId?: string;
23
+ /** The name of the linked trusted IAM profile to be used when obtaining the IAM access token */
24
+ iamProfileName?: string;
23
25
  /** The version of the Instance Metadata Service to be used obtaining tokens */
24
26
  serviceVersion?: string;
25
27
  /** The lifetime of the Instance Identity Token */
@@ -31,6 +33,7 @@ interface Options extends JwtTokenManagerOptions {
31
33
  export declare class VpcInstanceTokenManager extends JwtTokenManager {
32
34
  private iamProfileCrn;
33
35
  private iamProfileId;
36
+ private iamProfileName;
34
37
  private serviceVersion;
35
38
  private tokenLifetime;
36
39
  /**
@@ -41,9 +44,10 @@ export declare class VpcInstanceTokenManager extends JwtTokenManager {
41
44
  * - url: (optional) the endpoint URL for the VPC Instance Metadata Service (default value: "http://169.254.169.254")
42
45
  * - iamProfileCrn: (optional) the CRN of the linked IAM trusted profile to be used to obtain the IAM access token
43
46
  * - iamProfileId: (optional) the ID of the linked IAM trusted profile to be used to obtain the IAM access token
47
+ * - iamProfileName: (optional) the name of the linked IAM trusted profile to be used to obtain the IAM access token
44
48
  *
45
49
  * @remarks
46
- * At most one of "iamProfileCrn" or "iamProfileId" may be specified. If neither one is specified,
50
+ * At most one of "iamProfileCrn", "iamProfileId" or "iamProfileName" may be specified. If neither one is specified,
47
51
  * then the default IAM profile defined for the compute resource will be used.
48
52
  */
49
53
  constructor(options: Options);
@@ -57,6 +61,11 @@ export declare class VpcInstanceTokenManager extends JwtTokenManager {
57
61
  * @param iamProfileId - the ID of the IAM trusted profile
58
62
  */
59
63
  setIamProfileId(iamProfileId: string): void;
64
+ /**
65
+ * Sets the name of the IAM trusted profile to use when fetching access token from the IAM token server.
66
+ * @param iamProfileName - the name of the IAM trusted profile
67
+ */
68
+ setIamProfileName(iamProfileName: string): void;
60
69
  setServiceVersion(serviceVersion: string): void;
61
70
  setTokenLifetime(tokenLifetime: number): void;
62
71
  protected getAccessTokenPath(): string;
@@ -97,9 +97,10 @@ var VpcInstanceTokenManager = /** @class */ (function (_super) {
97
97
  * - url: (optional) the endpoint URL for the VPC Instance Metadata Service (default value: "http://169.254.169.254")
98
98
  * - iamProfileCrn: (optional) the CRN of the linked IAM trusted profile to be used to obtain the IAM access token
99
99
  * - iamProfileId: (optional) the ID of the linked IAM trusted profile to be used to obtain the IAM access token
100
+ * - iamProfileName: (optional) the name of the linked IAM trusted profile to be used to obtain the IAM access token
100
101
  *
101
102
  * @remarks
102
- * At most one of "iamProfileCrn" or "iamProfileId" may be specified. If neither one is specified,
103
+ * At most one of "iamProfileCrn", "iamProfileId" or "iamProfileName" may be specified. If neither one is specified,
103
104
  * then the default IAM profile defined for the compute resource will be used.
104
105
  */
105
106
  function VpcInstanceTokenManager(options) {
@@ -107,8 +108,8 @@ var VpcInstanceTokenManager = /** @class */ (function (_super) {
107
108
  // all parameters are optional
108
109
  options = options || {};
109
110
  _this = _super.call(this, options) || this;
110
- if (!(0, helpers_1.atMostOne)(options.iamProfileId, options.iamProfileCrn)) {
111
- throw new Error('At most one of `iamProfileId` or `iamProfileCrn` may be specified.');
111
+ if (!(0, helpers_1.atMostOne)(options.iamProfileId, options.iamProfileCrn, options.iamProfileName)) {
112
+ throw new Error('At most one of `iamProfileId`, `iamProfileCrn` or `iamProfileName` may be specified.');
112
113
  }
113
114
  _this.url = options.url || DEFAULT_IMS_ENDPOINT;
114
115
  // Validate and set serviceVersion
@@ -129,6 +130,9 @@ var VpcInstanceTokenManager = /** @class */ (function (_super) {
129
130
  if (options.iamProfileId) {
130
131
  _this.iamProfileId = options.iamProfileId;
131
132
  }
133
+ if (options.iamProfileName) {
134
+ _this.iamProfileName = options.iamProfileName;
135
+ }
132
136
  _this.userAgent = (0, build_user_agent_1.buildUserAgent)('vpc-instance-authenticator');
133
137
  return _this;
134
138
  }
@@ -146,6 +150,13 @@ var VpcInstanceTokenManager = /** @class */ (function (_super) {
146
150
  VpcInstanceTokenManager.prototype.setIamProfileId = function (iamProfileId) {
147
151
  this.iamProfileId = iamProfileId;
148
152
  };
153
+ /**
154
+ * Sets the name of the IAM trusted profile to use when fetching access token from the IAM token server.
155
+ * @param iamProfileName - the name of the IAM trusted profile
156
+ */
157
+ VpcInstanceTokenManager.prototype.setIamProfileName = function (iamProfileName) {
158
+ this.iamProfileName = iamProfileName;
159
+ };
149
160
  VpcInstanceTokenManager.prototype.setServiceVersion = function (serviceVersion) {
150
161
  if (!metadataServiceSupportedVersions.includes(serviceVersion)) {
151
162
  throw new Error("Invalid serviceVersion. Must be one of: ".concat(metadataServiceSupportedVersions.join(', ')));
@@ -188,6 +199,11 @@ var VpcInstanceTokenManager = /** @class */ (function (_super) {
188
199
  trusted_profile: { crn: this.iamProfileCrn },
189
200
  };
190
201
  }
202
+ else if (this.iamProfileName) {
203
+ body = {
204
+ trusted_profile: { name: this.iamProfileName },
205
+ };
206
+ }
191
207
  parameters = {
192
208
  options: {
193
209
  url: "".concat(this.url).concat(this.getIamTokenPath()),
@@ -8521,7 +8521,7 @@
8521
8521
  {
8522
8522
  "kind": "Constructor",
8523
8523
  "canonicalReference": "ibm-cloud-sdk-core!VpcInstanceAuthenticator:constructor(1)",
8524
- "docComment": "/**\n * Create a new VpcInstanceAuthenticator instance.\n *\n * @remarks\n *\n * At most one of \"iamProfileCrn\" or \"iamProfileId\" may be specified. If neither one is specified, then the default IAM profile defined for the compute resource will be used.\n *\n * @param options - Configuration options for VpcInstance authentication. 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\n */\n",
8524
+ "docComment": "/**\n * Create a new VpcInstanceAuthenticator instance.\n *\n * @remarks\n *\n * At most one of \"iamProfileCrn\", \"iamProfileId\" or \"iamProfileName\" may be specified. If neither one is specified, then the default IAM profile defined for the compute resource will be used.\n *\n * @param options - Configuration options for VpcInstance authentication. 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 - iamProfileName: (optional) the name of the linked IAM trusted profile to be used to obtain the IAM access token\n */\n",
8525
8525
  "excerptTokens": [
8526
8526
  {
8527
8527
  "kind": "Content",
@@ -8678,6 +8678,54 @@
8678
8678
  "isAbstract": false,
8679
8679
  "name": "setIamProfileId"
8680
8680
  },
8681
+ {
8682
+ "kind": "Method",
8683
+ "canonicalReference": "ibm-cloud-sdk-core!VpcInstanceAuthenticator#setIamProfileName:member(1)",
8684
+ "docComment": "/**\n * Sets the \"iamProfileName\" value to be used when obtaining an IAM access token\n *\n * @param iamProfileName - the name of the linked IAM trusted profile to use when obtaining an IAM access token\n */\n",
8685
+ "excerptTokens": [
8686
+ {
8687
+ "kind": "Content",
8688
+ "text": "setIamProfileName(iamProfileName: "
8689
+ },
8690
+ {
8691
+ "kind": "Content",
8692
+ "text": "string"
8693
+ },
8694
+ {
8695
+ "kind": "Content",
8696
+ "text": "): "
8697
+ },
8698
+ {
8699
+ "kind": "Content",
8700
+ "text": "void"
8701
+ },
8702
+ {
8703
+ "kind": "Content",
8704
+ "text": ";"
8705
+ }
8706
+ ],
8707
+ "isStatic": false,
8708
+ "returnTypeTokenRange": {
8709
+ "startIndex": 3,
8710
+ "endIndex": 4
8711
+ },
8712
+ "releaseTag": "Public",
8713
+ "isProtected": false,
8714
+ "overloadIndex": 1,
8715
+ "parameters": [
8716
+ {
8717
+ "parameterName": "iamProfileName",
8718
+ "parameterTypeTokenRange": {
8719
+ "startIndex": 1,
8720
+ "endIndex": 2
8721
+ },
8722
+ "isOptional": false
8723
+ }
8724
+ ],
8725
+ "isOptional": false,
8726
+ "isAbstract": false,
8727
+ "name": "setIamProfileName"
8728
+ },
8681
8729
  {
8682
8730
  "kind": "Method",
8683
8731
  "canonicalReference": "ibm-cloud-sdk-core!VpcInstanceAuthenticator#setServiceVersion:member(1)",
@@ -8840,7 +8888,7 @@
8840
8888
  {
8841
8889
  "kind": "Constructor",
8842
8890
  "canonicalReference": "ibm-cloud-sdk-core!VpcInstanceTokenManager:constructor(1)",
8843
- "docComment": "/**\n * Create a new VpcInstanceTokenManager instance.\n *\n * @remarks\n *\n * At most one of \"iamProfileCrn\" or \"iamProfileId\" may be specified. If neither one is specified, then the default IAM profile defined for the compute resource will be used.\n *\n * @param options - 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\n */\n",
8891
+ "docComment": "/**\n * Create a new VpcInstanceTokenManager instance.\n *\n * @remarks\n *\n * At most one of \"iamProfileCrn\", \"iamProfileId\" or \"iamProfileName\" may be specified. If neither one is specified, then the default IAM profile defined for the compute resource will be used.\n *\n * @param options - 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 - iamProfileName: (optional) the name of the linked IAM trusted profile to be used to obtain the IAM access token\n */\n",
8844
8892
  "excerptTokens": [
8845
8893
  {
8846
8894
  "kind": "Content",
@@ -9095,6 +9143,54 @@
9095
9143
  "isAbstract": false,
9096
9144
  "name": "setIamProfileId"
9097
9145
  },
9146
+ {
9147
+ "kind": "Method",
9148
+ "canonicalReference": "ibm-cloud-sdk-core!VpcInstanceTokenManager#setIamProfileName:member(1)",
9149
+ "docComment": "/**\n * Sets the name of the IAM trusted profile to use when fetching access token from the IAM token server.\n *\n * @param iamProfileName - the name of the IAM trusted profile\n */\n",
9150
+ "excerptTokens": [
9151
+ {
9152
+ "kind": "Content",
9153
+ "text": "setIamProfileName(iamProfileName: "
9154
+ },
9155
+ {
9156
+ "kind": "Content",
9157
+ "text": "string"
9158
+ },
9159
+ {
9160
+ "kind": "Content",
9161
+ "text": "): "
9162
+ },
9163
+ {
9164
+ "kind": "Content",
9165
+ "text": "void"
9166
+ },
9167
+ {
9168
+ "kind": "Content",
9169
+ "text": ";"
9170
+ }
9171
+ ],
9172
+ "isStatic": false,
9173
+ "returnTypeTokenRange": {
9174
+ "startIndex": 3,
9175
+ "endIndex": 4
9176
+ },
9177
+ "releaseTag": "Public",
9178
+ "isProtected": false,
9179
+ "overloadIndex": 1,
9180
+ "parameters": [
9181
+ {
9182
+ "parameterName": "iamProfileName",
9183
+ "parameterTypeTokenRange": {
9184
+ "startIndex": 1,
9185
+ "endIndex": 2
9186
+ },
9187
+ "isOptional": false
9188
+ }
9189
+ ],
9190
+ "isOptional": false,
9191
+ "isAbstract": false,
9192
+ "name": "setIamProfileName"
9193
+ },
9098
9194
  {
9099
9195
  "kind": "Method",
9100
9196
  "canonicalReference": "ibm-cloud-sdk-core!VpcInstanceTokenManager#setServiceVersion:member(1)",
@@ -21,6 +21,8 @@ export interface Options extends BaseOptions {
21
21
  iamProfileCrn?: string;
22
22
  /** The ID of the linked trusted IAM profile to be used when obtaining the IAM access token */
23
23
  iamProfileId?: string;
24
+ /** The name of the linked trusted IAM profile to be used when obtaining the IAM access token */
25
+ iamProfileName?: string;
24
26
  /** The version of the Instance Metadata Service to be used obtaining tokens */
25
27
  serviceVersion?: string;
26
28
  /** The lifetime of the Instance Identity Token */
@@ -40,6 +42,7 @@ export declare class VpcInstanceAuthenticator extends TokenRequestBasedAuthentic
40
42
  protected tokenManager: VpcInstanceTokenManager;
41
43
  private iamProfileCrn;
42
44
  private iamProfileId;
45
+ private iamProfileName;
43
46
  private serviceVersion;
44
47
  private tokenLifetime;
45
48
  /**
@@ -50,9 +53,10 @@ export declare class VpcInstanceAuthenticator extends TokenRequestBasedAuthentic
50
53
  * - url: (optional) the endpoint URL for the VPC Instance Metadata Service (default value: "http://169.254.169.254")
51
54
  * - iamProfileCrn: (optional) the CRN of the linked IAM trusted profile to be used to obtain the IAM access token
52
55
  * - iamProfileId: (optional) the ID of the linked IAM trusted profile to be used to obtain the IAM access token
56
+ * - iamProfileName: (optional) the name of the linked IAM trusted profile to be used to obtain the IAM access token
53
57
  *
54
58
  * @remarks
55
- * At most one of "iamProfileCrn" or "iamProfileId" may be specified. If neither one is specified,
59
+ * At most one of "iamProfileCrn", "iamProfileId" or "iamProfileName" may be specified. If neither one is specified,
56
60
  * then the default IAM profile defined for the compute resource will be used.
57
61
  */
58
62
  constructor(options: Options);
@@ -66,6 +70,11 @@ export declare class VpcInstanceAuthenticator extends TokenRequestBasedAuthentic
66
70
  * @param iamProfileId - the ID of the linked IAM trusted profile to use when obtaining an IAM access token
67
71
  */
68
72
  setIamProfileId(iamProfileId: string): void;
73
+ /**
74
+ * Sets the "iamProfileName" value to be used when obtaining an IAM access token
75
+ * @param iamProfileName - the name of the linked IAM trusted profile to use when obtaining an IAM access token
76
+ */
77
+ setIamProfileName(iamProfileName: string): void;
69
78
  setServiceVersion(serviceVersion: string): void;
70
79
  setTokenLifetime(tokenLifetime: number): void;
71
80
  /**
@@ -35,9 +35,10 @@ export class VpcInstanceAuthenticator extends TokenRequestBasedAuthenticator {
35
35
  * - url: (optional) the endpoint URL for the VPC Instance Metadata Service (default value: "http://169.254.169.254")
36
36
  * - iamProfileCrn: (optional) the CRN of the linked IAM trusted profile to be used to obtain the IAM access token
37
37
  * - iamProfileId: (optional) the ID of the linked IAM trusted profile to be used to obtain the IAM access token
38
+ * - iamProfileName: (optional) the name of the linked IAM trusted profile to be used to obtain the IAM access token
38
39
  *
39
40
  * @remarks
40
- * At most one of "iamProfileCrn" or "iamProfileId" may be specified. If neither one is specified,
41
+ * At most one of "iamProfileCrn", "iamProfileId" or "iamProfileName" may be specified. If neither one is specified,
41
42
  * then the default IAM profile defined for the compute resource will be used.
42
43
  */
43
44
  constructor(options) {
@@ -50,6 +51,9 @@ export class VpcInstanceAuthenticator extends TokenRequestBasedAuthenticator {
50
51
  if (options.iamProfileId) {
51
52
  this.iamProfileId = options.iamProfileId;
52
53
  }
54
+ if (options.iamProfileName) {
55
+ this.iamProfileName = options.iamProfileName;
56
+ }
53
57
  if (options.serviceVersion) {
54
58
  this.serviceVersion = options.serviceVersion;
55
59
  }
@@ -79,6 +83,15 @@ export class VpcInstanceAuthenticator extends TokenRequestBasedAuthenticator {
79
83
  // update properties in token manager
80
84
  this.tokenManager.setIamProfileId(iamProfileId);
81
85
  }
86
+ /**
87
+ * Sets the "iamProfileName" value to be used when obtaining an IAM access token
88
+ * @param iamProfileName - the name of the linked IAM trusted profile to use when obtaining an IAM access token
89
+ */
90
+ setIamProfileName(iamProfileName) {
91
+ this.iamProfileName = iamProfileName;
92
+ // update properties in token manager
93
+ this.tokenManager.setIamProfileName(iamProfileName);
94
+ }
82
95
  setServiceVersion(serviceVersion) {
83
96
  this.serviceVersion = serviceVersion;
84
97
  this.tokenManager.setServiceVersion(serviceVersion);
@@ -20,6 +20,8 @@ interface Options extends JwtTokenManagerOptions {
20
20
  iamProfileCrn?: string;
21
21
  /** The ID of the linked trusted IAM profile to be used when obtaining the IAM access token */
22
22
  iamProfileId?: string;
23
+ /** The name of the linked trusted IAM profile to be used when obtaining the IAM access token */
24
+ iamProfileName?: string;
23
25
  /** The version of the Instance Metadata Service to be used obtaining tokens */
24
26
  serviceVersion?: string;
25
27
  /** The lifetime of the Instance Identity Token */
@@ -31,6 +33,7 @@ interface Options extends JwtTokenManagerOptions {
31
33
  export declare class VpcInstanceTokenManager extends JwtTokenManager {
32
34
  private iamProfileCrn;
33
35
  private iamProfileId;
36
+ private iamProfileName;
34
37
  private serviceVersion;
35
38
  private tokenLifetime;
36
39
  /**
@@ -41,9 +44,10 @@ export declare class VpcInstanceTokenManager extends JwtTokenManager {
41
44
  * - url: (optional) the endpoint URL for the VPC Instance Metadata Service (default value: "http://169.254.169.254")
42
45
  * - iamProfileCrn: (optional) the CRN of the linked IAM trusted profile to be used to obtain the IAM access token
43
46
  * - iamProfileId: (optional) the ID of the linked IAM trusted profile to be used to obtain the IAM access token
47
+ * - iamProfileName: (optional) the name of the linked IAM trusted profile to be used to obtain the IAM access token
44
48
  *
45
49
  * @remarks
46
- * At most one of "iamProfileCrn" or "iamProfileId" may be specified. If neither one is specified,
50
+ * At most one of "iamProfileCrn", "iamProfileId" or "iamProfileName" may be specified. If neither one is specified,
47
51
  * then the default IAM profile defined for the compute resource will be used.
48
52
  */
49
53
  constructor(options: Options);
@@ -57,6 +61,11 @@ export declare class VpcInstanceTokenManager extends JwtTokenManager {
57
61
  * @param iamProfileId - the ID of the IAM trusted profile
58
62
  */
59
63
  setIamProfileId(iamProfileId: string): void;
64
+ /**
65
+ * Sets the name of the IAM trusted profile to use when fetching access token from the IAM token server.
66
+ * @param iamProfileName - the name of the IAM trusted profile
67
+ */
68
+ setIamProfileName(iamProfileName: string): void;
60
69
  setServiceVersion(serviceVersion: string): void;
61
70
  setTokenLifetime(tokenLifetime: number): void;
62
71
  protected getAccessTokenPath(): string;
@@ -48,17 +48,18 @@ export class VpcInstanceTokenManager extends JwtTokenManager {
48
48
  * - url: (optional) the endpoint URL for the VPC Instance Metadata Service (default value: "http://169.254.169.254")
49
49
  * - iamProfileCrn: (optional) the CRN of the linked IAM trusted profile to be used to obtain the IAM access token
50
50
  * - iamProfileId: (optional) the ID of the linked IAM trusted profile to be used to obtain the IAM access token
51
+ * - iamProfileName: (optional) the name of the linked IAM trusted profile to be used to obtain the IAM access token
51
52
  *
52
53
  * @remarks
53
- * At most one of "iamProfileCrn" or "iamProfileId" may be specified. If neither one is specified,
54
+ * At most one of "iamProfileCrn", "iamProfileId" or "iamProfileName" may be specified. If neither one is specified,
54
55
  * then the default IAM profile defined for the compute resource will be used.
55
56
  */
56
57
  constructor(options) {
57
58
  // all parameters are optional
58
59
  options = options || {};
59
60
  super(options);
60
- if (!atMostOne(options.iamProfileId, options.iamProfileCrn)) {
61
- throw new Error('At most one of `iamProfileId` or `iamProfileCrn` may be specified.');
61
+ if (!atMostOne(options.iamProfileId, options.iamProfileCrn, options.iamProfileName)) {
62
+ throw new Error('At most one of `iamProfileId`, `iamProfileCrn` or `iamProfileName` may be specified.');
62
63
  }
63
64
  this.url = options.url || DEFAULT_IMS_ENDPOINT;
64
65
  // Validate and set serviceVersion
@@ -79,6 +80,9 @@ export class VpcInstanceTokenManager extends JwtTokenManager {
79
80
  if (options.iamProfileId) {
80
81
  this.iamProfileId = options.iamProfileId;
81
82
  }
83
+ if (options.iamProfileName) {
84
+ this.iamProfileName = options.iamProfileName;
85
+ }
82
86
  this.userAgent = buildUserAgent('vpc-instance-authenticator');
83
87
  }
84
88
  /**
@@ -95,6 +99,13 @@ export class VpcInstanceTokenManager extends JwtTokenManager {
95
99
  setIamProfileId(iamProfileId) {
96
100
  this.iamProfileId = iamProfileId;
97
101
  }
102
+ /**
103
+ * Sets the name of the IAM trusted profile to use when fetching access token from the IAM token server.
104
+ * @param iamProfileName - the name of the IAM trusted profile
105
+ */
106
+ setIamProfileName(iamProfileName) {
107
+ this.iamProfileName = iamProfileName;
108
+ }
98
109
  setServiceVersion(serviceVersion) {
99
110
  if (!metadataServiceSupportedVersions.includes(serviceVersion)) {
100
111
  throw new Error(`Invalid serviceVersion. Must be one of: ${metadataServiceSupportedVersions.join(', ')}`);
@@ -134,6 +145,11 @@ export class VpcInstanceTokenManager extends JwtTokenManager {
134
145
  trusted_profile: { crn: this.iamProfileCrn },
135
146
  };
136
147
  }
148
+ else if (this.iamProfileName) {
149
+ body = {
150
+ trusted_profile: { name: this.iamProfileName },
151
+ };
152
+ }
137
153
  const parameters = {
138
154
  options: {
139
155
  url: `${this.url}${this.getIamTokenPath()}`,
@@ -1319,6 +1319,8 @@ declare interface Options_10 extends BaseOptions {
1319
1319
  iamProfileCrn?: string;
1320
1320
  /** The ID of the linked trusted IAM profile to be used when obtaining the IAM access token */
1321
1321
  iamProfileId?: string;
1322
+ /** The name of the linked trusted IAM profile to be used when obtaining the IAM access token */
1323
+ iamProfileName?: string;
1322
1324
  /** The version of the Instance Metadata Service to be used obtaining tokens */
1323
1325
  serviceVersion?: string;
1324
1326
  /** The lifetime of the Instance Identity Token */
@@ -1526,6 +1528,8 @@ declare interface Options_9 extends JwtTokenManagerOptions {
1526
1528
  iamProfileCrn?: string;
1527
1529
  /** The ID of the linked trusted IAM profile to be used when obtaining the IAM access token */
1528
1530
  iamProfileId?: string;
1531
+ /** The name of the linked trusted IAM profile to be used when obtaining the IAM access token */
1532
+ iamProfileName?: string;
1529
1533
  /** The version of the Instance Metadata Service to be used obtaining tokens */
1530
1534
  serviceVersion?: string;
1531
1535
  /** The lifetime of the Instance Identity Token */
@@ -1944,6 +1948,7 @@ export declare class VpcInstanceAuthenticator extends TokenRequestBasedAuthentic
1944
1948
  protected tokenManager: VpcInstanceTokenManager;
1945
1949
  private iamProfileCrn;
1946
1950
  private iamProfileId;
1951
+ private iamProfileName;
1947
1952
  private serviceVersion;
1948
1953
  private tokenLifetime;
1949
1954
  /**
@@ -1954,9 +1959,10 @@ export declare class VpcInstanceAuthenticator extends TokenRequestBasedAuthentic
1954
1959
  * - url: (optional) the endpoint URL for the VPC Instance Metadata Service (default value: "http://169.254.169.254")
1955
1960
  * - iamProfileCrn: (optional) the CRN of the linked IAM trusted profile to be used to obtain the IAM access token
1956
1961
  * - iamProfileId: (optional) the ID of the linked IAM trusted profile to be used to obtain the IAM access token
1962
+ * - iamProfileName: (optional) the name of the linked IAM trusted profile to be used to obtain the IAM access token
1957
1963
  *
1958
1964
  * @remarks
1959
- * At most one of "iamProfileCrn" or "iamProfileId" may be specified. If neither one is specified,
1965
+ * At most one of "iamProfileCrn", "iamProfileId" or "iamProfileName" may be specified. If neither one is specified,
1960
1966
  * then the default IAM profile defined for the compute resource will be used.
1961
1967
  */
1962
1968
  constructor(options: Options_10);
@@ -1970,6 +1976,11 @@ export declare class VpcInstanceAuthenticator extends TokenRequestBasedAuthentic
1970
1976
  * @param iamProfileId - the ID of the linked IAM trusted profile to use when obtaining an IAM access token
1971
1977
  */
1972
1978
  setIamProfileId(iamProfileId: string): void;
1979
+ /**
1980
+ * Sets the "iamProfileName" value to be used when obtaining an IAM access token
1981
+ * @param iamProfileName - the name of the linked IAM trusted profile to use when obtaining an IAM access token
1982
+ */
1983
+ setIamProfileName(iamProfileName: string): void;
1973
1984
  setServiceVersion(serviceVersion: string): void;
1974
1985
  setTokenLifetime(tokenLifetime: number): void;
1975
1986
  /**
@@ -1986,6 +1997,7 @@ export declare class VpcInstanceAuthenticator extends TokenRequestBasedAuthentic
1986
1997
  export declare class VpcInstanceTokenManager extends JwtTokenManager {
1987
1998
  private iamProfileCrn;
1988
1999
  private iamProfileId;
2000
+ private iamProfileName;
1989
2001
  private serviceVersion;
1990
2002
  private tokenLifetime;
1991
2003
  /**
@@ -1996,9 +2008,10 @@ export declare class VpcInstanceTokenManager extends JwtTokenManager {
1996
2008
  * - url: (optional) the endpoint URL for the VPC Instance Metadata Service (default value: "http://169.254.169.254")
1997
2009
  * - iamProfileCrn: (optional) the CRN of the linked IAM trusted profile to be used to obtain the IAM access token
1998
2010
  * - iamProfileId: (optional) the ID of the linked IAM trusted profile to be used to obtain the IAM access token
2011
+ * - iamProfileName: (optional) the name of the linked IAM trusted profile to be used to obtain the IAM access token
1999
2012
  *
2000
2013
  * @remarks
2001
- * At most one of "iamProfileCrn" or "iamProfileId" may be specified. If neither one is specified,
2014
+ * At most one of "iamProfileCrn", "iamProfileId" or "iamProfileName" may be specified. If neither one is specified,
2002
2015
  * then the default IAM profile defined for the compute resource will be used.
2003
2016
  */
2004
2017
  constructor(options: Options_9);
@@ -2012,6 +2025,11 @@ export declare class VpcInstanceTokenManager extends JwtTokenManager {
2012
2025
  * @param iamProfileId - the ID of the IAM trusted profile
2013
2026
  */
2014
2027
  setIamProfileId(iamProfileId: string): void;
2028
+ /**
2029
+ * Sets the name of the IAM trusted profile to use when fetching access token from the IAM token server.
2030
+ * @param iamProfileName - the name of the IAM trusted profile
2031
+ */
2032
+ setIamProfileName(iamProfileName: string): void;
2015
2033
  setServiceVersion(serviceVersion: string): void;
2016
2034
  setTokenLifetime(tokenLifetime: number): void;
2017
2035
  protected getAccessTokenPath(): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ibm-cloud-sdk-core",
3
- "version": "5.5.0",
3
+ "version": "5.6.0",
4
4
  "description": "Core functionality to support SDKs generated with IBM's OpenAPI SDK Generator.",
5
5
  "main": "./index.js",
6
6
  "typings": "./es/index.d.ts",