From a1a67b1a86f311cd9f3f0addf4cae3b0b075bcde Mon Sep 17 00:00:00 2001 From: Kevin Cunnane Date: Tue, 23 Jul 2019 19:14:18 -0700 Subject: [PATCH] Fix #6477 controller login + fix dashboard layout (#6478) * Fix #6477 controller login + fix dashboard layout - Service endpoints shoudl be on own column, cut off smaller screen - Controller login not working due to 404 error This is due to a breaking API change We have requested fixes to help mitigate need for cluster name, but for now have a default value for this Finally, modified code so it's easier to update swagger API and also added instructions on how to update in future --- build/gulpfile.hygiene.js | 7 +- extensions/big-data-cluster/instructions.txt | 12 + .../bigDataCluster/controller/apiGenerated.ts | 2169 ++++++++--------- .../controller/clusterControllerApi.ts | 36 +- .../dialog/addControllerDialog.ts | 54 +- .../tree/controllerTreeDataProvider.ts | 8 +- .../bigDataCluster/tree/controllerTreeNode.ts | 21 +- extensions/big-data-cluster/src/extension.ts | 32 +- extensions/mssql/package.json | 4 +- 9 files changed, 1157 insertions(+), 1186 deletions(-) create mode 100644 extensions/big-data-cluster/instructions.txt diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js index 3c07288d2e..2b0f4c6e7d 100644 --- a/build/gulpfile.hygiene.js +++ b/build/gulpfile.hygiene.js @@ -97,7 +97,8 @@ const indentationFilter = [ '!extensions/import/flatfileimportservice/**', '!extensions/admin-tool-ext-win/ssmsmin/**', '!extensions/resource-deployment/notebooks/**', - '!extensions/mssql/notebooks/**' + '!extensions/mssql/notebooks/**', + '!extensions/big-data-cluster/src/bigDataCluster/controller/apiGenerated.ts' ]; const copyrightFilter = [ @@ -184,7 +185,9 @@ const tslintFilter = [ '!extensions/vscode-api-tests/testWorkspace/**', '!extensions/vscode-api-tests/testWorkspace2/**', '!extensions/**/*.test.ts', - '!extensions/html-language-features/server/lib/jquery.d.ts' + '!extensions/html-language-features/server/lib/jquery.d.ts', + // {{SQL CARBON EDIT}} + '!extensions/big-data-cluster/src/bigDataCluster/controller/apiGenerated.ts' ]; // {{SQL CARBON EDIT}} diff --git a/extensions/big-data-cluster/instructions.txt b/extensions/big-data-cluster/instructions.txt new file mode 100644 index 0000000000..ddfa0a4c01 --- /dev/null +++ b/extensions/big-data-cluster/instructions.txt @@ -0,0 +1,12 @@ +How to update the Swagger-generated API to contact the controller + +1. You need to get the API specification. Long-term you should be able to get from the server, +but for now go to the internal repository and find the checked in SwaggerClient.yaml there. + +2. Copy the content from there, and add into https://editor.swagger.io/ +3. Choose Generate Client, and choose Typescript-Node as the client to generate +4. This will download a zip file. Open it and copy contents of api.ts +5. Copy this content to apiGenerated.ts +- keep the copyright header and everything above the let defaultBasePath = xyz line, +- Override the rest of the file +6. Format the apiGenerated.ts file so it passes gulp hygiene \ No newline at end of file diff --git a/extensions/big-data-cluster/src/bigDataCluster/controller/apiGenerated.ts b/extensions/big-data-cluster/src/bigDataCluster/controller/apiGenerated.ts index 15b2fbba13..bb3b349712 100644 --- a/extensions/big-data-cluster/src/bigDataCluster/controller/apiGenerated.ts +++ b/extensions/big-data-cluster/src/bigDataCluster/controller/apiGenerated.ts @@ -3,30 +3,41 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as request from 'request'; +/* tslint:disable: no-unexternalized-strings */ +/* tslint:disable: semicolon */ +/* tslint:disable: triple-equals */ +/* tslint:disable: no-redundant-jsdoc */ + +import * as localVarRequest from 'request'; import * as http from 'http'; let defaultBasePath = 'https://localhost'; +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +/* tslint:disable:no-unused-variable */ + let primitives = [ - 'string', - 'boolean', - 'double', - 'integer', - 'long', - 'float', - 'number', - 'any' + "string", + "boolean", + "double", + "integer", + "long", + "float", + "number", + "any" ]; class ObjectSerializer { public static findCorrectType(data: any, expectedType: string) { - if (data === undefined) { + if (data == undefined) { return expectedType; } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { return expectedType; - } else if (expectedType === 'Date') { + } else if (expectedType === "Date") { return expectedType; } else { if (enumsMap[expectedType]) { @@ -39,7 +50,7 @@ class ObjectSerializer { // Check the discriminator let discriminatorProperty = typeMap[expectedType].discriminator; - if (discriminatorProperty === null || discriminatorProperty === undefined) { + if (discriminatorProperty == null) { return expectedType; // the type does not have a discriminator. use it. } else { if (data[discriminatorProperty]) { @@ -52,12 +63,12 @@ class ObjectSerializer { } public static serialize(data: any, type: string) { - if (data === undefined) { + if (data == undefined) { return data; } else if (primitives.indexOf(type.toLowerCase()) !== -1) { return data; - } else if (type.lastIndexOf('Array<', 0) === 0) { // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> + } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 + let subType: string = type.replace("Array<", ""); // Array => Type> subType = subType.substring(0, subType.length - 1); // Type> => Type let transformedData: any[] = []; for (let index in data) { @@ -65,13 +76,13 @@ class ObjectSerializer { transformedData.push(ObjectSerializer.serialize(date, subType)); } return transformedData; - } else if (type === 'Date') { + } else if (type === "Date") { return data.toString(); } else { if (enumsMap[type]) { return data; } - if (!typeMap[type]) { // in case we don't know the type + if (!typeMap[type]) { // in case we dont know the type return data; } @@ -89,12 +100,12 @@ class ObjectSerializer { public static deserialize(data: any, type: string) { // polymorphism may change the actual type. type = ObjectSerializer.findCorrectType(data, type); - if (data === undefined) { + if (data == undefined) { return data; } else if (primitives.indexOf(type.toLowerCase()) !== -1) { return data; - } else if (type.lastIndexOf('Array<', 0) === 0) { // string.startsWith pre es6 - let subType: string = type.replace('Array<', ''); // Array => Type> + } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6 + let subType: string = type.replace("Array<", ""); // Array => Type> subType = subType.substring(0, subType.length - 1); // Type> => Type let transformedData: any[] = []; for (let index in data) { @@ -102,7 +113,7 @@ class ObjectSerializer { transformedData.push(ObjectSerializer.deserialize(date, subType)); } return transformedData; - } else if (type === 'Date') { + } else if (type === "Date") { return new Date(data); } else { if (enumsMap[type]) {// is Enum @@ -123,210 +134,6 @@ class ObjectSerializer { } } -export class AppMetadata { - 'name'?: string; - 'version'?: string; - 'description'?: string; - 'runtimeType'?: string; - 'initCode'?: string; - 'code'?: string; - 'azureFileSpec'?: Array; - 'inputDef'?: Array; - 'outputDef'?: Array; - 'replicas'?: number; - 'poolSizePerReplica'?: number; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{ name: string, baseName: string, type: string }> = [ - { - 'name': 'name', - 'baseName': 'name', - 'type': 'string' - }, - { - 'name': 'version', - 'baseName': 'version', - 'type': 'string' - }, - { - 'name': 'description', - 'baseName': 'description', - 'type': 'string' - }, - { - 'name': 'runtimeType', - 'baseName': 'runtimeType', - 'type': 'string' - }, - { - 'name': 'initCode', - 'baseName': 'initCode', - 'type': 'string' - }, - { - 'name': 'code', - 'baseName': 'code', - 'type': 'string' - }, - { - 'name': 'azureFileSpec', - 'baseName': 'azureFileSpec', - 'type': 'Array' - }, - { - 'name': 'inputDef', - 'baseName': 'inputDef', - 'type': 'Array' - }, - { - 'name': 'outputDef', - 'baseName': 'outputDef', - 'type': 'Array' - }, - { - 'name': 'replicas', - 'baseName': 'replicas', - 'type': 'number' - }, - { - 'name': 'poolSizePerReplica', - 'baseName': 'poolSizePerReplica', - 'type': 'number' - } - ]; - - static getAttributeTypeMap() { - return AppMetadata.attributeTypeMap; - } -} - -export class AppModel { - 'name'?: string; - 'internalName'?: string; - 'version'?: string; - 'inputParamDefs'?: Array; - 'outputParamDefs'?: Array; - 'state'?: string; - 'links'?: { [key: string]: string; }; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{ name: string, baseName: string, type: string }> = [ - { - 'name': 'name', - 'baseName': 'name', - 'type': 'string' - }, - { - 'name': 'internalName', - 'baseName': 'internal_name', - 'type': 'string' - }, - { - 'name': 'version', - 'baseName': 'version', - 'type': 'string' - }, - { - 'name': 'inputParamDefs', - 'baseName': 'input_param_defs', - 'type': 'Array' - }, - { - 'name': 'outputParamDefs', - 'baseName': 'output_param_defs', - 'type': 'Array' - }, - { - 'name': 'state', - 'baseName': 'state', - 'type': 'string' - }, - { - 'name': 'links', - 'baseName': 'links', - 'type': '{ [key: string]: string; }' - } - ]; - - static getAttributeTypeMap() { - return AppModel.attributeTypeMap; - } -} - -export class AppModelParameterDefinition { - 'name'?: string; - 'type'?: string; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{ name: string, baseName: string, type: string }> = [ - { - 'name': 'name', - 'baseName': 'name', - 'type': 'string' - }, - { - 'name': 'type', - 'baseName': 'type', - 'type': 'string' - } - ]; - - static getAttributeTypeMap() { - return AppModelParameterDefinition.attributeTypeMap; - } -} - -export class AppRequest { - 'metadata'?: AppMetadata; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{ name: string, baseName: string, type: string }> = [ - { - 'name': 'metadata', - 'baseName': 'metadata', - 'type': 'AppMetadata' - } - ]; - - static getAttributeTypeMap() { - return AppRequest.attributeTypeMap; - } -} - -export class AzureFileSpecDefinition { - 'secretName'?: string; - 'mountPath'?: string; - 'fileShareName'?: string; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{ name: string, baseName: string, type: string }> = [ - { - 'name': 'secretName', - 'baseName': 'secretName', - 'type': 'string' - }, - { - 'name': 'mountPath', - 'baseName': 'mountPath', - 'type': 'string' - }, - { - 'name': 'fileShareName', - 'baseName': 'fileShareName', - 'type': 'string' - } - ]; - - static getAttributeTypeMap() { - return AzureFileSpecDefinition.attributeTypeMap; - } -} - export class EndpointModel { 'name'?: string; 'description'?: string; @@ -341,148 +148,74 @@ export class EndpointModel { static attributeTypeMap: Array<{ name: string, baseName: string, type: string }> = [ { - 'name': 'name', - 'baseName': 'name', - 'type': 'string' + "name": "name", + "baseName": "name", + "type": "string" }, { - 'name': 'description', - 'baseName': 'description', - 'type': 'string' + "name": "description", + "baseName": "description", + "type": "string" }, { - 'name': 'endpoint', - 'baseName': 'endpoint', - 'type': 'string' + "name": "endpoint", + "baseName": "endpoint", + "type": "string" }, { - 'name': 'ip', - 'baseName': 'ip', - 'type': 'string' + "name": "ip", + "baseName": "ip", + "type": "string" }, { - 'name': 'port', - 'baseName': 'port', - 'type': 'number' + "name": "port", + "baseName": "port", + "type": "number" }, { - 'name': 'path', - 'baseName': 'path', - 'type': 'string' + "name": "path", + "baseName": "path", + "type": "string" }, { - 'name': 'protocol', - 'baseName': 'protocol', - 'type': 'string' + "name": "protocol", + "baseName": "protocol", + "type": "string" }, { - 'name': 'service', - 'baseName': 'service', - 'type': 'string' - } - ]; + "name": "service", + "baseName": "service", + "type": "string" + }]; static getAttributeTypeMap() { return EndpointModel.attributeTypeMap; } } -export class ParameterDefinition { - 'name'?: string; - 'type'?: string; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{ name: string, baseName: string, type: string }> = [ - { - 'name': 'name', - 'baseName': 'name', - 'type': 'string' - }, - { - 'name': 'type', - 'baseName': 'type', - 'type': 'string' - } - ]; - - static getAttributeTypeMap() { - return ParameterDefinition.attributeTypeMap; - } -} - -export class TokenModel { - 'tokenType'?: string; - 'accessToken'?: string; - 'expiresIn'?: number; - 'expiresOn'?: number; - 'tokenId'?: string; - - static discriminator: string | undefined = undefined; - - static attributeTypeMap: Array<{ name: string, baseName: string, type: string }> = [ - { - 'name': 'tokenType', - 'baseName': 'token_type', - 'type': 'string' - }, - { - 'name': 'accessToken', - 'baseName': 'access_token', - 'type': 'string' - }, - { - 'name': 'expiresIn', - 'baseName': 'expires_in', - 'type': 'number' - }, - { - 'name': 'expiresOn', - 'baseName': 'expires_on', - 'type': 'number' - }, - { - 'name': 'tokenId', - 'baseName': 'token_id', - 'type': 'string' - } - ]; - - static getAttributeTypeMap() { - return TokenModel.attributeTypeMap; - } -} - let enumsMap: { [index: string]: any } = { -}; +} let typeMap: { [index: string]: any } = { - 'AppMetadata': AppMetadata, - 'AppModel': AppModel, - 'AppModelParameterDefinition': AppModelParameterDefinition, - 'AppRequest': AppRequest, - 'AzureFileSpecDefinition': AzureFileSpecDefinition, - 'EndpointModel': EndpointModel, - 'ParameterDefinition': ParameterDefinition, - 'TokenModel': TokenModel, -}; + "EndpointModel": EndpointModel, +} export interface Authentication { - /** - * Apply authentication settings to header and query params. - */ - applyToRequest(requestOptions: request.Options): void; + /** + * Apply authentication settings to header and query params. + */ + applyToRequest(requestOptions: localVarRequest.Options): void; } export class HttpBasicAuth implements Authentication { public username: string = ''; public password: string = ''; - applyToRequest(requestOptions: request.Options): void { + applyToRequest(requestOptions: localVarRequest.Options): void { requestOptions.auth = { username: this.username, password: this.password - }; + } } } @@ -492,10 +225,10 @@ export class ApiKeyAuth implements Authentication { constructor(private location: string, private paramName: string) { } - applyToRequest(requestOptions: request.Options): void { - if (this.location === 'query') { + applyToRequest(requestOptions: localVarRequest.Options): void { + if (this.location == "query") { (requestOptions.qs)[this.paramName] = this.apiKey; - } else if (this.location === 'header' && requestOptions && requestOptions.headers) { + } else if (this.location == "header" && requestOptions && requestOptions.headers) { requestOptions.headers[this.paramName] = this.apiKey; } } @@ -504,9 +237,9 @@ export class ApiKeyAuth implements Authentication { export class OAuth implements Authentication { public accessToken: string = ''; - applyToRequest(requestOptions: request.Options): void { + applyToRequest(requestOptions: localVarRequest.Options): void { if (requestOptions && requestOptions.headers) { - requestOptions.headers['Authorization'] = 'Bearer ' + this.accessToken; + requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; } } } @@ -515,36 +248,36 @@ export class VoidAuth implements Authentication { public username: string = ''; public password: string = ''; - applyToRequest(_: request.Options): void { + applyToRequest(_: localVarRequest.Options): void { // Do nothing } } -export enum AppRouterApiApiKeys { +export enum ClusterRouterApiApiKeys { } -export class AppRouterApi { +export class ClusterRouterApi { protected _basePath = defaultBasePath; protected defaultHeaders: any = {}; protected _useQuerystring: boolean = false; protected authentications = { 'default': new VoidAuth(), - 'basic': new HttpBasicAuth() - }; + 'basicAuth': new HttpBasicAuth(), + } constructor(basePath?: string); constructor(username: string, password: string, basePath?: string); constructor(basePathOrUsername: string, password?: string, basePath?: string) { if (password) { this.username = basePathOrUsername; - this.password = password; + this.password = password if (basePath) { this.basePath = basePath; } } else { if (basePathOrUsername) { - this.basePath = basePathOrUsername; + this.basePath = basePathOrUsername } } } @@ -565,45 +298,381 @@ export class AppRouterApi { this.authentications.default = auth; } - public setApiKey(key: AppRouterApiApiKeys, value: string) { - (this.authentications as any)[AppRouterApiApiKeys[key]].apiKey = value; + public setApiKey(key: ClusterRouterApiApiKeys, value: string) { + (this.authentications as any)[ClusterRouterApiApiKeys[key]].apiKey = value; } set username(username: string) { - this.authentications.basic.username = username; + this.authentications.basicAuth.username = username; } set password(password: string) { - this.authentications.basic.password = password; + this.authentications.basicAuth.password = password; } - - /** - * @param name name - * @param version version - * @param [options] Override http request options. - */ - public appByNameByVersionDelete(name: string, version: string, options: any = {}): Promise<{ response: http.IncomingMessage; body?: any; }> { - const localVarPath = this.basePath + '/app/{name}/{version}' - .replace('{name}', encodeURIComponent(String(name))) - .replace('{version}', encodeURIComponent(String(version))); + /** + * + * @param clusterName + * @param endpointName + * @param {*} [options] Override http request options. + */ + public endpointsByNameGet(clusterName: string, endpointName: string, options: any = {}): Promise<{ response: http.ClientResponse; body: EndpointModel; }> { + const localVarPath = this.basePath + '/bdc/{clusterName}/endpoints/{endpointName}' + .replace('{' + 'clusterName' + '}', encodeURIComponent(String(clusterName))) + .replace('{' + 'endpointName' + '}', encodeURIComponent(String(endpointName))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); let localVarFormParams: any = {}; - // verify required parameter 'name' is not null or undefined - if (name === null || name === undefined) { - throw new Error('Required parameter name was null or undefined when calling appByNameByVersionDelete.'); + // verify required parameter 'clusterName' is not null or undefined + if (clusterName === null || clusterName === undefined) { + throw new Error('Required parameter clusterName was null or undefined when calling endpointsByNameGet.'); } - // verify required parameter 'version' is not null or undefined - if (version === null || version === undefined) { - throw new Error('Required parameter version was null or undefined when calling appByNameByVersionDelete.'); + // verify required parameter 'endpointName' is not null or undefined + if (endpointName === null || endpointName === undefined) { + throw new Error('Required parameter endpointName was null or undefined when calling endpointsByNameGet.'); } - localVarHeaderParams = (Object).assign(localVarHeaderParams, options.headers); + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; - let localVarRequestOptions: request.Options = { + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: EndpointModel; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "EndpointModel"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @param clusterName + * @param {*} [options] Override http request options. + */ + public endpointsGet(clusterName: string, options: any = {}): Promise<{ response: http.ClientResponse; body: Array; }> { + const localVarPath = this.basePath + '/bdc/{clusterName}/endpoints' + .replace('{' + 'clusterName' + '}', encodeURIComponent(String(clusterName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'clusterName' is not null or undefined + if (clusterName === null || clusterName === undefined) { + throw new Error('Required parameter clusterName was null or undefined when calling endpointsGet.'); + } + + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: Array; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "Array"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } +} +export enum DefaultApiApiKeys { +} + +export class DefaultApi { + protected _basePath = defaultBasePath; + protected defaultHeaders: any = {}; + protected _useQuerystring: boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'basicAuth': new HttpBasicAuth(), + } + + constructor(basePath?: string); + constructor(username: string, password: string, basePath?: string); + constructor(basePathOrUsername: string, password?: string, basePath?: string) { + if (password) { + this.username = basePathOrUsername; + this.password = password + if (basePath) { + this.basePath = basePath; + } + } else { + if (basePathOrUsername) { + this.basePath = basePathOrUsername + } + } + } + + set useQuerystring(value: boolean) { + this._useQuerystring = value; + } + + set basePath(basePath: string) { + this._basePath = basePath; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: DefaultApiApiKeys, value: string) { + (this.authentications as any)[DefaultApiApiKeys[key]].apiKey = value; + } + set username(username: string) { + this.authentications.basicAuth.username = username; + } + + set password(password: string) { + this.authentications.basicAuth.password = password; + } + /** + * + * @summary Create a cluster + * @param xRequestId + * @param connection + * @param data Cluster configuration in JSON format + * @param {*} [options] Override http request options. + */ + public createCluster(xRequestId: string, connection: string, data: string, options: any = {}): Promise<{ response: http.ClientResponse; body: any; }> { + const localVarPath = this.basePath + '/bdc'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'xRequestId' is not null or undefined + if (xRequestId === null || xRequestId === undefined) { + throw new Error('Required parameter xRequestId was null or undefined when calling createCluster.'); + } + + // verify required parameter 'connection' is not null or undefined + if (connection === null || connection === undefined) { + throw new Error('Required parameter connection was null or undefined when calling createCluster.'); + } + + // verify required parameter 'data' is not null or undefined + if (data === null || data === undefined) { + throw new Error('Required parameter data was null or undefined when calling createCluster.'); + } + + localVarHeaderParams['X-Request-Id'] = ObjectSerializer.serialize(xRequestId, "string"); + localVarHeaderParams['Connection'] = ObjectSerializer.serialize(connection, "string"); + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'POST', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(data, "string") + }; + + this.authentications.basicAuth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "any"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Create a mount + * @param xRequestId + * @param connection + * @param remote URI of remote store to mount + * @param mount Local path to mount on + * @param credentials Credentials to create the mount + * @param {*} [options] Override http request options. + */ + public createMount(xRequestId: string, connection: string, remote: string, mount: string, credentials?: any, options: any = {}): Promise<{ response: http.ClientResponse; body: any; }> { + const localVarPath = this.basePath + '/storage/mounts'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'xRequestId' is not null or undefined + if (xRequestId === null || xRequestId === undefined) { + throw new Error('Required parameter xRequestId was null or undefined when calling createMount.'); + } + + // verify required parameter 'connection' is not null or undefined + if (connection === null || connection === undefined) { + throw new Error('Required parameter connection was null or undefined when calling createMount.'); + } + + // verify required parameter 'remote' is not null or undefined + if (remote === null || remote === undefined) { + throw new Error('Required parameter remote was null or undefined when calling createMount.'); + } + + // verify required parameter 'mount' is not null or undefined + if (mount === null || mount === undefined) { + throw new Error('Required parameter mount was null or undefined when calling createMount.'); + } + + if (remote !== undefined) { + localVarQueryParameters['remote'] = ObjectSerializer.serialize(remote, "string"); + } + + if (mount !== undefined) { + localVarQueryParameters['mount'] = ObjectSerializer.serialize(mount, "string"); + } + + localVarHeaderParams['X-Request-Id'] = ObjectSerializer.serialize(xRequestId, "string"); + localVarHeaderParams['Connection'] = ObjectSerializer.serialize(connection, "string"); + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'POST', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(credentials, "any") + }; + + this.authentications.basicAuth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "any"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Delete a cluster + * @param xRequestId + * @param connection + * @param name + * @param {*} [options] Override http request options. + */ + public deleteCluster(xRequestId: string, connection: string, name: string, options: any = {}): Promise<{ response: http.ClientResponse; body: any; }> { + const localVarPath = this.basePath + '/bdc/{name}' + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'xRequestId' is not null or undefined + if (xRequestId === null || xRequestId === undefined) { + throw new Error('Required parameter xRequestId was null or undefined when calling deleteCluster.'); + } + + // verify required parameter 'connection' is not null or undefined + if (connection === null || connection === undefined) { + throw new Error('Required parameter connection was null or undefined when calling deleteCluster.'); + } + + // verify required parameter 'name' is not null or undefined + if (name === null || name === undefined) { + throw new Error('Required parameter name was null or undefined when calling deleteCluster.'); + } + + localVarHeaderParams['X-Request-Id'] = ObjectSerializer.serialize(xRequestId, "string"); + localVarHeaderParams['Connection'] = ObjectSerializer.serialize(connection, "string"); + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { method: 'DELETE', qs: localVarQueryParameters, headers: localVarHeaderParams, @@ -612,7 +681,7 @@ export class AppRouterApi { json: true, }; - this.authentications.basic.applyToRequest(localVarRequestOptions); + this.authentications.basicAuth.applyToRequest(localVarRequestOptions); this.authentications.default.applyToRequest(localVarRequestOptions); @@ -623,11 +692,12 @@ export class AppRouterApi { localVarRequestOptions.form = localVarFormParams; } } - return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { - request(localVarRequestOptions, (error, response, body) => { + return new Promise<{ response: http.ClientResponse; body: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { + body = ObjectSerializer.deserialize(body, "any"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { @@ -637,35 +707,117 @@ export class AppRouterApi { }); }); } - - /** - * @param name name - * @param version version - * @param [options] Override http request options. - */ - public appByNameByVersionGet(name: string, version: string, options: any = {}): Promise<{ response: http.IncomingMessage; body: AppModel; }> { - const localVarPath = this.basePath + '/app/{name}/{version}' - .replace('{name}', encodeURIComponent(String(name))) - .replace('{version}', encodeURIComponent(String(version))); + /** + * + * @summary Delete a mount + * @param xRequestId + * @param connection + * @param mount Local HDFS mount path + * @param {*} [options] Override http request options. + */ + public deleteMount(xRequestId: string, connection: string, mount: string, options: any = {}): Promise<{ response: http.ClientResponse; body: any; }> { + const localVarPath = this.basePath + '/storage/mounts'; let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); let localVarFormParams: any = {}; + // verify required parameter 'xRequestId' is not null or undefined + if (xRequestId === null || xRequestId === undefined) { + throw new Error('Required parameter xRequestId was null or undefined when calling deleteMount.'); + } + + // verify required parameter 'connection' is not null or undefined + if (connection === null || connection === undefined) { + throw new Error('Required parameter connection was null or undefined when calling deleteMount.'); + } + + // verify required parameter 'mount' is not null or undefined + if (mount === null || mount === undefined) { + throw new Error('Required parameter mount was null or undefined when calling deleteMount.'); + } + + if (mount !== undefined) { + localVarQueryParameters['mount'] = ObjectSerializer.serialize(mount, "string"); + } + + localVarHeaderParams['X-Request-Id'] = ObjectSerializer.serialize(xRequestId, "string"); + localVarHeaderParams['Connection'] = ObjectSerializer.serialize(connection, "string"); + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'DELETE', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.basicAuth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "any"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Get cluster config + * @param xRequestId + * @param connection + * @param name + * @param {*} [options] Override http request options. + */ + public getCluster(xRequestId: string, connection: string, name: string, options: any = {}): Promise<{ response: http.ClientResponse; body: any; }> { + const localVarPath = this.basePath + '/bdc/{name}' + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'xRequestId' is not null or undefined + if (xRequestId === null || xRequestId === undefined) { + throw new Error('Required parameter xRequestId was null or undefined when calling getCluster.'); + } + + // verify required parameter 'connection' is not null or undefined + if (connection === null || connection === undefined) { + throw new Error('Required parameter connection was null or undefined when calling getCluster.'); + } + // verify required parameter 'name' is not null or undefined if (name === null || name === undefined) { - throw new Error('Required parameter name was null or undefined when calling appByNameByVersionGet.'); + throw new Error('Required parameter name was null or undefined when calling getCluster.'); } - // verify required parameter 'version' is not null or undefined - if (version === null || version === undefined) { - throw new Error('Required parameter version was null or undefined when calling appByNameByVersionGet.'); - } - - localVarHeaderParams = (Object).assign(localVarHeaderParams, options.headers); + localVarHeaderParams['X-Request-Id'] = ObjectSerializer.serialize(xRequestId, "string"); + localVarHeaderParams['Connection'] = ObjectSerializer.serialize(connection, "string"); + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; - let localVarRequestOptions: request.Options = { + let localVarRequestOptions: localVarRequest.Options = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, @@ -674,7 +826,7 @@ export class AppRouterApi { json: true, }; - this.authentications.basic.applyToRequest(localVarRequestOptions); + this.authentications.basicAuth.applyToRequest(localVarRequestOptions); this.authentications.default.applyToRequest(localVarRequestOptions); @@ -685,12 +837,12 @@ export class AppRouterApi { localVarRequestOptions.form = localVarFormParams; } } - return new Promise<{ response: http.IncomingMessage; body: AppModel; }>((resolve, reject) => { - request(localVarRequestOptions, (error, response, body) => { + return new Promise<{ response: http.ClientResponse; body: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { - body = ObjectSerializer.deserialize(body, 'AppModel'); + body = ObjectSerializer.deserialize(body, "any"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { @@ -700,46 +852,52 @@ export class AppRouterApi { }); }); } - - /** - * @param name name - * @param version version - * @param appRequest appRequest - * @param [options] Override http request options. - */ - public appByNameByVersionPatch(name: string, version: string, appRequest?: AppRequest, options: any = {}): Promise<{ response: http.IncomingMessage; body?: any; }> { - const localVarPath = this.basePath + '/app/{name}/{version}' - .replace('{name}', encodeURIComponent(String(name))) - .replace('{version}', encodeURIComponent(String(version))); + /** + * + * @summary Get cluster status + * @param xRequestId + * @param connection + * @param name + * @param {*} [options] Override http request options. + */ + public getClusterStatus(xRequestId: string, connection: string, name: string, options: any = {}): Promise<{ response: http.ClientResponse; body: any; }> { + const localVarPath = this.basePath + '/bdc/{name}/status' + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); let localVarFormParams: any = {}; + // verify required parameter 'xRequestId' is not null or undefined + if (xRequestId === null || xRequestId === undefined) { + throw new Error('Required parameter xRequestId was null or undefined when calling getClusterStatus.'); + } + + // verify required parameter 'connection' is not null or undefined + if (connection === null || connection === undefined) { + throw new Error('Required parameter connection was null or undefined when calling getClusterStatus.'); + } + // verify required parameter 'name' is not null or undefined if (name === null || name === undefined) { - throw new Error('Required parameter name was null or undefined when calling appByNameByVersionPatch.'); + throw new Error('Required parameter name was null or undefined when calling getClusterStatus.'); } - // verify required parameter 'version' is not null or undefined - if (version === null || version === undefined) { - throw new Error('Required parameter version was null or undefined when calling appByNameByVersionPatch.'); - } - - localVarHeaderParams = (Object).assign(localVarHeaderParams, options.headers); + localVarHeaderParams['X-Request-Id'] = ObjectSerializer.serialize(xRequestId, "string"); + localVarHeaderParams['Connection'] = ObjectSerializer.serialize(connection, "string"); + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; - let localVarRequestOptions: request.Options = { - method: 'PATCH', + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, - body: ObjectSerializer.serialize(appRequest, 'AppRequest') }; - this.authentications.basic.applyToRequest(localVarRequestOptions); + this.authentications.basicAuth.applyToRequest(localVarRequestOptions); this.authentications.default.applyToRequest(localVarRequestOptions); @@ -750,11 +908,12 @@ export class AppRouterApi { localVarRequestOptions.form = localVarFormParams; } } - return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { - request(localVarRequestOptions, (error, response, body) => { + return new Promise<{ response: http.ClientResponse; body: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { + body = ObjectSerializer.deserialize(body, "any"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { @@ -764,35 +923,43 @@ export class AppRouterApi { }); }); } - - /** - * @param name name - * @param version version - * @param [options] Override http request options. - */ - public appByNameByVersionSwaggerJsonGet(name: string, version: string, options: any = {}): Promise<{ response: http.IncomingMessage; body?: any; }> { - const localVarPath = this.basePath + '/app/{name}/{version}/swagger.json' - .replace('{name}', encodeURIComponent(String(name))) - .replace('{version}', encodeURIComponent(String(version))); + /** + * + * @summary Get control status + * @param xRequestId + * @param connection + * @param name + * @param {*} [options] Override http request options. + */ + public getControlStatus(xRequestId: string, connection: string, name: string, options: any = {}): Promise<{ response: http.ClientResponse; body: any; }> { + const localVarPath = this.basePath + '/control/status' + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); let localVarFormParams: any = {}; + // verify required parameter 'xRequestId' is not null or undefined + if (xRequestId === null || xRequestId === undefined) { + throw new Error('Required parameter xRequestId was null or undefined when calling getControlStatus.'); + } + + // verify required parameter 'connection' is not null or undefined + if (connection === null || connection === undefined) { + throw new Error('Required parameter connection was null or undefined when calling getControlStatus.'); + } + // verify required parameter 'name' is not null or undefined if (name === null || name === undefined) { - throw new Error('Required parameter name was null or undefined when calling appByNameByVersionSwaggerJsonGet.'); + throw new Error('Required parameter name was null or undefined when calling getControlStatus.'); } - // verify required parameter 'version' is not null or undefined - if (version === null || version === undefined) { - throw new Error('Required parameter version was null or undefined when calling appByNameByVersionSwaggerJsonGet.'); - } - - localVarHeaderParams = (Object).assign(localVarHeaderParams, options.headers); + localVarHeaderParams['X-Request-Id'] = ObjectSerializer.serialize(xRequestId, "string"); + localVarHeaderParams['Connection'] = ObjectSerializer.serialize(connection, "string"); + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; - let localVarRequestOptions: request.Options = { + let localVarRequestOptions: localVarRequest.Options = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, @@ -801,7 +968,7 @@ export class AppRouterApi { json: true, }; - this.authentications.basic.applyToRequest(localVarRequestOptions); + this.authentications.basicAuth.applyToRequest(localVarRequestOptions); this.authentications.default.applyToRequest(localVarRequestOptions); @@ -812,11 +979,12 @@ export class AppRouterApi { localVarRequestOptions.form = localVarFormParams; } } - return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { - request(localVarRequestOptions, (error, response, body) => { + return new Promise<{ response: http.ClientResponse; body: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { + body = ObjectSerializer.deserialize(body, "any"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { @@ -826,644 +994,46 @@ export class AppRouterApi { }); }); } - - /** - * @param name name - * @param [options] Override http request options. - */ - public appByNameGet(name: string, options: any = {}): Promise<{ response: http.IncomingMessage; body: Array; }> { - const localVarPath = this.basePath + '/app/{name}' - .replace('{name}', encodeURIComponent(String(name))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'name' is not null or undefined - if (name === null || name === undefined) { - throw new Error('Required parameter name was null or undefined when calling appByNameGet.'); - } - - localVarHeaderParams = (Object).assign(localVarHeaderParams, options.headers); - - let localVarUseFormData = false; - - let localVarRequestOptions: request.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.basic.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.IncomingMessage; body: Array; }>((resolve, reject) => { - request(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, 'Array'); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - - /** - * @param [options] Override http request options. - */ - public appGet(options: any = {}): Promise<{ response: http.IncomingMessage; body: Array; }> { - const localVarPath = this.basePath + '/app'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - localVarHeaderParams = (Object).assign(localVarHeaderParams, options.headers); - - let localVarUseFormData = false; - - let localVarRequestOptions: request.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.basic.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.IncomingMessage; body: Array; }>((resolve, reject) => { - request(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, 'Array'); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - - /** - * @param _package Zip archive file which contains a spec.yaml - * @param [options] Override http request options. - */ - public createApp(_package: Buffer, options: any = {}): Promise<{ response: http.IncomingMessage; body?: any; }> { - const localVarPath = this.basePath + '/app'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter '_package' is not null or undefined - if (_package === null || _package === undefined) { - throw new Error('Required parameter _package was null or undefined when calling createApp.'); - } - - localVarHeaderParams = (Object).assign(localVarHeaderParams, options.headers); - - let localVarUseFormData = false; - - if (_package !== undefined) { - localVarFormParams['package'] = _package; - } - localVarUseFormData = true; - - let localVarRequestOptions: request.Options = { - method: 'POST', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.basic.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { - request(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } - - /** - * @param _package Zip archive file which contains a spec.yaml - * @param [options] Override http request options. - */ - public updateApp(_package: Buffer, options: any = {}): Promise<{ response: http.IncomingMessage; body?: any; }> { - const localVarPath = this.basePath + '/app'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter '_package' is not null or undefined - if (_package === null || _package === undefined) { - throw new Error('Required parameter _package was null or undefined when calling updateApp.'); - } - - localVarHeaderParams = (Object).assign(localVarHeaderParams, options.headers); - - let localVarUseFormData = false; - - if (_package !== undefined) { - localVarFormParams['package'] = _package; - } - localVarUseFormData = true; - - let localVarRequestOptions: request.Options = { - method: 'PATCH', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.basic.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { - request(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } -} -export enum CertificateRouterApiApiKeys { -} - -export class CertificateRouterApi { - protected _basePath = defaultBasePath; - protected defaultHeaders: any = {}; - protected _useQuerystring: boolean = false; - - protected authentications = { - 'default': new VoidAuth(), - 'basic': new HttpBasicAuth() - }; - - constructor(basePath?: string); - constructor(username: string, password: string, basePath?: string); - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { - this.username = basePathOrUsername; - this.password = password; - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername; - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - set basePath(basePath: string) { - this._basePath = basePath; - } - - get basePath() { - return this._basePath; - } - - public setDefaultAuthentication(auth: Authentication) { - this.authentications.default = auth; - } - - public setApiKey(key: CertificateRouterApiApiKeys, value: string) { - (this.authentications as any)[CertificateRouterApiApiKeys[key]].apiKey = value; - } - set username(username: string) { - this.authentications.basic.username = username; - } - - set password(password: string) { - this.authentications.basic.password = password; - } - - /** - * @param [options] Override http request options. - */ - public certificatesRootcaGet(options: any = {}): Promise<{ response: http.IncomingMessage; body?: any; }> { - const localVarPath = this.basePath + '/certificates/rootca'; - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - localVarHeaderParams = (Object).assign(localVarHeaderParams, options.headers); - - let localVarUseFormData = false; - - let localVarRequestOptions: request.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.basic.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { - request(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } -} - -export enum EndpointRouterApiApiKeys { -} - -export class EndpointRouterApi { - protected _url = defaultBasePath; - protected _defaultHeaders: any = {}; - protected _useQuerystring: boolean = false; - protected _ignoreSslVerification: boolean = false; - - protected _authentications = { - 'default': new VoidAuth(), - 'basic': new HttpBasicAuth() - }; - - constructor(url?: string); - constructor(username: string, password: string, url?: string); - constructor(urlOrUsername: string, password?: string, url?: string) { - if (password) { - this.username = urlOrUsername; - this.password = password; - if (url) { - this.url = url; - } - } else { - if (urlOrUsername) { - this.url = urlOrUsername; - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - set ignoreSslVerification(ignoreSslVerification: boolean) { - this._ignoreSslVerification = ignoreSslVerification; - } - - set url(url: string) { - this._url = url; - } - - get url() { - return this._url; - } - - public setDefaultAuthentication(auth: Authentication) { - this._authentications.default = auth; - } - - public setApiKey(key: EndpointRouterApiApiKeys, value: string) { - (this._authentications as any)[EndpointRouterApiApiKeys[key]].apiKey = value; - } - - set username(username: string) { - this._authentications.basic.username = username; - } - - set password(password: string) { - this._authentications.basic.password = password; - } - - /** - * @param [options] Override http request options. - */ - public endpointsGet(options: request.Options = {}): Promise<{ response: http.IncomingMessage; body: Array; }> { - return this.endpointsGetInternal(undefined, options); - } - - /** - * @param name endpoint name, - * @param [options] Override http request options. - */ - public endpointsByNameGet(name: string, options: request.Options = {}): Promise<{ response: http.IncomingMessage; body: Array; }> { - // verify required parameter 'name' is not null or undefined - if (name === null || name === undefined) { - throw new Error('Required parameter name was null or undefined when calling endpointsByNameGet.'); - } - return this.endpointsGetInternal(name, options); - } - - private endpointsGetInternal(name?: string, options: request.Options = {}): Promise<{ response: http.IncomingMessage; body: Array; }> { - const targetUri = this.url + '/endpoints' + (name ? `/${name}` : ''); - let requestOptions: request.Options = { - method: 'GET', - qs: {}, - headers: {}, - uri: targetUri, - useQuerystring: this._useQuerystring, - json: true, - agentOptions: { - rejectUnauthorized: !this._ignoreSslVerification - } - }; - if (Object.keys(options).length) { - requestOptions = Object.assign(requestOptions, options); - } - - this._authentications.basic.applyToRequest(requestOptions); - this._authentications.default.applyToRequest(requestOptions); - - return new Promise<{ response: http.IncomingMessage; body: Array; }>((resolve, reject) => { - request(requestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - body = ObjectSerializer.deserialize(body, 'Array'); - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } -} - -export enum FileRouterApiApiKeys { -} - -export class FileRouterApi { - protected _basePath = defaultBasePath; - protected defaultHeaders: any = {}; - protected _useQuerystring: boolean = false; - - protected authentications = { - 'default': new VoidAuth(), - 'basic': new HttpBasicAuth() - }; - - constructor(basePath?: string); - constructor(username: string, password: string, basePath?: string); - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { - this.username = basePathOrUsername; - this.password = password; - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername; - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - set basePath(basePath: string) { - this._basePath = basePath; - } - - get basePath() { - return this._basePath; - } - - public setDefaultAuthentication(auth: Authentication) { - this.authentications.default = auth; - } - - public setApiKey(key: FileRouterApiApiKeys, value: string) { - (this.authentications as any)[FileRouterApiApiKeys[key]].apiKey = value; - } - set username(username: string) { - this.authentications.basic.username = username; - } - - set password(password: string) { - this.authentications.basic.password = password; - } - - /** - * @param filePath filePath - * @param op op - * @param [options] Override http request options. - */ - public filesByFilePathGet(filePath: string, op?: string, options: any = {}): Promise<{ response: http.IncomingMessage; body?: any; }> { - const localVarPath = this.basePath + '/files/{filePath}' - .replace('{filePath}', encodeURIComponent(String(filePath))); - let localVarQueryParameters: any = {}; - let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); - let localVarFormParams: any = {}; - - // verify required parameter 'filePath' is not null or undefined - if (filePath === null || filePath === undefined) { - throw new Error('Required parameter filePath was null or undefined when calling filesByFilePathGet.'); - } - - if (op !== undefined) { - localVarQueryParameters['op'] = ObjectSerializer.serialize(op, 'string'); - } - - localVarHeaderParams = (Object).assign(localVarHeaderParams, options.headers); - - let localVarUseFormData = false; - - let localVarRequestOptions: request.Options = { - method: 'GET', - qs: localVarQueryParameters, - headers: localVarHeaderParams, - uri: localVarPath, - useQuerystring: this._useQuerystring, - json: true, - }; - - this.authentications.basic.applyToRequest(localVarRequestOptions); - - this.authentications.default.applyToRequest(localVarRequestOptions); - - if (Object.keys(localVarFormParams).length) { - if (localVarUseFormData) { - (localVarRequestOptions).formData = localVarFormParams; - } else { - localVarRequestOptions.form = localVarFormParams; - } - } - return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { - request(localVarRequestOptions, (error, response, body) => { - if (error) { - reject(error); - } else { - if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { - resolve({ response: response, body: body }); - } else { - reject({ response: response, body: body }); - } - } - }); - }); - } -} -export enum HealthRouterApiApiKeys { -} - -export class HealthRouterApi { - protected _basePath = defaultBasePath; - protected defaultHeaders: any = {}; - protected _useQuerystring: boolean = false; - - protected authentications = { - 'default': new VoidAuth(), - 'basic': new HttpBasicAuth() - }; - - constructor(basePath?: string); - constructor(username: string, password: string, basePath?: string); - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { - this.username = basePathOrUsername; - this.password = password; - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername; - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - set basePath(basePath: string) { - this._basePath = basePath; - } - - get basePath() { - return this._basePath; - } - - public setDefaultAuthentication(auth: Authentication) { - this.authentications.default = auth; - } - - public setApiKey(key: HealthRouterApiApiKeys, value: string) { - (this.authentications as any)[HealthRouterApiApiKeys[key]].apiKey = value; - } - set username(username: string) { - this.authentications.basic.username = username; - } - - set password(password: string) { - this.authentications.basic.password = password; - } - - /** - * @param query query - * @param [options] Override http request options. - */ - public healthGet(query?: string, options: any = {}): Promise<{ response: http.IncomingMessage; body?: any; }> { + /** + * + * @summary Get health properties with specific query + * @param xRequestId + * @param connection + * @param query The query in the json format for the health properties + * @param {*} [options] Override http request options. + */ + public getHealthProperties(xRequestId: string, connection: string, query: string, options: any = {}): Promise<{ response: http.ClientResponse; body: any; }> { const localVarPath = this.basePath + '/health'; let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); let localVarFormParams: any = {}; + // verify required parameter 'xRequestId' is not null or undefined + if (xRequestId === null || xRequestId === undefined) { + throw new Error('Required parameter xRequestId was null or undefined when calling getHealthProperties.'); + } + + // verify required parameter 'connection' is not null or undefined + if (connection === null || connection === undefined) { + throw new Error('Required parameter connection was null or undefined when calling getHealthProperties.'); + } + + // verify required parameter 'query' is not null or undefined + if (query === null || query === undefined) { + throw new Error('Required parameter query was null or undefined when calling getHealthProperties.'); + } + if (query !== undefined) { - localVarQueryParameters['query'] = ObjectSerializer.serialize(query, 'string'); + localVarQueryParameters['query'] = ObjectSerializer.serialize(query, "string"); } - localVarHeaderParams = (Object).assign(localVarHeaderParams, options.headers); + localVarHeaderParams['X-Request-Id'] = ObjectSerializer.serialize(xRequestId, "string"); + localVarHeaderParams['Connection'] = ObjectSerializer.serialize(connection, "string"); + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; - let localVarRequestOptions: request.Options = { + let localVarRequestOptions: localVarRequest.Options = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, @@ -1472,7 +1042,7 @@ export class HealthRouterApi { json: true, }; - this.authentications.basic.applyToRequest(localVarRequestOptions); + this.authentications.basicAuth.applyToRequest(localVarRequestOptions); this.authentications.default.applyToRequest(localVarRequestOptions); @@ -1483,8 +1053,72 @@ export class HealthRouterApi { localVarRequestOptions.form = localVarFormParams; } } - return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { - request(localVarRequestOptions, (error, response, body) => { + return new Promise<{ response: http.ClientResponse; body: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "any"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Retrieve home page of Controller service + * @param xRequestId + * @param connection + * @param {*} [options] Override http request options. + */ + public getHome(xRequestId: string, connection: string, options: any = {}): Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'xRequestId' is not null or undefined + if (xRequestId === null || xRequestId === undefined) { + throw new Error('Required parameter xRequestId was null or undefined when calling getHome.'); + } + + // verify required parameter 'connection' is not null or undefined + if (connection === null || connection === undefined) { + throw new Error('Required parameter connection was null or undefined when calling getHome.'); + } + + localVarHeaderParams['X-Request-Id'] = ObjectSerializer.serialize(xRequestId, "string"); + localVarHeaderParams['Connection'] = ObjectSerializer.serialize(connection, "string"); + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.basicAuth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { @@ -1497,21 +1131,281 @@ export class HealthRouterApi { }); }); } - - /** - * @param [options] Override http request options. - */ - public healthPost(options: any = {}): Promise<{ response: http.IncomingMessage; body?: any; }> { - const localVarPath = this.basePath + '/health'; + /** + * + * @summary Get console logs + * @param xRequestId + * @param connection + * @param name + * @param offset + * @param {*} [options] Override http request options. + */ + public getLogs(xRequestId: string, connection: string, name: string, offset: number, options: any = {}): Promise<{ response: http.ClientResponse; body: string; }> { + const localVarPath = this.basePath + '/bdc/{name}/log' + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); let localVarFormParams: any = {}; - localVarHeaderParams = (Object).assign(localVarHeaderParams, options.headers); + // verify required parameter 'xRequestId' is not null or undefined + if (xRequestId === null || xRequestId === undefined) { + throw new Error('Required parameter xRequestId was null or undefined when calling getLogs.'); + } + + // verify required parameter 'connection' is not null or undefined + if (connection === null || connection === undefined) { + throw new Error('Required parameter connection was null or undefined when calling getLogs.'); + } + + // verify required parameter 'name' is not null or undefined + if (name === null || name === undefined) { + throw new Error('Required parameter name was null or undefined when calling getLogs.'); + } + + // verify required parameter 'offset' is not null or undefined + if (offset === null || offset === undefined) { + throw new Error('Required parameter offset was null or undefined when calling getLogs.'); + } + + if (offset !== undefined) { + localVarQueryParameters['offset'] = ObjectSerializer.serialize(offset, "number"); + } + + localVarHeaderParams['X-Request-Id'] = ObjectSerializer.serialize(xRequestId, "string"); + localVarHeaderParams['Connection'] = ObjectSerializer.serialize(connection, "string"); + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; - let localVarRequestOptions: request.Options = { + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.basicAuth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: string; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "string"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Get pool status + * @param xRequestId + * @param connection + * @param name + * @param poolType + * @param poolName + * @param {*} [options] Override http request options. + */ + public getPoolStatus(xRequestId: string, connection: string, name: string, poolType: string, poolName: string, options: any = {}): Promise<{ response: http.ClientResponse; body: any; }> { + const localVarPath = this.basePath + '/bdc/{name}/pools/{poolType}/{poolName}/status' + .replace('{' + 'name' + '}', encodeURIComponent(String(name))) + .replace('{' + 'poolType' + '}', encodeURIComponent(String(poolType))) + .replace('{' + 'poolName' + '}', encodeURIComponent(String(poolName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'xRequestId' is not null or undefined + if (xRequestId === null || xRequestId === undefined) { + throw new Error('Required parameter xRequestId was null or undefined when calling getPoolStatus.'); + } + + // verify required parameter 'connection' is not null or undefined + if (connection === null || connection === undefined) { + throw new Error('Required parameter connection was null or undefined when calling getPoolStatus.'); + } + + // verify required parameter 'name' is not null or undefined + if (name === null || name === undefined) { + throw new Error('Required parameter name was null or undefined when calling getPoolStatus.'); + } + + // verify required parameter 'poolType' is not null or undefined + if (poolType === null || poolType === undefined) { + throw new Error('Required parameter poolType was null or undefined when calling getPoolStatus.'); + } + + // verify required parameter 'poolName' is not null or undefined + if (poolName === null || poolName === undefined) { + throw new Error('Required parameter poolName was null or undefined when calling getPoolStatus.'); + } + + localVarHeaderParams['X-Request-Id'] = ObjectSerializer.serialize(xRequestId, "string"); + localVarHeaderParams['Connection'] = ObjectSerializer.serialize(connection, "string"); + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.basicAuth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "any"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Get list of all mounts + * @param xRequestId + * @param connection + * @param mount + * @param {*} [options] Override http request options. + */ + public listMounts(xRequestId: string, connection: string, mount?: string, options: any = {}): Promise<{ response: http.ClientResponse; body: any; }> { + const localVarPath = this.basePath + '/storage/mounts'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'xRequestId' is not null or undefined + if (xRequestId === null || xRequestId === undefined) { + throw new Error('Required parameter xRequestId was null or undefined when calling listMounts.'); + } + + // verify required parameter 'connection' is not null or undefined + if (connection === null || connection === undefined) { + throw new Error('Required parameter connection was null or undefined when calling listMounts.'); + } + + if (mount !== undefined) { + localVarQueryParameters['mount'] = ObjectSerializer.serialize(mount, "string"); + } + + localVarHeaderParams['X-Request-Id'] = ObjectSerializer.serialize(xRequestId, "string"); + localVarHeaderParams['Connection'] = ObjectSerializer.serialize(connection, "string"); + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'GET', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + }; + + this.authentications.basicAuth.applyToRequest(localVarRequestOptions); + + this.authentications.default.applyToRequest(localVarRequestOptions); + + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.ClientResponse; body: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "any"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject({ response: response, body: body }); + } + } + }); + }); + } + /** + * + * @summary Refresh a mount + * @param xRequestId + * @param connection + * @param mount Local path to mount on HDFS + * @param {*} [options] Override http request options. + */ + public refreshMount(xRequestId: string, connection: string, mount: string, options: any = {}): Promise<{ response: http.ClientResponse; body: any; }> { + const localVarPath = this.basePath + '/storage/mounts/refresh'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'xRequestId' is not null or undefined + if (xRequestId === null || xRequestId === undefined) { + throw new Error('Required parameter xRequestId was null or undefined when calling refreshMount.'); + } + + // verify required parameter 'connection' is not null or undefined + if (connection === null || connection === undefined) { + throw new Error('Required parameter connection was null or undefined when calling refreshMount.'); + } + + // verify required parameter 'mount' is not null or undefined + if (mount === null || mount === undefined) { + throw new Error('Required parameter mount was null or undefined when calling refreshMount.'); + } + + if (mount !== undefined) { + localVarQueryParameters['mount'] = ObjectSerializer.serialize(mount, "string"); + } + + localVarHeaderParams['X-Request-Id'] = ObjectSerializer.serialize(xRequestId, "string"); + localVarHeaderParams['Connection'] = ObjectSerializer.serialize(connection, "string"); + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { method: 'POST', qs: localVarQueryParameters, headers: localVarHeaderParams, @@ -1520,7 +1414,7 @@ export class HealthRouterApi { json: true, }; - this.authentications.basic.applyToRequest(localVarRequestOptions); + this.authentications.basicAuth.applyToRequest(localVarRequestOptions); this.authentications.default.applyToRequest(localVarRequestOptions); @@ -1531,11 +1425,12 @@ export class HealthRouterApi { localVarRequestOptions.form = localVarFormParams; } } - return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { - request(localVarRequestOptions, (error, response, body) => { + return new Promise<{ response: http.ClientResponse; body: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { + body = ObjectSerializer.deserialize(body, "any"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { @@ -1545,87 +1440,66 @@ export class HealthRouterApi { }); }); } -} - -export enum TokenRouterApiApiKeys { -} - -export class TokenRouterApi { - protected _basePath = defaultBasePath; - protected defaultHeaders: any = {}; - protected _useQuerystring: boolean = false; - - protected authentications = { - 'default': new VoidAuth(), - 'basic': new HttpBasicAuth() - }; - - constructor(basePath?: string); - constructor(username: string, password: string, basePath?: string); - constructor(basePathOrUsername: string, password?: string, basePath?: string) { - if (password) { - this.username = basePathOrUsername; - this.password = password; - if (basePath) { - this.basePath = basePath; - } - } else { - if (basePathOrUsername) { - this.basePath = basePathOrUsername; - } - } - } - - set useQuerystring(value: boolean) { - this._useQuerystring = value; - } - - set basePath(basePath: string) { - this._basePath = basePath; - } - - get basePath() { - return this._basePath; - } - - public setDefaultAuthentication(auth: Authentication) { - this.authentications.default = auth; - } - - public setApiKey(key: TokenRouterApiApiKeys, value: string) { - (this.authentications as any)[TokenRouterApiApiKeys[key]].apiKey = value; - } - set username(username: string) { - this.authentications.basic.username = username; - } - - set password(password: string) { - this.authentications.basic.password = password; - } - - /** - * @param [options] Override http request options. - */ - public tokenPost(options: any = {}): Promise<{ response: http.IncomingMessage; body: TokenModel; }> { - const localVarPath = this.basePath + '/token'; + /** + * + * @summary Update the password for the given service and user + * @param xRequestId + * @param connection + * @param serviceName + * @param serviceUsername + * @param data Password and cluster name in JSON format + * @param {*} [options] Override http request options. + */ + public updatePassword(xRequestId: string, connection: string, serviceName: string, serviceUsername: string, data: string, options: any = {}): Promise<{ response: http.ClientResponse; body?: any; }> { + const localVarPath = this.basePath + '/passwords/{serviceName}/{serviceUsername}' + .replace('{' + 'serviceName' + '}', encodeURIComponent(String(serviceName))) + .replace('{' + 'serviceUsername' + '}', encodeURIComponent(String(serviceUsername))); let localVarQueryParameters: any = {}; let localVarHeaderParams: any = (Object).assign({}, this.defaultHeaders); let localVarFormParams: any = {}; - localVarHeaderParams = (Object).assign(localVarHeaderParams, options.headers); + // verify required parameter 'xRequestId' is not null or undefined + if (xRequestId === null || xRequestId === undefined) { + throw new Error('Required parameter xRequestId was null or undefined when calling updatePassword.'); + } + + // verify required parameter 'connection' is not null or undefined + if (connection === null || connection === undefined) { + throw new Error('Required parameter connection was null or undefined when calling updatePassword.'); + } + + // verify required parameter 'serviceName' is not null or undefined + if (serviceName === null || serviceName === undefined) { + throw new Error('Required parameter serviceName was null or undefined when calling updatePassword.'); + } + + // verify required parameter 'serviceUsername' is not null or undefined + if (serviceUsername === null || serviceUsername === undefined) { + throw new Error('Required parameter serviceUsername was null or undefined when calling updatePassword.'); + } + + // verify required parameter 'data' is not null or undefined + if (data === null || data === undefined) { + throw new Error('Required parameter data was null or undefined when calling updatePassword.'); + } + + localVarHeaderParams['X-Request-Id'] = ObjectSerializer.serialize(xRequestId, "string"); + localVarHeaderParams['Connection'] = ObjectSerializer.serialize(connection, "string"); + (Object).assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; - let localVarRequestOptions: request.Options = { - method: 'POST', + let localVarRequestOptions: localVarRequest.Options = { + method: 'PUT', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, + body: ObjectSerializer.serialize(data, "string") }; - this.authentications.basic.applyToRequest(localVarRequestOptions); + this.authentications.basicAuth.applyToRequest(localVarRequestOptions); this.authentications.default.applyToRequest(localVarRequestOptions); @@ -1636,12 +1510,11 @@ export class TokenRouterApi { localVarRequestOptions.form = localVarFormParams; } } - return new Promise<{ response: http.IncomingMessage; body: TokenModel; }>((resolve, reject) => { - request(localVarRequestOptions, (error, response, body) => { + return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { - body = ObjectSerializer.deserialize(body, 'TokenModel'); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { diff --git a/extensions/big-data-cluster/src/bigDataCluster/controller/clusterControllerApi.ts b/extensions/big-data-cluster/src/bigDataCluster/controller/clusterControllerApi.ts index 0c74d1edd4..3fedafb0fd 100644 --- a/extensions/big-data-cluster/src/bigDataCluster/controller/clusterControllerApi.ts +++ b/extensions/big-data-cluster/src/bigDataCluster/controller/clusterControllerApi.ts @@ -3,10 +3,37 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { EndpointRouterApi } from './apiGenerated'; +import * as request from 'request'; +import { ClusterRouterApi, Authentication } from './apiGenerated'; + + +class AuthConfiguration implements Authentication { + public username: string = ''; + public password: string = ''; + + constructor(private _ignoreSslVerification: boolean) { + } + + applyToRequest(requestOptions: request.Options): void { + requestOptions['agentOptions'] = { + rejectUnauthorized: !this._ignoreSslVerification + }; + } +} + +class ClusterApiWrapper extends ClusterRouterApi { + constructor(basePathOrUsername: string, password?: string, basePath?: string, ignoreSslVerification?: boolean) { + super(basePathOrUsername, password, basePath); + this.authentications.default = new AuthConfiguration(!!ignoreSslVerification); + } +} export async function getEndPoints( - url: string, username: string, password: string, ignoreSslVerification?: boolean + clusterName: string, + url: string, + username: string, + password: string, + ignoreSslVerification?: boolean ): Promise { if (!url || !username || !password) { @@ -14,8 +41,7 @@ export async function getEndPoints( } url = adjustUrl(url); - let endPointApi = new EndpointRouterApi(username, password, url); - endPointApi.ignoreSslVerification = !!ignoreSslVerification; + let endPointApi = new ClusterApiWrapper(username, password, url, !!ignoreSslVerification); let controllerResponse: IEndPointsResponse = undefined; let controllerError: IControllerError = undefined; @@ -27,7 +53,7 @@ export async function getEndPoints( }; try { - let result = await endPointApi.endpointsGet(); + let result = await endPointApi.endpointsGet(clusterName); controllerResponse = { response: result.response as IHttpResponse, endPoints: result.body as IEndPoint[], diff --git a/extensions/big-data-cluster/src/bigDataCluster/dialog/addControllerDialog.ts b/extensions/big-data-cluster/src/bigDataCluster/dialog/addControllerDialog.ts index acc6070d74..7bc72050de 100644 --- a/extensions/big-data-cluster/src/bigDataCluster/dialog/addControllerDialog.ts +++ b/extensions/big-data-cluster/src/bigDataCluster/dialog/addControllerDialog.ts @@ -19,25 +19,27 @@ export class AddControllerDialogModel { constructor( public treeDataProvider: ControllerTreeDataProvider, public node?: TreeNode, + public prefilledClusterName?: string, public prefilledUrl?: string, public prefilledUsername?: string, public prefilledPassword?: string, public prefilledRememberPassword?: boolean ) { + this.prefilledClusterName = prefilledClusterName || (node && node['clusterName']); this.prefilledUrl = prefilledUrl || (node && node['url']); this.prefilledUsername = prefilledUsername || (node && node['username']); this.prefilledPassword = prefilledPassword || (node && node['password']); this.prefilledRememberPassword = prefilledRememberPassword || (node && node['rememberPassword']); } - public async onComplete(url: string, username: string, password: string, rememberPassword: boolean): Promise { - let response = await getEndPoints(url, username, password, true); + public async onComplete(clusterName: string, url: string, username: string, password: string, rememberPassword: boolean): Promise { + let response = await getEndPoints(clusterName, url, username, password, true); if (response && response.endPoints) { let masterInstance: IEndPoint = undefined; if (response.endPoints) { masterInstance = response.endPoints.find(e => e.name && e.name === 'sql-server-master'); } - this.treeDataProvider.addController(url, username, password, rememberPassword, masterInstance); + this.treeDataProvider.addController(clusterName, url, username, password, rememberPassword, masterInstance); await this.treeDataProvider.saveControllers(); } } @@ -58,6 +60,7 @@ export class AddControllerDialog { private dialog: azdata.window.Dialog; private uiModelBuilder: azdata.ModelBuilder; + private clusterNameInputBox: azdata.InputBoxComponent; private urlInputBox: azdata.InputBoxComponent; private usernameInputBox: azdata.InputBoxComponent; private passwordInputBox: azdata.InputBoxComponent; @@ -76,6 +79,11 @@ export class AddControllerDialog { this.dialog.registerContent(async view => { this.uiModelBuilder = view.modelBuilder; + this.clusterNameInputBox = this.uiModelBuilder.inputBox() + .withProperties({ + placeHolder: localize('textClusterNameLower', 'mssql-cluster'), + value: this.model.prefilledUrl || 'mssql-cluster' + }).component(); this.urlInputBox = this.uiModelBuilder.inputBox() .withProperties({ placeHolder: localize('textUrlLower', 'url'), @@ -101,22 +109,27 @@ export class AddControllerDialog { let formModel = this.uiModelBuilder.formContainer() .withFormItems([{ - components: [{ - component: this.urlInputBox, - title: localize('textUrlCapital', 'URL'), - required: true - }, { - component: this.usernameInputBox, - title: localize('textUsernameCapital', 'Username'), - required: true - }, { - component: this.passwordInputBox, - title: localize('textPasswordCapital', 'Password'), - required: true - }, { - component: this.rememberPwCheckBox, - title: '' - } + components: [ + { + component: this.clusterNameInputBox, + title: localize('textClusterNameCapital', 'Cluster Name'), + required: true + }, { + component: this.urlInputBox, + title: localize('textUrlCapital', 'URL'), + required: true + }, { + component: this.usernameInputBox, + title: localize('textUsernameCapital', 'Username'), + required: true + }, { + component: this.passwordInputBox, + title: localize('textPasswordCapital', 'Password'), + required: true + }, { + component: this.rememberPwCheckBox, + title: '' + } ], title: '' }]).withLayout({ width: '100%' }).component(); @@ -131,13 +144,14 @@ export class AddControllerDialog { } private async validate(): Promise { + let clusterName = this.clusterNameInputBox && this.clusterNameInputBox.value; let url = this.urlInputBox && this.urlInputBox.value; let username = this.usernameInputBox && this.usernameInputBox.value; let password = this.passwordInputBox && this.passwordInputBox.value; let rememberPassword = this.passwordInputBox && !!this.rememberPwCheckBox.checked; try { - await this.model.onComplete(url, username, password, rememberPassword); + await this.model.onComplete(clusterName, url, username, password, rememberPassword); return true; } catch (error) { showErrorMessage(error); diff --git a/extensions/big-data-cluster/src/bigDataCluster/tree/controllerTreeDataProvider.ts b/extensions/big-data-cluster/src/bigDataCluster/tree/controllerTreeDataProvider.ts index f2dda6e0b5..10c9784d88 100644 --- a/extensions/big-data-cluster/src/bigDataCluster/tree/controllerTreeDataProvider.ts +++ b/extensions/big-data-cluster/src/bigDataCluster/tree/controllerTreeDataProvider.ts @@ -18,6 +18,7 @@ import { LoadingControllerNode } from './loadingControllerNode'; const CredentialNamespace = 'clusterControllerCredentials'; interface IControllerInfoSlim { + clusterName: string; url: string; username: string; password?: string; @@ -57,6 +58,7 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider { let controller = e as ControllerNode; return { + clusterName: controller.clusterName, url: controller.url, username: controller.username, password: controller.password, @@ -145,6 +148,7 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider { return { + clusterName: e.clusterName, url: e.url, username: e.username, rememberPassword: e.rememberPassword diff --git a/extensions/big-data-cluster/src/bigDataCluster/tree/controllerTreeNode.ts b/extensions/big-data-cluster/src/bigDataCluster/tree/controllerTreeNode.ts index bf76064b1d..1a25df980d 100644 --- a/extensions/big-data-cluster/src/bigDataCluster/tree/controllerTreeNode.ts +++ b/extensions/big-data-cluster/src/bigDataCluster/tree/controllerTreeNode.ts @@ -113,14 +113,20 @@ export class ControllerRootNode extends ControllerTreeNode { return this.children as ControllerNode[]; } - public addControllerNode(url: string, username: string, password: string, rememberPassword: boolean, masterInstance?: IEndPoint): void { + public addControllerNode(clusterName: string, + url: string, + username: string, + password: string, + rememberPassword: boolean, + masterInstance?: IEndPoint + ): void { let controllerNode = this.getExistingControllerNode(url, username); if (controllerNode) { controllerNode.password = password; controllerNode.rememberPassword = rememberPassword; controllerNode.clearChildren(); } else { - controllerNode = new ControllerNode(url, username, password, rememberPassword, undefined, this, this.treeChangeHandler, undefined); + controllerNode = new ControllerNode(clusterName, url, username, password, rememberPassword, undefined, this, this.treeChangeHandler, undefined); this.addChild(controllerNode); } @@ -158,6 +164,7 @@ export class ControllerRootNode extends ControllerTreeNode { export class ControllerNode extends ControllerTreeNode { constructor( + private _clusterName: string, private _url: string, private _username: string, private _password: string, @@ -184,7 +191,7 @@ export class ControllerNode extends ControllerTreeNode { } try { - let response = await getEndPoints(this._url, this._username, this._password, true); + let response = await getEndPoints(this._clusterName, this._url, this._username, this._password, true); if (response && response.endPoints) { let master = response.endPoints.find(e => e.name && e.name === 'sql-server-master'); this.addSqlMasterNode(master.endpoint, master.description); @@ -226,6 +233,14 @@ export class ControllerNode extends ControllerTreeNode { return item; } + public get clusterName() { + return this._clusterName; + } + + public set clusterName(clusterName: string) { + this._clusterName = clusterName; + } + public get url() { return this._url; } diff --git a/extensions/big-data-cluster/src/extension.ts b/extensions/big-data-cluster/src/extension.ts index 10018abeed..1c31eda65c 100644 --- a/extensions/big-data-cluster/src/extension.ts +++ b/extensions/big-data-cluster/src/extension.ts @@ -15,6 +15,12 @@ import { ControllerNode } from './bigDataCluster/tree/controllerTreeNode'; const localize = nls.loadMessageBundle(); +const AddControllerCommand = 'bigDataClusters.command.addController'; +const DeleteControllerCommand = 'bigDataClusters.command.deleteController'; +const RefreshControllerCommand = 'bigDataClusters.command.refreshController'; + +let throttleTimers: { [key: string]: any } = {}; + export function activate(extensionContext: vscode.ExtensionContext) { IconPath.setExtensionContext(extensionContext); let treeDataProvider = new ControllerTreeDataProvider(extensionContext.globalState); @@ -31,15 +37,15 @@ function registerTreeDataProvider(treeDataProvider: ControllerTreeDataProvider): } function registerCommands(treeDataProvider: ControllerTreeDataProvider): void { - vscode.commands.registerCommand('bigDataClusters.command.addController', (node?: TreeNode) => { - addBdcController(treeDataProvider, node); + vscode.commands.registerCommand(AddControllerCommand, (node?: TreeNode) => { + runThrottledAction(AddControllerCommand, () => addBdcController(treeDataProvider, node)); }); - vscode.commands.registerCommand('bigDataClusters.command.deleteController', (node: TreeNode) => { + vscode.commands.registerCommand(DeleteControllerCommand, (node: TreeNode) => { deleteBdcController(treeDataProvider, node); }); - vscode.commands.registerCommand('bigDataClusters.command.refreshController', (node: TreeNode) => { + vscode.commands.registerCommand(RefreshControllerCommand, (node: TreeNode) => { if (!node) { return; } @@ -83,3 +89,21 @@ function deleteControllerInternal(treeDataProvider: ControllerTreeDataProvider, treeDataProvider.saveControllers(); } } + + + +/** + * Throttles actions to avoid bug where on clicking in tree, action gets called twice + * instead of once. Any right-click action is safe, just the default on-click action in a tree + */ +function runThrottledAction(id: string, action: () => void) { + let timer = throttleTimers[id]; + if (!timer) { + throttleTimers[id] = timer = setTimeout(() => { + action(); + clearTimeout(timer); + throttleTimers[id] = undefined; + }, 150); + } + // else ignore this as we got an identical action in the last 150ms +} \ No newline at end of file diff --git a/extensions/mssql/package.json b/extensions/mssql/package.json index 3251b4d3ac..fa1ea0b42e 100644 --- a/extensions/mssql/package.json +++ b/extensions/mssql/package.json @@ -416,8 +416,8 @@ }, { "name": "%title.endpoints%", - "row": 0, - "col": 4, + "row": 1, + "col": 0, "rowspan": 1.5, "colspan": 2, "widget": {