diff --git a/examples/ibm-analytics-engine-api.v3.test.js b/examples/ibm-analytics-engine-api.v3.test.js index a19e9d9..c009fcc 100644 --- a/examples/ibm-analytics-engine-api.v3.test.js +++ b/examples/ibm-analytics-engine-api.v3.test.js @@ -23,8 +23,8 @@ const IbmAnalyticsEngineApiV3 = require('../dist/ibm-analytics-engine-api/v3'); // eslint-disable-next-line node/no-unpublished-require //!!! Start of custom content to be copied !!! -// Replace auth-helper.js with auth.js -const authHelper = require('../resources/auth-helper.js'); +// Replace auth-helper.js with auth.js for testing +const authHelper = require('../test/resources/auth-helper.js'); const { IamAuthenticator } = require('../dist/auth'); const timeout = 200000; // !!! End of custom content to be copied !!! @@ -60,6 +60,9 @@ const consoleLogMock = jest.spyOn(console, 'log'); const consoleWarnMock = jest.spyOn(console, 'warn'); describe('IbmAnalyticsEngineApiV3', () => { + // Service instance + let ibmAnalyticsEngineApiService; + // To access additional configuration values, uncomment this line and extract the values from config // const config = readExternalSources(IbmAnalyticsEngineApiV3.DEFAULT_SERVICE_NAME); @@ -73,7 +76,6 @@ describe('IbmAnalyticsEngineApiV3', () => { let applicationId = ''; jest.setTimeout(timeout); // !!! End of custom content to be copied !!! - let ibmAnalyticsEngineApiService; test('Initialize services', async () => { // begin-common @@ -152,7 +154,6 @@ describe('IbmAnalyticsEngineApiV3', () => { const params = { instanceId: instanceGuid, }; - //!!! Start of custom content to be copied !!! ibmAnalyticsEngineApiService .getInstanceState(params) @@ -174,7 +175,7 @@ describe('IbmAnalyticsEngineApiV3', () => { }); //!!! Start of custom content to be copied !!! - test('createInstanceHome request example', (done) => { + test('setInstanceHome request example', (done) => { // !!! End of custom content to be copied !!! consoleLogMock.mockImplementation((output) => { originalLog(output); @@ -191,8 +192,8 @@ describe('IbmAnalyticsEngineApiV3', () => { // !!! End of custom content to be copied !!! }); - originalLog('createInstanceHome() result:'); - // begin-create_instance_home + originalLog('setInstanceHome() result:'); + // begin-set_instance_home //!!! Start of custom content to be copied !!! const params = { instanceId: instanceIdInstanceHome, @@ -207,7 +208,7 @@ describe('IbmAnalyticsEngineApiV3', () => { // !!! End of custom content to be copied !!! //!!! Start of custom content to be copied !!! ibmAnalyticsEngineApiService - .createInstanceHome(params) + .setInstanceHome(params) .then((res)=>{ console.log(JSON.stringify(res.result, null, 2)); }) @@ -222,7 +223,7 @@ describe('IbmAnalyticsEngineApiV3', () => { // console.warn(err); // } // !!! End of custom content to be copied !!! - // end-create_instance_home + // end-set_instance_home }); //!!! Start of custom content to be copied !!! @@ -272,7 +273,6 @@ describe('IbmAnalyticsEngineApiV3', () => { // console.warn(err); // } // !!! End of custom content to be copied !!! - // end-create_application }); @@ -511,7 +511,6 @@ describe('IbmAnalyticsEngineApiV3', () => { //!!! Start of custom content to be copied !!! done(); // !!! End of custom content to be copied !!! - }); consoleWarnMock.mockImplementation((output) => { // if an error occurs, display the message and then fail the test @@ -616,72 +615,31 @@ describe('IbmAnalyticsEngineApiV3', () => { instanceId: instanceGuid, }; //!!! Start of custom content to be copied !!! - ibmAnalyticsEngineApiService - .stopSparkHistoryServer(params) - .then((res) => { - console.log(JSON.stringify(res.result, null, 2)); - }) - .catch((err) => { - console.warn(err); - }); - // try { - // await ibmAnalyticsEngineApiService.stopSparkHistoryServer(params); - // } catch (err) { - // console.warn(err); - // } - // !!! End of custom content to be copied !!! - // end-stop_spark_history_server - }); - - //!!! Start of custom content to be copied !!! - test('deleteLoggingConfiguration request example', (done) => { - // !!! End of custom content to be copied !!! - consoleLogMock.mockImplementation((output) => { - originalLog(output); - //!!! Start of custom content to be copied !!! - done(); - // !!! End of custom content to be copied !!! - }); - consoleWarnMock.mockImplementation((output) => { - // if an error occurs, display the message and then fail the test - originalWarn(output); - expect(true).toBeFalsy(); - //!!! Start of custom content to be copied !!! - done(); + ibmAnalyticsEngineApiService + .stopSparkHistoryServer(params) + .then((res) => { + console.log(JSON.stringify(res.result, null, 2)); + }) + .catch((err) => { + console.warn(err); + }); + // try { + // await ibmAnalyticsEngineApiService.stopSparkHistoryServer(params); + // } catch (err) { + // console.warn(err); + // } // !!! End of custom content to be copied !!! + // end-stop_spark_history_server }); - // begin-delete_logging_configuration - - const params = { - instanceGuid: instanceGuid, - }; - //!!! Start of custom content to be copied !!! - ibmAnalyticsEngineApiService - .deleteLoggingConfiguration(params) - .then((res) => { - console.log(JSON.stringify(res.result, null, 2)); - }) - .catch((err) => { - console.warn(err); - }); - // try { - // await ibmAnalyticsEngineApiService.deleteLoggingConfiguration(params); - // } catch (err) { - // console.warn(err); - // } - // !!! End of custom content to be copied !!! - // end-delete_logging_configuration - }); - //!!! Start of custom content to be copied !!! test('deleteApplication request example', (done) => { - // !!! End of custom content to be copied !!! + // !!! End of custom content to be copied !!! consoleLogMock.mockImplementation((output) => { originalLog(output); //!!! Start of custom content to be copied !!! done(); - // !!! End of custom content to be copied !!! + // !!! End of custom content to be copied !!! }); consoleWarnMock.mockImplementation((output) => { // if an error occurs, display the message and then fail the test @@ -698,6 +656,7 @@ describe('IbmAnalyticsEngineApiV3', () => { instanceId: instanceGuid, applicationId: applicationId, }; + //!!! Start of custom content to be copied !!! ibmAnalyticsEngineApiService .deleteApplication(params) diff --git a/ibm-analytics-engine-api/v3.ts b/ibm-analytics-engine-api/v3.ts index 762da57..a4859c9 100644 --- a/ibm-analytics-engine-api/v3.ts +++ b/ibm-analytics-engine-api/v3.ts @@ -15,7 +15,7 @@ */ /** - * IBM OpenAPI SDK Code Generator Version: 3.45.1-632ec580-20220210-190638 + * IBM OpenAPI SDK Code Generator Version: 3.49.0-be9b22fb-20220504-154308 */ import * as extend from 'extend'; @@ -198,8 +198,7 @@ class IbmAnalyticsEngineApiV3 extends BaseService { // const _validationErrors = validateParams(_params, _requiredParams, _validParams); // if (_validationErrors) { // return Promise.reject(_validationErrors); - // !!! End of custom content to be copied !!! - + // !!! End of custom content to be copied !!! } const path = { @@ -234,13 +233,13 @@ class IbmAnalyticsEngineApiV3 extends BaseService { } /** - * Edit instance home details. + * Set instance home. * - * Update details of the Object Storage associated as 'instance home' for an Analytics Engine instance. + * Provide the details of the Cloud Object Storage instance to associate with the Analytics Engine instance and use as + * 'instance home' if 'instance home' has not already been set. * * @param {Object} params - The parameters to send to the service. - * @param {string} params.instanceId - GUID of the Analytics Engine instance for which 'instance home' is to be - * updated. + * @param {string} params.instanceId - GUID of the Analytics Engine instance for which 'instance home' is to be set. * @param {string} [params.newInstanceId] - UUID of the instance home storage instance. * @param {string} [params.newProvider] - Currently only ibm-cos (IBM Cloud Object Storage) is supported. * @param {string} [params.newType] - Type of the instance home storage. Currently, only objectstore (Cloud Object @@ -252,8 +251,8 @@ class IbmAnalyticsEngineApiV3 extends BaseService { * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise>} */ - public createInstanceHome( - params: IbmAnalyticsEngineApiV3.CreateInstanceHomeParams + public setInstanceHome( + params: IbmAnalyticsEngineApiV3.SetInstanceHomeParams ): Promise> { const _params = { ...params }; // !!! Start of custom content to be copied !!! @@ -287,7 +286,7 @@ class IbmAnalyticsEngineApiV3 extends BaseService { const sdkHeaders = getSdkHeaders( IbmAnalyticsEngineApiV3.DEFAULT_SERVICE_NAME, 'v3', - 'createInstanceHome' + 'setInstanceHome' ); const parameters = { @@ -339,8 +338,7 @@ class IbmAnalyticsEngineApiV3 extends BaseService { // const _validationErrors = validateParams(_params, _requiredParams, _validParams); // if (_validationErrors) { // return Promise.reject(_validationErrors); - // !!! End of custom content to be copied !!! - + // !!! End of custom content to be copied !!! } const body = { @@ -625,7 +623,7 @@ class IbmAnalyticsEngineApiV3 extends BaseService { } /** - * Enable or disable log fowarding. + * Enable or disable log forwarding. * * Enable or disable log forwarding from IBM Analytics Engine to IBM Log Analysis server. * @@ -651,7 +649,6 @@ class IbmAnalyticsEngineApiV3 extends BaseService { // if (_validationErrors) { // return Promise.reject(_validationErrors); // !!! End of custom content to be copied !!! - } const body = { @@ -716,7 +713,7 @@ class IbmAnalyticsEngineApiV3 extends BaseService { // const _validationErrors = validateParams(_params, _requiredParams, _validParams); // if (_validationErrors) { // return Promise.reject(_validationErrors); - // !!! End of custom content to be copied !!! + // !!! End of custom content to be copied !!! } const path = { @@ -750,71 +747,14 @@ class IbmAnalyticsEngineApiV3 extends BaseService { return this.createRequest(parameters); } - /** - * Delete logging configuration of a given instance id. - * - * Delete the logging configuration of a given Analytics Engine instance. - * - * @param {Object} params - The parameters to send to the service. - * @param {string} params.instanceGuid - GUID of the instance for which log configuration is to be deleted. - * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers - * @returns {Promise>} - */ - public deleteLoggingConfiguration( - params: IbmAnalyticsEngineApiV3.DeleteLoggingConfigurationParams - ): Promise> { - const _params = { ...params }; - // !!! Start of custom content to be copied !!! - const requiredParams = ['instanceGuid']; - - const missingParams = getMissingParams(_params, requiredParams); - if (missingParams) { - return Promise.reject(missingParams); - // const _requiredParams = ['instanceGuid']; - // const _validParams = ['instanceGuid', 'headers']; - // const _validationErrors = validateParams(_params, _requiredParams, _validParams); - // if (_validationErrors) { - // return Promise.reject(_validationErrors); - // !!! End of custom content to be copied !!! - } - - const path = { - 'instance_guid': _params.instanceGuid, - }; - - const sdkHeaders = getSdkHeaders( - IbmAnalyticsEngineApiV3.DEFAULT_SERVICE_NAME, - 'v3', - 'deleteLoggingConfiguration' - ); - - const parameters = { - options: { - url: '/v3/analytics_engines/{instance_guid}/logging', - method: 'DELETE', - path, - }, - defaultOptions: extend(true, {}, this.baseOptions, { - headers: extend( - true, - sdkHeaders, - { - }, - _params.headers - ), - }), - }; - - return this.createRequest(parameters); - } - /** * Start Spark history server. * - * Start the Spark history server for a given serverless Spark instance. + * Start the Spark history server for the given Analytics Engine instance. * * @param {Object} params - The parameters to send to the service. - * @param {string} params.instanceId - The identifier of the instance for which the Spark history server is started. + * @param {string} params.instanceId - The ID of the Analytics Engine instance whose Spark history server is to be + * started. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise>} */ @@ -833,7 +773,7 @@ class IbmAnalyticsEngineApiV3 extends BaseService { // const _validationErrors = validateParams(_params, _requiredParams, _validParams); // if (_validationErrors) { // return Promise.reject(_validationErrors); - // !!! End of custom content to be copied !!! + // !!! End of custom content to be copied !!! } const path = { @@ -868,12 +808,13 @@ class IbmAnalyticsEngineApiV3 extends BaseService { } /** - * Retrieve Spark history server details by ID. + * Retrieve Spark history server details. * - * Retrieve the Spark history server details for an Analytics Engine instance by the instance ID. + * Get the details of the Spark history server of the given Analytics Engine instance. * * @param {Object} params - The parameters to send to the service. - * @param {string} params.instanceId - The identifier of the instance for which the Spark history server is started. + * @param {string} params.instanceId - The ID of the Analytics Engine instance to which the Spark history server + * belongs. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise>} */ @@ -929,10 +870,11 @@ class IbmAnalyticsEngineApiV3 extends BaseService { /** * Stop Spark history server. * - * Stop the Spark history server for a given serverless Spark instance. + * Stop the Spark history server of the given Analytics Engine instance. * * @param {Object} params - The parameters to send to the service. - * @param {string} params.instanceId - The identifier of the instance for which the Spark history server is stopped. + * @param {string} params.instanceId - The ID of the Analytics Engine instance whose Spark history server is to be + * stopped. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise>} */ @@ -1027,9 +969,9 @@ namespace IbmAnalyticsEngineApiV3 { headers?: OutgoingHttpHeaders; } - /** Parameters for the `createInstanceHome` operation. */ - export interface CreateInstanceHomeParams { - /** GUID of the Analytics Engine instance for which 'instance home' is to be updated. */ + /** Parameters for the `setInstanceHome` operation. */ + export interface SetInstanceHomeParams { + /** GUID of the Analytics Engine instance for which 'instance home' is to be set. */ instanceId: string; /** UUID of the instance home storage instance. */ newInstanceId?: string; @@ -1107,30 +1049,23 @@ namespace IbmAnalyticsEngineApiV3 { headers?: OutgoingHttpHeaders; } - /** Parameters for the `deleteLoggingConfiguration` operation. */ - export interface DeleteLoggingConfigurationParams { - /** GUID of the instance for which log configuration is to be deleted. */ - instanceGuid: string; - headers?: OutgoingHttpHeaders; - } - /** Parameters for the `startSparkHistoryServer` operation. */ export interface StartSparkHistoryServerParams { - /** The identifier of the instance for which the Spark history server is started. */ + /** The ID of the Analytics Engine instance whose Spark history server is to be started. */ instanceId: string; headers?: OutgoingHttpHeaders; } /** Parameters for the `getSparkHistoryServer` operation. */ export interface GetSparkHistoryServerParams { - /** The identifier of the instance for which the Spark history server is started. */ + /** The ID of the Analytics Engine instance to which the Spark history server belongs. */ instanceId: string; headers?: OutgoingHttpHeaders; } /** Parameters for the `stopSparkHistoryServer` operation. */ export interface StopSparkHistoryServerParams { - /** The identifier of the instance for which the Spark history server is stopped. */ + /** The ID of the Analytics Engine instance whose Spark history server is to be stopped. */ instanceId: string; headers?: OutgoingHttpHeaders; } @@ -1355,13 +1290,13 @@ namespace IbmAnalyticsEngineApiV3 { type?: string; } - /** State of Spark history server. */ + /** State of the Spark history server. */ export interface SparkHistoryServerResponse { - /** State of Spark history server. */ + /** State of the Spark history server. */ state?: string; - /** Number of cores used for the Spark history server. */ + /** Number of cpu cores used by the Spark history server. */ cores?: string; - /** Memory used for the Spark history server. */ + /** Amount of memory used by the Spark history server. */ memory?: string; /** Time when the Spark history server was started. */ start_time?: string; @@ -1369,13 +1304,13 @@ namespace IbmAnalyticsEngineApiV3 { stop_time?: string; } - /** Spark history server started response. */ + /** Response of the request to start the Spark history server. */ export interface SparkHistoryServerStartResponse { - /** State of Spark history server. */ + /** State of the Spark history server. */ state?: string; - /** Number of cores used for the Spark history server. */ + /** Number of cpu cores used by the Spark history server. */ cores?: string; - /** Memory used for the Spark history server. */ + /** Amount of memory used by the Spark history server. */ memory?: string; /** Time when the Spark history server was started. */ start_time?: string; diff --git a/test/integration/ibm-analytics-engine-api.v3.test.js b/test/integration/ibm-analytics-engine-api.v3.test.js index e2f420f..2260185 100644 --- a/test/integration/ibm-analytics-engine-api.v3.test.js +++ b/test/integration/ibm-analytics-engine-api.v3.test.js @@ -18,9 +18,8 @@ const IbmAnalyticsEngineApiV3 = require('../../dist/ibm-analytics-engine-api/v3'); const { readExternalSources } = require('ibm-cloud-sdk-core'); - // !!! Start of custom content to be copied !!! -// Replace auth-helper.js with auth.js +// Replace auth-helper.js with auth.js for integration testing const authHelper = require('../resources/auth-helper.js'); const { IamAuthenticator } = require('../../dist/auth'); // !!! End of custom content to be copied !!! @@ -31,7 +30,6 @@ const timeout = 200000; // !!! Start of custom content to be copied !!! // Location of our config file. // const configFile = 'ibm_analytics_engine_api_v3.env'; - // const describe = authHelper.prepareTests(configFile); // !!! End of custom content to be copied !!! @@ -49,6 +47,7 @@ describe('IbmAnalyticsEngineApiV3_integration', () => { jest.setTimeout(timeout); + // Service instance let ibmAnalyticsEngineApiService; test('Initialise service', async () => { @@ -59,7 +58,6 @@ describe('IbmAnalyticsEngineApiV3_integration', () => { const config = readExternalSources(IbmAnalyticsEngineApiV3.DEFAULT_SERVICE_NAME); expect(config).not.toBeNull(); - // ibmAnalyticsEngineApiService.enableRetries(); }); @@ -67,7 +65,6 @@ describe('IbmAnalyticsEngineApiV3_integration', () => { const params = { instanceId: instanceGuid, }; - const res = await ibmAnalyticsEngineApiService.getInstance(params); expect(res).toBeDefined(); expect(res.status).toBe(200); @@ -77,7 +74,6 @@ describe('IbmAnalyticsEngineApiV3_integration', () => { // The following status codes aren't covered by tests. // Please provide integration tests for these too. // - // 400 // 401 // 403 // 404 @@ -98,14 +94,13 @@ describe('IbmAnalyticsEngineApiV3_integration', () => { // The following status codes aren't covered by tests. // Please provide integration tests for these too. // - // 400 // 401 // 403 // 404 // 500 // }); - test('createInstanceHome()', async () => { + test('setInstanceHome()', async () => { const params = { instanceId: instanceIdInstanceHome, newInstanceId: 'testString', @@ -117,7 +112,7 @@ describe('IbmAnalyticsEngineApiV3_integration', () => { newHmacSecretKey: hmacSecretKey, }; - const res = await ibmAnalyticsEngineApiService.createInstanceHome(params); + const res = await ibmAnalyticsEngineApiService.setInstanceHome(params); expect(res).toBeDefined(); expect(res.status).toBe(200); expect(res.result).toBeDefined(); @@ -130,6 +125,7 @@ describe('IbmAnalyticsEngineApiV3_integration', () => { // 401 // 403 // 404 + // 409 // 500 // }); @@ -189,7 +185,6 @@ describe('IbmAnalyticsEngineApiV3_integration', () => { // The following status codes aren't covered by tests. // Please provide integration tests for these too. // - // 400 // 401 // 403 // 404 @@ -211,7 +206,6 @@ describe('IbmAnalyticsEngineApiV3_integration', () => { // The following status codes aren't covered by tests. // Please provide integration tests for these too. // - // 400 // 401 // 403 // 404 @@ -233,7 +227,6 @@ describe('IbmAnalyticsEngineApiV3_integration', () => { // The following status codes aren't covered by tests. // Please provide integration tests for these too. // - // 400 // 401 // 403 // 404 @@ -276,7 +269,6 @@ describe('IbmAnalyticsEngineApiV3_integration', () => { // The following status codes aren't covered by tests. // Please provide integration tests for these too. // - // 400 // 401 // 403 // 404 @@ -292,8 +284,7 @@ describe('IbmAnalyticsEngineApiV3_integration', () => { expect(res).toBeDefined(); expect(res.status).toBe(201); expect(res.result).toBeDefined(); - console.log('startSparkHistoryServer'); - console.log(res); + // // The following status codes aren't covered by tests. // Please provide integration tests for these too. @@ -314,8 +305,7 @@ describe('IbmAnalyticsEngineApiV3_integration', () => { expect(res).toBeDefined(); expect(res.status).toBe(200); expect(res.result).toBeDefined(); - console.log('getSparkHistoryServer'); - console.log(res); + // // The following status codes aren't covered by tests. // Please provide integration tests for these too. @@ -336,28 +326,6 @@ describe('IbmAnalyticsEngineApiV3_integration', () => { expect(res).toBeDefined(); expect(res.status).toBe(204); expect(res.result).toBeDefined(); - console.log('stopSparkHistoryServer'); - console.log(res); - // - // The following status codes aren't covered by tests. - // Please provide integration tests for these too. - // - // 400 - // 401 - // 403 - // 404 - // 500 - // - }); - test('deleteLoggingConfiguration()', async () => { - const params = { - instanceGuid: instanceGuid, - }; - - const res = await ibmAnalyticsEngineApiService.deleteLoggingConfiguration(params); - expect(res).toBeDefined(); - expect(res.status).toBe(204); - expect(res.result).toBeDefined(); // // The following status codes aren't covered by tests. diff --git a/test/unit/ibm-analytics-engine-api.v3.test.js b/test/unit/ibm-analytics-engine-api.v3.test.js index ab28c73..3ef9a86 100644 --- a/test/unit/ibm-analytics-engine-api.v3.test.js +++ b/test/unit/ibm-analytics-engine-api.v3.test.js @@ -286,10 +286,10 @@ describe('IbmAnalyticsEngineApiV3', () => { }); }); }); - describe('createInstanceHome', () => { + describe('setInstanceHome', () => { describe('positive tests', () => { - function __createInstanceHomeTest() { - // Construct the params object for operation createInstanceHome + function __setInstanceHomeTest() { + // Construct the params object for operation setInstanceHome const instanceId = 'e64c907a-e82f-46fd-addc-ccfafbd28b09'; const newInstanceId = 'testString'; const newProvider = 'ibm-cos'; @@ -298,7 +298,7 @@ describe('IbmAnalyticsEngineApiV3', () => { const newEndpoint = 's3.direct.us-south.cloud-object-storage.appdomain.cloud'; const newHmacAccessKey = '821**********0ae'; const newHmacSecretKey = '03e****************4fc3'; - const createInstanceHomeParams = { + const setInstanceHomeParams = { instanceId: instanceId, newInstanceId: newInstanceId, newProvider: newProvider, @@ -309,12 +309,12 @@ describe('IbmAnalyticsEngineApiV3', () => { newHmacSecretKey: newHmacSecretKey, }; - const createInstanceHomeResult = ibmAnalyticsEngineApiService.createInstanceHome( - createInstanceHomeParams + const setInstanceHomeResult = ibmAnalyticsEngineApiService.setInstanceHome( + setInstanceHomeParams ); // all methods should return a Promise - expectToBePromise(createInstanceHomeResult); + expectToBePromise(setInstanceHomeResult); // assert that create request was called expect(createRequestMock).toHaveBeenCalledTimes(1); @@ -341,21 +341,21 @@ describe('IbmAnalyticsEngineApiV3', () => { test('should pass the right params to createRequest with enable and disable retries', () => { // baseline test - __createInstanceHomeTest(); + __setInstanceHomeTest(); // enable retries and test again createRequestMock.mockClear(); // !!! Start of custom content to be copied !!! // ibmAnalyticsEngineApiService.enableRetries(); // !!! End of custom content to be copied !!! - __createInstanceHomeTest(); + __setInstanceHomeTest(); // disable retries and test again createRequestMock.mockClear(); // !!! Start of custom content to be copied !!! // ibmAnalyticsEngineApiService.disableRetries(); // !!! End of custom content to be copied !!! - __createInstanceHomeTest(); + __setInstanceHomeTest(); }); test('should prioritize user-given headers', () => { @@ -363,7 +363,7 @@ describe('IbmAnalyticsEngineApiV3', () => { const instanceId = 'e64c907a-e82f-46fd-addc-ccfafbd28b09'; const userAccept = 'fake/accept'; const userContentType = 'fake/contentType'; - const createInstanceHomeParams = { + const setInstanceHomeParams = { instanceId, headers: { Accept: userAccept, @@ -371,7 +371,7 @@ describe('IbmAnalyticsEngineApiV3', () => { }, }; - ibmAnalyticsEngineApiService.createInstanceHome(createInstanceHomeParams); + ibmAnalyticsEngineApiService.setInstanceHome(setInstanceHomeParams); checkMediaHeaders(createRequestMock, userAccept, userContentType); }); }); @@ -380,7 +380,7 @@ describe('IbmAnalyticsEngineApiV3', () => { test('should enforce required parameters', async () => { let err; try { - await ibmAnalyticsEngineApiService.createInstanceHome({}); + await ibmAnalyticsEngineApiService.setInstanceHome({}); } catch (e) { err = e; } @@ -391,7 +391,7 @@ describe('IbmAnalyticsEngineApiV3', () => { test('should reject promise when required params are not given', async () => { let err; try { - await ibmAnalyticsEngineApiService.createInstanceHome(); + await ibmAnalyticsEngineApiService.setInstanceHome(); } catch (e) { err = e; } @@ -1089,99 +1089,6 @@ describe('IbmAnalyticsEngineApiV3', () => { }); }); }); - describe('deleteLoggingConfiguration', () => { - describe('positive tests', () => { - function __deleteLoggingConfigurationTest() { - // Construct the params object for operation deleteLoggingConfiguration - const instanceGuid = 'e64c907a-e82f-46fd-addc-ccfafbd28b09'; - const deleteLoggingConfigurationParams = { - instanceGuid: instanceGuid, - }; - - const deleteLoggingConfigurationResult = ibmAnalyticsEngineApiService.deleteLoggingConfiguration( - deleteLoggingConfigurationParams - ); - - // all methods should return a Promise - expectToBePromise(deleteLoggingConfigurationResult); - - // assert that create request was called - expect(createRequestMock).toHaveBeenCalledTimes(1); - - const mockRequestOptions = getOptions(createRequestMock); - - checkUrlAndMethod( - mockRequestOptions, - '/v3/analytics_engines/{instance_guid}/logging', - 'DELETE' - ); - const expectedAccept = undefined; - const expectedContentType = undefined; - checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); - expect(mockRequestOptions.path.instance_guid).toEqual(instanceGuid); - } - - test('should pass the right params to createRequest with enable and disable retries', () => { - // baseline test - __deleteLoggingConfigurationTest(); - - // enable retries and test again - createRequestMock.mockClear(); - // !!! Start of custom content to be copied !!! - // ibmAnalyticsEngineApiService.enableRetries(); - // !!! End of custom content to be copied !!! - __deleteLoggingConfigurationTest(); - - // disable retries and test again - createRequestMock.mockClear(); - // !!! Start of custom content to be copied !!! - // ibmAnalyticsEngineApiService.disableRetries(); - // !!! End of custom content to be copied !!! - __deleteLoggingConfigurationTest(); - }); - - test('should prioritize user-given headers', () => { - // parameters - const instanceGuid = 'e64c907a-e82f-46fd-addc-ccfafbd28b09'; - const userAccept = 'fake/accept'; - const userContentType = 'fake/contentType'; - const deleteLoggingConfigurationParams = { - instanceGuid, - headers: { - Accept: userAccept, - 'Content-Type': userContentType, - }, - }; - - ibmAnalyticsEngineApiService.deleteLoggingConfiguration(deleteLoggingConfigurationParams); - checkMediaHeaders(createRequestMock, userAccept, userContentType); - }); - }); - - describe('negative tests', () => { - test('should enforce required parameters', async () => { - let err; - try { - await ibmAnalyticsEngineApiService.deleteLoggingConfiguration({}); - } catch (e) { - err = e; - } - - expect(err.message).toMatch(/Missing required parameters/); - }); - - test('should reject promise when required params are not given', async () => { - let err; - try { - await ibmAnalyticsEngineApiService.deleteLoggingConfiguration(); - } catch (e) { - err = e; - } - - expect(err.message).toMatch(/Missing required parameters/); - }); - }); - }); describe('startSparkHistoryServer', () => { describe('positive tests', () => { function __startSparkHistoryServerTest() {