From 261349a484cc218ae283f8687ec37c10fbedb71e Mon Sep 17 00:00:00 2001 From: pooraniss-ibm <71089502+pooraniss-ibm@users.noreply.github.com> Date: Tue, 7 Sep 2021 15:28:33 +0100 Subject: [PATCH] fix(IAM Identity): fix listProfiles and listLinks operation id's (#128) --- examples/iam-identity.v1.test.js | 4 +- iam-identity/v1.ts | 80 ++++---- test/integration/iam-identity.v1.test.js | 8 +- test/unit/iam-identity.v1.test.js | 250 +++++++++++------------ 4 files changed, 174 insertions(+), 168 deletions(-) diff --git a/examples/iam-identity.v1.test.js b/examples/iam-identity.v1.test.js index cfcc39a0..e786ae96 100644 --- a/examples/iam-identity.v1.test.js +++ b/examples/iam-identity.v1.test.js @@ -580,7 +580,7 @@ describe('IamIdentityV1', () => { includeHistory: false, }; - iamIdentityService.listProfile(params) + iamIdentityService.listProfiles(params) .then(res => { console.log(JSON.stringify(res.result, null, 2)); }) @@ -867,7 +867,7 @@ describe('IamIdentityV1', () => { profileId, }; - iamIdentityService.listLink(params) + iamIdentityService.listLinks(params) .then(res => { console.log(JSON.stringify(res.result, null, 2)); }) diff --git a/iam-identity/v1.ts b/iam-identity/v1.ts index ddc0980b..ca0dc5c1 100644 --- a/iam-identity/v1.ts +++ b/iam-identity/v1.ts @@ -537,7 +537,7 @@ class IamIdentityV1 extends BaseService { * * Returns a list of service IDs. Users can manage user API keys for themself, or service ID API keys for service IDs * that are bound to an entity they have access to. Note: apikey details are only included in the response when - * creating a Service ID with an api key. + * creating a Service ID with an apikey. * * @param {Object} [params] - The parameters to send to the service. * @param {string} [params.accountId] - Account ID of the service ID(s) to query. This parameter is required (unless @@ -663,7 +663,7 @@ class IamIdentityV1 extends BaseService { * * Returns the details of a service ID. Users can manage user API keys for themself, or service ID API keys for * service IDs that are bound to an entity they have access to. Note: apikey details are only included in the response - * when creating a Service ID with an api key. + * when creating a Service ID with an apikey. * * @param {Object} params - The parameters to send to the service. * @param {string} params.id - Unique ID of the service ID. @@ -922,7 +922,7 @@ class IamIdentityV1 extends BaseService { /** * Create a trusted profile. * - * Creates a trusted profile for a given account ID. + * Create a trusted profile for a given account ID. * * @param {Object} params - The parameters to send to the service. * @param {string} params.name - Name of the trusted profile. The name is checked for uniqueness. Therefore trusted @@ -975,9 +975,10 @@ class IamIdentityV1 extends BaseService { } /** - * Get list of trusted profiles for a given account ID. + * List trusted profiles. * - * Returns the list of trusted profiles for a given account ID. + * List the trusted profiles in an account. The `account_id` query parameter determines the account from which to + * retrieve the list of trusted profiles. * * @param {Object} params - The parameters to send to the service. * @param {string} params.accountId - Account ID to query for trusted profiles. @@ -993,8 +994,8 @@ class IamIdentityV1 extends BaseService { * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise>} */ - public listProfile( - params: IamIdentityV1.ListProfileParams + public listProfiles( + params: IamIdentityV1.ListProfilesParams ): Promise> { const _params = { ...params }; const requiredParams = ['accountId']; @@ -1014,7 +1015,7 @@ class IamIdentityV1 extends BaseService { 'pagetoken': _params.pagetoken, }; - const sdkHeaders = getSdkHeaders(IamIdentityV1.DEFAULT_SERVICE_NAME, 'v1', 'listProfile'); + const sdkHeaders = getSdkHeaders(IamIdentityV1.DEFAULT_SERVICE_NAME, 'v1', 'listProfiles'); const parameters = { options: { @@ -1040,7 +1041,8 @@ class IamIdentityV1 extends BaseService { /** * Get a trusted profile. * - * Get a trusted profile. + * Retrieve a trusted profile by its `profile-id`. Only the trusted profile's data is returned (`name`, `description`, + * `iam_id`, etc.), not the federated users or compute resources that qualify to apply the trusted profile. * * @param {Object} params - The parameters to send to the service. * @param {string} params.profileId - ID of the trusted profile to get. @@ -1088,7 +1090,7 @@ class IamIdentityV1 extends BaseService { /** * Update a trusted profile. * - * Updates a trusted profile. + * Update the name or description of an existing trusted profile. * * @param {Object} params - The parameters to send to the service. * @param {string} params.profileId - ID of the trusted profile to be updated. @@ -1152,7 +1154,8 @@ class IamIdentityV1 extends BaseService { /** * Delete a trusted profile. * - * Deletes a trusted profile. + * Delete a trusted profile. When you delete trusted profile, compute resources and federated users are unlinked from + * the profile and can no longer apply the trusted profile identity. * * @param {Object} params - The parameters to send to the service. * @param {string} params.profileId - ID of the trusted profile. @@ -1193,7 +1196,7 @@ class IamIdentityV1 extends BaseService { /** * Create claim rule for a trusted profile. * - * Claim rule can be created for a given trusted profile, There is a limit of 20 rules allowed per trusted profile. + * Create a claim rule for a trusted profile. There is a limit of 20 rules per trusted profile. * * @param {Object} params - The parameters to send to the service. * @param {string} params.profileId - ID of the trusted profile to create a claim rule. @@ -1260,9 +1263,10 @@ class IamIdentityV1 extends BaseService { } /** - * Get all claim rules for a given trusted profile. + * List claim rules for a trusted profile. * - * Returns list of claim rules for a trusted profile. + * Get a list of all claim rules for a trusted profile. The `profile-id` query parameter determines the profile from + * which to retrieve the list of claim rules. * * @param {Object} params - The parameters to send to the service. * @param {string} params.profileId - ID of the trusted profile. @@ -1308,9 +1312,9 @@ class IamIdentityV1 extends BaseService { } /** - * Get claim rule for a trusted profile. + * Get a claim rule for a trusted profile. * - * Claim rule can be fetched for a given trusted profile ID and rule ID. + * A specific claim rule can be fetched for a given trusted profile ID and rule ID. * * @param {Object} params - The parameters to send to the service. * @param {string} params.profileId - ID of the trusted profile. @@ -1360,7 +1364,7 @@ class IamIdentityV1 extends BaseService { /** * Update claim rule for a trusted profile. * - * Claim rule can be updated for a given trusted profile ID and rule ID. + * Update a specific claim rule for a given trusted profile ID and rule ID. * * @param {Object} params - The parameters to send to the service. * @param {string} params.profileId - ID of the trusted profile. @@ -1435,7 +1439,8 @@ class IamIdentityV1 extends BaseService { /** * Delete a claim rule. * - * Deletes a claim rule. + * Delete a claim rule. When you delete a claim rule, federated user or compute resources are no longer required to + * meet the conditions of the claim rule in order to apply the trusted profile. * * @param {Object} params - The parameters to send to the service. * @param {string} params.profileId - ID of the trusted profile. @@ -1478,7 +1483,8 @@ class IamIdentityV1 extends BaseService { /** * Create link to a trusted profile. * - * Link compute resource to a trusted profile. + * Create a direct link between a specific compute resource and a trusted profile, rather than creating conditions + * that a compute resource must fulfill to apply a trusted profile. * * @param {Object} params - The parameters to send to the service. * @param {string} params.profileId - ID of the trusted profile. @@ -1535,17 +1541,17 @@ class IamIdentityV1 extends BaseService { } /** - * Get list of links to a trusted profile. + * List links to a trusted profile. * - * Gets list of link to a trusted profile. + * Get a list of links to a trusted profile. * * @param {Object} params - The parameters to send to the service. * @param {string} params.profileId - ID of the trusted profile. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise>} */ - public listLink( - params: IamIdentityV1.ListLinkParams + public listLinks( + params: IamIdentityV1.ListLinksParams ): Promise> { const _params = { ...params }; const requiredParams = ['profileId']; @@ -1559,7 +1565,7 @@ class IamIdentityV1 extends BaseService { 'profile-id': _params.profileId, }; - const sdkHeaders = getSdkHeaders(IamIdentityV1.DEFAULT_SERVICE_NAME, 'v1', 'listLink'); + const sdkHeaders = getSdkHeaders(IamIdentityV1.DEFAULT_SERVICE_NAME, 'v1', 'listLinks'); const parameters = { options: { @@ -1585,7 +1591,7 @@ class IamIdentityV1 extends BaseService { /** * Get link to a trusted profile. * - * Gets link to a trusted profile. + * Get a specific link to a trusted profile by `link_id`. * * @param {Object} params - The parameters to send to the service. * @param {string} params.profileId - ID of the trusted profile. @@ -1635,7 +1641,7 @@ class IamIdentityV1 extends BaseService { /** * Delete link to a trusted profile. * - * Deletes link to a trusted profile. + * Delete a link between a compute resource and a trusted profile. * * @param {Object} params - The parameters to send to the service. * @param {string} params.profileId - ID of the trusted profile. @@ -2123,8 +2129,8 @@ namespace IamIdentityV1 { headers?: OutgoingHttpHeaders; } - /** Parameters for the `listProfile` operation. */ - export interface ListProfileParams { + /** Parameters for the `listProfiles` operation. */ + export interface ListProfilesParams { /** Account ID to query for trusted profiles. */ accountId: string; /** Name of the trusted profile to query. */ @@ -2136,7 +2142,7 @@ namespace IamIdentityV1 { */ sort?: string; /** Optional sort order, valid values are asc and desc. Default: asc. */ - order?: ListProfileConstants.Order | string; + order?: ListProfilesConstants.Order | string; /** Defines if the entity history is included in the response. */ includeHistory?: boolean; /** Optional Prev or Next page token returned from a previous query execution. Default is start with first page. */ @@ -2144,8 +2150,8 @@ namespace IamIdentityV1 { headers?: OutgoingHttpHeaders; } - /** Constants for the `listProfile` operation. */ - export namespace ListProfileConstants { + /** Constants for the `listProfiles` operation. */ + export namespace ListProfilesConstants { /** Optional sort order, valid values are asc and desc. Default: asc. */ export enum Order { ASC = 'asc', @@ -2282,8 +2288,8 @@ namespace IamIdentityV1 { headers?: OutgoingHttpHeaders; } - /** Parameters for the `listLink` operation. */ - export interface ListLinkParams { + /** Parameters for the `listLinks` operation. */ + export interface ListLinksParams { /** ID of the trusted profile. */ profileId: string; headers?: OutgoingHttpHeaders; @@ -2590,7 +2596,7 @@ namespace IamIdentityV1 { /** ProfileClaimRuleConditions. */ export interface ProfileClaimRuleConditions { - /** The claim to valuate againt. */ + /** The claim to evaluate against. */ claim: string; /** The operation to perform on the claim. valid values are EQUALS, NOT_EQUALS, EQUALS_IGNORE_CASE, * NOT_EQUALS_IGNORE_CASE, CONTAINS, IN. @@ -2678,7 +2684,7 @@ namespace IamIdentityV1 { /** Version of the service ID details object. You need to specify this value when updating the service ID to * avoid stale updates. */ - entity_tag?: string; + entity_tag: string; /** Cloud Resource Name of the item. Example Cloud Resource Name: * 'crn:v1:bluemix:public:iam-identity:us-south:a/myaccount::serviceid:1234-5678-9012'. */ @@ -2686,9 +2692,9 @@ namespace IamIdentityV1 { /** The service ID cannot be changed if set to true. */ locked: boolean; /** If set contains a date time string of the creation date in ISO format. */ - created_at?: string; + created_at: string; /** If set contains a date time string of the last modification date in ISO format. */ - modified_at?: string; + modified_at: string; /** ID of the account the service ID belongs to. */ account_id: string; /** Name of the Service Id. The name is not checked for uniqueness. Therefore multiple names with the same value diff --git a/test/integration/iam-identity.v1.test.js b/test/integration/iam-identity.v1.test.js index 1f490fbd..13e2a2d7 100644 --- a/test/integration/iam-identity.v1.test.js +++ b/test/integration/iam-identity.v1.test.js @@ -668,7 +668,7 @@ describe('IamIdentityV1_integration', () => { includeHistory: false, }; - const res = await iamIdentityService.listProfile(params); + const res = await iamIdentityService.listProfiles(params); expect(res.status).toEqual(200); const { result } = res; @@ -997,13 +997,13 @@ describe('IamIdentityV1_integration', () => { }); }); - test('listLink()', async (done) => { + test('listLinks()', async (done) => { const links = []; const params = { profileId: profileId2, }; - const res = await iamIdentityService.listLink(params); + const res = await iamIdentityService.listLinks(params); expect(res.status).toEqual(200); const { result } = res; @@ -1477,7 +1477,7 @@ describe('IamIdentityV1_integration', () => { accountId, }; - const profilesResponse = await iamIdentityService.listProfile(profileParams); + const profilesResponse = await iamIdentityService.listProfiles(profileParams); const profilesResult = profilesResponse.result; if (profilesResult.profiles) { for (const elem of profilesResult.profiles) { diff --git a/test/unit/iam-identity.v1.test.js b/test/unit/iam-identity.v1.test.js index edaf1b87..2af510d3 100644 --- a/test/unit/iam-identity.v1.test.js +++ b/test/unit/iam-identity.v1.test.js @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; // need to import the whole package to mock getAuthenticatorFromEnvironment const core = require('ibm-cloud-sdk-core'); + const { NoAuthAuthenticator, unitTestUtils } = core; const IamIdentityV1 = require('../../dist/iam-identity/v1'); @@ -112,7 +112,7 @@ describe('IamIdentityV1', () => { const type = 'user'; const sort = 'testString'; const order = 'asc'; - const includeHistory = true; + const includeHistory = false; const params = { accountId: accountId, iamId: iamId, @@ -139,15 +139,15 @@ describe('IamIdentityV1', () => { const expectedAccept = 'application/json'; const expectedContentType = undefined; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); - expect(options.qs['account_id']).toEqual(accountId); - expect(options.qs['iam_id']).toEqual(iamId); - expect(options.qs['pagesize']).toEqual(pagesize); - expect(options.qs['pagetoken']).toEqual(pagetoken); - expect(options.qs['scope']).toEqual(scope); - expect(options.qs['type']).toEqual(type); - expect(options.qs['sort']).toEqual(sort); - expect(options.qs['order']).toEqual(order); - expect(options.qs['include_history']).toEqual(includeHistory); + expect(options.qs.account_id).toEqual(accountId); + expect(options.qs.iam_id).toEqual(iamId); + expect(options.qs.pagesize).toEqual(pagesize); + expect(options.qs.pagetoken).toEqual(pagetoken); + expect(options.qs.scope).toEqual(scope); + expect(options.qs.type).toEqual(type); + expect(options.qs.sort).toEqual(sort); + expect(options.qs.order).toEqual(order); + expect(options.qs.include_history).toEqual(includeHistory); }); test('should prioritize user-given headers', () => { @@ -208,12 +208,12 @@ describe('IamIdentityV1', () => { const expectedContentType = 'application/json'; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); checkUserHeader(createRequestMock, 'Entity-Lock', entityLock); - expect(options.body['name']).toEqual(name); - expect(options.body['iam_id']).toEqual(iamId); - expect(options.body['description']).toEqual(description); - expect(options.body['account_id']).toEqual(accountId); - expect(options.body['apikey']).toEqual(apikey); - expect(options.body['store_value']).toEqual(storeValue); + expect(options.body.name).toEqual(name); + expect(options.body.iam_id).toEqual(iamId); + expect(options.body.description).toEqual(description); + expect(options.body.account_id).toEqual(accountId); + expect(options.body.apikey).toEqual(apikey); + expect(options.body.store_value).toEqual(storeValue); }); test('should prioritize user-given headers', () => { @@ -237,7 +237,7 @@ describe('IamIdentityV1', () => { }); describe('negative tests', () => { - test('should enforce required parameters', async done => { + test('should enforce required parameters', async (done) => { let err; try { await iamIdentityService.createApiKey({}); @@ -249,11 +249,11 @@ describe('IamIdentityV1', () => { done(); }); - test('should reject promise when required params are not given', done => { + test('should reject promise when required params are not given', (done) => { const createApiKeyPromise = iamIdentityService.createApiKey(); expectToBePromise(createApiKeyPromise); - createApiKeyPromise.catch(err => { + createApiKeyPromise.catch((err) => { expect(err.message).toMatch(/Missing required parameters/); done(); }); @@ -265,7 +265,7 @@ describe('IamIdentityV1', () => { test('should pass the right params to createRequest', () => { // Construct the params object for operation getApiKeysDetails const iamApiKey = 'testString'; - const includeHistory = true; + const includeHistory = false; const params = { iamApiKey: iamApiKey, includeHistory: includeHistory, @@ -286,7 +286,7 @@ describe('IamIdentityV1', () => { const expectedContentType = undefined; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); checkUserHeader(createRequestMock, 'IAM-ApiKey', iamApiKey); - expect(options.qs['include_history']).toEqual(includeHistory); + expect(options.qs.include_history).toEqual(includeHistory); }); test('should prioritize user-given headers', () => { @@ -316,7 +316,7 @@ describe('IamIdentityV1', () => { test('should pass the right params to createRequest', () => { // Construct the params object for operation getApiKey const id = 'testString'; - const includeHistory = true; + const includeHistory = false; const params = { id: id, includeHistory: includeHistory, @@ -336,8 +336,8 @@ describe('IamIdentityV1', () => { const expectedAccept = 'application/json'; const expectedContentType = undefined; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); - expect(options.qs['include_history']).toEqual(includeHistory); - expect(options.path['id']).toEqual(id); + expect(options.qs.include_history).toEqual(includeHistory); + expect(options.path.id).toEqual(id); }); test('should prioritize user-given headers', () => { @@ -359,7 +359,7 @@ describe('IamIdentityV1', () => { }); describe('negative tests', () => { - test('should enforce required parameters', async done => { + test('should enforce required parameters', async (done) => { let err; try { await iamIdentityService.getApiKey({}); @@ -371,11 +371,11 @@ describe('IamIdentityV1', () => { done(); }); - test('should reject promise when required params are not given', done => { + test('should reject promise when required params are not given', (done) => { const getApiKeyPromise = iamIdentityService.getApiKey(); expectToBePromise(getApiKeyPromise); - getApiKeyPromise.catch(err => { + getApiKeyPromise.catch((err) => { expect(err.message).toMatch(/Missing required parameters/); done(); }); @@ -412,9 +412,9 @@ describe('IamIdentityV1', () => { const expectedContentType = 'application/json'; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); checkUserHeader(createRequestMock, 'If-Match', ifMatch); - expect(options.body['name']).toEqual(name); - expect(options.body['description']).toEqual(description); - expect(options.path['id']).toEqual(id); + expect(options.body.name).toEqual(name); + expect(options.body.description).toEqual(description); + expect(options.path.id).toEqual(id); }); test('should prioritize user-given headers', () => { @@ -438,7 +438,7 @@ describe('IamIdentityV1', () => { }); describe('negative tests', () => { - test('should enforce required parameters', async done => { + test('should enforce required parameters', async (done) => { let err; try { await iamIdentityService.updateApiKey({}); @@ -450,11 +450,11 @@ describe('IamIdentityV1', () => { done(); }); - test('should reject promise when required params are not given', done => { + test('should reject promise when required params are not given', (done) => { const updateApiKeyPromise = iamIdentityService.updateApiKey(); expectToBePromise(updateApiKeyPromise); - updateApiKeyPromise.catch(err => { + updateApiKeyPromise.catch((err) => { expect(err.message).toMatch(/Missing required parameters/); done(); }); @@ -484,7 +484,7 @@ describe('IamIdentityV1', () => { const expectedAccept = undefined; const expectedContentType = undefined; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); - expect(options.path['id']).toEqual(id); + expect(options.path.id).toEqual(id); }); test('should prioritize user-given headers', () => { @@ -506,7 +506,7 @@ describe('IamIdentityV1', () => { }); describe('negative tests', () => { - test('should enforce required parameters', async done => { + test('should enforce required parameters', async (done) => { let err; try { await iamIdentityService.deleteApiKey({}); @@ -518,11 +518,11 @@ describe('IamIdentityV1', () => { done(); }); - test('should reject promise when required params are not given', done => { + test('should reject promise when required params are not given', (done) => { const deleteApiKeyPromise = iamIdentityService.deleteApiKey(); expectToBePromise(deleteApiKeyPromise); - deleteApiKeyPromise.catch(err => { + deleteApiKeyPromise.catch((err) => { expect(err.message).toMatch(/Missing required parameters/); done(); }); @@ -552,7 +552,7 @@ describe('IamIdentityV1', () => { const expectedAccept = undefined; const expectedContentType = undefined; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); - expect(options.path['id']).toEqual(id); + expect(options.path.id).toEqual(id); }); test('should prioritize user-given headers', () => { @@ -574,7 +574,7 @@ describe('IamIdentityV1', () => { }); describe('negative tests', () => { - test('should enforce required parameters', async done => { + test('should enforce required parameters', async (done) => { let err; try { await iamIdentityService.lockApiKey({}); @@ -586,11 +586,11 @@ describe('IamIdentityV1', () => { done(); }); - test('should reject promise when required params are not given', done => { + test('should reject promise when required params are not given', (done) => { const lockApiKeyPromise = iamIdentityService.lockApiKey(); expectToBePromise(lockApiKeyPromise); - lockApiKeyPromise.catch(err => { + lockApiKeyPromise.catch((err) => { expect(err.message).toMatch(/Missing required parameters/); done(); }); @@ -620,7 +620,7 @@ describe('IamIdentityV1', () => { const expectedAccept = undefined; const expectedContentType = undefined; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); - expect(options.path['id']).toEqual(id); + expect(options.path.id).toEqual(id); }); test('should prioritize user-given headers', () => { @@ -642,7 +642,7 @@ describe('IamIdentityV1', () => { }); describe('negative tests', () => { - test('should enforce required parameters', async done => { + test('should enforce required parameters', async (done) => { let err; try { await iamIdentityService.unlockApiKey({}); @@ -654,11 +654,11 @@ describe('IamIdentityV1', () => { done(); }); - test('should reject promise when required params are not given', done => { + test('should reject promise when required params are not given', (done) => { const unlockApiKeyPromise = iamIdentityService.unlockApiKey(); expectToBePromise(unlockApiKeyPromise); - unlockApiKeyPromise.catch(err => { + unlockApiKeyPromise.catch((err) => { expect(err.message).toMatch(/Missing required parameters/); done(); }); @@ -675,7 +675,7 @@ describe('IamIdentityV1', () => { const pagetoken = 'testString'; const sort = 'testString'; const order = 'asc'; - const includeHistory = true; + const includeHistory = false; const params = { accountId: accountId, name: name, @@ -700,13 +700,13 @@ describe('IamIdentityV1', () => { const expectedAccept = 'application/json'; const expectedContentType = undefined; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); - expect(options.qs['account_id']).toEqual(accountId); - expect(options.qs['name']).toEqual(name); - expect(options.qs['pagesize']).toEqual(pagesize); - expect(options.qs['pagetoken']).toEqual(pagetoken); - expect(options.qs['sort']).toEqual(sort); - expect(options.qs['order']).toEqual(order); - expect(options.qs['include_history']).toEqual(includeHistory); + expect(options.qs.account_id).toEqual(accountId); + expect(options.qs.name).toEqual(name); + expect(options.qs.pagesize).toEqual(pagesize); + expect(options.qs.pagetoken).toEqual(pagetoken); + expect(options.qs.sort).toEqual(sort); + expect(options.qs.order).toEqual(order); + expect(options.qs.include_history).toEqual(includeHistory); }); test('should prioritize user-given headers', () => { @@ -750,7 +750,7 @@ describe('IamIdentityV1', () => { const description = 'testString'; const uniqueInstanceCrns = ['testString']; const apikey = apiKeyInsideCreateServiceIdRequestModel; - const entityLock = 'testString'; + const entityLock = 'false'; const params = { accountId: accountId, name: name, @@ -775,11 +775,11 @@ describe('IamIdentityV1', () => { const expectedContentType = 'application/json'; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); checkUserHeader(createRequestMock, 'Entity-Lock', entityLock); - expect(options.body['account_id']).toEqual(accountId); - expect(options.body['name']).toEqual(name); - expect(options.body['description']).toEqual(description); - expect(options.body['unique_instance_crns']).toEqual(uniqueInstanceCrns); - expect(options.body['apikey']).toEqual(apikey); + expect(options.body.account_id).toEqual(accountId); + expect(options.body.name).toEqual(name); + expect(options.body.description).toEqual(description); + expect(options.body.unique_instance_crns).toEqual(uniqueInstanceCrns); + expect(options.body.apikey).toEqual(apikey); }); test('should prioritize user-given headers', () => { @@ -803,7 +803,7 @@ describe('IamIdentityV1', () => { }); describe('negative tests', () => { - test('should enforce required parameters', async done => { + test('should enforce required parameters', async (done) => { let err; try { await iamIdentityService.createServiceId({}); @@ -815,11 +815,11 @@ describe('IamIdentityV1', () => { done(); }); - test('should reject promise when required params are not given', done => { + test('should reject promise when required params are not given', (done) => { const createServiceIdPromise = iamIdentityService.createServiceId(); expectToBePromise(createServiceIdPromise); - createServiceIdPromise.catch(err => { + createServiceIdPromise.catch((err) => { expect(err.message).toMatch(/Missing required parameters/); done(); }); @@ -831,7 +831,7 @@ describe('IamIdentityV1', () => { test('should pass the right params to createRequest', () => { // Construct the params object for operation getServiceId const id = 'testString'; - const includeHistory = true; + const includeHistory = false; const params = { id: id, includeHistory: includeHistory, @@ -851,8 +851,8 @@ describe('IamIdentityV1', () => { const expectedAccept = 'application/json'; const expectedContentType = undefined; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); - expect(options.qs['include_history']).toEqual(includeHistory); - expect(options.path['id']).toEqual(id); + expect(options.qs.include_history).toEqual(includeHistory); + expect(options.path.id).toEqual(id); }); test('should prioritize user-given headers', () => { @@ -874,7 +874,7 @@ describe('IamIdentityV1', () => { }); describe('negative tests', () => { - test('should enforce required parameters', async done => { + test('should enforce required parameters', async (done) => { let err; try { await iamIdentityService.getServiceId({}); @@ -886,11 +886,11 @@ describe('IamIdentityV1', () => { done(); }); - test('should reject promise when required params are not given', done => { + test('should reject promise when required params are not given', (done) => { const getServiceIdPromise = iamIdentityService.getServiceId(); expectToBePromise(getServiceIdPromise); - getServiceIdPromise.catch(err => { + getServiceIdPromise.catch((err) => { expect(err.message).toMatch(/Missing required parameters/); done(); }); @@ -929,10 +929,10 @@ describe('IamIdentityV1', () => { const expectedContentType = 'application/json'; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); checkUserHeader(createRequestMock, 'If-Match', ifMatch); - expect(options.body['name']).toEqual(name); - expect(options.body['description']).toEqual(description); - expect(options.body['unique_instance_crns']).toEqual(uniqueInstanceCrns); - expect(options.path['id']).toEqual(id); + expect(options.body.name).toEqual(name); + expect(options.body.description).toEqual(description); + expect(options.body.unique_instance_crns).toEqual(uniqueInstanceCrns); + expect(options.path.id).toEqual(id); }); test('should prioritize user-given headers', () => { @@ -956,7 +956,7 @@ describe('IamIdentityV1', () => { }); describe('negative tests', () => { - test('should enforce required parameters', async done => { + test('should enforce required parameters', async (done) => { let err; try { await iamIdentityService.updateServiceId({}); @@ -968,11 +968,11 @@ describe('IamIdentityV1', () => { done(); }); - test('should reject promise when required params are not given', done => { + test('should reject promise when required params are not given', (done) => { const updateServiceIdPromise = iamIdentityService.updateServiceId(); expectToBePromise(updateServiceIdPromise); - updateServiceIdPromise.catch(err => { + updateServiceIdPromise.catch((err) => { expect(err.message).toMatch(/Missing required parameters/); done(); }); @@ -1002,7 +1002,7 @@ describe('IamIdentityV1', () => { const expectedAccept = undefined; const expectedContentType = undefined; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); - expect(options.path['id']).toEqual(id); + expect(options.path.id).toEqual(id); }); test('should prioritize user-given headers', () => { @@ -1024,7 +1024,7 @@ describe('IamIdentityV1', () => { }); describe('negative tests', () => { - test('should enforce required parameters', async done => { + test('should enforce required parameters', async (done) => { let err; try { await iamIdentityService.deleteServiceId({}); @@ -1036,11 +1036,11 @@ describe('IamIdentityV1', () => { done(); }); - test('should reject promise when required params are not given', done => { + test('should reject promise when required params are not given', (done) => { const deleteServiceIdPromise = iamIdentityService.deleteServiceId(); expectToBePromise(deleteServiceIdPromise); - deleteServiceIdPromise.catch(err => { + deleteServiceIdPromise.catch((err) => { expect(err.message).toMatch(/Missing required parameters/); done(); }); @@ -1070,7 +1070,7 @@ describe('IamIdentityV1', () => { const expectedAccept = undefined; const expectedContentType = undefined; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); - expect(options.path['id']).toEqual(id); + expect(options.path.id).toEqual(id); }); test('should prioritize user-given headers', () => { @@ -1092,7 +1092,7 @@ describe('IamIdentityV1', () => { }); describe('negative tests', () => { - test('should enforce required parameters', async done => { + test('should enforce required parameters', async (done) => { let err; try { await iamIdentityService.lockServiceId({}); @@ -1104,11 +1104,11 @@ describe('IamIdentityV1', () => { done(); }); - test('should reject promise when required params are not given', done => { + test('should reject promise when required params are not given', (done) => { const lockServiceIdPromise = iamIdentityService.lockServiceId(); expectToBePromise(lockServiceIdPromise); - lockServiceIdPromise.catch(err => { + lockServiceIdPromise.catch((err) => { expect(err.message).toMatch(/Missing required parameters/); done(); }); @@ -1138,7 +1138,7 @@ describe('IamIdentityV1', () => { const expectedAccept = undefined; const expectedContentType = undefined; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); - expect(options.path['id']).toEqual(id); + expect(options.path.id).toEqual(id); }); test('should prioritize user-given headers', () => { @@ -1160,7 +1160,7 @@ describe('IamIdentityV1', () => { }); describe('negative tests', () => { - test('should enforce required parameters', async done => { + test('should enforce required parameters', async (done) => { let err; try { await iamIdentityService.unlockServiceId({}); @@ -1172,11 +1172,11 @@ describe('IamIdentityV1', () => { done(); }); - test('should reject promise when required params are not given', done => { + test('should reject promise when required params are not given', (done) => { const unlockServiceIdPromise = iamIdentityService.unlockServiceId(); expectToBePromise(unlockServiceIdPromise); - unlockServiceIdPromise.catch(err => { + unlockServiceIdPromise.catch((err) => { expect(err.message).toMatch(/Missing required parameters/); done(); }); @@ -1259,10 +1259,10 @@ describe('IamIdentityV1', () => { }); }); }); - describe('listProfile', () => { + describe('listProfiles', () => { describe('positive tests', () => { test('should pass the right params to createRequest', () => { - // Construct the params object for operation listProfile + // Construct the params object for operation listProfiles const accountId = 'testString'; const name = 'testString'; const pagesize = 38; @@ -1280,10 +1280,10 @@ describe('IamIdentityV1', () => { pagetoken: pagetoken, }; - const listProfileResult = iamIdentityService.listProfile(params); + const listProfilesResult = iamIdentityService.listProfiles(params); // all methods should return a Promise - expectToBePromise(listProfileResult); + expectToBePromise(listProfilesResult); // assert that create request was called expect(createRequestMock).toHaveBeenCalledTimes(1); @@ -1316,7 +1316,7 @@ describe('IamIdentityV1', () => { }, }; - iamIdentityService.listProfile(params); + iamIdentityService.listProfiles(params); checkMediaHeaders(createRequestMock, userAccept, userContentType); }); }); @@ -1325,7 +1325,7 @@ describe('IamIdentityV1', () => { test('should enforce required parameters', async (done) => { let err; try { - await iamIdentityService.listProfile({}); + await iamIdentityService.listProfiles({}); } catch (e) { err = e; } @@ -1335,10 +1335,10 @@ describe('IamIdentityV1', () => { }); test('should reject promise when required params are not given', (done) => { - const listProfilePromise = iamIdentityService.listProfile(); - expectToBePromise(listProfilePromise); + const listProfilesPromise = iamIdentityService.listProfiles(); + expectToBePromise(listProfilesPromise); - listProfilePromise.catch((err) => { + listProfilesPromise.catch((err) => { expect(err.message).toMatch(/Missing required parameters/); done(); }); @@ -2108,19 +2108,19 @@ describe('IamIdentityV1', () => { }); }); }); - describe('listLink', () => { + describe('listLinks', () => { describe('positive tests', () => { test('should pass the right params to createRequest', () => { - // Construct the params object for operation listLink + // Construct the params object for operation listLinks const profileId = 'testString'; const params = { profileId: profileId, }; - const listLinkResult = iamIdentityService.listLink(params); + const listLinksResult = iamIdentityService.listLinks(params); // all methods should return a Promise - expectToBePromise(listLinkResult); + expectToBePromise(listLinksResult); // assert that create request was called expect(createRequestMock).toHaveBeenCalledTimes(1); @@ -2147,7 +2147,7 @@ describe('IamIdentityV1', () => { }, }; - iamIdentityService.listLink(params); + iamIdentityService.listLinks(params); checkMediaHeaders(createRequestMock, userAccept, userContentType); }); }); @@ -2156,7 +2156,7 @@ describe('IamIdentityV1', () => { test('should enforce required parameters', async (done) => { let err; try { - await iamIdentityService.listLink({}); + await iamIdentityService.listLinks({}); } catch (e) { err = e; } @@ -2166,10 +2166,10 @@ describe('IamIdentityV1', () => { }); test('should reject promise when required params are not given', (done) => { - const listLinkPromise = iamIdentityService.listLink(); - expectToBePromise(listLinkPromise); + const listLinksPromise = iamIdentityService.listLinks(); + expectToBePromise(listLinksPromise); - listLinkPromise.catch((err) => { + listLinksPromise.catch((err) => { expect(err.message).toMatch(/Missing required parameters/); done(); }); @@ -2327,7 +2327,7 @@ describe('IamIdentityV1', () => { test('should pass the right params to createRequest', () => { // Construct the params object for operation getAccountSettings const accountId = 'testString'; - const includeHistory = true; + const includeHistory = false; const params = { accountId: accountId, includeHistory: includeHistory, @@ -2347,8 +2347,8 @@ describe('IamIdentityV1', () => { const expectedAccept = 'application/json'; const expectedContentType = undefined; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); - expect(options.qs['include_history']).toEqual(includeHistory); - expect(options.path['account_id']).toEqual(accountId); + expect(options.qs.include_history).toEqual(includeHistory); + expect(options.path.account_id).toEqual(accountId); }); test('should prioritize user-given headers', () => { @@ -2370,7 +2370,7 @@ describe('IamIdentityV1', () => { }); describe('negative tests', () => { - test('should enforce required parameters', async done => { + test('should enforce required parameters', async (done) => { let err; try { await iamIdentityService.getAccountSettings({}); @@ -2382,11 +2382,11 @@ describe('IamIdentityV1', () => { done(); }); - test('should reject promise when required params are not given', done => { + test('should reject promise when required params are not given', (done) => { const getAccountSettingsPromise = iamIdentityService.getAccountSettings(); expectToBePromise(getAccountSettingsPromise); - getAccountSettingsPromise.catch(err => { + getAccountSettingsPromise.catch((err) => { expect(err.message).toMatch(/Missing required parameters/); done(); }); @@ -2403,8 +2403,8 @@ describe('IamIdentityV1', () => { const restrictCreatePlatformApikey = 'RESTRICTED'; const allowedIpAddresses = 'testString'; const mfa = 'NONE'; - const sessionExpirationInSeconds = 'testString'; - const sessionInvalidationInSeconds = 'testString'; + const sessionExpirationInSeconds = '86400'; + const sessionInvalidationInSeconds = '7200'; const maxSessionsPerIdentity = 'testString'; const params = { ifMatch: ifMatch, @@ -2433,14 +2433,14 @@ describe('IamIdentityV1', () => { const expectedContentType = 'application/json'; checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); checkUserHeader(createRequestMock, 'If-Match', ifMatch); - expect(options.body['restrict_create_service_id']).toEqual(restrictCreateServiceId); - expect(options.body['restrict_create_platform_apikey']).toEqual(restrictCreatePlatformApikey); - expect(options.body['allowed_ip_addresses']).toEqual(allowedIpAddresses); - expect(options.body['mfa']).toEqual(mfa); - expect(options.body['session_expiration_in_seconds']).toEqual(sessionExpirationInSeconds); - expect(options.body['session_invalidation_in_seconds']).toEqual(sessionInvalidationInSeconds); - expect(options.body['max_sessions_per_identity']).toEqual(maxSessionsPerIdentity); - expect(options.path['account_id']).toEqual(accountId); + expect(options.body.restrict_create_service_id).toEqual(restrictCreateServiceId); + expect(options.body.restrict_create_platform_apikey).toEqual(restrictCreatePlatformApikey); + expect(options.body.allowed_ip_addresses).toEqual(allowedIpAddresses); + expect(options.body.mfa).toEqual(mfa); + expect(options.body.session_expiration_in_seconds).toEqual(sessionExpirationInSeconds); + expect(options.body.session_invalidation_in_seconds).toEqual(sessionInvalidationInSeconds); + expect(options.body.max_sessions_per_identity).toEqual(maxSessionsPerIdentity); + expect(options.path.account_id).toEqual(accountId); }); test('should prioritize user-given headers', () => { @@ -2464,7 +2464,7 @@ describe('IamIdentityV1', () => { }); describe('negative tests', () => { - test('should enforce required parameters', async done => { + test('should enforce required parameters', async (done) => { let err; try { await iamIdentityService.updateAccountSettings({}); @@ -2476,11 +2476,11 @@ describe('IamIdentityV1', () => { done(); }); - test('should reject promise when required params are not given', done => { + test('should reject promise when required params are not given', (done) => { const updateAccountSettingsPromise = iamIdentityService.updateAccountSettings(); expectToBePromise(updateAccountSettingsPromise); - updateAccountSettingsPromise.catch(err => { + updateAccountSettingsPromise.catch((err) => { expect(err.message).toMatch(/Missing required parameters/); done(); });