diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js index 1f9aab7df5..2dde039a25 100644 --- a/build/gulpfile.hygiene.js +++ b/build/gulpfile.hygiene.js @@ -103,6 +103,7 @@ const indentationFilter = [ '!extensions/resource-deployment/notebooks/**', '!extensions/mssql/notebooks/**', '!extensions/integration-tests/testData/**', + '!extensions/arc/src/controller/generated/**', '!extensions/sql-database-projects/resources/templates/*.xml', '!extensions/sql-database-projects/src/test/baselines/*.xml', '!extensions/sql-database-projects/src/test/baselines/*.json', diff --git a/build/lib/extensions.js b/build/lib/extensions.js index 19a38340ac..770876a169 100644 --- a/build/lib/extensions.js +++ b/build/lib/extensions.js @@ -198,6 +198,7 @@ const externalExtensions = [ // Any extension not included here will be installed by default. 'admin-tool-ext-win', 'agent', + 'arc', 'import', 'profiler', 'admin-pack', diff --git a/build/lib/extensions.ts b/build/lib/extensions.ts index 624be94601..0d78b7ad2c 100644 --- a/build/lib/extensions.ts +++ b/build/lib/extensions.ts @@ -233,6 +233,7 @@ const externalExtensions = [ // Any extension not included here will be installed by default. 'admin-tool-ext-win', 'agent', + 'arc', 'import', 'profiler', 'admin-pack', diff --git a/extensions/arc/.gitignore b/extensions/arc/.gitignore new file mode 100644 index 0000000000..dfacd4d5b4 --- /dev/null +++ b/extensions/arc/.gitignore @@ -0,0 +1 @@ +*.vsix \ No newline at end of file diff --git a/extensions/arc/.vscodeignore b/extensions/arc/.vscodeignore new file mode 100644 index 0000000000..602ebf11c0 --- /dev/null +++ b/extensions/arc/.vscodeignore @@ -0,0 +1,6 @@ +.gitignore +src/** +out/** +extension.webpack.config.js +tsconfig.json +yarn.lock diff --git a/extensions/arc/README.md b/extensions/arc/README.md new file mode 100644 index 0000000000..0b6b81335e --- /dev/null +++ b/extensions/arc/README.md @@ -0,0 +1,17 @@ +# Microsoft Azure Arc Extension for Azure Data Studio + +Welcome to Microsoft Azure Arc Extension for Azure Data Studio! + +## Code of Conduct + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + +## Privacy Statement + +The [Microsoft Enterprise and Developer Privacy Statement](https://privacy.microsoft.com/en-us/privacystatement) describes the privacy statement of this software. + +## License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Licensed under the [Source EULA](https://raw.githubusercontent.com/Microsoft/azuredatastudio/master/LICENSE.txt). diff --git a/extensions/arc/extension.webpack.config.js b/extensions/arc/extension.webpack.config.js new file mode 100644 index 0000000000..35b95ccffc --- /dev/null +++ b/extensions/arc/extension.webpack.config.js @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +//@ts-check + +'use strict'; + +const withDefaults = require('../shared.webpack.config'); + +module.exports = withDefaults({ + context: __dirname, + entry: { + extension: './src/extension.ts' + } +}); diff --git a/extensions/arc/images/add.svg b/extensions/arc/images/add.svg new file mode 100644 index 0000000000..bc5c48438c --- /dev/null +++ b/extensions/arc/images/add.svg @@ -0,0 +1,3 @@ + + + diff --git a/extensions/arc/images/billing.svg b/extensions/arc/images/billing.svg new file mode 100644 index 0000000000..8298ab03b3 --- /dev/null +++ b/extensions/arc/images/billing.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + Icon-general-12 + + + + + + diff --git a/extensions/arc/images/collapse-down-inverse.svg b/extensions/arc/images/collapse-down-inverse.svg new file mode 100644 index 0000000000..81848c6598 --- /dev/null +++ b/extensions/arc/images/collapse-down-inverse.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/arc/images/collapse-down.svg b/extensions/arc/images/collapse-down.svg new file mode 100644 index 0000000000..122ab8abfb --- /dev/null +++ b/extensions/arc/images/collapse-down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/arc/images/collapse-up-inverse.svg b/extensions/arc/images/collapse-up-inverse.svg new file mode 100644 index 0000000000..a207d0f145 --- /dev/null +++ b/extensions/arc/images/collapse-up-inverse.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/arc/images/collapse-up.svg b/extensions/arc/images/collapse-up.svg new file mode 100644 index 0000000000..4c7c97e181 --- /dev/null +++ b/extensions/arc/images/collapse-up.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/extensions/arc/images/connections.svg b/extensions/arc/images/connections.svg new file mode 100644 index 0000000000..d4bf35a19b --- /dev/null +++ b/extensions/arc/images/connections.svg @@ -0,0 +1,4 @@ + + + + diff --git a/extensions/arc/images/copy.svg b/extensions/arc/images/copy.svg new file mode 100644 index 0000000000..330289da52 --- /dev/null +++ b/extensions/arc/images/copy.svg @@ -0,0 +1,3 @@ + + + diff --git a/extensions/arc/images/delete.svg b/extensions/arc/images/delete.svg new file mode 100644 index 0000000000..130e71d5f2 --- /dev/null +++ b/extensions/arc/images/delete.svg @@ -0,0 +1,3 @@ + + + diff --git a/extensions/arc/images/edit.svg b/extensions/arc/images/edit.svg new file mode 100644 index 0000000000..345362da0a --- /dev/null +++ b/extensions/arc/images/edit.svg @@ -0,0 +1,3 @@ + + + diff --git a/extensions/arc/images/extension.png b/extensions/arc/images/extension.png new file mode 100644 index 0000000000..c86d6d1e00 Binary files /dev/null and b/extensions/arc/images/extension.png differ diff --git a/extensions/arc/images/heart.svg b/extensions/arc/images/heart.svg new file mode 100644 index 0000000000..3c60b8d751 --- /dev/null +++ b/extensions/arc/images/heart.svg @@ -0,0 +1,3 @@ + + + diff --git a/extensions/arc/images/migrate.svg b/extensions/arc/images/migrate.svg new file mode 100644 index 0000000000..27b10d55af --- /dev/null +++ b/extensions/arc/images/migrate.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + Icon-migrate-282 + + + + diff --git a/extensions/arc/images/open-in-tab.svg b/extensions/arc/images/open-in-tab.svg new file mode 100644 index 0000000000..a71a305037 --- /dev/null +++ b/extensions/arc/images/open-in-tab.svg @@ -0,0 +1,3 @@ + + + diff --git a/extensions/arc/images/postgres.svg b/extensions/arc/images/postgres.svg new file mode 100644 index 0000000000..e247e4e717 --- /dev/null +++ b/extensions/arc/images/postgres.svg @@ -0,0 +1 @@ +Icon-databases-131 \ No newline at end of file diff --git a/extensions/arc/images/properties.svg b/extensions/arc/images/properties.svg new file mode 100644 index 0000000000..0e40fc87f0 --- /dev/null +++ b/extensions/arc/images/properties.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/extensions/arc/images/security.svg b/extensions/arc/images/security.svg new file mode 100644 index 0000000000..065df840f6 --- /dev/null +++ b/extensions/arc/images/security.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/extensions/arc/package.json b/extensions/arc/package.json new file mode 100644 index 0000000000..0bd74bc0e4 --- /dev/null +++ b/extensions/arc/package.json @@ -0,0 +1,65 @@ +{ + "name": "arc", + "displayName": "%arc.displayName%", + "description": "%arc.description%", + "version": "0.1.0", + "publisher": "Microsoft", + "preview": true, + "license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/master/LICENSE.txt", + "icon": "images/extension.png", + "engines": { + "vscode": "*", + "azdata": ">=1.18.0" + }, + "activationEvents": [ + "onCommand:arc.manageMiaa", + "onCommand:arc.managePostgres" + ], + "repository": { + "type": "git", + "url": "https://github.com/Microsoft/azuredatastudio.git" + }, + "main": "./out/extension", + "contributes": { + "commands": [ + { + "command": "arc.manageMiaa", + "title": "%arc.manageMiaa%" + }, + { + "command": "arc.managePostgres", + "title": "%arc.managePostgres%" + } + ], + "menus": { + "commandPalette": [ + { + "command": "arc.manageMiaa", + "when": "false" + }, + { + "command": "arc.managePostgres", + "when": "false" + } + ] + }, + "configuration": { + "type": "object", + "title": "%arc.configuration.title%", + "properties": { + "arc.ignoreSslVerification": { + "type": "boolean", + "default": true, + "description": "%arc.ignoreSslVerification.desc%" + } + } + } + }, + "dependencies": { + "request": "^2.88.0", + "vscode-nls": "^4.1.2" + }, + "devDependencies": { + "@types/request": "^2.48.3" + } +} diff --git a/extensions/arc/package.nls.json b/extensions/arc/package.nls.json new file mode 100644 index 0000000000..46d81a7d25 --- /dev/null +++ b/extensions/arc/package.nls.json @@ -0,0 +1,8 @@ +{ + "arc.displayName": "Azure Arc", + "arc.description": "Support for Azure Arc", + "arc.configuration.title": "Azure Arc", + "arc.ignoreSslVerification.desc" : "Ignore SSL verification errors against the controller endpoint if true", + "arc.manageMiaa": "Manage MIAA", + "arc.managePostgres": "Manage Postgres" +} diff --git a/extensions/arc/src/common/promise.ts b/extensions/arc/src/common/promise.ts new file mode 100644 index 0000000000..53f62a287b --- /dev/null +++ b/extensions/arc/src/common/promise.ts @@ -0,0 +1,25 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +/** + * Deferred promise + */ +export class Deferred { + promise: Promise; + resolve!: (value?: T | PromiseLike) => void; + reject!: (reason?: any) => void; + constructor() { + this.promise = new Promise((resolve, reject) => { + this.resolve = resolve; + this.reject = reject; + }); + } + + then(onfulfilled?: (value: T) => TResult | Thenable, onrejected?: (reason: any) => TResult | Thenable): Thenable; + then(onfulfilled?: (value: T) => TResult | Thenable, onrejected?: (reason: any) => void): Thenable; + then(onfulfilled?: (value: T) => TResult | Thenable, onrejected?: (reason: any) => TResult | Thenable): Thenable { + return this.promise.then(onfulfilled, onrejected); + } +} diff --git a/extensions/arc/src/constants.ts b/extensions/arc/src/constants.ts new file mode 100644 index 0000000000..28d14c3123 --- /dev/null +++ b/extensions/arc/src/constants.ts @@ -0,0 +1,97 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; + +export interface IconPath { + dark: string; + light: string; +} + +export class IconPathHelper { + private static context: vscode.ExtensionContext; + + public static add: IconPath; + public static edit: IconPath; + public static delete: IconPath; + public static openInTab: IconPath; + public static heart: IconPath; + public static copy: IconPath; + public static collapseUp: IconPath; + public static collapseDown: IconPath; + public static postgres: IconPath; + public static computeStorage: IconPath; + public static connection: IconPath; + public static backup: IconPath; + public static properties: IconPath; + public static networking: IconPath; + + public static setExtensionContext(context: vscode.ExtensionContext) { + IconPathHelper.context = context; + IconPathHelper.add = { + light: IconPathHelper.context.asAbsolutePath('images/add.svg'), + dark: IconPathHelper.context.asAbsolutePath('images/add.svg') + }; + IconPathHelper.edit = { + light: IconPathHelper.context.asAbsolutePath('images/edit.svg'), + dark: IconPathHelper.context.asAbsolutePath('images/edit.svg') + }; + IconPathHelper.delete = { + light: IconPathHelper.context.asAbsolutePath('images/delete.svg'), + dark: IconPathHelper.context.asAbsolutePath('images/delete.svg') + }; + IconPathHelper.openInTab = { + light: IconPathHelper.context.asAbsolutePath('images/open-in-tab.svg'), + dark: IconPathHelper.context.asAbsolutePath('images/open-in-tab.svg') + }; + IconPathHelper.heart = { + light: IconPathHelper.context.asAbsolutePath('images/heart.svg'), + dark: IconPathHelper.context.asAbsolutePath('images/heart.svg') + }; + IconPathHelper.copy = { + light: IconPathHelper.context.asAbsolutePath('images/copy.svg'), + dark: IconPathHelper.context.asAbsolutePath('images/copy.svg') + }; + IconPathHelper.collapseUp = { + light: IconPathHelper.context.asAbsolutePath('images/collapse-up.svg'), + dark: IconPathHelper.context.asAbsolutePath('images/collapse-up-inverse.svg') + }; + IconPathHelper.collapseDown = { + light: IconPathHelper.context.asAbsolutePath('images/collapse-down.svg'), + dark: IconPathHelper.context.asAbsolutePath('images/collapse-down-inverse.svg') + }; + IconPathHelper.postgres = { + light: IconPathHelper.context.asAbsolutePath('images/postgres.svg'), + dark: IconPathHelper.context.asAbsolutePath('images/postgres.svg') + }; + IconPathHelper.computeStorage = { + light: context.asAbsolutePath('images/billing.svg'), + dark: context.asAbsolutePath('images/billing.svg') + }; + IconPathHelper.connection = { + light: context.asAbsolutePath('images/connections.svg'), + dark: context.asAbsolutePath('images/connections.svg') + }; + IconPathHelper.backup = { + light: context.asAbsolutePath('images/migrate.svg'), + dark: context.asAbsolutePath('images/migrate.svg') + }; + IconPathHelper.properties = { + light: context.asAbsolutePath('images/properties.svg'), + dark: context.asAbsolutePath('images/properties.svg') + }; + IconPathHelper.networking = { + light: context.asAbsolutePath('images/security.svg'), + dark: context.asAbsolutePath('images/security.svg') + }; + } +} + +export namespace cssStyles { + export const text = { 'user-select': 'text', 'cursor': 'text' }; + export const title = { ...text, 'font-weight': 'bold', 'font-size': '14px' }; + export const tableHeader = { ...text, 'text-align': 'left', 'border': 'none' }; + export const tableRow = { ...text, 'border-top': 'solid 1px #ccc', 'border-bottom': 'solid 1px #ccc', 'border-left': 'none', 'border-right': 'none' }; +} diff --git a/extensions/arc/src/controller/README.md b/extensions/arc/src/controller/README.md new file mode 100644 index 0000000000..81b8ddec26 --- /dev/null +++ b/extensions/arc/src/controller/README.md @@ -0,0 +1,20 @@ +# Updating the Swagger generated clients + +The TypeScript clients used to communicate with the controller are generated from the controller's Swagger specification. To update the clients: + +1. Get the Swagger specification from a running controller, and save it locally: + * `https://:30080/api//swagger.json` + +2. Generate the clients: + * At the time of writing, [editor.swagger.io](https://editor.swagger.io) does not support typescript-node client generation from OpenAPI 3.x specifications. So we'll use [openapi-generator.tech](https://openapi-generator.tech) instead. + + * Run openapi-generator: + * Either by [installing it](https://openapi-generator.tech/docs/installation) (requires Java) and running: + * `openapi-generator generate -i swagger.json -g typescript-node -o out --additional-properties supportsES6=true` + + * Or by running the Docker image (works in Linux or PowerShell): + * `docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/swagger.json -g typescript-node -o /local/out --additional-properties supportsES6=true` + +3. Copy the generated clients (api.ts, api/, model/) to ./generated/. + +4. The generated clients have some unused imports. This will not compile. VS Code has an "Organize Imports" command (Shift + Alt + O) that fixes this, but it fixes a single file. To organize imports for all files in a folder, you can use the [Folder Source Actions extension](https://marketplace.visualstudio.com/items?itemName=bierner.folder-source-actions). Followed by File -> Save All. diff --git a/extensions/arc/src/controller/auth.ts b/extensions/arc/src/controller/auth.ts new file mode 100644 index 0000000000..eb2f3994cb --- /dev/null +++ b/extensions/arc/src/controller/auth.ts @@ -0,0 +1,77 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as request from 'request'; +import * as vscode from 'vscode'; + +export interface Authentication { + applyToRequest(requestOptions: request.Options): Promise | void; +} + +class SslAuth implements Authentication { + constructor() { } + + applyToRequest(requestOptions: request.Options): void { + requestOptions['agentOptions'] = { + rejectUnauthorized: !getIgnoreSslVerificationConfigSetting() + }; + } +} + +export class KerberosAuth extends SslAuth implements Authentication { + + constructor(public kerberosToken: string) { + super(); + } + + applyToRequest(requestOptions: request.Options): void { + super.applyToRequest(requestOptions); + if (requestOptions && requestOptions.headers) { + requestOptions.headers['Authorization'] = `Negotiate ${this.kerberosToken}`; + } + requestOptions.auth = undefined; + } +} + +export class BasicAuth extends SslAuth implements Authentication { + constructor(public username: string, public password: string) { + super(); + } + + applyToRequest(requestOptions: request.Options): void { + super.applyToRequest(requestOptions); + requestOptions.auth = { + username: this.username, password: this.password + }; + } +} + +export class OAuthWithSsl extends SslAuth implements Authentication { + constructor(public accessToken: string) { + super(); + } + + applyToRequest(requestOptions: request.Options): void { + super.applyToRequest(requestOptions); + if (requestOptions && requestOptions.headers) { + requestOptions.headers['Authorization'] = `Bearer ${this.accessToken}`; + } + requestOptions.auth = undefined; + } +} + +/* Retrieves the current setting for whether to ignore SSL verification errors */ +export function getIgnoreSslVerificationConfigSetting(): boolean { + const arcConfigSectionName = 'arc'; + const ignoreSslConfigName = 'ignoreSslVerification'; + + try { + const config = vscode.workspace.getConfiguration(arcConfigSectionName); + return config.get(ignoreSslConfigName, true); + } catch (error) { + console.error(`Unexpected error retrieving ${arcConfigSectionName}.${ignoreSslConfigName} setting : ${error}`); + } + return true; +} diff --git a/extensions/arc/src/controller/generated/dusky/api.ts b/extensions/arc/src/controller/generated/dusky/api.ts new file mode 100644 index 0000000000..b1119f15c4 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/api.ts @@ -0,0 +1,3 @@ +// This is the entrypoint for the package +export * from './api/apis'; +export * from './model/models'; diff --git a/extensions/arc/src/controller/generated/dusky/api/apis.ts b/extensions/arc/src/controller/generated/dusky/api/apis.ts new file mode 100644 index 0000000000..3c4a5b3311 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/api/apis.ts @@ -0,0 +1,31 @@ +export * from './databaseRouterApi'; +export * from './databaseValidateRouterApi'; +export * from './logsRouterApi'; +export * from './metricRouterApi'; +export * from './operatorRouterApi'; +import * as fs from 'fs'; +import * as http from 'http'; +import { DatabaseRouterApi } from './databaseRouterApi'; +import { DatabaseValidateRouterApi } from './databaseValidateRouterApi'; +import { LogsRouterApi } from './logsRouterApi'; +import { MetricRouterApi } from './metricRouterApi'; +import { OperatorRouterApi } from './operatorRouterApi'; + +export class HttpError extends Error { + constructor (public response: http.IncomingMessage, public body: any, public statusCode?: number) { + super('HTTP request failed'); + this.name = 'HttpError'; + } +} + +export interface RequestDetailedFile { + value: Buffer; + options?: { + filename?: string; + contentType?: string; + } +} + +export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile; + +export const APIS = [DatabaseRouterApi, DatabaseValidateRouterApi, LogsRouterApi, MetricRouterApi, OperatorRouterApi]; diff --git a/extensions/arc/src/controller/generated/dusky/api/databaseRouterApi.ts b/extensions/arc/src/controller/generated/dusky/api/databaseRouterApi.ts new file mode 100644 index 0000000000..c5e0760dcb --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/api/databaseRouterApi.ts @@ -0,0 +1,2647 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); + +/* tslint:disable:no-unused-locals */ +import { DuskyObjectModelsBackup } from '../model/duskyObjectModelsBackup'; +import { DuskyObjectModelsBackupRetention } from '../model/duskyObjectModelsBackupRetention'; +import { DuskyObjectModelsDatabase } from '../model/duskyObjectModelsDatabase'; +import { DuskyObjectModelsDatabaseService } from '../model/duskyObjectModelsDatabaseService'; +import { DuskyObjectModelsDatabaseServiceList } from '../model/duskyObjectModelsDatabaseServiceList'; +import { DuskyObjectModelsDatabaseServiceVolumeStatus } from '../model/duskyObjectModelsDatabaseServiceVolumeStatus'; +import { DuskyObjectModelsRestoreStatus } from '../model/duskyObjectModelsRestoreStatus'; +import { DuskyObjectModelsRole } from '../model/duskyObjectModelsRole'; +import { DuskyObjectModelsUser } from '../model/duskyObjectModelsUser'; +import { Authentication, HttpBasicAuth, HttpBearerAuth, Interceptor, ObjectSerializer, VoidAuth } from '../model/models'; +import { V1Status } from '../model/v1Status'; +import { HttpError } from './apis'; + + + +let defaultBasePath = 'https://10.135.16.138:30080'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum DatabaseRouterApiApiKeys { +} + +export class DatabaseRouterApi { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'BasicAuth': new HttpBasicAuth(), + 'BearerAuth': new HttpBearerAuth(), + } + + protected interceptors: Interceptor[] = []; + + 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; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: DatabaseRouterApiApiKeys, value: string) { + (this.authentications as any)[DatabaseRouterApiApiKeys[key]].apiKey = value; + } + + set username(username: string) { + this.authentications.BasicAuth.username = username; + } + + set password(password: string) { + this.authentications.BasicAuth.password = password; + } + + set accessToken(accessToken: string | (() => string)) { + this.authentications.BearerAuth.accessToken = accessToken; + } + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + + /** + * + * @summary Creates a database in a Dusky database service. + * @param ns The namespace of the database service. + * @param serviceName The name of the database service. + * @param duskyObjectModelsDatabase + */ + public async createDuskyDatabase (ns: string, serviceName: string, duskyObjectModelsDatabase?: DuskyObjectModelsDatabase, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDatabase; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{serviceName}/databases' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'serviceName' + '}', encodeURIComponent(String(serviceName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling createDuskyDatabase.'); + } + + // 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 createDuskyDatabase.'); + } + + (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(duskyObjectModelsDatabase, "DuskyObjectModelsDatabase") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDatabase; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsDatabase"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Creates a Dusky database service. + * @param duskyObjectModelsDatabaseService + */ + public async createDuskyDatabaseService (duskyObjectModelsDatabaseService?: DuskyObjectModelsDatabaseService, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDatabaseService; }> { + const localVarPath = this.basePath + '/dusky/databases'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + (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(duskyObjectModelsDatabaseService, "DuskyObjectModelsDatabaseService") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDatabaseService; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsDatabaseService"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Creates a role in a Dusky database service. + * @param ns The namespace of the database service. + * @param dbName The name of the database service. + * @param roleName The name of the role to create. + */ + public async createDuskyRole (ns: string, dbName: string, roleName: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsRole; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{dbName}/roles/{roleName}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'dbName' + '}', encodeURIComponent(String(dbName))) + .replace('{' + 'roleName' + '}', encodeURIComponent(String(roleName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling createDuskyRole.'); + } + + // verify required parameter 'dbName' is not null or undefined + if (dbName === null || dbName === undefined) { + throw new Error('Required parameter dbName was null or undefined when calling createDuskyRole.'); + } + + // verify required parameter 'roleName' is not null or undefined + if (roleName === null || roleName === undefined) { + throw new Error('Required parameter roleName was null or undefined when calling createDuskyRole.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsRole; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsRole"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Creates a user in a Dusky database service. + * @param ns The namespace of the database service. + * @param serviceName The name of the database service. + * @param duskyObjectModelsUser + */ + public async createDuskyUser (ns: string, serviceName: string, duskyObjectModelsUser?: DuskyObjectModelsUser, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsUser; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{serviceName}/users' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'serviceName' + '}', encodeURIComponent(String(serviceName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling createDuskyUser.'); + } + + // 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 createDuskyUser.'); + } + + (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(duskyObjectModelsUser, "DuskyObjectModelsUser") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsUser; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsUser"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Deletes a Dusky database backup. + * @param ns The namespace of the database service. + * @param dbName The name of the database service. + * @param backupId The id of the backup to delete. + * @param tier The tier to delete the backup from. If omitted the backup will be deleted from all tiers. + */ + public async deleteDuskyBackup (ns: string, dbName: string, backupId: string, tier?: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsBackup; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{dbName}/backups/{backupId}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'dbName' + '}', encodeURIComponent(String(dbName))) + .replace('{' + 'backupId' + '}', encodeURIComponent(String(backupId))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling deleteDuskyBackup.'); + } + + // verify required parameter 'dbName' is not null or undefined + if (dbName === null || dbName === undefined) { + throw new Error('Required parameter dbName was null or undefined when calling deleteDuskyBackup.'); + } + + // verify required parameter 'backupId' is not null or undefined + if (backupId === null || backupId === undefined) { + throw new Error('Required parameter backupId was null or undefined when calling deleteDuskyBackup.'); + } + + if (tier !== undefined) { + localVarQueryParameters['tier'] = ObjectSerializer.serialize(tier, "number"); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsBackup; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsBackup"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Deletes a database from a Dusky database service + * @param ns The namespace of the database service. + * @param serviceName The name of the database service. + * @param dbName The name of the database to delete. + */ + public async deleteDuskyDatabase (ns: string, serviceName: string, dbName: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDatabase; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{serviceName}/databases/{dbName}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'serviceName' + '}', encodeURIComponent(String(serviceName))) + .replace('{' + 'dbName' + '}', encodeURIComponent(String(dbName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling deleteDuskyDatabase.'); + } + + // 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 deleteDuskyDatabase.'); + } + + // verify required parameter 'dbName' is not null or undefined + if (dbName === null || dbName === undefined) { + throw new Error('Required parameter dbName was null or undefined when calling deleteDuskyDatabase.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDatabase; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsDatabase"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Deletes a Dusky database service. + * @param ns The namespace of the database service. + * @param name The name of the database service to delete. + */ + public async deleteDuskyDatabaseService (ns: string, name: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: V1Status; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{name}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling deleteDuskyDatabaseService.'); + } + + // 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 deleteDuskyDatabaseService.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: V1Status; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "V1Status"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Deletes a role from a Dusky database. + * @param ns The namespace of the database service. + * @param dbName The name of the database service. + * @param roleName The name of the role to delete. + */ + public async deleteDuskyRole (ns: string, dbName: string, roleName: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsRole; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{dbName}/roles/{roleName}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'dbName' + '}', encodeURIComponent(String(dbName))) + .replace('{' + 'roleName' + '}', encodeURIComponent(String(roleName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling deleteDuskyRole.'); + } + + // verify required parameter 'dbName' is not null or undefined + if (dbName === null || dbName === undefined) { + throw new Error('Required parameter dbName was null or undefined when calling deleteDuskyRole.'); + } + + // verify required parameter 'roleName' is not null or undefined + if (roleName === null || roleName === undefined) { + throw new Error('Required parameter roleName was null or undefined when calling deleteDuskyRole.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsRole; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsRole"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Deletes a user from a Dusky database. + * @param ns The namespace of the database service. + * @param serviceName The name of the database service. + * @param userName The name of the user to delete. + */ + public async deleteDuskyUser (ns: string, serviceName: string, userName: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsUser; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{serviceName}/users/{userName}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'serviceName' + '}', encodeURIComponent(String(serviceName))) + .replace('{' + 'userName' + '}', encodeURIComponent(String(userName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling deleteDuskyUser.'); + } + + // 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 deleteDuskyUser.'); + } + + // verify required parameter 'userName' is not null or undefined + if (userName === null || userName === undefined) { + throw new Error('Required parameter userName was null or undefined when calling deleteDuskyUser.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsUser; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsUser"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Deletes volumes used by database services. + * @param ns The namespace of the database services. If omitted, all namespaces are considered. + * @param dbId The id of the database service. If omitted, all database services in the namespace are considered. + */ + public async deleteDuskyVolumes (ns?: string, dbId?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/dusky/databases/volumes'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + if (ns !== undefined) { + localVarQueryParameters['ns'] = ObjectSerializer.serialize(ns, "string"); + } + + if (dbId !== undefined) { + localVarQueryParameters['dbId'] = ObjectSerializer.serialize(dbId, "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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Gets a Dusky database backup. + * @param ns The namespace of the database service. + * @param dbName The name of the database service that will process the request. + * @param backupId The id of the backup to get. + * @param from The ID of a different database service to get the backup from, or omitted to get it from this service. + * @param tier The tier to get the backup from. If omitted all tiers will be searched. + */ + public async getDuskyBackup (ns: string, dbName: string, backupId: string, from?: string, tier?: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsBackup; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{dbName}/backups/{backupId}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'dbName' + '}', encodeURIComponent(String(dbName))) + .replace('{' + 'backupId' + '}', encodeURIComponent(String(backupId))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling getDuskyBackup.'); + } + + // verify required parameter 'dbName' is not null or undefined + if (dbName === null || dbName === undefined) { + throw new Error('Required parameter dbName was null or undefined when calling getDuskyBackup.'); + } + + // verify required parameter 'backupId' is not null or undefined + if (backupId === null || backupId === undefined) { + throw new Error('Required parameter backupId was null or undefined when calling getDuskyBackup.'); + } + + if (from !== undefined) { + localVarQueryParameters['from'] = ObjectSerializer.serialize(from, "string"); + } + + if (tier !== undefined) { + localVarQueryParameters['tier'] = ObjectSerializer.serialize(tier, "number"); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsBackup; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsBackup"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Lists the backups for a Dusky database service. + * @param ns The namespace of the database service. + * @param name The name of the database service that will process the request. + * @param from The ID of a different database service to list backups from, or omitted to list them from this service. + * @param tier The tier to list the backup from. If omitted backups will be listed from all tiers. + */ + public async getDuskyBackups (ns: string, name: string, from?: string, tier?: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{name}/backups' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling getDuskyBackups.'); + } + + // 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 getDuskyBackups.'); + } + + if (from !== undefined) { + localVarQueryParameters['from'] = ObjectSerializer.serialize(from, "string"); + } + + if (tier !== undefined) { + localVarQueryParameters['tier'] = ObjectSerializer.serialize(tier, "number"); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; 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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Gets a database in a Dusky database service. + * @param ns The namespace of the database service. + * @param serviceName The name of the database service. + * @param dbName The name of the database to get. + */ + public async getDuskyDatabase (ns: string, serviceName: string, dbName: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDatabase; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{serviceName}/databases/{dbName}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'serviceName' + '}', encodeURIComponent(String(serviceName))) + .replace('{' + 'dbName' + '}', encodeURIComponent(String(dbName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling getDuskyDatabase.'); + } + + // 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 getDuskyDatabase.'); + } + + // verify required parameter 'dbName' is not null or undefined + if (dbName === null || dbName === undefined) { + throw new Error('Required parameter dbName was null or undefined when calling getDuskyDatabase.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDatabase; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsDatabase"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Fetches logs from given database service in namespace and downloads them on local machine. + * @param ns The namespace of the database service. + * @param serviceName The name of the database service. + */ + public async getDuskyDatabaseLogs (ns: string, serviceName: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{serviceName}/logs' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'serviceName' + '}', encodeURIComponent(String(serviceName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling getDuskyDatabaseLogs.'); + } + + // 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 getDuskyDatabaseLogs.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Gets the status of the most recent restore operation. + * @param ns The namespace of the database service. + * @param dbName The name of the database service. + */ + public async getDuskyDatabaseRestoreStatus (ns: string, dbName: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsRestoreStatus; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{dbName}/backups/restore' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'dbName' + '}', encodeURIComponent(String(dbName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['text/plain', 'application/json', 'text/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling getDuskyDatabaseRestoreStatus.'); + } + + // verify required parameter 'dbName' is not null or undefined + if (dbName === null || dbName === undefined) { + throw new Error('Required parameter dbName was null or undefined when calling getDuskyDatabaseRestoreStatus.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsRestoreStatus; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsRestoreStatus"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Gets the configuration of a Dusky database service. + * @param ns The namespace of the database service. + * @param name The name of the database service. + */ + public async getDuskyDatabaseService (ns: string, name: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDatabaseService; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{name}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling getDuskyDatabaseService.'); + } + + // 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 getDuskyDatabaseService.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDatabaseService; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsDatabaseService"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Gets the password for a Dusky database service. + * @param ns The namespace of the database service. + * @param name The name of the database service. + */ + public async getDuskyPassword (ns: string, name: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{name}/password' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling getDuskyPassword.'); + } + + // 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 getDuskyPassword.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Gets a user in a Dusky database service. + * @param ns + * @param serviceName + * @param userName + */ + public async getDuskyUser (ns: string, serviceName: string, userName: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsUser; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{serviceName}/users/{userName}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'serviceName' + '}', encodeURIComponent(String(serviceName))) + .replace('{' + 'userName' + '}', encodeURIComponent(String(userName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling getDuskyUser.'); + } + + // 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 getDuskyUser.'); + } + + // verify required parameter 'userName' is not null or undefined + if (userName === null || userName === undefined) { + throw new Error('Required parameter userName was null or undefined when calling getDuskyUser.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsUser; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsUser"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Lists Dusky databases services. + * @param ns The namespace of the database services. + */ + public async listDuskyDatabaseServices (ns: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDatabaseServiceList; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling listDuskyDatabaseServices.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDatabaseServiceList; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsDatabaseServiceList"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Lists databases in a Dusky database service. + * @param ns The namespace of the database service. + * @param name The name of the database service. + */ + public async listDuskyDatabases (ns: string, name: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{name}/databases' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling listDuskyDatabases.'); + } + + // 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 listDuskyDatabases.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; 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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary List the roles in a Dusky database service. + * @param ns The namespace of the database service. + * @param dbName The name of the database service. + */ + public async listDuskyRoles (ns: string, dbName: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{dbName}/roles' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'dbName' + '}', encodeURIComponent(String(dbName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling listDuskyRoles.'); + } + + // verify required parameter 'dbName' is not null or undefined + if (dbName === null || dbName === undefined) { + throw new Error('Required parameter dbName was null or undefined when calling listDuskyRoles.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; 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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Lists the users in a Dusky database service. + * @param ns The namespace of the database service. + * @param name The name of the database service. + */ + public async listDuskyUsers (ns: string, name: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{name}/users' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling listDuskyUsers.'); + } + + // 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 listDuskyUsers.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; 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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Lists volumes used by database services. + * @param ns The namespace of the database services. If omitted, all namespaces are considered. + */ + public async listDuskyVolumes (ns?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array; }> { + const localVarPath = this.basePath + '/dusky/databases/volumes'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + if (ns !== undefined) { + localVarQueryParameters['ns'] = ObjectSerializer.serialize(ns, "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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; 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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Restarts a Dusky database service. + * @param ns The namespace of the database service. + * @param name The name of the database service. + */ + public async restartDuskyDatabaseService (ns: string, name: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{name}/restart' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling restartDuskyDatabaseService.'); + } + + // 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 restartDuskyDatabaseService.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Restores a Dusky database backup. + * @param ns The namespace of the database service. + * @param dbName The name of the database service that will process the request. + * @param id The id of the backup to restore. + * @param from The ID of a different database service to restore from, or omitted to restore from this service. + * @param time The timestamp or relative time (e.g. 1.5h) to restore the backup to. + * @param tier The tier to restore the backup from. If omitted the backup will be restored from the first available tier. + */ + public async restoreDuskyBackup (ns: string, dbName: string, id?: string, from?: string, time?: string, tier?: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsRestoreStatus; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{dbName}/backups/restore' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'dbName' + '}', encodeURIComponent(String(dbName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['text/plain', 'application/json', 'text/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling restoreDuskyBackup.'); + } + + // verify required parameter 'dbName' is not null or undefined + if (dbName === null || dbName === undefined) { + throw new Error('Required parameter dbName was null or undefined when calling restoreDuskyBackup.'); + } + + if (id !== undefined) { + localVarQueryParameters['id'] = ObjectSerializer.serialize(id, "string"); + } + + if (from !== undefined) { + localVarQueryParameters['from'] = ObjectSerializer.serialize(from, "string"); + } + + if (time !== undefined) { + localVarQueryParameters['time'] = ObjectSerializer.serialize(time, "string"); + } + + if (tier !== undefined) { + localVarQueryParameters['tier'] = ObjectSerializer.serialize(tier, "number"); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsRestoreStatus; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsRestoreStatus"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Takes a backup of a Dusky database service. + * @param ns The namespace of the database service. + * @param name The name of the database service to backup. + * @param backupName The name of the backup. + * @param throttle Whether to throttle the backup to reduce load. + */ + public async takeDuskyBackup (ns: string, name: string, backupName?: string, throttle?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsBackup; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{name}/backups' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling takeDuskyBackup.'); + } + + // 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 takeDuskyBackup.'); + } + + if (backupName !== undefined) { + localVarQueryParameters['backupName'] = ObjectSerializer.serialize(backupName, "string"); + } + + if (throttle !== undefined) { + localVarQueryParameters['throttle'] = ObjectSerializer.serialize(throttle, "boolean"); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsBackup; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsBackup"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Deletes old backups for a Dusky database service. + * @param ns The namespace of the database service. + * @param name The name of the database service. + * @param duskyObjectModelsBackupRetention + */ + public async trimDuskyBackups (ns: string, name: string, duskyObjectModelsBackupRetention?: Array, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{name}/backups/trim' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling trimDuskyBackups.'); + } + + // 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 trimDuskyBackups.'); + } + + (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(duskyObjectModelsBackupRetention, "Array") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; 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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Updates a database in a Dusky database service. + * @param ns The namespace of the database service. + * @param serviceName The name of the database service. + * @param dbName The name of the database to update. + * @param duskyObjectModelsDatabase + */ + public async updateDuskyDatabase (ns: string, serviceName: string, dbName: string, duskyObjectModelsDatabase?: DuskyObjectModelsDatabase, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDatabase; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{serviceName}/databases/{dbName}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'serviceName' + '}', encodeURIComponent(String(serviceName))) + .replace('{' + 'dbName' + '}', encodeURIComponent(String(dbName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling updateDuskyDatabase.'); + } + + // 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 updateDuskyDatabase.'); + } + + // verify required parameter 'dbName' is not null or undefined + if (dbName === null || dbName === undefined) { + throw new Error('Required parameter dbName was null or undefined when calling updateDuskyDatabase.'); + } + + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'PATCH', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(duskyObjectModelsDatabase, "DuskyObjectModelsDatabase") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDatabase; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsDatabase"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Updates a Dusky database service. + * @param ns The namespace of the database service. + * @param name The name of the database service to update. + * @param duskyObjectModelsDatabaseService + */ + public async updateDuskyDatabaseService (ns: string, name: string, duskyObjectModelsDatabaseService?: DuskyObjectModelsDatabaseService, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDatabaseService; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{name}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling updateDuskyDatabaseService.'); + } + + // 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 updateDuskyDatabaseService.'); + } + + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'PUT', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(duskyObjectModelsDatabaseService, "DuskyObjectModelsDatabaseService") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDatabaseService; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsDatabaseService"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Updates a user in a Dusky database service. + * @param ns The namespace of the database service. + * @param serviceName The name of the database service. + * @param userName The name of the user to update + * @param duskyObjectModelsUser + */ + public async updateDuskyUser (ns: string, serviceName: string, userName: string, duskyObjectModelsUser?: DuskyObjectModelsUser, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsUser; }> { + const localVarPath = this.basePath + '/dusky/databases/{ns}/{serviceName}/users/{userName}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'serviceName' + '}', encodeURIComponent(String(serviceName))) + .replace('{' + 'userName' + '}', encodeURIComponent(String(userName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling updateDuskyUser.'); + } + + // 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 updateDuskyUser.'); + } + + // verify required parameter 'userName' is not null or undefined + if (userName === null || userName === undefined) { + throw new Error('Required parameter userName was null or undefined when calling updateDuskyUser.'); + } + + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'PATCH', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(duskyObjectModelsUser, "DuskyObjectModelsUser") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsUser; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsUser"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +} diff --git a/extensions/arc/src/controller/generated/dusky/api/databaseValidateRouterApi.ts b/extensions/arc/src/controller/generated/dusky/api/databaseValidateRouterApi.ts new file mode 100644 index 0000000000..96709e5e73 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/api/databaseValidateRouterApi.ts @@ -0,0 +1,260 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); + +/* tslint:disable:no-unused-locals */ +import { DuskyObjectModelsDatabaseService } from '../model/duskyObjectModelsDatabaseService'; +import { DuskyObjectModelsDuskyValidationResult } from '../model/duskyObjectModelsDuskyValidationResult'; +import { Authentication, HttpBasicAuth, HttpBearerAuth, Interceptor, ObjectSerializer, VoidAuth } from '../model/models'; +import { HttpError } from './apis'; + + + +let defaultBasePath = 'https://10.135.16.138:30080'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum DatabaseValidateRouterApiApiKeys { +} + +export class DatabaseValidateRouterApi { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'BasicAuth': new HttpBasicAuth(), + 'BearerAuth': new HttpBearerAuth(), + } + + protected interceptors: Interceptor[] = []; + + 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; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: DatabaseValidateRouterApiApiKeys, value: string) { + (this.authentications as any)[DatabaseValidateRouterApiApiKeys[key]].apiKey = value; + } + + set username(username: string) { + this.authentications.BasicAuth.username = username; + } + + set password(password: string) { + this.authentications.BasicAuth.password = password; + } + + set accessToken(accessToken: string | (() => string)) { + this.authentications.BearerAuth.accessToken = accessToken; + } + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + + /** + * + * @summary Validate database service creation. + * @param duskyObjectModelsDatabaseService + */ + public async validateCreateDatabaseService (duskyObjectModelsDatabaseService?: DuskyObjectModelsDatabaseService, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDuskyValidationResult; }> { + const localVarPath = this.basePath + '/dusky/databases/validate'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + (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(duskyObjectModelsDatabaseService, "DuskyObjectModelsDatabaseService") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDuskyValidationResult; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsDuskyValidationResult"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Validate database service update. + * @param ns The namespace of the database service. + * @param name The name of the database service to update. + * @param duskyObjectModelsDatabaseService + */ + public async validateUpdateDatabaseService (ns: string, name: string, duskyObjectModelsDatabaseService?: DuskyObjectModelsDatabaseService, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDuskyValidationResult; }> { + const localVarPath = this.basePath + '/dusky/databases/validate/{ns}/{name}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling validateUpdateDatabaseService.'); + } + + // 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 validateUpdateDatabaseService.'); + } + + (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(duskyObjectModelsDatabaseService, "DuskyObjectModelsDatabaseService") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsDuskyValidationResult; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsDuskyValidationResult"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +} diff --git a/extensions/arc/src/controller/generated/dusky/api/logsRouterApi.ts b/extensions/arc/src/controller/generated/dusky/api/logsRouterApi.ts new file mode 100644 index 0000000000..c8d999b2a9 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/api/logsRouterApi.ts @@ -0,0 +1,175 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); + +/* tslint:disable:no-unused-locals */ +import { LogsRequest } from '../model/logsRequest'; +import { Authentication, HttpBasicAuth, HttpBearerAuth, Interceptor, ObjectSerializer, VoidAuth } from '../model/models'; +import { HttpError } from './apis'; + + + +let defaultBasePath = 'https://10.135.16.138:30080'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum LogsRouterApiApiKeys { +} + +export class LogsRouterApi { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'BasicAuth': new HttpBasicAuth(), + 'BearerAuth': new HttpBearerAuth(), + } + + protected interceptors: Interceptor[] = []; + + 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; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: LogsRouterApiApiKeys, value: string) { + (this.authentications as any)[LogsRouterApiApiKeys[key]].apiKey = value; + } + + set username(username: string) { + this.authentications.BasicAuth.username = username; + } + + set password(password: string) { + this.authentications.BasicAuth.password = password; + } + + set accessToken(accessToken: string | (() => string)) { + this.authentications.BearerAuth.accessToken = accessToken; + } + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + + /** + * + * @summary Gets logs from Elasticsearch. + * @param logsRequest + */ + public async apiV1LogsPost (logsRequest?: LogsRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: object; }> { + const localVarPath = this.basePath + '/api/v1/logs'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + (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(logsRequest, "LogsRequest") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: object; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "object"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +} diff --git a/extensions/arc/src/controller/generated/dusky/api/metricRouterApi.ts b/extensions/arc/src/controller/generated/dusky/api/metricRouterApi.ts new file mode 100644 index 0000000000..d17d1c9ffe --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/api/metricRouterApi.ts @@ -0,0 +1,171 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); + +/* tslint:disable:no-unused-locals */ + +import { Authentication, HttpBasicAuth, HttpBearerAuth, Interceptor, ObjectSerializer, VoidAuth } from '../model/models'; +import { HttpError } from './apis'; + + +let defaultBasePath = 'https://10.135.16.138:30080'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum MetricRouterApiApiKeys { +} + +export class MetricRouterApi { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'BasicAuth': new HttpBasicAuth(), + 'BearerAuth': new HttpBearerAuth(), + } + + protected interceptors: Interceptor[] = []; + + 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; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: MetricRouterApiApiKeys, value: string) { + (this.authentications as any)[MetricRouterApiApiKeys[key]].apiKey = value; + } + + set username(username: string) { + this.authentications.BasicAuth.username = username; + } + + set password(password: string) { + this.authentications.BasicAuth.password = password; + } + + set accessToken(accessToken: string | (() => string)) { + this.authentications.BearerAuth.accessToken = accessToken; + } + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + + /** + * + */ + public async apiV1MetricsPost (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: object; }> { + const localVarPath = this.basePath + '/api/v1/metrics'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: object; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "object"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +} diff --git a/extensions/arc/src/controller/generated/dusky/api/operatorRouterApi.ts b/extensions/arc/src/controller/generated/dusky/api/operatorRouterApi.ts new file mode 100644 index 0000000000..3a8381555b --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/api/operatorRouterApi.ts @@ -0,0 +1,236 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); + +/* tslint:disable:no-unused-locals */ +import { ClusterPatchModel } from '../model/clusterPatchModel'; +import { DuskyObjectModelsOperatorStatus } from '../model/duskyObjectModelsOperatorStatus'; +import { Authentication, HttpBasicAuth, HttpBearerAuth, Interceptor, ObjectSerializer, VoidAuth } from '../model/models'; +import { HttpError } from './apis'; + + + +let defaultBasePath = 'https://10.135.16.138:30080'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum OperatorRouterApiApiKeys { +} + +export class OperatorRouterApi { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'BasicAuth': new HttpBasicAuth(), + 'BearerAuth': new HttpBearerAuth(), + } + + protected interceptors: Interceptor[] = []; + + 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; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: OperatorRouterApiApiKeys, value: string) { + (this.authentications as any)[OperatorRouterApiApiKeys[key]].apiKey = value; + } + + set username(username: string) { + this.authentications.BasicAuth.username = username; + } + + set password(password: string) { + this.authentications.BasicAuth.password = password; + } + + set accessToken(accessToken: string | (() => string)) { + this.authentications.BearerAuth.accessToken = accessToken; + } + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + + /** + * + * @summary Gets the status of the Dusky operator. + */ + public async getDuskyOperatorStatus (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsOperatorStatus; }> { + const localVarPath = this.basePath + '/dusky/operator/status'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: DuskyObjectModelsOperatorStatus; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "DuskyObjectModelsOperatorStatus"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Upgrades the Dusky operator. + * @param clusterPatchModel + */ + public async upgradeDuskyOperator (clusterPatchModel?: ClusterPatchModel, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/dusky/operator/upgrade'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'PATCH', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(clusterPatchModel, "ClusterPatchModel") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +} diff --git a/extensions/arc/src/controller/generated/dusky/model/clusterPatchModel.ts b/extensions/arc/src/controller/generated/dusky/model/clusterPatchModel.ts new file mode 100644 index 0000000000..67a4fbbb7b --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/clusterPatchModel.ts @@ -0,0 +1,36 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class ClusterPatchModel { + 'targetVersion': string; + 'targetRepository'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "targetVersion", + "baseName": "targetVersion", + "type": "string" + }, + { + "name": "targetRepository", + "baseName": "targetRepository", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return ClusterPatchModel.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsBackup.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsBackup.ts new file mode 100644 index 0000000000..86aa592ff2 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsBackup.ts @@ -0,0 +1,67 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { DuskyObjectModelsError } from './duskyObjectModelsError'; + +export class DuskyObjectModelsBackup { + 'error'?: DuskyObjectModelsError; + 'id'?: string; + 'name'?: string; + 'timestamp': Date; + 'size'?: number | null; + 'state': string; + 'tiers'?: number | null; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "error", + "baseName": "error", + "type": "DuskyObjectModelsError" + }, + { + "name": "id", + "baseName": "id", + "type": "string" + }, + { + "name": "name", + "baseName": "name", + "type": "string" + }, + { + "name": "timestamp", + "baseName": "timestamp", + "type": "Date" + }, + { + "name": "size", + "baseName": "size", + "type": "number" + }, + { + "name": "state", + "baseName": "state", + "type": "string" + }, + { + "name": "tiers", + "baseName": "tiers", + "type": "number" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsBackup.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsBackupCopySchedule.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsBackupCopySchedule.ts new file mode 100644 index 0000000000..b09c856ddd --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsBackupCopySchedule.ts @@ -0,0 +1,36 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsBackupCopySchedule { + 'interval': string; + 'offset'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "interval", + "baseName": "interval", + "type": "string" + }, + { + "name": "offset", + "baseName": "offset", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsBackupCopySchedule.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsBackupRetention.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsBackupRetention.ts new file mode 100644 index 0000000000..cc2b266c02 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsBackupRetention.ts @@ -0,0 +1,36 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsBackupRetention { + 'maximums'?: Array; + 'minimums'?: Array; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "maximums", + "baseName": "maximums", + "type": "Array" + }, + { + "name": "minimums", + "baseName": "minimums", + "type": "Array" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsBackupRetention.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsBackupSpec.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsBackupSpec.ts new file mode 100644 index 0000000000..4cabc23e03 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsBackupSpec.ts @@ -0,0 +1,50 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { DuskyObjectModelsBackupCopySchedule } from './duskyObjectModelsBackupCopySchedule'; +import { DuskyObjectModelsBackupTier } from './duskyObjectModelsBackupTier'; + +export class DuskyObjectModelsBackupSpec { + 'deltaMinutes'?: number | null; + 'fullMinutes'?: number | null; + 'copySchedule'?: DuskyObjectModelsBackupCopySchedule; + 'tiers': Array; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "deltaMinutes", + "baseName": "deltaMinutes", + "type": "number" + }, + { + "name": "fullMinutes", + "baseName": "fullMinutes", + "type": "number" + }, + { + "name": "copySchedule", + "baseName": "copySchedule", + "type": "DuskyObjectModelsBackupCopySchedule" + }, + { + "name": "tiers", + "baseName": "tiers", + "type": "Array" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsBackupSpec.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsBackupTier.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsBackupTier.ts new file mode 100644 index 0000000000..72480b5c20 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsBackupTier.ts @@ -0,0 +1,38 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { DuskyObjectModelsRetentionSpec } from './duskyObjectModelsRetentionSpec'; +import { DuskyObjectModelsStorageSpec } from './duskyObjectModelsStorageSpec'; + +export class DuskyObjectModelsBackupTier { + 'retention'?: DuskyObjectModelsRetentionSpec; + 'storage': DuskyObjectModelsStorageSpec; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "retention", + "baseName": "retention", + "type": "DuskyObjectModelsRetentionSpec" + }, + { + "name": "storage", + "baseName": "storage", + "type": "DuskyObjectModelsStorageSpec" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsBackupTier.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabase.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabase.ts new file mode 100644 index 0000000000..13b542df4a --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabase.ts @@ -0,0 +1,42 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsDatabase { + 'name': string; + 'owner'?: string; + 'sharded'?: boolean; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "name", + "baseName": "name", + "type": "string" + }, + { + "name": "owner", + "baseName": "owner", + "type": "string" + }, + { + "name": "sharded", + "baseName": "sharded", + "type": "boolean" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsDatabase.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseService.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseService.ts new file mode 100644 index 0000000000..435e02d50f --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseService.ts @@ -0,0 +1,64 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { DuskyObjectModelsDatabaseServiceArcPayload } from './duskyObjectModelsDatabaseServiceArcPayload'; +import { DuskyObjectModelsDatabaseServiceSpec } from './duskyObjectModelsDatabaseServiceSpec'; +import { DuskyObjectModelsDatabaseServiceStatus } from './duskyObjectModelsDatabaseServiceStatus'; +import { DuskyObjectModelsObjectMeta } from './duskyObjectModelsObjectMeta'; + +export class DuskyObjectModelsDatabaseService { + 'kind'?: string; + 'apiVersion'?: string; + 'metadata'?: DuskyObjectModelsObjectMeta; + 'spec': DuskyObjectModelsDatabaseServiceSpec; + 'status'?: DuskyObjectModelsDatabaseServiceStatus; + 'arc'?: DuskyObjectModelsDatabaseServiceArcPayload; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "kind", + "baseName": "kind", + "type": "string" + }, + { + "name": "apiVersion", + "baseName": "apiVersion", + "type": "string" + }, + { + "name": "metadata", + "baseName": "metadata", + "type": "DuskyObjectModelsObjectMeta" + }, + { + "name": "spec", + "baseName": "spec", + "type": "DuskyObjectModelsDatabaseServiceSpec" + }, + { + "name": "status", + "baseName": "status", + "type": "DuskyObjectModelsDatabaseServiceStatus" + }, + { + "name": "arc", + "baseName": "arc", + "type": "DuskyObjectModelsDatabaseServiceArcPayload" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsDatabaseService.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceArcPayload.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceArcPayload.ts new file mode 100644 index 0000000000..8d1007e232 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceArcPayload.ts @@ -0,0 +1,30 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsDatabaseServiceArcPayload { + 'servicePassword'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "servicePassword", + "baseName": "servicePassword", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsDatabaseServiceArcPayload.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceCondition.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceCondition.ts new file mode 100644 index 0000000000..b76e717d65 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceCondition.ts @@ -0,0 +1,61 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsDatabaseServiceCondition { + 'type': string; + 'status': DuskyObjectModelsDatabaseServiceCondition.StatusEnum; + 'lastTransitionTime'?: Date | null; + 'reason'?: string; + 'message'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "string" + }, + { + "name": "status", + "baseName": "status", + "type": "DuskyObjectModelsDatabaseServiceCondition.StatusEnum" + }, + { + "name": "lastTransitionTime", + "baseName": "lastTransitionTime", + "type": "Date" + }, + { + "name": "reason", + "baseName": "reason", + "type": "string" + }, + { + "name": "message", + "baseName": "message", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsDatabaseServiceCondition.attributeTypeMap; + } +} + +export namespace DuskyObjectModelsDatabaseServiceCondition { + export enum StatusEnum { + Unknown = 'Unknown', + False = 'False', + True = 'True' + } +} diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceList.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceList.ts new file mode 100644 index 0000000000..fa6b671783 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceList.ts @@ -0,0 +1,49 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { DuskyObjectModelsDatabaseService } from './duskyObjectModelsDatabaseService'; + +export class DuskyObjectModelsDatabaseServiceList { + 'kind'?: string; + 'apiVersion'?: string; + 'metadata'?: object; + 'items': Array; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "kind", + "baseName": "kind", + "type": "string" + }, + { + "name": "apiVersion", + "baseName": "apiVersion", + "type": "string" + }, + { + "name": "metadata", + "baseName": "metadata", + "type": "object" + }, + { + "name": "items", + "baseName": "items", + "type": "Array" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsDatabaseServiceList.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceSpec.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceSpec.ts new file mode 100644 index 0000000000..7f57d3b274 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceSpec.ts @@ -0,0 +1,80 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { DuskyObjectModelsBackupSpec } from './duskyObjectModelsBackupSpec'; +import { DuskyObjectModelsDockerSpec } from './duskyObjectModelsDockerSpec'; +import { DuskyObjectModelsEngineSpec } from './duskyObjectModelsEngineSpec'; +import { DuskyObjectModelsMonitoringSpec } from './duskyObjectModelsMonitoringSpec'; +import { DuskyObjectModelsScaleSpec } from './duskyObjectModelsScaleSpec'; +import { DuskyObjectModelsSchedulingSpec } from './duskyObjectModelsSchedulingSpec'; +import { DuskyObjectModelsServiceSpec } from './duskyObjectModelsServiceSpec'; +import { DuskyObjectModelsStorageSpec } from './duskyObjectModelsStorageSpec'; + +export class DuskyObjectModelsDatabaseServiceSpec { + 'backups'?: DuskyObjectModelsBackupSpec; + 'docker'?: DuskyObjectModelsDockerSpec; + 'engine': DuskyObjectModelsEngineSpec; + 'monitoring'?: DuskyObjectModelsMonitoringSpec; + 'scale'?: DuskyObjectModelsScaleSpec; + 'scheduling'?: DuskyObjectModelsSchedulingSpec; + 'service'?: DuskyObjectModelsServiceSpec; + 'storage': DuskyObjectModelsStorageSpec; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "backups", + "baseName": "backups", + "type": "DuskyObjectModelsBackupSpec" + }, + { + "name": "docker", + "baseName": "docker", + "type": "DuskyObjectModelsDockerSpec" + }, + { + "name": "engine", + "baseName": "engine", + "type": "DuskyObjectModelsEngineSpec" + }, + { + "name": "monitoring", + "baseName": "monitoring", + "type": "DuskyObjectModelsMonitoringSpec" + }, + { + "name": "scale", + "baseName": "scale", + "type": "DuskyObjectModelsScaleSpec" + }, + { + "name": "scheduling", + "baseName": "scheduling", + "type": "DuskyObjectModelsSchedulingSpec" + }, + { + "name": "service", + "baseName": "service", + "type": "DuskyObjectModelsServiceSpec" + }, + { + "name": "storage", + "baseName": "storage", + "type": "DuskyObjectModelsStorageSpec" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsDatabaseServiceSpec.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceStatus.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceStatus.ts new file mode 100644 index 0000000000..d6e7c84b7b --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceStatus.ts @@ -0,0 +1,115 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { DuskyObjectModelsDatabaseServiceCondition } from './duskyObjectModelsDatabaseServiceCondition'; + +export class DuskyObjectModelsDatabaseServiceStatus { + 'state': string; + 'appliedGeneration'?: number | null; + 'conditions'?: Array; + 'internalIP'?: string; + 'internalPort'?: number | null; + 'externalIP'?: string; + 'externalPort'?: number | null; + 'podsFailed': number; + 'podsPending': number; + 'podsRunning': number; + 'podsUnknown': number; + 'restartRequired': boolean; + 'execFailCount'?: number | null; + 'settingsUpdatePending'?: boolean; + 'shardsProvisioned'?: number | null; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "state", + "baseName": "state", + "type": "string" + }, + { + "name": "appliedGeneration", + "baseName": "appliedGeneration", + "type": "number" + }, + { + "name": "conditions", + "baseName": "conditions", + "type": "Array" + }, + { + "name": "internalIP", + "baseName": "internalIP", + "type": "string" + }, + { + "name": "internalPort", + "baseName": "internalPort", + "type": "number" + }, + { + "name": "externalIP", + "baseName": "externalIP", + "type": "string" + }, + { + "name": "externalPort", + "baseName": "externalPort", + "type": "number" + }, + { + "name": "podsFailed", + "baseName": "podsFailed", + "type": "number" + }, + { + "name": "podsPending", + "baseName": "podsPending", + "type": "number" + }, + { + "name": "podsRunning", + "baseName": "podsRunning", + "type": "number" + }, + { + "name": "podsUnknown", + "baseName": "podsUnknown", + "type": "number" + }, + { + "name": "restartRequired", + "baseName": "restartRequired", + "type": "boolean" + }, + { + "name": "execFailCount", + "baseName": "execFailCount", + "type": "number" + }, + { + "name": "settingsUpdatePending", + "baseName": "settingsUpdatePending", + "type": "boolean" + }, + { + "name": "shardsProvisioned", + "baseName": "shardsProvisioned", + "type": "number" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsDatabaseServiceStatus.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceVolumeStatus.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceVolumeStatus.ts new file mode 100644 index 0000000000..a9a988faee --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDatabaseServiceVolumeStatus.ts @@ -0,0 +1,54 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsDatabaseServiceVolumeStatus { + 'id'?: string; + 'count'?: number; + 'totalSize'?: number; + 'storageClass'?: string; + 'state'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "id", + "baseName": "id", + "type": "string" + }, + { + "name": "count", + "baseName": "count", + "type": "number" + }, + { + "name": "totalSize", + "baseName": "totalSize", + "type": "number" + }, + { + "name": "storageClass", + "baseName": "storageClass", + "type": "string" + }, + { + "name": "state", + "baseName": "state", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsDatabaseServiceVolumeStatus.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDockerSpec.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDockerSpec.ts new file mode 100644 index 0000000000..64134d0a73 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDockerSpec.ts @@ -0,0 +1,54 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsDockerSpec { + 'registry'?: string; + 'repository'?: string; + 'imagePullPolicy'?: string; + 'imagePullSecret'?: string; + 'imageTagSuffix'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "registry", + "baseName": "registry", + "type": "string" + }, + { + "name": "repository", + "baseName": "repository", + "type": "string" + }, + { + "name": "imagePullPolicy", + "baseName": "imagePullPolicy", + "type": "string" + }, + { + "name": "imagePullSecret", + "baseName": "imagePullSecret", + "type": "string" + }, + { + "name": "imageTagSuffix", + "baseName": "imageTagSuffix", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsDockerSpec.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDuskyValidationMessage.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDuskyValidationMessage.ts new file mode 100644 index 0000000000..9298431ea0 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDuskyValidationMessage.ts @@ -0,0 +1,57 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsDuskyValidationMessage { + 'type'?: DuskyObjectModelsDuskyValidationMessage.TypeEnum; + 'code'?: DuskyObjectModelsDuskyValidationMessage.CodeEnum; + 'message'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "DuskyObjectModelsDuskyValidationMessage.TypeEnum" + }, + { + "name": "code", + "baseName": "code", + "type": "DuskyObjectModelsDuskyValidationMessage.CodeEnum" + }, + { + "name": "message", + "baseName": "message", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsDuskyValidationMessage.attributeTypeMap; + } +} + +export namespace DuskyObjectModelsDuskyValidationMessage { + export enum TypeEnum { + Info = 'Info', + Warning = 'Warning', + Fail = 'Fail' + } + export enum CodeEnum { + InvalidInput = 'InvalidInput', + ResourceExists = 'ResourceExists', + ResourceNotFound = 'ResourceNotFound', + ResourceNotRunning = 'ResourceNotRunning', + AvailableResources = 'AvailableResources', + InsufficientResources = 'InsufficientResources' + } +} diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDuskyValidationResult.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDuskyValidationResult.ts new file mode 100644 index 0000000000..1c624ddd20 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsDuskyValidationResult.ts @@ -0,0 +1,31 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { DuskyObjectModelsDuskyValidationMessage } from './duskyObjectModelsDuskyValidationMessage'; + +export class DuskyObjectModelsDuskyValidationResult { + 'messages'?: Array; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "messages", + "baseName": "messages", + "type": "Array" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsDuskyValidationResult.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsEngineSpec.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsEngineSpec.ts new file mode 100644 index 0000000000..6b1d81380a --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsEngineSpec.ts @@ -0,0 +1,49 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { DuskyObjectModelsPluginSpec } from './duskyObjectModelsPluginSpec'; + +export class DuskyObjectModelsEngineSpec { + 'type': string; + 'version'?: number | null; + 'settings'?: { [key: string]: string; }; + 'plugins'?: Array; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "type", + "baseName": "type", + "type": "string" + }, + { + "name": "version", + "baseName": "version", + "type": "number" + }, + { + "name": "settings", + "baseName": "settings", + "type": "{ [key: string]: string; }" + }, + { + "name": "plugins", + "baseName": "plugins", + "type": "Array" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsEngineSpec.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsError.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsError.ts new file mode 100644 index 0000000000..98693a0f23 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsError.ts @@ -0,0 +1,49 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { DuskyObjectModelsErrorDetails } from './duskyObjectModelsErrorDetails'; + +export class DuskyObjectModelsError { + 'reason'?: string; + 'message'?: string; + 'details'?: DuskyObjectModelsErrorDetails; + 'code'?: number | null; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "reason", + "baseName": "reason", + "type": "string" + }, + { + "name": "message", + "baseName": "message", + "type": "string" + }, + { + "name": "details", + "baseName": "details", + "type": "DuskyObjectModelsErrorDetails" + }, + { + "name": "code", + "baseName": "code", + "type": "number" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsError.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsErrorDetails.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsErrorDetails.ts new file mode 100644 index 0000000000..b5b961fb1d --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsErrorDetails.ts @@ -0,0 +1,42 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsErrorDetails { + 'reason'?: string; + 'message'?: string; + 'details'?: DuskyObjectModelsErrorDetails; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "reason", + "baseName": "reason", + "type": "string" + }, + { + "name": "message", + "baseName": "message", + "type": "string" + }, + { + "name": "details", + "baseName": "details", + "type": "DuskyObjectModelsErrorDetails" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsErrorDetails.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsMonitoringSpec.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsMonitoringSpec.ts new file mode 100644 index 0000000000..74c8792b95 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsMonitoringSpec.ts @@ -0,0 +1,31 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { DuskyObjectModelsTINASpec } from './duskyObjectModelsTINASpec'; + +export class DuskyObjectModelsMonitoringSpec { + 'tina'?: DuskyObjectModelsTINASpec; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "tina", + "baseName": "tina", + "type": "DuskyObjectModelsTINASpec" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsMonitoringSpec.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsObjectMeta.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsObjectMeta.ts new file mode 100644 index 0000000000..cab484a9ab --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsObjectMeta.ts @@ -0,0 +1,102 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsObjectMeta { + 'annotations'?: { [key: string]: string; }; + 'creationTimestamp'?: Date | null; + 'deletionTimestamp'?: Date | null; + 'finalizers'?: Array; + 'generateName'?: string; + 'generation'?: number | null; + 'labels'?: { [key: string]: string; }; + 'name'?: string; + 'namespace'?: string; + 'ownerReferences'?: Array; + 'resourceVersion'?: string; + 'selfLink'?: string; + 'uid'?: string | null; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "annotations", + "baseName": "annotations", + "type": "{ [key: string]: string; }" + }, + { + "name": "creationTimestamp", + "baseName": "creationTimestamp", + "type": "Date" + }, + { + "name": "deletionTimestamp", + "baseName": "deletionTimestamp", + "type": "Date" + }, + { + "name": "finalizers", + "baseName": "finalizers", + "type": "Array" + }, + { + "name": "generateName", + "baseName": "generateName", + "type": "string" + }, + { + "name": "generation", + "baseName": "generation", + "type": "number" + }, + { + "name": "labels", + "baseName": "labels", + "type": "{ [key: string]: string; }" + }, + { + "name": "name", + "baseName": "name", + "type": "string" + }, + { + "name": "namespace", + "baseName": "namespace", + "type": "string" + }, + { + "name": "ownerReferences", + "baseName": "ownerReferences", + "type": "Array" + }, + { + "name": "resourceVersion", + "baseName": "resourceVersion", + "type": "string" + }, + { + "name": "selfLink", + "baseName": "selfLink", + "type": "string" + }, + { + "name": "uid", + "baseName": "uid", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsObjectMeta.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsOperatorStatus.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsOperatorStatus.ts new file mode 100644 index 0000000000..1c5ebd8e82 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsOperatorStatus.ts @@ -0,0 +1,31 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { DuskyObjectModelsReplicaStatus } from './duskyObjectModelsReplicaStatus'; + +export class DuskyObjectModelsOperatorStatus { + 'statuses'?: { [key: string]: DuskyObjectModelsReplicaStatus; }; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "statuses", + "baseName": "statuses", + "type": "{ [key: string]: DuskyObjectModelsReplicaStatus; }" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsOperatorStatus.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsPluginSpec.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsPluginSpec.ts new file mode 100644 index 0000000000..94dab67b1a --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsPluginSpec.ts @@ -0,0 +1,30 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsPluginSpec { + 'name': string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "name", + "baseName": "name", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsPluginSpec.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsReplicaStatus.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsReplicaStatus.ts new file mode 100644 index 0000000000..0fc7d2dc2f --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsReplicaStatus.ts @@ -0,0 +1,36 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsReplicaStatus { + 'replicas'?: number; + 'readyReplicas'?: number; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "replicas", + "baseName": "replicas", + "type": "number" + }, + { + "name": "readyReplicas", + "baseName": "readyReplicas", + "type": "number" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsReplicaStatus.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsResourceRequirements.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsResourceRequirements.ts new file mode 100644 index 0000000000..ea377451e2 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsResourceRequirements.ts @@ -0,0 +1,36 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsResourceRequirements { + 'limits'?: { [key: string]: string; }; + 'requests'?: { [key: string]: string; }; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "limits", + "baseName": "limits", + "type": "{ [key: string]: string; }" + }, + { + "name": "requests", + "baseName": "requests", + "type": "{ [key: string]: string; }" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsResourceRequirements.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsRestoreStatus.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsRestoreStatus.ts new file mode 100644 index 0000000000..b6b11d0ffa --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsRestoreStatus.ts @@ -0,0 +1,67 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { DuskyObjectModelsError } from './duskyObjectModelsError'; + +export class DuskyObjectModelsRestoreStatus { + 'backupId'?: string; + 'endTime'?: Date; + 'error'?: DuskyObjectModelsError; + 'fromServer'?: string; + 'restoreTime'?: Date; + 'startTime'?: Date; + 'state': string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "backupId", + "baseName": "backupId", + "type": "string" + }, + { + "name": "endTime", + "baseName": "endTime", + "type": "Date" + }, + { + "name": "error", + "baseName": "error", + "type": "DuskyObjectModelsError" + }, + { + "name": "fromServer", + "baseName": "fromServer", + "type": "string" + }, + { + "name": "restoreTime", + "baseName": "restoreTime", + "type": "Date" + }, + { + "name": "startTime", + "baseName": "startTime", + "type": "Date" + }, + { + "name": "state", + "baseName": "state", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsRestoreStatus.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsRetentionSpec.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsRetentionSpec.ts new file mode 100644 index 0000000000..64db56c5c4 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsRetentionSpec.ts @@ -0,0 +1,36 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsRetentionSpec { + 'maximums'?: Array; + 'minimums'?: Array; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "maximums", + "baseName": "maximums", + "type": "Array" + }, + { + "name": "minimums", + "baseName": "minimums", + "type": "Array" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsRetentionSpec.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsRole.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsRole.ts new file mode 100644 index 0000000000..de11f9475d --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsRole.ts @@ -0,0 +1,30 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsRole { + 'name': string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "name", + "baseName": "name", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsRole.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsScaleSpec.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsScaleSpec.ts new file mode 100644 index 0000000000..9e7b774241 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsScaleSpec.ts @@ -0,0 +1,36 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsScaleSpec { + 'replicas'?: number | null; + 'shards'?: number | null; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "replicas", + "baseName": "replicas", + "type": "number" + }, + { + "name": "shards", + "baseName": "shards", + "type": "number" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsScaleSpec.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsSchedulingSpec.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsSchedulingSpec.ts new file mode 100644 index 0000000000..3ddac4baac --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsSchedulingSpec.ts @@ -0,0 +1,37 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { DuskyObjectModelsResourceRequirements } from './duskyObjectModelsResourceRequirements'; + +export class DuskyObjectModelsSchedulingSpec { + 'nodeSelector'?: { [key: string]: string; }; + 'resources'?: DuskyObjectModelsResourceRequirements; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "nodeSelector", + "baseName": "nodeSelector", + "type": "{ [key: string]: string; }" + }, + { + "name": "resources", + "baseName": "resources", + "type": "DuskyObjectModelsResourceRequirements" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsSchedulingSpec.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsServiceSpec.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsServiceSpec.ts new file mode 100644 index 0000000000..7316041a33 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsServiceSpec.ts @@ -0,0 +1,42 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsServiceSpec { + 'port'?: number | null; + 'type'?: string; + 'externalIPs'?: Array; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "port", + "baseName": "port", + "type": "number" + }, + { + "name": "type", + "baseName": "type", + "type": "string" + }, + { + "name": "externalIPs", + "baseName": "externalIPs", + "type": "Array" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsServiceSpec.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsStorageSpec.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsStorageSpec.ts new file mode 100644 index 0000000000..9f274bbd9d --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsStorageSpec.ts @@ -0,0 +1,48 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsStorageSpec { + 'storageClassName'?: string; + 'volumeClaimName'?: string; + 'volumeSize'?: string; + 'matchLabels'?: { [key: string]: string; }; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "storageClassName", + "baseName": "storageClassName", + "type": "string" + }, + { + "name": "volumeClaimName", + "baseName": "volumeClaimName", + "type": "string" + }, + { + "name": "volumeSize", + "baseName": "volumeSize", + "type": "string" + }, + { + "name": "matchLabels", + "baseName": "matchLabels", + "type": "{ [key: string]: string; }" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsStorageSpec.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsTINASpec.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsTINASpec.ts new file mode 100644 index 0000000000..98f82c2174 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsTINASpec.ts @@ -0,0 +1,30 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsTINASpec { + 'namespace': string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "namespace", + "baseName": "namespace", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsTINASpec.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsUser.ts b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsUser.ts new file mode 100644 index 0000000000..a58dcfc967 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/duskyObjectModelsUser.ts @@ -0,0 +1,42 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class DuskyObjectModelsUser { + 'name': string; + 'password'?: string; + 'roles': Array; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "name", + "baseName": "name", + "type": "string" + }, + { + "name": "password", + "baseName": "password", + "type": "string" + }, + { + "name": "roles", + "baseName": "roles", + "type": "Array" + } ]; + + static getAttributeTypeMap() { + return DuskyObjectModelsUser.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/logsRequest.ts b/extensions/arc/src/controller/generated/dusky/model/logsRequest.ts new file mode 100644 index 0000000000..d2f071b6a3 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/logsRequest.ts @@ -0,0 +1,48 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class LogsRequest { + 'startTime': string; + 'endTime': string; + 'termQueries'?: { [key: string]: string; }; + 'regexQueries'?: { [key: string]: string; }; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "startTime", + "baseName": "startTime", + "type": "string" + }, + { + "name": "endTime", + "baseName": "endTime", + "type": "string" + }, + { + "name": "termQueries", + "baseName": "termQueries", + "type": "{ [key: string]: string; }" + }, + { + "name": "regexQueries", + "baseName": "regexQueries", + "type": "{ [key: string]: string; }" + } ]; + + static getAttributeTypeMap() { + return LogsRequest.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/models.ts b/extensions/arc/src/controller/generated/dusky/model/models.ts new file mode 100644 index 0000000000..aff8523e1a --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/models.ts @@ -0,0 +1,329 @@ +export * from './clusterPatchModel'; +export * from './duskyObjectModelsBackup'; +export * from './duskyObjectModelsBackupCopySchedule'; +export * from './duskyObjectModelsBackupRetention'; +export * from './duskyObjectModelsBackupSpec'; +export * from './duskyObjectModelsBackupTier'; +export * from './duskyObjectModelsDatabase'; +export * from './duskyObjectModelsDatabaseService'; +export * from './duskyObjectModelsDatabaseServiceArcPayload'; +export * from './duskyObjectModelsDatabaseServiceCondition'; +export * from './duskyObjectModelsDatabaseServiceList'; +export * from './duskyObjectModelsDatabaseServiceSpec'; +export * from './duskyObjectModelsDatabaseServiceStatus'; +export * from './duskyObjectModelsDatabaseServiceVolumeStatus'; +export * from './duskyObjectModelsDockerSpec'; +export * from './duskyObjectModelsDuskyValidationMessage'; +export * from './duskyObjectModelsDuskyValidationResult'; +export * from './duskyObjectModelsEngineSpec'; +export * from './duskyObjectModelsError'; +export * from './duskyObjectModelsErrorDetails'; +export * from './duskyObjectModelsMonitoringSpec'; +export * from './duskyObjectModelsObjectMeta'; +export * from './duskyObjectModelsOperatorStatus'; +export * from './duskyObjectModelsPluginSpec'; +export * from './duskyObjectModelsReplicaStatus'; +export * from './duskyObjectModelsResourceRequirements'; +export * from './duskyObjectModelsRestoreStatus'; +export * from './duskyObjectModelsRetentionSpec'; +export * from './duskyObjectModelsRole'; +export * from './duskyObjectModelsScaleSpec'; +export * from './duskyObjectModelsSchedulingSpec'; +export * from './duskyObjectModelsServiceSpec'; +export * from './duskyObjectModelsStorageSpec'; +export * from './duskyObjectModelsTINASpec'; +export * from './duskyObjectModelsUser'; +export * from './logsRequest'; +export * from './v1ListMeta'; +export * from './v1Status'; +export * from './v1StatusCause'; +export * from './v1StatusDetails'; + +import localVarRequest = require('request'); + +import { ClusterPatchModel } from './clusterPatchModel'; +import { DuskyObjectModelsBackup } from './duskyObjectModelsBackup'; +import { DuskyObjectModelsBackupCopySchedule } from './duskyObjectModelsBackupCopySchedule'; +import { DuskyObjectModelsBackupRetention } from './duskyObjectModelsBackupRetention'; +import { DuskyObjectModelsBackupSpec } from './duskyObjectModelsBackupSpec'; +import { DuskyObjectModelsBackupTier } from './duskyObjectModelsBackupTier'; +import { DuskyObjectModelsDatabase } from './duskyObjectModelsDatabase'; +import { DuskyObjectModelsDatabaseService } from './duskyObjectModelsDatabaseService'; +import { DuskyObjectModelsDatabaseServiceArcPayload } from './duskyObjectModelsDatabaseServiceArcPayload'; +import { DuskyObjectModelsDatabaseServiceCondition } from './duskyObjectModelsDatabaseServiceCondition'; +import { DuskyObjectModelsDatabaseServiceList } from './duskyObjectModelsDatabaseServiceList'; +import { DuskyObjectModelsDatabaseServiceSpec } from './duskyObjectModelsDatabaseServiceSpec'; +import { DuskyObjectModelsDatabaseServiceStatus } from './duskyObjectModelsDatabaseServiceStatus'; +import { DuskyObjectModelsDatabaseServiceVolumeStatus } from './duskyObjectModelsDatabaseServiceVolumeStatus'; +import { DuskyObjectModelsDockerSpec } from './duskyObjectModelsDockerSpec'; +import { DuskyObjectModelsDuskyValidationMessage } from './duskyObjectModelsDuskyValidationMessage'; +import { DuskyObjectModelsDuskyValidationResult } from './duskyObjectModelsDuskyValidationResult'; +import { DuskyObjectModelsEngineSpec } from './duskyObjectModelsEngineSpec'; +import { DuskyObjectModelsError } from './duskyObjectModelsError'; +import { DuskyObjectModelsErrorDetails } from './duskyObjectModelsErrorDetails'; +import { DuskyObjectModelsMonitoringSpec } from './duskyObjectModelsMonitoringSpec'; +import { DuskyObjectModelsObjectMeta } from './duskyObjectModelsObjectMeta'; +import { DuskyObjectModelsOperatorStatus } from './duskyObjectModelsOperatorStatus'; +import { DuskyObjectModelsPluginSpec } from './duskyObjectModelsPluginSpec'; +import { DuskyObjectModelsReplicaStatus } from './duskyObjectModelsReplicaStatus'; +import { DuskyObjectModelsResourceRequirements } from './duskyObjectModelsResourceRequirements'; +import { DuskyObjectModelsRestoreStatus } from './duskyObjectModelsRestoreStatus'; +import { DuskyObjectModelsRetentionSpec } from './duskyObjectModelsRetentionSpec'; +import { DuskyObjectModelsRole } from './duskyObjectModelsRole'; +import { DuskyObjectModelsScaleSpec } from './duskyObjectModelsScaleSpec'; +import { DuskyObjectModelsSchedulingSpec } from './duskyObjectModelsSchedulingSpec'; +import { DuskyObjectModelsServiceSpec } from './duskyObjectModelsServiceSpec'; +import { DuskyObjectModelsStorageSpec } from './duskyObjectModelsStorageSpec'; +import { DuskyObjectModelsTINASpec } from './duskyObjectModelsTINASpec'; +import { DuskyObjectModelsUser } from './duskyObjectModelsUser'; +import { LogsRequest } from './logsRequest'; +import { V1ListMeta } from './v1ListMeta'; +import { V1Status } from './v1Status'; +import { V1StatusCause } from './v1StatusCause'; +import { V1StatusDetails } from './v1StatusDetails'; + +/* tslint:disable:no-unused-variable */ +let primitives = [ + "string", + "boolean", + "double", + "integer", + "long", + "float", + "number", + "any" + ]; + +let enumsMap: {[index: string]: any} = { + "DuskyObjectModelsDatabaseServiceCondition.StatusEnum": DuskyObjectModelsDatabaseServiceCondition.StatusEnum, + "DuskyObjectModelsDuskyValidationMessage.TypeEnum": DuskyObjectModelsDuskyValidationMessage.TypeEnum, + "DuskyObjectModelsDuskyValidationMessage.CodeEnum": DuskyObjectModelsDuskyValidationMessage.CodeEnum, +} + +let typeMap: {[index: string]: any} = { + "ClusterPatchModel": ClusterPatchModel, + "DuskyObjectModelsBackup": DuskyObjectModelsBackup, + "DuskyObjectModelsBackupCopySchedule": DuskyObjectModelsBackupCopySchedule, + "DuskyObjectModelsBackupRetention": DuskyObjectModelsBackupRetention, + "DuskyObjectModelsBackupSpec": DuskyObjectModelsBackupSpec, + "DuskyObjectModelsBackupTier": DuskyObjectModelsBackupTier, + "DuskyObjectModelsDatabase": DuskyObjectModelsDatabase, + "DuskyObjectModelsDatabaseService": DuskyObjectModelsDatabaseService, + "DuskyObjectModelsDatabaseServiceArcPayload": DuskyObjectModelsDatabaseServiceArcPayload, + "DuskyObjectModelsDatabaseServiceCondition": DuskyObjectModelsDatabaseServiceCondition, + "DuskyObjectModelsDatabaseServiceList": DuskyObjectModelsDatabaseServiceList, + "DuskyObjectModelsDatabaseServiceSpec": DuskyObjectModelsDatabaseServiceSpec, + "DuskyObjectModelsDatabaseServiceStatus": DuskyObjectModelsDatabaseServiceStatus, + "DuskyObjectModelsDatabaseServiceVolumeStatus": DuskyObjectModelsDatabaseServiceVolumeStatus, + "DuskyObjectModelsDockerSpec": DuskyObjectModelsDockerSpec, + "DuskyObjectModelsDuskyValidationMessage": DuskyObjectModelsDuskyValidationMessage, + "DuskyObjectModelsDuskyValidationResult": DuskyObjectModelsDuskyValidationResult, + "DuskyObjectModelsEngineSpec": DuskyObjectModelsEngineSpec, + "DuskyObjectModelsError": DuskyObjectModelsError, + "DuskyObjectModelsErrorDetails": DuskyObjectModelsErrorDetails, + "DuskyObjectModelsMonitoringSpec": DuskyObjectModelsMonitoringSpec, + "DuskyObjectModelsObjectMeta": DuskyObjectModelsObjectMeta, + "DuskyObjectModelsOperatorStatus": DuskyObjectModelsOperatorStatus, + "DuskyObjectModelsPluginSpec": DuskyObjectModelsPluginSpec, + "DuskyObjectModelsReplicaStatus": DuskyObjectModelsReplicaStatus, + "DuskyObjectModelsResourceRequirements": DuskyObjectModelsResourceRequirements, + "DuskyObjectModelsRestoreStatus": DuskyObjectModelsRestoreStatus, + "DuskyObjectModelsRetentionSpec": DuskyObjectModelsRetentionSpec, + "DuskyObjectModelsRole": DuskyObjectModelsRole, + "DuskyObjectModelsScaleSpec": DuskyObjectModelsScaleSpec, + "DuskyObjectModelsSchedulingSpec": DuskyObjectModelsSchedulingSpec, + "DuskyObjectModelsServiceSpec": DuskyObjectModelsServiceSpec, + "DuskyObjectModelsStorageSpec": DuskyObjectModelsStorageSpec, + "DuskyObjectModelsTINASpec": DuskyObjectModelsTINASpec, + "DuskyObjectModelsUser": DuskyObjectModelsUser, + "LogsRequest": LogsRequest, + "V1ListMeta": V1ListMeta, + "V1Status": V1Status, + "V1StatusCause": V1StatusCause, + "V1StatusDetails": V1StatusDetails, +} + +export class ObjectSerializer { + public static findCorrectType(data: any, expectedType: string) { + if (data == undefined) { + return expectedType; + } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { + return expectedType; + } else if (expectedType === "Date") { + return expectedType; + } else { + if (enumsMap[expectedType]) { + return expectedType; + } + + if (!typeMap[expectedType]) { + return expectedType; // w/e we don't know the type + } + + // Check the discriminator + let discriminatorProperty = typeMap[expectedType].discriminator; + if (discriminatorProperty == null) { + return expectedType; // the type does not have a discriminator. use it. + } else { + if (data[discriminatorProperty]) { + var discriminatorType = data[discriminatorProperty]; + if(typeMap[discriminatorType]){ + return discriminatorType; // use the type given in the discriminator + } else { + return expectedType; // discriminator did not map to a type + } + } else { + return expectedType; // discriminator was not present (or an empty string) + } + } + } + } + + public static serialize(data: any, type: string) { + 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> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let index in data) { + let date = data[index]; + transformedData.push(ObjectSerializer.serialize(date, subType)); + } + return transformedData; + } else if (type === "Date") { + return data.toISOString(); + } else { + if (enumsMap[type]) { + return data; + } + if (!typeMap[type]) { // in case we dont know the type + return data; + } + + // Get the actual type of this object + type = this.findCorrectType(data, type); + + // get the map for the correct type. + let attributeTypes = typeMap[type].getAttributeTypeMap(); + let instance: {[index: string]: any} = {}; + for (let index in attributeTypes) { + let attributeType = attributeTypes[index]; + instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); + } + return instance; + } + } + + public static deserialize(data: any, type: string) { + // polymorphism may change the actual type. + type = ObjectSerializer.findCorrectType(data, type); + 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> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let index in data) { + let date = data[index]; + transformedData.push(ObjectSerializer.deserialize(date, subType)); + } + return transformedData; + } else if (type === "Date") { + return new Date(data); + } else { + if (enumsMap[type]) {// is Enum + return data; + } + + if (!typeMap[type]) { // dont know the type + return data; + } + let instance = new typeMap[type](); + let attributeTypes = typeMap[type].getAttributeTypeMap(); + for (let index in attributeTypes) { + let attributeType = attributeTypes[index]; + instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type); + } + return instance; + } + } +} + +export interface Authentication { + /** + * Apply authentication settings to header and query params. + */ + applyToRequest(requestOptions: localVarRequest.Options): Promise | void; +} + +export class HttpBasicAuth implements Authentication { + public username: string = ''; + public password: string = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + requestOptions.auth = { + username: this.username, password: this.password + } + } +} + +export class HttpBearerAuth implements Authentication { + public accessToken: string | (() => string) = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (requestOptions && requestOptions.headers) { + const accessToken = typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + requestOptions.headers["Authorization"] = "Bearer " + accessToken; + } + } +} + +export class ApiKeyAuth implements Authentication { + public apiKey: string = ''; + + constructor(private location: string, private paramName: string) { + } + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (this.location == "query") { + (requestOptions.qs)[this.paramName] = this.apiKey; + } else if (this.location == "header" && requestOptions && requestOptions.headers) { + requestOptions.headers[this.paramName] = this.apiKey; + } else if (this.location == 'cookie' && requestOptions && requestOptions.headers) { + if (requestOptions.headers['Cookie']) { + requestOptions.headers['Cookie'] += '; ' + this.paramName + '=' + encodeURIComponent(this.apiKey); + } + else { + requestOptions.headers['Cookie'] = this.paramName + '=' + encodeURIComponent(this.apiKey); + } + } + } +} + +export class OAuth implements Authentication { + public accessToken: string = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (requestOptions && requestOptions.headers) { + requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; + } + } +} + +export class VoidAuth implements Authentication { + public username: string = ''; + public password: string = ''; + + applyToRequest(_: localVarRequest.Options): void { + // Do nothing + } +} + +export type Interceptor = (requestOptions: localVarRequest.Options) => (Promise | void); diff --git a/extensions/arc/src/controller/generated/dusky/model/v1ListMeta.ts b/extensions/arc/src/controller/generated/dusky/model/v1ListMeta.ts new file mode 100644 index 0000000000..424e5e5ddd --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/v1ListMeta.ts @@ -0,0 +1,42 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class V1ListMeta { + '_continue'?: string; + 'resourceVersion'?: string; + 'selfLink'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "_continue", + "baseName": "continue", + "type": "string" + }, + { + "name": "resourceVersion", + "baseName": "resourceVersion", + "type": "string" + }, + { + "name": "selfLink", + "baseName": "selfLink", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return V1ListMeta.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/v1Status.ts b/extensions/arc/src/controller/generated/dusky/model/v1Status.ts new file mode 100644 index 0000000000..a5e838bc70 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/v1Status.ts @@ -0,0 +1,80 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { V1ListMeta } from './v1ListMeta'; +import { V1StatusDetails } from './v1StatusDetails'; + +export class V1Status { + 'apiVersion'?: string; + 'code'?: number | null; + 'details'?: V1StatusDetails; + 'kind'?: string; + 'message'?: string; + 'metadata'?: V1ListMeta; + 'reason'?: string; + 'status'?: string; + 'hasObject'?: boolean; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "apiVersion", + "baseName": "apiVersion", + "type": "string" + }, + { + "name": "code", + "baseName": "code", + "type": "number" + }, + { + "name": "details", + "baseName": "details", + "type": "V1StatusDetails" + }, + { + "name": "kind", + "baseName": "kind", + "type": "string" + }, + { + "name": "message", + "baseName": "message", + "type": "string" + }, + { + "name": "metadata", + "baseName": "metadata", + "type": "V1ListMeta" + }, + { + "name": "reason", + "baseName": "reason", + "type": "string" + }, + { + "name": "status", + "baseName": "status", + "type": "string" + }, + { + "name": "hasObject", + "baseName": "hasObject", + "type": "boolean" + } ]; + + static getAttributeTypeMap() { + return V1Status.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/v1StatusCause.ts b/extensions/arc/src/controller/generated/dusky/model/v1StatusCause.ts new file mode 100644 index 0000000000..3e70304a03 --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/v1StatusCause.ts @@ -0,0 +1,42 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class V1StatusCause { + 'field'?: string; + 'message'?: string; + 'reason'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "field", + "baseName": "field", + "type": "string" + }, + { + "name": "message", + "baseName": "message", + "type": "string" + }, + { + "name": "reason", + "baseName": "reason", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return V1StatusCause.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/dusky/model/v1StatusDetails.ts b/extensions/arc/src/controller/generated/dusky/model/v1StatusDetails.ts new file mode 100644 index 0000000000..fbac8cd78b --- /dev/null +++ b/extensions/arc/src/controller/generated/dusky/model/v1StatusDetails.ts @@ -0,0 +1,61 @@ +/** + * Dusky API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: v1 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { V1StatusCause } from './v1StatusCause'; + +export class V1StatusDetails { + 'causes'?: Array; + 'group'?: string; + 'kind'?: string; + 'name'?: string; + 'retryAfterSeconds'?: number | null; + 'uid'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "causes", + "baseName": "causes", + "type": "Array" + }, + { + "name": "group", + "baseName": "group", + "type": "string" + }, + { + "name": "kind", + "baseName": "kind", + "type": "string" + }, + { + "name": "name", + "baseName": "name", + "type": "string" + }, + { + "name": "retryAfterSeconds", + "baseName": "retryAfterSeconds", + "type": "number" + }, + { + "name": "uid", + "baseName": "uid", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return V1StatusDetails.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/api.ts b/extensions/arc/src/controller/generated/v1/api.ts new file mode 100644 index 0000000000..d1c41415d7 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/api.ts @@ -0,0 +1,4 @@ +// This is the entrypoint for the package +export * from './api/apis'; +export * from './model/models'; + diff --git a/extensions/arc/src/controller/generated/v1/api/apis.ts b/extensions/arc/src/controller/generated/v1/api/apis.ts new file mode 100644 index 0000000000..b031c0feee --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/api/apis.ts @@ -0,0 +1,43 @@ +export * from './controlRouterApi'; +export * from './endpointsRouterApi'; +export * from './homeRouterApi'; +export * from './hybridDataHomeRouterApi'; +export * from './infoRouterApi'; +export * from './logsRouterApi'; +export * from './metricRouterApi'; +export * from './registrationRouterApi'; +export * from './sqlInstanceRouterApi'; +export * from './sqlOperatorUpgradeRouterApi'; +export * from './tokenRouterApi'; +import * as fs from 'fs'; +import * as http from 'http'; +import { ControlRouterApi } from './controlRouterApi'; +import { EndpointsRouterApi } from './endpointsRouterApi'; +import { HomeRouterApi } from './homeRouterApi'; +import { HybridDataHomeRouterApi } from './hybridDataHomeRouterApi'; +import { InfoRouterApi } from './infoRouterApi'; +import { LogsRouterApi } from './logsRouterApi'; +import { MetricRouterApi } from './metricRouterApi'; +import { RegistrationRouterApi } from './registrationRouterApi'; +import { SqlInstanceRouterApi } from './sqlInstanceRouterApi'; +import { SqlOperatorUpgradeRouterApi } from './sqlOperatorUpgradeRouterApi'; +import { TokenRouterApi } from './tokenRouterApi'; + +export class HttpError extends Error { + constructor (public response: http.IncomingMessage, public body: any, public statusCode?: number) { + super('HTTP request failed'); + this.name = 'HttpError'; + } +} + +export interface RequestDetailedFile { + value: Buffer; + options?: { + filename?: string; + contentType?: string; + } +} + +export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile; + +export const APIS = [ControlRouterApi, EndpointsRouterApi, HomeRouterApi, HybridDataHomeRouterApi, InfoRouterApi, LogsRouterApi, MetricRouterApi, RegistrationRouterApi, SqlInstanceRouterApi, SqlOperatorUpgradeRouterApi, TokenRouterApi]; diff --git a/extensions/arc/src/controller/generated/v1/api/controlRouterApi.ts b/extensions/arc/src/controller/generated/v1/api/controlRouterApi.ts new file mode 100644 index 0000000000..ca8c88c7f4 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/api/controlRouterApi.ts @@ -0,0 +1,396 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); + +/* tslint:disable:no-unused-locals */ +import { ClusterPatchModel } from '../model/clusterPatchModel'; +import { Authentication, HttpBasicAuth, HttpBearerAuth, Interceptor, ObjectSerializer, VoidAuth } from '../model/models'; +import { ResourceStatusModel } from '../model/resourceStatusModel'; +import { ServiceStatusModel } from '../model/serviceStatusModel'; +import { HttpError } from './apis'; + + + +let defaultBasePath = 'https://0.0.0.0:30080'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum ControlRouterApiApiKeys { +} + +export class ControlRouterApi { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'BasicAuth': new HttpBasicAuth(), + 'BearerAuth': new HttpBearerAuth(), + } + + protected interceptors: Interceptor[] = []; + + 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; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: ControlRouterApiApiKeys, value: string) { + (this.authentications as any)[ControlRouterApiApiKeys[key]].apiKey = value; + } + + set username(username: string) { + this.authentications.BasicAuth.username = username; + } + + set password(password: string) { + this.authentications.BasicAuth.password = password; + } + + set accessToken(accessToken: string | (() => string)) { + this.authentications.BearerAuth.accessToken = accessToken; + } + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + + /** + * + * @summary Redirects to the dashboard UI of the specified instance. + * @param instanceName The name of the instance for which you want the dashboard. + * @param linkType The name of the dashboard UI you would like. + */ + public async apiV1ControlInstancesInstanceNameStatusLinkTypeUiGet (instanceName: string, linkType: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/api/v1/control/instances/{instanceName}/status/{linkType}/ui' + .replace('{' + 'instanceName' + '}', encodeURIComponent(String(instanceName))) + .replace('{' + 'linkType' + '}', encodeURIComponent(String(linkType))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'instanceName' is not null or undefined + if (instanceName === null || instanceName === undefined) { + throw new Error('Required parameter instanceName was null or undefined when calling apiV1ControlInstancesInstanceNameStatusLinkTypeUiGet.'); + } + + // verify required parameter 'linkType' is not null or undefined + if (linkType === null || linkType === undefined) { + throw new Error('Required parameter linkType was null or undefined when calling apiV1ControlInstancesInstanceNameStatusLinkTypeUiGet.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Upgrades the control plane. + * @param clusterPatchModel + */ + public async apiV1ControlPatch (clusterPatchModel?: ClusterPatchModel, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/api/v1/control'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'PATCH', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(clusterPatchModel, "ClusterPatchModel") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Gets the status of the specified resource within the control plane. + * @param resourceName The name of the resource you would like the status of. + * @param all Whether you want all instances of all resources. + */ + public async apiV1ControlResourcesResourceNameStatusGet (resourceName: string, all?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ResourceStatusModel; }> { + const localVarPath = this.basePath + '/api/v1/control/resources/{resourceName}/status' + .replace('{' + 'resourceName' + '}', encodeURIComponent(String(resourceName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['text/plain', 'application/json', 'text/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'resourceName' is not null or undefined + if (resourceName === null || resourceName === undefined) { + throw new Error('Required parameter resourceName was null or undefined when calling apiV1ControlResourcesResourceNameStatusGet.'); + } + + if (all !== undefined) { + localVarQueryParameters['all'] = ObjectSerializer.serialize(all, "boolean"); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: ResourceStatusModel; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "ResourceStatusModel"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Gets the status of the control plane. + * @param all Whether you want all instances of all resources. + */ + public async apiV1ControlStatusGet (all?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array; }> { + const localVarPath = this.basePath + '/api/v1/control/status'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['text/plain', 'application/json', 'text/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + if (all !== undefined) { + localVarQueryParameters['all'] = ObjectSerializer.serialize(all, "boolean"); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; 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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +} diff --git a/extensions/arc/src/controller/generated/v1/api/endpointsRouterApi.ts b/extensions/arc/src/controller/generated/v1/api/endpointsRouterApi.ts new file mode 100644 index 0000000000..babd2d8d81 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/api/endpointsRouterApi.ts @@ -0,0 +1,248 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); + +/* tslint:disable:no-unused-locals */ +import { EndpointModel } from '../model/endpointModel'; +import { Authentication, HttpBasicAuth, HttpBearerAuth, Interceptor, ObjectSerializer, VoidAuth } from '../model/models'; +import { HttpError } from './apis'; + + + +let defaultBasePath = 'https://0.0.0.0:30080'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum EndpointsRouterApiApiKeys { +} + +export class EndpointsRouterApi { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'BasicAuth': new HttpBasicAuth(), + 'BearerAuth': new HttpBearerAuth(), + } + + protected interceptors: Interceptor[] = []; + + 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; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: EndpointsRouterApiApiKeys, value: string) { + (this.authentications as any)[EndpointsRouterApiApiKeys[key]].apiKey = value; + } + + set username(username: string) { + this.authentications.BasicAuth.username = username; + } + + set password(password: string) { + this.authentications.BasicAuth.password = password; + } + + set accessToken(accessToken: string | (() => string)) { + this.authentications.BearerAuth.accessToken = accessToken; + } + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + + /** + * + * @summary Gets the endpoint with the specified name. + * @param endpointName The name of the endpoint you want. + */ + public async apiV1BdcEndpointsEndpointNameGet (endpointName: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: EndpointModel; }> { + const localVarPath = this.basePath + '/api/v1/bdc/endpoints/{endpointName}' + .replace('{' + 'endpointName' + '}', encodeURIComponent(String(endpointName))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['text/plain', 'application/json', 'text/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // 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 apiV1BdcEndpointsEndpointNameGet.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; 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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Gets the endpoints of the cluster. + */ + public async apiV1BdcEndpointsGet (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array; }> { + const localVarPath = this.basePath + '/api/v1/bdc/endpoints'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['text/plain', 'application/json', 'text/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; 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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +} diff --git a/extensions/arc/src/controller/generated/v1/api/homeRouterApi.ts b/extensions/arc/src/controller/generated/v1/api/homeRouterApi.ts new file mode 100644 index 0000000000..6bba35436b --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/api/homeRouterApi.ts @@ -0,0 +1,224 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); + +/* tslint:disable:no-unused-locals */ + +import { Authentication, HttpBasicAuth, HttpBearerAuth, Interceptor, VoidAuth } from '../model/models'; +import { HttpError } from './apis'; + + +let defaultBasePath = 'https://0.0.0.0:30080'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum HomeRouterApiApiKeys { +} + +export class HomeRouterApi { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'BasicAuth': new HttpBasicAuth(), + 'BearerAuth': new HttpBearerAuth(), + } + + protected interceptors: Interceptor[] = []; + + 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; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: HomeRouterApiApiKeys, value: string) { + (this.authentications as any)[HomeRouterApiApiKeys[key]].apiKey = value; + } + + set username(username: string) { + this.authentications.BasicAuth.username = username; + } + + set password(password: string) { + this.authentications.BasicAuth.password = password; + } + + set accessToken(accessToken: string | (() => string)) { + this.authentications.BearerAuth.accessToken = accessToken; + } + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + + /** + * + * @summary Retrieves home page of controller service. + */ + public async apiV1Get (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/api/v1'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @summary Determines if the controller is available. + */ + public async apiV1PingGet (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/api/v1/ping'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +} diff --git a/extensions/arc/src/controller/generated/v1/api/hybridDataHomeRouterApi.ts b/extensions/arc/src/controller/generated/v1/api/hybridDataHomeRouterApi.ts new file mode 100644 index 0000000000..dc1824fe5a --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/api/hybridDataHomeRouterApi.ts @@ -0,0 +1,222 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); + +/* tslint:disable:no-unused-locals */ + +import { Authentication, HttpBasicAuth, HttpBearerAuth, Interceptor, VoidAuth } from '../model/models'; +import { HttpError } from './apis'; + + +let defaultBasePath = 'https://0.0.0.0:30080'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum HybridDataHomeRouterApiApiKeys { +} + +export class HybridDataHomeRouterApi { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'BasicAuth': new HttpBasicAuth(), + 'BearerAuth': new HttpBearerAuth(), + } + + protected interceptors: Interceptor[] = []; + + 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; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: HybridDataHomeRouterApiApiKeys, value: string) { + (this.authentications as any)[HybridDataHomeRouterApiApiKeys[key]].apiKey = value; + } + + set username(username: string) { + this.authentications.BasicAuth.username = username; + } + + set password(password: string) { + this.authentications.BasicAuth.password = password; + } + + set accessToken(accessToken: string | (() => string)) { + this.authentications.BearerAuth.accessToken = accessToken; + } + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + + /** + * + */ + public async apiV1HybridGet (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/api/v1/hybrid'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + */ + public async apiV1HybridPingGet (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/api/v1/hybrid/ping'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +} diff --git a/extensions/arc/src/controller/generated/v1/api/infoRouterApi.ts b/extensions/arc/src/controller/generated/v1/api/infoRouterApi.ts new file mode 100644 index 0000000000..8653f5411b --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/api/infoRouterApi.ts @@ -0,0 +1,164 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); + +/* tslint:disable:no-unused-locals */ + +import { Authentication, HttpBasicAuth, HttpBearerAuth, Interceptor, VoidAuth } from '../model/models'; +import { HttpError } from './apis'; + + +let defaultBasePath = 'https://0.0.0.0:30080'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum InfoRouterApiApiKeys { +} + +export class InfoRouterApi { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'BasicAuth': new HttpBasicAuth(), + 'BearerAuth': new HttpBearerAuth(), + } + + protected interceptors: Interceptor[] = []; + + 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; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: InfoRouterApiApiKeys, value: string) { + (this.authentications as any)[InfoRouterApiApiKeys[key]].apiKey = value; + } + + set username(username: string) { + this.authentications.BasicAuth.username = username; + } + + set password(password: string) { + this.authentications.BasicAuth.password = password; + } + + set accessToken(accessToken: string | (() => string)) { + this.authentications.BearerAuth.accessToken = accessToken; + } + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + + /** + * + * @summary Get cluster info. + */ + public async apiV1InfoGet (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/api/v1/info'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +} diff --git a/extensions/arc/src/controller/generated/v1/api/logsRouterApi.ts b/extensions/arc/src/controller/generated/v1/api/logsRouterApi.ts new file mode 100644 index 0000000000..ddacbb4bf3 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/api/logsRouterApi.ts @@ -0,0 +1,175 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); + +/* tslint:disable:no-unused-locals */ +import { LogsRequest } from '../model/logsRequest'; +import { Authentication, HttpBasicAuth, HttpBearerAuth, Interceptor, ObjectSerializer, VoidAuth } from '../model/models'; +import { HttpError } from './apis'; + + + +let defaultBasePath = 'https://0.0.0.0:30080'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum LogsRouterApiApiKeys { +} + +export class LogsRouterApi { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'BasicAuth': new HttpBasicAuth(), + 'BearerAuth': new HttpBearerAuth(), + } + + protected interceptors: Interceptor[] = []; + + 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; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: LogsRouterApiApiKeys, value: string) { + (this.authentications as any)[LogsRouterApiApiKeys[key]].apiKey = value; + } + + set username(username: string) { + this.authentications.BasicAuth.username = username; + } + + set password(password: string) { + this.authentications.BasicAuth.password = password; + } + + set accessToken(accessToken: string | (() => string)) { + this.authentications.BearerAuth.accessToken = accessToken; + } + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + + /** + * + * @summary Gets logs from Elasticsearch. + * @param logsRequest + */ + public async apiV1LogsPost (logsRequest?: LogsRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: object; }> { + const localVarPath = this.basePath + '/api/v1/logs'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + (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(logsRequest, "LogsRequest") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: object; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "object"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +} diff --git a/extensions/arc/src/controller/generated/v1/api/metricRouterApi.ts b/extensions/arc/src/controller/generated/v1/api/metricRouterApi.ts new file mode 100644 index 0000000000..608afa9bc2 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/api/metricRouterApi.ts @@ -0,0 +1,171 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); + +/* tslint:disable:no-unused-locals */ + +import { Authentication, HttpBasicAuth, HttpBearerAuth, Interceptor, ObjectSerializer, VoidAuth } from '../model/models'; +import { HttpError } from './apis'; + + +let defaultBasePath = 'https://0.0.0.0:30080'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum MetricRouterApiApiKeys { +} + +export class MetricRouterApi { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'BasicAuth': new HttpBasicAuth(), + 'BearerAuth': new HttpBearerAuth(), + } + + protected interceptors: Interceptor[] = []; + + 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; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: MetricRouterApiApiKeys, value: string) { + (this.authentications as any)[MetricRouterApiApiKeys[key]].apiKey = value; + } + + set username(username: string) { + this.authentications.BasicAuth.username = username; + } + + set password(password: string) { + this.authentications.BasicAuth.password = password; + } + + set accessToken(accessToken: string | (() => string)) { + this.authentications.BearerAuth.accessToken = accessToken; + } + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + + /** + * + */ + public async apiV1MetricsPost (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: object; }> { + const localVarPath = this.basePath + '/api/v1/metrics'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: object; }>((resolve, reject) => { + localVarRequest(localVarRequestOptions, (error, response, body) => { + if (error) { + reject(error); + } else { + body = ObjectSerializer.deserialize(body, "object"); + if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { + resolve({ response: response, body: body }); + } else { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +} diff --git a/extensions/arc/src/controller/generated/v1/api/registrationRouterApi.ts b/extensions/arc/src/controller/generated/v1/api/registrationRouterApi.ts new file mode 100644 index 0000000000..99e0e86cf0 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/api/registrationRouterApi.ts @@ -0,0 +1,321 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); + +/* tslint:disable:no-unused-locals */ +import { CreateRegistrationRequest } from '../model/createRegistrationRequest'; +import { Authentication, HttpBasicAuth, HttpBearerAuth, Interceptor, ObjectSerializer, VoidAuth } from '../model/models'; +import { RegistrationResponse } from '../model/registrationResponse'; +import { HttpError } from './apis'; + + + +let defaultBasePath = 'https://0.0.0.0:30080'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum RegistrationRouterApiApiKeys { +} + +export class RegistrationRouterApi { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'BasicAuth': new HttpBasicAuth(), + 'BearerAuth': new HttpBearerAuth(), + } + + protected interceptors: Interceptor[] = []; + + 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; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: RegistrationRouterApiApiKeys, value: string) { + (this.authentications as any)[RegistrationRouterApiApiKeys[key]].apiKey = value; + } + + set username(username: string) { + this.authentications.BasicAuth.username = username; + } + + set password(password: string) { + this.authentications.BasicAuth.password = password; + } + + set accessToken(accessToken: string | (() => string)) { + this.authentications.BearerAuth.accessToken = accessToken; + } + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + + /** + * + * @param createRegistrationRequest + */ + public async apiV1RegistrationCreatePut (createRegistrationRequest?: CreateRegistrationRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/api/v1/registration/create'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'PUT', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(createRegistrationRequest, "CreateRegistrationRequest") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @param ns + */ + public async apiV1RegistrationListResourcesNsGet (ns: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array; }> { + const localVarPath = this.basePath + '/api/v1/registration/listResources/{ns}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['text/plain', 'application/json', 'text/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling apiV1RegistrationListResourcesNsGet.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; 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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @param ns + * @param name + * @param isDeleted + */ + public async apiV1RegistrationNsNameIsDeletedDelete (ns: string, name: string, isDeleted: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/api/v1/registration/{ns}/{name}/{isDeleted}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'name' + '}', encodeURIComponent(String(name))) + .replace('{' + 'isDeleted' + '}', encodeURIComponent(String(isDeleted))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling apiV1RegistrationNsNameIsDeletedDelete.'); + } + + // 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 apiV1RegistrationNsNameIsDeletedDelete.'); + } + + // verify required parameter 'isDeleted' is not null or undefined + if (isDeleted === null || isDeleted === undefined) { + throw new Error('Required parameter isDeleted was null or undefined when calling apiV1RegistrationNsNameIsDeletedDelete.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +} diff --git a/extensions/arc/src/controller/generated/v1/api/sqlInstanceRouterApi.ts b/extensions/arc/src/controller/generated/v1/api/sqlInstanceRouterApi.ts new file mode 100644 index 0000000000..1942160e80 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/api/sqlInstanceRouterApi.ts @@ -0,0 +1,496 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); + +/* tslint:disable:no-unused-locals */ +import { CreateSqlInstanceMessage } from '../model/createSqlInstanceMessage'; +import { Authentication, HttpBasicAuth, HttpBearerAuth, Interceptor, ObjectSerializer, VoidAuth } from '../model/models'; +import { HttpError } from './apis'; + + + +let defaultBasePath = 'https://0.0.0.0:30080'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum SqlInstanceRouterApiApiKeys { +} + +export class SqlInstanceRouterApi { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'BasicAuth': new HttpBasicAuth(), + 'BearerAuth': new HttpBearerAuth(), + } + + protected interceptors: Interceptor[] = []; + + 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; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: SqlInstanceRouterApiApiKeys, value: string) { + (this.authentications as any)[SqlInstanceRouterApiApiKeys[key]].apiKey = value; + } + + set username(username: string) { + this.authentications.BasicAuth.username = username; + } + + set password(password: string) { + this.authentications.BasicAuth.password = password; + } + + set accessToken(accessToken: string | (() => string)) { + this.authentications.BearerAuth.accessToken = accessToken; + } + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + + /** + * + * @param createSqlInstanceMessage + */ + public async apiV1HybridSqlCreatePost (createSqlInstanceMessage?: CreateSqlInstanceMessage, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/api/v1/hybrid/sql/create'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + (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(createSqlInstanceMessage, "CreateSqlInstanceMessage") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @param ns + */ + public async apiV1HybridSqlNsGet (ns: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/api/v1/hybrid/sql/{ns}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling apiV1HybridSqlNsGet.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @param ns + * @param name + */ + public async apiV1HybridSqlNsNameDelete (ns: string, name: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/api/v1/hybrid/sql/{ns}/{name}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling apiV1HybridSqlNsNameDelete.'); + } + + // 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 apiV1HybridSqlNsNameDelete.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + * @param ns + * @param name + */ + public async apiV1HybridSqlNsNameGet (ns: string, name: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/api/v1/hybrid/sql/{ns}/{name}' + .replace('{' + 'ns' + '}', encodeURIComponent(String(ns))) + .replace('{' + 'name' + '}', encodeURIComponent(String(name))); + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + // verify required parameter 'ns' is not null or undefined + if (ns === null || ns === undefined) { + throw new Error('Required parameter ns was null or undefined when calling apiV1HybridSqlNsNameGet.'); + } + + // 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 apiV1HybridSqlNsNameGet.'); + } + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + */ + public async apiV1HybridSqlPingpostsqlPost (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/api/v1/hybrid/sql/pingpostsql'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } + /** + * + */ + public async apiV1HybridSqlPingsqlGet (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/api/v1/hybrid/sql/pingsql'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +} diff --git a/extensions/arc/src/controller/generated/v1/api/sqlOperatorUpgradeRouterApi.ts b/extensions/arc/src/controller/generated/v1/api/sqlOperatorUpgradeRouterApi.ts new file mode 100644 index 0000000000..d90d516208 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/api/sqlOperatorUpgradeRouterApi.ts @@ -0,0 +1,166 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); + +/* tslint:disable:no-unused-locals */ +import { ClusterPatchModel } from '../model/clusterPatchModel'; +import { Authentication, HttpBasicAuth, HttpBearerAuth, Interceptor, ObjectSerializer, VoidAuth } from '../model/models'; +import { HttpError } from './apis'; + + + +let defaultBasePath = 'https://0.0.0.0:30080'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum SqlOperatorUpgradeRouterApiApiKeys { +} + +export class SqlOperatorUpgradeRouterApi { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'BasicAuth': new HttpBasicAuth(), + 'BearerAuth': new HttpBearerAuth(), + } + + protected interceptors: Interceptor[] = []; + + 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; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + get basePath() { + return this._basePath; + } + + public setDefaultAuthentication(auth: Authentication) { + this.authentications.default = auth; + } + + public setApiKey(key: SqlOperatorUpgradeRouterApiApiKeys, value: string) { + (this.authentications as any)[SqlOperatorUpgradeRouterApiApiKeys[key]].apiKey = value; + } + + set username(username: string) { + this.authentications.BasicAuth.username = username; + } + + set password(password: string) { + this.authentications.BasicAuth.password = password; + } + + set accessToken(accessToken: string | (() => string)) { + this.authentications.BearerAuth.accessToken = accessToken; + } + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + + /** + * + * @param clusterPatchModel + */ + public async apiV1HybridSqlPatch (clusterPatchModel?: ClusterPatchModel, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> { + const localVarPath = this.basePath + '/api/v1/hybrid/sql'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + let localVarFormParams: any = {}; + + (Object).assign(localVarHeaderParams, options.headers); + + let localVarUseFormData = false; + + let localVarRequestOptions: localVarRequest.Options = { + method: 'PATCH', + qs: localVarQueryParameters, + headers: localVarHeaderParams, + uri: localVarPath, + useQuerystring: this._useQuerystring, + json: true, + body: ObjectSerializer.serialize(clusterPatchModel, "ClusterPatchModel") + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => { + localVarRequest(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(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +} diff --git a/extensions/arc/src/controller/generated/v1/api/tokenRouterApi.ts b/extensions/arc/src/controller/generated/v1/api/tokenRouterApi.ts new file mode 100644 index 0000000000..2a531eb057 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/api/tokenRouterApi.ts @@ -0,0 +1,172 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import localVarRequest = require('request'); +import http = require('http'); + +/* tslint:disable:no-unused-locals */ +import { Authentication, HttpBasicAuth, HttpBearerAuth, Interceptor, ObjectSerializer, VoidAuth } from '../model/models'; +import { TokenModel } from '../model/tokenModel'; +import { HttpError } from './apis'; + + + +let defaultBasePath = 'https://0.0.0.0:30080'; + +// =============================================== +// This file is autogenerated - Please do not edit +// =============================================== + +export enum TokenRouterApiApiKeys { +} + +export class TokenRouterApi { + protected _basePath = defaultBasePath; + protected _defaultHeaders : any = {}; + protected _useQuerystring : boolean = false; + + protected authentications = { + 'default': new VoidAuth(), + 'BasicAuth': new HttpBasicAuth(), + 'BearerAuth': new HttpBearerAuth(), + } + + protected interceptors: Interceptor[] = []; + + 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; + } + + set defaultHeaders(defaultHeaders: any) { + this._defaultHeaders = defaultHeaders; + } + + get defaultHeaders() { + return this._defaultHeaders; + } + + 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.BasicAuth.username = username; + } + + set password(password: string) { + this.authentications.BasicAuth.password = password; + } + + set accessToken(accessToken: string | (() => string)) { + this.authentications.BearerAuth.accessToken = accessToken; + } + + public addInterceptor(interceptor: Interceptor) { + this.interceptors.push(interceptor); + } + + /** + * + */ + public async apiV1TokenPost (options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: TokenModel; }> { + const localVarPath = this.basePath + '/api/v1/token'; + let localVarQueryParameters: any = {}; + let localVarHeaderParams: any = (Object).assign({}, this._defaultHeaders); + const produces = ['application/json']; + // give precedence to 'application/json' + if (produces.indexOf('application/json') >= 0) { + localVarHeaderParams.Accept = 'application/json'; + } else { + localVarHeaderParams.Accept = produces.join(','); + } + let localVarFormParams: any = {}; + + (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, + }; + + let authenticationPromise = Promise.resolve(); + if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); + } + if (this.authentications.BearerAuth.accessToken) { + authenticationPromise = authenticationPromise.then(() => this.authentications.BearerAuth.applyToRequest(localVarRequestOptions)); + } + authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); + + let interceptorPromise = authenticationPromise; + for (const interceptor of this.interceptors) { + interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); + } + + return interceptorPromise.then(() => { + if (Object.keys(localVarFormParams).length) { + if (localVarUseFormData) { + (localVarRequestOptions).formData = localVarFormParams; + } else { + localVarRequestOptions.form = localVarFormParams; + } + } + return new Promise<{ response: http.IncomingMessage; body: TokenModel; }>((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 { + reject(new HttpError(response, body, response.statusCode)); + } + } + }); + }); + }); + } +} diff --git a/extensions/arc/src/controller/generated/v1/model/activeDirectory.ts b/extensions/arc/src/controller/generated/v1/model/activeDirectory.ts new file mode 100644 index 0000000000..05e1c99d86 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/activeDirectory.ts @@ -0,0 +1,97 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class ActiveDirectory { + 'useInternalDomain'?: boolean; + 'ouDistinguishedName': string; + 'dnsIpAddresses'?: Array; + 'domainControllerFullyQualifiedDns'?: Array; + 'realm'?: string; + 'domainDnsName': string; + 'clusterAdmins': Array; + 'clusterUsers': Array; + 'appOwners'?: Array; + 'appReaders'?: Array; + 'kerberosDelegationMode'?: ActiveDirectory.KerberosDelegationModeEnum; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "useInternalDomain", + "baseName": "useInternalDomain", + "type": "boolean" + }, + { + "name": "ouDistinguishedName", + "baseName": "ouDistinguishedName", + "type": "string" + }, + { + "name": "dnsIpAddresses", + "baseName": "dnsIpAddresses", + "type": "Array" + }, + { + "name": "domainControllerFullyQualifiedDns", + "baseName": "domainControllerFullyQualifiedDns", + "type": "Array" + }, + { + "name": "realm", + "baseName": "realm", + "type": "string" + }, + { + "name": "domainDnsName", + "baseName": "domainDnsName", + "type": "string" + }, + { + "name": "clusterAdmins", + "baseName": "clusterAdmins", + "type": "Array" + }, + { + "name": "clusterUsers", + "baseName": "clusterUsers", + "type": "Array" + }, + { + "name": "appOwners", + "baseName": "appOwners", + "type": "Array" + }, + { + "name": "appReaders", + "baseName": "appReaders", + "type": "Array" + }, + { + "name": "kerberosDelegationMode", + "baseName": "kerberosDelegationMode", + "type": "ActiveDirectory.KerberosDelegationModeEnum" + } ]; + + static getAttributeTypeMap() { + return ActiveDirectory.attributeTypeMap; + } +} + +export namespace ActiveDirectory { + export enum KerberosDelegationModeEnum { + None = 'None', + ConstrainedDelegation = 'ConstrainedDelegation', + UnconstrainedDelegation = 'UnconstrainedDelegation' + } +} diff --git a/extensions/arc/src/controller/generated/v1/model/clusterPatchModel.ts b/extensions/arc/src/controller/generated/v1/model/clusterPatchModel.ts new file mode 100644 index 0000000000..710aa756ee --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/clusterPatchModel.ts @@ -0,0 +1,36 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class ClusterPatchModel { + 'targetVersion': string; + 'targetRepository'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "targetVersion", + "baseName": "targetVersion", + "type": "string" + }, + { + "name": "targetRepository", + "baseName": "targetRepository", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return ClusterPatchModel.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/model/createRegistrationRequest.ts b/extensions/arc/src/controller/generated/v1/model/createRegistrationRequest.ts new file mode 100644 index 0000000000..b90faba07e --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/createRegistrationRequest.ts @@ -0,0 +1,43 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { RegistrationSpec } from './registrationSpec'; + +export class CreateRegistrationRequest { + 'namespace'?: string; + 'name'?: string; + 'spec'?: RegistrationSpec; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "namespace", + "baseName": "namespace", + "type": "string" + }, + { + "name": "name", + "baseName": "name", + "type": "string" + }, + { + "name": "spec", + "baseName": "spec", + "type": "RegistrationSpec" + } ]; + + static getAttributeTypeMap() { + return CreateRegistrationRequest.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/model/createSqlInstanceMessage.ts b/extensions/arc/src/controller/generated/v1/model/createSqlInstanceMessage.ts new file mode 100644 index 0000000000..dc2a18e552 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/createSqlInstanceMessage.ts @@ -0,0 +1,54 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class CreateSqlInstanceMessage { + 'namespace'?: string; + 'name'?: string; + 'sysAdminPassword'?: string; + 'vcores'?: string; + 'memory'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "namespace", + "baseName": "namespace", + "type": "string" + }, + { + "name": "name", + "baseName": "name", + "type": "string" + }, + { + "name": "sysAdminPassword", + "baseName": "sys_admin_password", + "type": "string" + }, + { + "name": "vcores", + "baseName": "vcores", + "type": "string" + }, + { + "name": "memory", + "baseName": "memory", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return CreateSqlInstanceMessage.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/model/dashboards.ts b/extensions/arc/src/controller/generated/v1/model/dashboards.ts new file mode 100644 index 0000000000..aa78093058 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/dashboards.ts @@ -0,0 +1,42 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class Dashboards { + 'nodeMetricsUrl'?: string; + 'sqlMetricsUrl'?: string; + 'logsUrl'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "nodeMetricsUrl", + "baseName": "nodeMetricsUrl", + "type": "string" + }, + { + "name": "sqlMetricsUrl", + "baseName": "sqlMetricsUrl", + "type": "string" + }, + { + "name": "logsUrl", + "baseName": "logsUrl", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return Dashboards.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/model/docker.ts b/extensions/arc/src/controller/generated/v1/model/docker.ts new file mode 100644 index 0000000000..17d301ebf9 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/docker.ts @@ -0,0 +1,48 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class Docker { + 'registry': string; + 'repository': string; + 'imageTag': string; + 'imagePullPolicy'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "registry", + "baseName": "registry", + "type": "string" + }, + { + "name": "repository", + "baseName": "repository", + "type": "string" + }, + { + "name": "imageTag", + "baseName": "imageTag", + "type": "string" + }, + { + "name": "imagePullPolicy", + "baseName": "imagePullPolicy", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return Docker.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/model/endpoint.ts b/extensions/arc/src/controller/generated/v1/model/endpoint.ts new file mode 100644 index 0000000000..beb80555e1 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/endpoint.ts @@ -0,0 +1,54 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class Endpoint { + 'name': string; + 'serviceType'?: string; + 'port': number; + 'dnsName'?: string; + 'dynamicDnsUpdate'?: boolean; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "name", + "baseName": "name", + "type": "string" + }, + { + "name": "serviceType", + "baseName": "serviceType", + "type": "string" + }, + { + "name": "port", + "baseName": "port", + "type": "number" + }, + { + "name": "dnsName", + "baseName": "dnsName", + "type": "string" + }, + { + "name": "dynamicDnsUpdate", + "baseName": "dynamicDnsUpdate", + "type": "boolean" + } ]; + + static getAttributeTypeMap() { + return Endpoint.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/model/endpointModel.ts b/extensions/arc/src/controller/generated/v1/model/endpointModel.ts new file mode 100644 index 0000000000..4f4801f85a --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/endpointModel.ts @@ -0,0 +1,48 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class EndpointModel { + 'name'?: string; + 'description'?: string; + 'endpoint'?: string; + 'protocol'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "name", + "baseName": "name", + "type": "string" + }, + { + "name": "description", + "baseName": "description", + "type": "string" + }, + { + "name": "endpoint", + "baseName": "endpoint", + "type": "string" + }, + { + "name": "protocol", + "baseName": "protocol", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return EndpointModel.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/model/instanceStatusModel.ts b/extensions/arc/src/controller/generated/v1/model/instanceStatusModel.ts new file mode 100644 index 0000000000..e5685f862f --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/instanceStatusModel.ts @@ -0,0 +1,55 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { Dashboards } from './dashboards'; + +export class InstanceStatusModel { + 'instanceName'?: string; + 'state'?: string; + 'healthStatus'?: string; + 'details'?: string; + 'dashboards'?: Dashboards; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "instanceName", + "baseName": "instanceName", + "type": "string" + }, + { + "name": "state", + "baseName": "state", + "type": "string" + }, + { + "name": "healthStatus", + "baseName": "healthStatus", + "type": "string" + }, + { + "name": "details", + "baseName": "details", + "type": "string" + }, + { + "name": "dashboards", + "baseName": "dashboards", + "type": "Dashboards" + } ]; + + static getAttributeTypeMap() { + return InstanceStatusModel.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/model/logsRequest.ts b/extensions/arc/src/controller/generated/v1/model/logsRequest.ts new file mode 100644 index 0000000000..33529857ea --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/logsRequest.ts @@ -0,0 +1,48 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class LogsRequest { + 'startTime': string; + 'endTime': string; + 'termQueries'?: { [key: string]: string; }; + 'regexQueries'?: { [key: string]: string; }; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "startTime", + "baseName": "startTime", + "type": "string" + }, + { + "name": "endTime", + "baseName": "endTime", + "type": "string" + }, + { + "name": "termQueries", + "baseName": "termQueries", + "type": "{ [key: string]: string; }" + }, + { + "name": "regexQueries", + "baseName": "regexQueries", + "type": "{ [key: string]: string; }" + } ]; + + static getAttributeTypeMap() { + return LogsRequest.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/model/metadata.ts b/extensions/arc/src/controller/generated/v1/model/metadata.ts new file mode 100644 index 0000000000..8116a26d1e --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/metadata.ts @@ -0,0 +1,42 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class Metadata { + 'kind': string; + 'name': string; + 'namespace'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "kind", + "baseName": "kind", + "type": "string" + }, + { + "name": "name", + "baseName": "name", + "type": "string" + }, + { + "name": "namespace", + "baseName": "namespace", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return Metadata.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/model/models.ts b/extensions/arc/src/controller/generated/v1/model/models.ts new file mode 100644 index 0000000000..3b7b4f3034 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/models.ts @@ -0,0 +1,265 @@ +export * from './activeDirectory'; +export * from './clusterPatchModel'; +export * from './createRegistrationRequest'; +export * from './createSqlInstanceMessage'; +export * from './dashboards'; +export * from './docker'; +export * from './endpoint'; +export * from './endpointModel'; +export * from './instanceStatusModel'; +export * from './logsRequest'; +export * from './metadata'; +export * from './registrationResponse'; +export * from './registrationSpec'; +export * from './resourceStatusModel'; +export * from './security'; +export * from './serviceStatusModel'; +export * from './storage'; +export * from './storageSpec'; +export * from './tokenModel'; + +import localVarRequest = require('request'); + +import { ActiveDirectory } from './activeDirectory'; +import { ClusterPatchModel } from './clusterPatchModel'; +import { CreateRegistrationRequest } from './createRegistrationRequest'; +import { CreateSqlInstanceMessage } from './createSqlInstanceMessage'; +import { Dashboards } from './dashboards'; +import { Docker } from './docker'; +import { Endpoint } from './endpoint'; +import { EndpointModel } from './endpointModel'; +import { InstanceStatusModel } from './instanceStatusModel'; +import { LogsRequest } from './logsRequest'; +import { Metadata } from './metadata'; +import { RegistrationResponse } from './registrationResponse'; +import { RegistrationSpec } from './registrationSpec'; +import { ResourceStatusModel } from './resourceStatusModel'; +import { Security } from './security'; +import { ServiceStatusModel } from './serviceStatusModel'; +import { Storage } from './storage'; +import { StorageSpec } from './storageSpec'; +import { TokenModel } from './tokenModel'; + +/* tslint:disable:no-unused-variable */ +let primitives = [ + "string", + "boolean", + "double", + "integer", + "long", + "float", + "number", + "any" + ]; + +let enumsMap: {[index: string]: any} = { + "ActiveDirectory.KerberosDelegationModeEnum": ActiveDirectory.KerberosDelegationModeEnum, + "Security.KerberosDelegationModeEnum": Security.KerberosDelegationModeEnum, +} + +let typeMap: {[index: string]: any} = { + "ActiveDirectory": ActiveDirectory, + "ClusterPatchModel": ClusterPatchModel, + "CreateRegistrationRequest": CreateRegistrationRequest, + "CreateSqlInstanceMessage": CreateSqlInstanceMessage, + "Dashboards": Dashboards, + "Docker": Docker, + "Endpoint": Endpoint, + "EndpointModel": EndpointModel, + "InstanceStatusModel": InstanceStatusModel, + "LogsRequest": LogsRequest, + "Metadata": Metadata, + "RegistrationResponse": RegistrationResponse, + "RegistrationSpec": RegistrationSpec, + "ResourceStatusModel": ResourceStatusModel, + "Security": Security, + "ServiceStatusModel": ServiceStatusModel, + "Storage": Storage, + "StorageSpec": StorageSpec, + "TokenModel": TokenModel, +} + +export class ObjectSerializer { + public static findCorrectType(data: any, expectedType: string) { + if (data == undefined) { + return expectedType; + } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) { + return expectedType; + } else if (expectedType === "Date") { + return expectedType; + } else { + if (enumsMap[expectedType]) { + return expectedType; + } + + if (!typeMap[expectedType]) { + return expectedType; // w/e we don't know the type + } + + // Check the discriminator + let discriminatorProperty = typeMap[expectedType].discriminator; + if (discriminatorProperty == null) { + return expectedType; // the type does not have a discriminator. use it. + } else { + if (data[discriminatorProperty]) { + var discriminatorType = data[discriminatorProperty]; + if(typeMap[discriminatorType]){ + return discriminatorType; // use the type given in the discriminator + } else { + return expectedType; // discriminator did not map to a type + } + } else { + return expectedType; // discriminator was not present (or an empty string) + } + } + } + } + + public static serialize(data: any, type: string) { + 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> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let index in data) { + let date = data[index]; + transformedData.push(ObjectSerializer.serialize(date, subType)); + } + return transformedData; + } else if (type === "Date") { + return data.toISOString(); + } else { + if (enumsMap[type]) { + return data; + } + if (!typeMap[type]) { // in case we dont know the type + return data; + } + + // Get the actual type of this object + type = this.findCorrectType(data, type); + + // get the map for the correct type. + let attributeTypes = typeMap[type].getAttributeTypeMap(); + let instance: {[index: string]: any} = {}; + for (let index in attributeTypes) { + let attributeType = attributeTypes[index]; + instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type); + } + return instance; + } + } + + public static deserialize(data: any, type: string) { + // polymorphism may change the actual type. + type = ObjectSerializer.findCorrectType(data, type); + 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> + subType = subType.substring(0, subType.length - 1); // Type> => Type + let transformedData: any[] = []; + for (let index in data) { + let date = data[index]; + transformedData.push(ObjectSerializer.deserialize(date, subType)); + } + return transformedData; + } else if (type === "Date") { + return new Date(data); + } else { + if (enumsMap[type]) {// is Enum + return data; + } + + if (!typeMap[type]) { // dont know the type + return data; + } + let instance = new typeMap[type](); + let attributeTypes = typeMap[type].getAttributeTypeMap(); + for (let index in attributeTypes) { + let attributeType = attributeTypes[index]; + instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type); + } + return instance; + } + } +} + +export interface Authentication { + /** + * Apply authentication settings to header and query params. + */ + applyToRequest(requestOptions: localVarRequest.Options): Promise | void; +} + +export class HttpBasicAuth implements Authentication { + public username: string = ''; + public password: string = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + requestOptions.auth = { + username: this.username, password: this.password + } + } +} + +export class HttpBearerAuth implements Authentication { + public accessToken: string | (() => string) = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (requestOptions && requestOptions.headers) { + const accessToken = typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + requestOptions.headers["Authorization"] = "Bearer " + accessToken; + } + } +} + +export class ApiKeyAuth implements Authentication { + public apiKey: string = ''; + + constructor(private location: string, private paramName: string) { + } + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (this.location == "query") { + (requestOptions.qs)[this.paramName] = this.apiKey; + } else if (this.location == "header" && requestOptions && requestOptions.headers) { + requestOptions.headers[this.paramName] = this.apiKey; + } else if (this.location == 'cookie' && requestOptions && requestOptions.headers) { + if (requestOptions.headers['Cookie']) { + requestOptions.headers['Cookie'] += '; ' + this.paramName + '=' + encodeURIComponent(this.apiKey); + } + else { + requestOptions.headers['Cookie'] = this.paramName + '=' + encodeURIComponent(this.apiKey); + } + } + } +} + +export class OAuth implements Authentication { + public accessToken: string = ''; + + applyToRequest(requestOptions: localVarRequest.Options): void { + if (requestOptions && requestOptions.headers) { + requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; + } + } +} + +export class VoidAuth implements Authentication { + public username: string = ''; + public password: string = ''; + + applyToRequest(_: localVarRequest.Options): void { + // Do nothing + } +} + +export type Interceptor = (requestOptions: localVarRequest.Options) => (Promise | void); diff --git a/extensions/arc/src/controller/generated/v1/model/registrationResponse.ts b/extensions/arc/src/controller/generated/v1/model/registrationResponse.ts new file mode 100644 index 0000000000..3fd7428213 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/registrationResponse.ts @@ -0,0 +1,84 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class RegistrationResponse { + 'customObjectName'?: string; + 'instanceName'?: string; + 'instanceNamespace'?: string; + 'instanceType'?: string; + 'location'?: string; + 'resourceGroupName'?: string; + 'subscriptionId'?: string; + 'isDeleted'?: boolean; + 'externalEndpoint'?: string; + 'vCores'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "customObjectName", + "baseName": "customObjectName", + "type": "string" + }, + { + "name": "instanceName", + "baseName": "instanceName", + "type": "string" + }, + { + "name": "instanceNamespace", + "baseName": "instanceNamespace", + "type": "string" + }, + { + "name": "instanceType", + "baseName": "instanceType", + "type": "string" + }, + { + "name": "location", + "baseName": "location", + "type": "string" + }, + { + "name": "resourceGroupName", + "baseName": "resourceGroupName", + "type": "string" + }, + { + "name": "subscriptionId", + "baseName": "subscriptionId", + "type": "string" + }, + { + "name": "isDeleted", + "baseName": "isDeleted", + "type": "boolean" + }, + { + "name": "externalEndpoint", + "baseName": "externalEndpoint", + "type": "string" + }, + { + "name": "vCores", + "baseName": "vCores", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return RegistrationResponse.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/model/registrationSpec.ts b/extensions/arc/src/controller/generated/v1/model/registrationSpec.ts new file mode 100644 index 0000000000..d5255f22c9 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/registrationSpec.ts @@ -0,0 +1,78 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class RegistrationSpec { + 'instanceNamespace'?: string; + 'instanceName'?: string; + 'instanceType'?: string; + 'serviceName'?: string; + 'vcores'?: string; + 'location'?: string; + 'resourceGroupName'?: string; + 'subscriptionId'?: string; + 'isDeleted'?: boolean; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "instanceNamespace", + "baseName": "instanceNamespace", + "type": "string" + }, + { + "name": "instanceName", + "baseName": "instanceName", + "type": "string" + }, + { + "name": "instanceType", + "baseName": "instanceType", + "type": "string" + }, + { + "name": "serviceName", + "baseName": "serviceName", + "type": "string" + }, + { + "name": "vcores", + "baseName": "vcores", + "type": "string" + }, + { + "name": "location", + "baseName": "location", + "type": "string" + }, + { + "name": "resourceGroupName", + "baseName": "resourceGroupName", + "type": "string" + }, + { + "name": "subscriptionId", + "baseName": "subscriptionId", + "type": "string" + }, + { + "name": "isDeleted", + "baseName": "isDeleted", + "type": "boolean" + } ]; + + static getAttributeTypeMap() { + return RegistrationSpec.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/model/resourceStatusModel.ts b/extensions/arc/src/controller/generated/v1/model/resourceStatusModel.ts new file mode 100644 index 0000000000..ecb74fd1bf --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/resourceStatusModel.ts @@ -0,0 +1,55 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { InstanceStatusModel } from './instanceStatusModel'; + +export class ResourceStatusModel { + 'resourceName'?: string; + 'state'?: string; + 'healthStatus'?: string; + 'details'?: string; + 'instances'?: Array; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "resourceName", + "baseName": "resourceName", + "type": "string" + }, + { + "name": "state", + "baseName": "state", + "type": "string" + }, + { + "name": "healthStatus", + "baseName": "healthStatus", + "type": "string" + }, + { + "name": "details", + "baseName": "details", + "type": "string" + }, + { + "name": "instances", + "baseName": "instances", + "type": "Array" + } ]; + + static getAttributeTypeMap() { + return ResourceStatusModel.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/model/security.ts b/extensions/arc/src/controller/generated/v1/model/security.ts new file mode 100644 index 0000000000..472167b138 --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/security.ts @@ -0,0 +1,110 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ActiveDirectory } from './activeDirectory'; + +export class Security { + 'activeDirectory'?: ActiveDirectory; + 'privileged'?: boolean; + 'useInternalDomain'?: boolean; + 'ouDistinguishedName'?: string; + 'dnsIpAddresses'?: Array; + 'domainControllerFullyQualifiedDns'?: Array; + 'realm'?: string; + 'domainDnsName'?: string; + 'clusterAdmins'?: Array; + 'clusterUsers'?: Array; + 'appOwners'?: Array; + 'appReaders'?: Array; + 'kerberosDelegationMode'?: Security.KerberosDelegationModeEnum; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "activeDirectory", + "baseName": "activeDirectory", + "type": "ActiveDirectory" + }, + { + "name": "privileged", + "baseName": "privileged", + "type": "boolean" + }, + { + "name": "useInternalDomain", + "baseName": "useInternalDomain", + "type": "boolean" + }, + { + "name": "ouDistinguishedName", + "baseName": "ouDistinguishedName", + "type": "string" + }, + { + "name": "dnsIpAddresses", + "baseName": "dnsIpAddresses", + "type": "Array" + }, + { + "name": "domainControllerFullyQualifiedDns", + "baseName": "domainControllerFullyQualifiedDns", + "type": "Array" + }, + { + "name": "realm", + "baseName": "realm", + "type": "string" + }, + { + "name": "domainDnsName", + "baseName": "domainDnsName", + "type": "string" + }, + { + "name": "clusterAdmins", + "baseName": "clusterAdmins", + "type": "Array" + }, + { + "name": "clusterUsers", + "baseName": "clusterUsers", + "type": "Array" + }, + { + "name": "appOwners", + "baseName": "appOwners", + "type": "Array" + }, + { + "name": "appReaders", + "baseName": "appReaders", + "type": "Array" + }, + { + "name": "kerberosDelegationMode", + "baseName": "kerberosDelegationMode", + "type": "Security.KerberosDelegationModeEnum" + } ]; + + static getAttributeTypeMap() { + return Security.attributeTypeMap; + } +} + +export namespace Security { + export enum KerberosDelegationModeEnum { + None = 'None', + ConstrainedDelegation = 'ConstrainedDelegation', + UnconstrainedDelegation = 'UnconstrainedDelegation' + } +} diff --git a/extensions/arc/src/controller/generated/v1/model/serviceStatusModel.ts b/extensions/arc/src/controller/generated/v1/model/serviceStatusModel.ts new file mode 100644 index 0000000000..8405136adc --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/serviceStatusModel.ts @@ -0,0 +1,55 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { ResourceStatusModel } from './resourceStatusModel'; + +export class ServiceStatusModel { + 'serviceName'?: string; + 'state'?: string; + 'healthStatus'?: string; + 'details'?: string; + 'resources'?: Array; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "serviceName", + "baseName": "serviceName", + "type": "string" + }, + { + "name": "state", + "baseName": "state", + "type": "string" + }, + { + "name": "healthStatus", + "baseName": "healthStatus", + "type": "string" + }, + { + "name": "details", + "baseName": "details", + "type": "string" + }, + { + "name": "resources", + "baseName": "resources", + "type": "Array" + } ]; + + static getAttributeTypeMap() { + return ServiceStatusModel.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/model/storage.ts b/extensions/arc/src/controller/generated/v1/model/storage.ts new file mode 100644 index 0000000000..9f85c40e4e --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/storage.ts @@ -0,0 +1,55 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { StorageSpec } from './storageSpec'; + +export class Storage { + 'data'?: StorageSpec; + 'logs'?: StorageSpec; + 'className'?: string; + 'accessMode'?: string; + 'size'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "data", + "baseName": "data", + "type": "StorageSpec" + }, + { + "name": "logs", + "baseName": "logs", + "type": "StorageSpec" + }, + { + "name": "className", + "baseName": "className", + "type": "string" + }, + { + "name": "accessMode", + "baseName": "accessMode", + "type": "string" + }, + { + "name": "size", + "baseName": "size", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return Storage.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/model/storageSpec.ts b/extensions/arc/src/controller/generated/v1/model/storageSpec.ts new file mode 100644 index 0000000000..7de6f0215b --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/storageSpec.ts @@ -0,0 +1,42 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class StorageSpec { + 'className'?: string; + 'accessMode'?: string; + 'size'?: string; + + static discriminator: string | undefined = undefined; + + static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [ + { + "name": "className", + "baseName": "className", + "type": "string" + }, + { + "name": "accessMode", + "baseName": "accessMode", + "type": "string" + }, + { + "name": "size", + "baseName": "size", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return StorageSpec.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/controller/generated/v1/model/tokenModel.ts b/extensions/arc/src/controller/generated/v1/model/tokenModel.ts new file mode 100644 index 0000000000..06e3d1e80f --- /dev/null +++ b/extensions/arc/src/controller/generated/v1/model/tokenModel.ts @@ -0,0 +1,60 @@ +/** + * SQL Server Big Data Cluster API + * OpenAPI specification for **SQL Server Big Data Cluster**. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export class TokenModel { + 'tokenType'?: string; + 'accessToken'?: string; + 'expiresIn'?: number; + 'expiresOn'?: number; + 'tokenId'?: string; + 'namespace'?: 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" + }, + { + "name": "namespace", + "baseName": "namespace", + "type": "string" + } ]; + + static getAttributeTypeMap() { + return TokenModel.attributeTypeMap; + } +} + diff --git a/extensions/arc/src/extension.ts b/extensions/arc/src/extension.ts new file mode 100644 index 0000000000..a7dfa96414 --- /dev/null +++ b/extensions/arc/src/extension.ts @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; +import * as loc from './localizedConstants'; +import { IconPathHelper } from './constants'; +import { BasicAuth } from './controller/auth'; +import { PostgresDashboard } from './ui/dashboards/postgres/postgresDashboard'; +import { ControllerModel } from './models/controllerModel'; +import { PostgresModel } from './models/postgresModel'; + +export async function activate(context: vscode.ExtensionContext): Promise { + IconPathHelper.setExtensionContext(context); + + vscode.commands.registerCommand('arc.managePostgres', async () => { + // Controller information + const controllerUrl = ''; + const auth = new BasicAuth('', ''); + + // Postgres information + const dbNamespace = ''; + const dbName = ''; + + const controllerModel = new ControllerModel(controllerUrl, auth); + const databaseModel = new PostgresModel(controllerUrl, auth, dbNamespace, dbName); + const postgresDashboard = new PostgresDashboard(loc.postgresDashboard, controllerModel, databaseModel); + await postgresDashboard.showDashboard(); + }); +} + +export function deactivate(): void { +} diff --git a/extensions/arc/src/localizedConstants.ts b/extensions/arc/src/localizedConstants.ts new file mode 100644 index 0000000000..5d6bd7a71b --- /dev/null +++ b/extensions/arc/src/localizedConstants.ts @@ -0,0 +1,79 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as nls from 'vscode-nls'; +const localize = nls.loadMessageBundle(); + +export const miaaDashboard = localize('arc.miaaDashboard', "Managed Instance Dashboard (Preview)"); +export const postgresDashboard = localize('arc.postgresDashboard', "Postgres Dashboard (Preview)"); + +export const overview = localize('arc.overview', "Overview"); +export const connectionStrings = localize('arc.connectionStrings', "Connection Strings"); +export const networking = localize('arc.networking', "Networking"); +export const properties = localize('arc.properties', "Properties"); +export const settings = localize('arc.settings', "Settings"); +export const security = localize('arc.security', "Security"); +export const computeAndStorage = localize('arc.computeAndStorage', 'Compute + Storage'); +export const backup = localize('arc.backup', "Backup"); + +export const createNew = localize('arc.createNew', "Create New"); +export const deleteText = localize('arc.delete', "Delete"); +export const resetPassword = localize('arc.resetPassword', "Reset Password"); +export const openInAzurePortal = localize('arc.openInAzurePortal', "Open in Azure Portal"); +export const resourceGroup = localize('arc.resourceGroup', "Resource Group"); +export const region = localize('arc.region', "Region"); +export const subscription = localize('arc.subscription', "Subscription"); +export const subscriptionId = localize('arc.subscriptionId', "Subscription ID"); +export const state = localize('arc.state', "State"); +export const adminUsername = localize('arc.adminUsername', "Data controller admin username"); +export const host = localize('arc.host', "Host"); +export const name = localize('arc.name', "Name"); +export const type = localize('arc.type', "Type"); +export const status = localize('arc.status', "Status"); +export const dataController = localize('arc.dataController', 'Data controller'); +export const kibanaDashboard = localize('arc.kibanaDashboard', 'Kibana Dashboard'); +export const grafanaDashboard = localize('arc.grafanaDashboard', 'Grafana Dashboard'); +export const kibanaDashboardDescription = localize('arc.kibanaDashboardDescription', 'Dashboard for viewing logs'); +export const grafanaDashboardDescription = localize('arc.grafanaDashboardDescription', 'Dashboard for viewing metrics'); +export const serviceEndpoints = localize('arc.serviceEndpoints', 'Service endpoints'); +export const endpoint = localize('arc.endpoint', 'Endpoint'); +export const description = localize('arc.description', 'Description'); +export const yes = localize('arc.yes', 'Yes'); +export const no = localize('arc.no', 'No'); +export const feedback = localize('arc.feedback', 'Feedback'); +export const selectConnectionString = localize('arc.selectConnectionString', 'Select from available client connection strings below'); +export const vCores = localize('arc.vCores', 'vCores'); +export const ram = localize('arc.ram', 'RAM'); + +// Postgres constants +export const coordinatorEndpoint = localize('arc.coordinatorEndpoint', 'Coordinator endpoint'); +export const postgresAdminUsername = localize('arc.postgresAdminUsername', 'Admin username'); +export const nodeConfiguration = localize('arc.nodeConfiguration', 'Node configuration'); +export const postgresVersion = localize('arc.postgresVersion', 'PostgreSQL version'); +export const serverGroupType = localize('arc.serverGroupType', 'Server group type'); +export const serverGroupNodes = localize('arc.serverGroupNodes', 'Server group nodes'); +export const fullyQualifiedDomain = localize('arc.fullyQualifiedDomain', 'Fully qualified domain'); +export const postgresArcProductName = localize('arc.postgresArcProductName', 'Azure Database for PostgreSQL - Azure Arc'); +export const coordinator = localize('arc.coordinator', 'Coordinator'); +export const worker = localize('arc.worker', 'Worker'); +export const newDatabase = localize('arc.newDatabase', 'New Database'); +export const databaseName = localize('arc.databaseName', 'Database name'); +export const newPassword = localize('arc.newPassword', 'New password'); +export const learnAboutPostgresClients = localize('arc.learnAboutPostgresClients', 'Learn more about Azure PostgreSQL Hyperscale client interfaces'); +export const node = localize('arc.node', 'node'); +export const nodes = localize('arc.nodes', 'nodes'); +export const storagePerNode = localize('arc.storagePerNode', 'storage per node'); + +export function databaseCreated(name: string): string { return localize('arc.databaseCreated', "Database '{0}' created", name); } +export function databaseCreationFailed(name: string, error: any): string { return localize('arc.databaseCreationFailed', "Failed to create database '{0}'. {1}", name, (error instanceof Error ? error.message : error)); } +export function passwordReset(name: string): string { return localize('arc.passwordReset', "Password reset for service '{0}'", name); } +export function passwordResetFailed(name: string, error: any): string { return localize('arc.passwordResetFailed', "Failed to reset password for service '{0}'. {1}", name, (error instanceof Error ? error.message : error)); } +export function deleteServicePrompt(name: string): string { return localize('arc.deleteServicePrompt', "Delete service '{0}'?", name); } +export function serviceDeleted(name: string): string { return localize('arc.serviceDeleted', "Service '{0}' deleted", name); } +export function serviceDeletionFailed(name: string, error: any): string { return localize('arc.serviceDeletionFailed', "Failed to delete service '{0}'. {1}", name, (error instanceof Error ? error.message : error)); } +export function couldNotFindAzureResource(name: string): string { return localize('arc.couldNotFindAzureResource', "Could not find Azure resource for '{0}'", name); } +export function copiedToClipboard(name: string): string { return localize('arc.copiedToClipboard', '{0} copied to clipboard', name); } + +export const arcResources = localize('arc.arcResources', "Azure Arc Resources"); diff --git a/extensions/arc/src/models/controllerModel.ts b/extensions/arc/src/models/controllerModel.ts new file mode 100644 index 0000000000..44143fcae3 --- /dev/null +++ b/extensions/arc/src/models/controllerModel.ts @@ -0,0 +1,71 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { Authentication } from '../controller/auth'; +import { EndpointsRouterApi, EndpointModel, RegistrationRouterApi, RegistrationResponse, TokenRouterApi } from '../controller/generated/v1/api'; + +export class ControllerModel { + private _endpointsRouter: EndpointsRouterApi; + private _tokenRouter: TokenRouterApi; + private _registrationRouter: RegistrationRouterApi; + private _endpoints!: EndpointModel[]; + private _namespace!: string; + private _registrations!: RegistrationResponse[]; + + constructor(controllerUrl: string, auth: Authentication) { + this._endpointsRouter = new EndpointsRouterApi(controllerUrl); + this._endpointsRouter.setDefaultAuthentication(auth); + + this._tokenRouter = new TokenRouterApi(controllerUrl); + this._tokenRouter.setDefaultAuthentication(auth); + + this._registrationRouter = new RegistrationRouterApi(controllerUrl); + this._registrationRouter.setDefaultAuthentication(auth); + } + + public async refresh(): Promise { + await Promise.all([ + this._endpointsRouter.apiV1BdcEndpointsGet().then(response => { + this._endpoints = response.body; + }), + this._tokenRouter.apiV1TokenPost().then(async response => { + this._namespace = response.body.namespace!; + }) + ]).then(async _ => { + this._registrations = (await this._registrationRouter.apiV1RegistrationListResourcesNsGet(this._namespace)).body; + }); + } + + public endpoints(): EndpointModel[] { + return this._endpoints; + } + + public endpoint(name: string): EndpointModel | undefined { + return this._endpoints.find(e => e.name === name); + } + + public namespace(): string { + return this._namespace; + } + + public registrations(): RegistrationResponse[] { + return this._registrations; + } + + public registration(type: string, namespace: string, name: string): RegistrationResponse | undefined { + return this._registrations.find(r => { + // Resources deployed outside the controller's namespace are named in the format 'namespace_name' + let instanceName = r.instanceName!; + const parts: string[] = instanceName.split('_'); + if (parts.length === 2) { + instanceName = parts[1]; + } + else if (parts.length > 2) { + throw new Error(`Cannot parse resource '${instanceName}'. Acceptable formats are 'namespace_name' or 'name'.`); + } + return r.instanceType === type && r.instanceNamespace === namespace && instanceName === name; + }); + } +} diff --git a/extensions/arc/src/models/postgresModel.ts b/extensions/arc/src/models/postgresModel.ts new file mode 100644 index 0000000000..440531d9eb --- /dev/null +++ b/extensions/arc/src/models/postgresModel.ts @@ -0,0 +1,152 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as loc from '../localizedConstants'; +import { DuskyObjectModelsDatabaseService, DatabaseRouterApi, DuskyObjectModelsDatabase, V1Status } from '../controller/generated/dusky/api'; +import { Authentication } from '../controller/auth'; + +export class PostgresModel { + private _databaseRouter: DatabaseRouterApi; + private _service!: DuskyObjectModelsDatabaseService; + private _password!: string; + + constructor(controllerUrl: string, auth: Authentication, private _namespace: string, private _name: string) { + this._databaseRouter = new DatabaseRouterApi(controllerUrl); + this._databaseRouter.setDefaultAuthentication(auth); + } + + /** Returns the service's Kubernetes namespace */ + public namespace(): string { + return this._namespace; + } + + /** Returns the service's name */ + public name(): string { + return this._name; + } + + /** Returns the service's fully qualified name in the format namespace.name */ + public fullName(): string { + return `${this._namespace}.${this._name}`; + } + + /** Returns the service's spec */ + public service(): DuskyObjectModelsDatabaseService { + return this._service; + } + + /** Returns the service's password */ + public password(): string { + return this._password; + } + + /** Refreshes the service's model */ + public async refresh() { + await Promise.all([ + this._databaseRouter.getDuskyDatabaseService(this._namespace, this._name).then(response => { + this._service = response.body; + }), + this._databaseRouter.getDuskyPassword(this._namespace, this._name).then(async response => { + this._password = response.body; + }) + ]); + } + + /** + * Updates the service + * @param func A function of modifications to apply to the service + */ + public async update(func: (service: DuskyObjectModelsDatabaseService) => void): Promise { + // Get the latest spec of the service in case it has changed + const service = (await this._databaseRouter.getDuskyDatabaseService(this._namespace, this._name)).body; + service.status = undefined; // can't update the status + func(service); + + return await this._databaseRouter.updateDuskyDatabaseService(this.namespace(), this.name(), service).then(r => { + this._service = r.body; + return this._service; + }); + } + + /** Deletes the service */ + public async delete(): Promise { + return (await this._databaseRouter.deleteDuskyDatabaseService(this._namespace, this._name)).body; + } + + /** Creates a SQL database in the service */ + public async createDatabase(db: DuskyObjectModelsDatabase): Promise { + return await (await this._databaseRouter.createDuskyDatabase(this.namespace(), this.name(), db)).body; + } + + /** Returns the number of nodes in the service */ + public numNodes(): number { + let nodes = this._service.spec.scale?.shards ?? 1; + if (nodes > 1) { nodes++; } // for multiple shards there is an additional node for the coordinator + return nodes; + } + + /** + * Returns the IP address and port of the service, preferring external IP over + * internal IP. If either field is not available it will be set to undefined. + */ + public endpoint(): { ip?: string, port?: number } { + const externalIp = this._service.status?.externalIP; + const internalIp = this._service.status?.internalIP; + const externalPort = this._service.status?.externalPort; + const internalPort = this._service.status?.internalPort; + + return externalIp ? { ip: externalIp, port: externalPort ?? undefined } + : internalIp ? { ip: internalIp, port: internalPort ?? undefined } + : { ip: undefined, port: undefined }; + } + + /** Returns the service's configuration e.g. '3 nodes, 1.5 vCores, 1GiB RAM, 2GiB storage per node' */ + public configuration(): string { + const nodes = this.numNodes(); + const cpuLimit = this._service.spec.scheduling?.resources?.limits?.['cpu']; + const ramLimit = this._service.spec.scheduling?.resources?.limits?.['memory']; + const cpuRequest = this._service.spec.scheduling?.resources?.requests?.['cpu']; + const ramRequest = this._service.spec.scheduling?.resources?.requests?.['memory']; + const storage = this._service.spec.storage.volumeSize; + + // Prefer limits if they're provided, otherwise use requests if they're provided + let nodeConfiguration = `${nodes} ${nodes > 1 ? loc.nodes : loc.node}`; + if (cpuLimit) { + nodeConfiguration += `, ${this.formatCores(cpuLimit)} ${loc.vCores}`; + } else if (cpuRequest) { + nodeConfiguration += `, ${this.formatCores(cpuRequest)} ${loc.vCores}`; + } + if (ramLimit) { + nodeConfiguration += `, ${this.formatMemory(ramLimit)} ${loc.ram}`; + } else if (ramRequest) { + nodeConfiguration += `, ${this.formatMemory(ramRequest)} ${loc.ram}`; + } + if (storage) { nodeConfiguration += `, ${storage} ${loc.storagePerNode}`; } + return nodeConfiguration; + } + + /** + * Converts millicores to cores (600m -> 0.6 cores) + * https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-cpu + * @param cores The millicores to format e.g. 600m + */ + private formatCores(cores: string): number { + return cores?.endsWith('m') ? +cores.slice(0, -1) / 1000 : +cores; + } + + /** + * Formats the memory to end with 'B' e.g: + * 1 -> 1B + * 1K -> 1KB, 1Ki -> 1KiB + * 1M -> 1MB, 1Mi -> 1MiB + * 1G -> 1GB, 1Gi -> 1GiB + * 1T -> 1TB, 1Ti -> 1TiB + * https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-memory + * @param memory The amount + unit of memory to format e.g. 1K + */ + private formatMemory(memory: string): string { + return memory && !memory.endsWith('B') ? `${memory}B` : memory; + } +} diff --git a/extensions/arc/src/typings/refs.d.ts b/extensions/arc/src/typings/refs.d.ts new file mode 100644 index 0000000000..dad0d96412 --- /dev/null +++ b/extensions/arc/src/typings/refs.d.ts @@ -0,0 +1,8 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +/// +/// +/// diff --git a/extensions/arc/src/ui/components/dashboard.ts b/extensions/arc/src/ui/components/dashboard.ts new file mode 100644 index 0000000000..4cacfeb6dd --- /dev/null +++ b/extensions/arc/src/ui/components/dashboard.ts @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as azdata from 'azdata'; + +export abstract class Dashboard { + + private dashboard!: azdata.window.ModelViewDashboard; + + constructor(protected title: string) { } + + public async showDashboard(): Promise { + this.dashboard = this.createDashboard(); + await this.dashboard.open(); + } + + protected createDashboard(): azdata.window.ModelViewDashboard { + const dashboard = azdata.window.createModelViewDashboard(this.title); + dashboard.registerTabs(async modelView => { + return await this.registerTabs(modelView); + }); + return dashboard; + } + + protected abstract async registerTabs(modelView: azdata.ModelView): Promise<(azdata.DashboardTab | azdata.DashboardTabGroup)[]>; +} diff --git a/extensions/arc/src/ui/components/dashboardPage.ts b/extensions/arc/src/ui/components/dashboardPage.ts new file mode 100644 index 0000000000..64a58fd9ce --- /dev/null +++ b/extensions/arc/src/ui/components/dashboardPage.ts @@ -0,0 +1,32 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as azdata from 'azdata'; +import { InitializingComponent } from './initializingComponent'; + +export abstract class DashboardPage extends InitializingComponent { + + constructor(protected modelView: azdata.ModelView) { + super(); + } + + public get tab(): azdata.DashboardTab { + return { + title: this.title, + id: this.id, + icon: this.icon, + content: this.container, + toolbar: this.toolbarContainer + }; + } + + protected abstract get title(): string; + protected abstract get id(): string; + protected abstract get icon(): { dark: string; light: string; }; + protected abstract get container(): azdata.Component; + protected abstract get toolbarContainer(): azdata.ToolbarContainer; + +} + diff --git a/extensions/arc/src/ui/components/initializingComponent.ts b/extensions/arc/src/ui/components/initializingComponent.ts new file mode 100644 index 0000000000..c8db964f5d --- /dev/null +++ b/extensions/arc/src/ui/components/initializingComponent.ts @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { Deferred } from '../../common/promise'; + +export abstract class InitializingComponent { + + private _initialized: boolean = false; + + private onInitializedPromise: Deferred = new Deferred(); + + constructor() { } + + protected get initialized(): boolean { + return this._initialized; + } + + protected set initialized(value: boolean) { + if (!this._initialized && value) { + this._initialized = true; + this.onInitializedPromise.resolve(); + } + } + + /** + * Runs the specified action when the component is initialized. If already initialized just runs + * the action immediately. + * @param action The action to be ran when the page is initialized + */ + protected eventuallyRunOnInitialized(action: () => void): void { + if (!this._initialized) { + this.onInitializedPromise.promise.then(() => action()).catch(error => console.error(`Unexpected error running onInitialized action: ${error}`)); + } else { + action(); + } + } +} + diff --git a/extensions/arc/src/ui/components/keyValueContainer.ts b/extensions/arc/src/ui/components/keyValueContainer.ts new file mode 100644 index 0000000000..33142c5ae0 --- /dev/null +++ b/extensions/arc/src/ui/components/keyValueContainer.ts @@ -0,0 +1,96 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; +import * as azdata from 'azdata'; +import * as loc from '../../localizedConstants'; +import { IconPathHelper, cssStyles } from '../../constants'; + +/** A container with a single vertical column of KeyValue pairs */ +export class KeyValueContainer { + public container: azdata.DivContainer; + + constructor(private modelBuilder: azdata.ModelBuilder, pairs: KeyValue[]) { + this.container = modelBuilder.divContainer().component(); + this.refresh(pairs); + } + + public refresh(pairs: KeyValue[]) { + this.container.clearItems(); + this.container.addItems( + pairs.map(p => p.getComponent(this.modelBuilder)), + { CSSStyles: { 'margin-bottom': '15px', 'min-height': '30px' } } + ); + } +} + +/** A key value pair in the KeyValueContainer */ +export abstract class KeyValue { + constructor(protected key: string, protected value: string) { } + + /** Returns a component representing the entire KeyValue pair */ + public getComponent(modelBuilder: azdata.ModelBuilder) { + const container = modelBuilder.flexContainer().withLayout({ flexWrap: 'wrap', alignItems: 'center' }).component(); + const key = modelBuilder.text().withProperties({ + value: this.key, + CSSStyles: { ...cssStyles.text, 'font-weight': 'bold', 'margin-block-start': '0px', 'margin-block-end': '0px' } + }).component(); + + container.addItem(key, { flex: `0 0 200px` }); + container.addItem(this.getValueComponent(modelBuilder), { flex: '1 1 250px' }); + return container; + } + + /** Returns a component representing the value of the KeyValue pair */ + protected abstract getValueComponent(modelBuilder: azdata.ModelBuilder): azdata.Component; +} + +/** Implementation of KeyValue where the value is text */ +export class TextKeyValue extends KeyValue { + getValueComponent(modelBuilder: azdata.ModelBuilder): azdata.Component { + return modelBuilder.text().withProperties({ + value: this.value, + CSSStyles: { ...cssStyles.text, 'margin-block-start': '0px', 'margin-block-end': '0px' } + }).component(); + } +} + +/** Implementation of KeyValue where the value is a readonly copyable input field */ +export class InputKeyValue extends KeyValue { + getValueComponent(modelBuilder: azdata.ModelBuilder): azdata.Component { + const container = modelBuilder.flexContainer().withLayout({ alignItems: 'center' }).component(); + container.addItem(modelBuilder.inputBox().withProperties({ + value: this.value // TODO: Add a readOnly property to input boxes + }).component()); + + const copy = modelBuilder.button().withProperties({ + iconPath: IconPathHelper.copy, width: '17px', height: '17px' + }).component(); + + copy.onDidClick(async () => { + vscode.env.clipboard.writeText(this.value); + vscode.window.showInformationMessage(loc.copiedToClipboard(this.key)); + }); + + container.addItem(copy, { CSSStyles: { 'margin-left': '10px' } }); + return container; + } +} + +/** Implementation of KeyValue where the value is a clickable link */ +export class LinkKeyValue extends KeyValue { + constructor(key: string, value: string, private onClick: (e: any) => any) { + super(key, value); + } + + getValueComponent(modelBuilder: azdata.ModelBuilder): azdata.Component { + const link = modelBuilder.hyperlink().withProperties({ + label: this.value, url: '' + }).component(); + + link.onDidClick(this.onClick); + return link; + } +} diff --git a/extensions/arc/src/ui/dashboards/postgres/postgresBackupPage.ts b/extensions/arc/src/ui/dashboards/postgres/postgresBackupPage.ts new file mode 100644 index 0000000000..966821035a --- /dev/null +++ b/extensions/arc/src/ui/dashboards/postgres/postgresBackupPage.ts @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as azdata from 'azdata'; +import * as loc from '../../../localizedConstants'; +import { IconPathHelper } from '../../../constants'; +import { PostgresDashboardPage } from './postgresDashboardPage'; + +export class PostgresBackupPage extends PostgresDashboardPage { + protected get title(): string { + return loc.backup; + } + + protected get id(): string { + return 'postgres-backup'; + } + + protected get icon(): { dark: string; light: string; } { + return IconPathHelper.backup; + } + + protected get container(): azdata.Component { + return this.modelView.modelBuilder.text().withProperties({ value: loc.backup }).component(); + } + + protected get toolbarContainer(): azdata.ToolbarContainer { + return this.modelView.modelBuilder.toolbarContainer().component(); + } +} diff --git a/extensions/arc/src/ui/dashboards/postgres/postgresComputeStoragePage.ts b/extensions/arc/src/ui/dashboards/postgres/postgresComputeStoragePage.ts new file mode 100644 index 0000000000..539c5dc14a --- /dev/null +++ b/extensions/arc/src/ui/dashboards/postgres/postgresComputeStoragePage.ts @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as azdata from 'azdata'; +import * as loc from '../../../localizedConstants'; +import { IconPathHelper } from '../../../constants'; +import { PostgresDashboardPage } from './postgresDashboardPage'; + +export class PostgresComputeStoragePage extends PostgresDashboardPage { + protected get title(): string { + return loc.computeAndStorage; + } + + protected get id(): string { + return 'postgres-compute-storage'; + } + + protected get icon(): { dark: string; light: string; } { + return IconPathHelper.computeStorage; + } + + protected get container(): azdata.Component { + return this.modelView.modelBuilder.text().withProperties({ value: loc.computeAndStorage }).component(); + } + + protected get toolbarContainer(): azdata.ToolbarContainer { + return this.modelView.modelBuilder.toolbarContainer().component(); + } +} diff --git a/extensions/arc/src/ui/dashboards/postgres/postgresConnectionStringsPage.ts b/extensions/arc/src/ui/dashboards/postgres/postgresConnectionStringsPage.ts new file mode 100644 index 0000000000..b0694548e5 --- /dev/null +++ b/extensions/arc/src/ui/dashboards/postgres/postgresConnectionStringsPage.ts @@ -0,0 +1,72 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as azdata from 'azdata'; +import * as loc from '../../../localizedConstants'; +import { IconPathHelper, cssStyles } from '../../../constants'; +import { PostgresDashboardPage } from './postgresDashboardPage'; +import { KeyValueContainer, KeyValue, InputKeyValue } from '../../components/keyValueContainer'; + +export class PostgresConnectionStringsPage extends PostgresDashboardPage { + protected get title(): string { + return loc.connectionStrings; + } + + protected get id(): string { + return 'postgres-connection-strings'; + } + + protected get icon(): { dark: string; light: string; } { + return IconPathHelper.connection; + } + + protected get container(): azdata.Component { + const root = this.modelView.modelBuilder.divContainer().component(); + const content = this.modelView.modelBuilder.divContainer().component(); + root.addItem(content, { CSSStyles: { 'margin': '20px' } }); + + content.addItem(this.modelView.modelBuilder.text().withProperties({ + value: loc.connectionStrings, + CSSStyles: { ...cssStyles.title } + }).component()); + + const info = this.modelView.modelBuilder.text().withProperties({ + value: `${loc.selectConnectionString}. `, + CSSStyles: { ...cssStyles.text, 'margin-block-start': '0px', 'margin-block-end': '0px' } + }).component(); + + const link = this.modelView.modelBuilder.hyperlink().withProperties({ + label: loc.learnAboutPostgresClients, + url: 'http://example.com', // TODO link to documentation + }).component(); + + content.addItem( + this.modelView.modelBuilder.flexContainer().withItems([info, link]).withLayout({ flexWrap: 'wrap' }).component(), + { CSSStyles: { display: 'inline-flex', 'margin-bottom': '25px' } }); + + const endpoint: { ip?: string, port?: number } = this.databaseModel.endpoint(); + const password = this.databaseModel.password(); + + const pairs: KeyValue[] = [ + new InputKeyValue('ADO.NET', `Server=${endpoint.ip};Database=postgres;Port=${endpoint.port};User Id=postgres;Password=${password};Ssl Mode=Require;`), + new InputKeyValue('C++ (libpq)', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password=${password} sslmode=require`), + new InputKeyValue('JDBC', `jdbc:postgresql://${endpoint.ip}:${endpoint.port}/postgres?user=postgres&password=${password}&sslmode=require`), + new InputKeyValue('Node.js', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password=${password} sslmode=require`), + new InputKeyValue('PHP', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password=${password} sslmode=require`), + new InputKeyValue('psql', `psql "host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password=${password} sslmode=require`), + new InputKeyValue('Python', `dbname='postgres' user='postgres' host='${endpoint.ip}' password='${password}' port='${endpoint.port}' sslmode='true'`), + new InputKeyValue('Ruby', `host=${endpoint.ip}; dbname=postgres user=postgres password=${password} port=${endpoint.port} sslmode=require`), + new InputKeyValue('Web App', `Database=postgres; Data Source=${endpoint.ip}; User Id=postgres; Password=${password}`) + ]; + + const keyValueContainer = new KeyValueContainer(this.modelView.modelBuilder, pairs); + content.addItem(keyValueContainer.container); + return root; + } + + protected get toolbarContainer(): azdata.ToolbarContainer { + return this.modelView.modelBuilder.toolbarContainer().component(); + } +} diff --git a/extensions/arc/src/ui/dashboards/postgres/postgresDashboard.ts b/extensions/arc/src/ui/dashboards/postgres/postgresDashboard.ts new file mode 100644 index 0000000000..3b311233aa --- /dev/null +++ b/extensions/arc/src/ui/dashboards/postgres/postgresDashboard.ts @@ -0,0 +1,51 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as azdata from 'azdata'; +import * as loc from '../../../localizedConstants'; +import { ControllerModel } from '../../../models/controllerModel'; +import { PostgresModel } from '../../../models/postgresModel'; +import { PostgresOverviewPage } from './postgresOverviewPage'; +import { PostgresComputeStoragePage } from './postgresComputeStoragePage'; +import { PostgresConnectionStringsPage } from './postgresConnectionStringsPage'; +import { PostgresBackupPage } from './postgresBackupPage'; +import { PostgresPropertiesPage } from './postgresPropertiesPage'; +import { PostgresNetworkingPage } from './postgresNetworkingPage'; +import { Dashboard } from '../../components/dashboard'; + +export class PostgresDashboard extends Dashboard { + constructor(title: string, private _controllerModel: ControllerModel, private _databaseModel: PostgresModel) { + super(title); + } + + protected async registerTabs(modelView: azdata.ModelView): Promise<(azdata.DashboardTab | azdata.DashboardTabGroup)[]> { + await Promise.all([this._controllerModel.refresh(), this._databaseModel.refresh()]); + + const overviewPage = new PostgresOverviewPage(modelView, this._controllerModel, this._databaseModel); + const computeStoragePage = new PostgresComputeStoragePage(modelView, this._controllerModel, this._databaseModel); + const connectionStringsPage = new PostgresConnectionStringsPage(modelView, this._controllerModel, this._databaseModel); + const backupPage = new PostgresBackupPage(modelView, this._controllerModel, this._databaseModel); + const propertiesPage = new PostgresPropertiesPage(modelView, this._controllerModel, this._databaseModel); + const networkingPage = new PostgresNetworkingPage(modelView, this._controllerModel, this._databaseModel); + + return [ + overviewPage.tab, + { + title: loc.settings, + tabs: [ + computeStoragePage.tab, + connectionStringsPage.tab, + backupPage.tab, + propertiesPage.tab + ] + }, { + title: loc.security, + tabs: [ + networkingPage.tab + ] + } + ]; + } +} diff --git a/extensions/arc/src/ui/dashboards/postgres/postgresDashboardPage.ts b/extensions/arc/src/ui/dashboards/postgres/postgresDashboardPage.ts new file mode 100644 index 0000000000..f3664ee33a --- /dev/null +++ b/extensions/arc/src/ui/dashboards/postgres/postgresDashboardPage.ts @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as azdata from 'azdata'; +import { ControllerModel } from '../../../models/controllerModel'; +import { PostgresModel } from '../../../models/postgresModel'; +import { DashboardPage } from '../../components/dashboardPage'; + +export abstract class PostgresDashboardPage extends DashboardPage { + constructor(protected modelView: azdata.ModelView, protected controllerModel: ControllerModel, protected databaseModel: PostgresModel) { + super(modelView); + } +} diff --git a/extensions/arc/src/ui/dashboards/postgres/postgresNetworkingPage.ts b/extensions/arc/src/ui/dashboards/postgres/postgresNetworkingPage.ts new file mode 100644 index 0000000000..6062d150da --- /dev/null +++ b/extensions/arc/src/ui/dashboards/postgres/postgresNetworkingPage.ts @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as azdata from 'azdata'; +import * as loc from '../../../localizedConstants'; +import { IconPathHelper } from '../../../constants'; +import { PostgresDashboardPage } from './postgresDashboardPage'; + +export class PostgresNetworkingPage extends PostgresDashboardPage { + protected get title(): string { + return loc.networking; + } + + protected get id(): string { + return 'postgres-networking'; + } + + protected get icon(): { dark: string; light: string; } { + return IconPathHelper.networking; + } + + protected get container(): azdata.Component { + return this.modelView.modelBuilder.text().withProperties({ value: loc.networking }).component(); + } + + protected get toolbarContainer(): azdata.ToolbarContainer { + return this.modelView.modelBuilder.toolbarContainer().component(); + } +} diff --git a/extensions/arc/src/ui/dashboards/postgres/postgresOverviewPage.ts b/extensions/arc/src/ui/dashboards/postgres/postgresOverviewPage.ts new file mode 100644 index 0000000000..c6c3bfa712 --- /dev/null +++ b/extensions/arc/src/ui/dashboards/postgres/postgresOverviewPage.ts @@ -0,0 +1,233 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; +import * as azdata from 'azdata'; +import * as loc from '../../../localizedConstants'; +import { IconPathHelper, cssStyles } from '../../../constants'; +import { DuskyObjectModelsDatabase, DuskyObjectModelsDatabaseServiceArcPayload } from '../../../controller/generated/dusky/api'; +import { PostgresDashboardPage } from './postgresDashboardPage'; + +export class PostgresOverviewPage extends PostgresDashboardPage { + protected get title(): string { + return loc.overview; + } + + protected get id(): string { + return 'postgres-overview'; + } + + protected get icon(): { dark: string; light: string; } { + return IconPathHelper.postgres; + } + + protected get container(): azdata.Component { + const root = this.modelView.modelBuilder.divContainer().component(); + const content = this.modelView.modelBuilder.divContainer().component(); + root.addItem(content, { CSSStyles: { 'margin': '10px 20px 0px 20px' } }); + + const registration = this.controllerModel.registration('postgresInstances', this.databaseModel.namespace(), this.databaseModel.name()); + const endpoint: { ip?: string, port?: number } = this.databaseModel.endpoint(); + const essentials = this.modelView.modelBuilder.propertiesContainer().withProperties({ + propertyItems: [ + { displayName: loc.name, value: this.databaseModel.name() }, + { displayName: loc.serverGroupType, value: loc.postgresArcProductName }, + { displayName: loc.resourceGroup, value: registration?.resourceGroupName ?? 'None' }, + { displayName: loc.coordinatorEndpoint, value: `postgresql://postgres:${this.databaseModel.password()}@${endpoint.ip}:${endpoint.port}` }, + { displayName: loc.status, value: this.databaseModel.service().status?.state ?? '' }, + { displayName: loc.postgresAdminUsername, value: 'postgres' }, + { displayName: loc.dataController, value: this.controllerModel.namespace() }, + { displayName: loc.nodeConfiguration, value: this.databaseModel.configuration() }, + { displayName: loc.subscriptionId, value: registration?.subscriptionId ?? 'None' }, + { displayName: loc.postgresVersion, value: this.databaseModel.service().spec.engine.version?.toString() ?? '' } + ] + }).component(); + content.addItem(essentials, { CSSStyles: cssStyles.text }); + + // Service endpoints + const titleCSS = { ...cssStyles.title, 'margin-block-start': '2em', 'margin-block-end': '0' }; + content.addItem(this.modelView.modelBuilder.text().withProperties({ value: loc.serviceEndpoints, CSSStyles: titleCSS }).component()); + + const kibanaQuery = `kubernetes_namespace:"${this.databaseModel.namespace()}" and cluster_name:"${this.databaseModel.name()}"`; + const kibanaUrl = `${this.controllerModel.endpoint('logsui')?.endpoint}/app/kibana#/discover?_a=(query:(language:kuery,query:'${kibanaQuery}'))`; + const grafanaUrl = `${this.controllerModel.endpoint('metricsui')?.endpoint}/d/postgres-metrics?var-Namespace=${this.databaseModel.namespace()}&var-Name=${this.databaseModel.name()}`; + + const kibanaLink = this.modelView.modelBuilder.hyperlink().withProperties({ label: kibanaUrl, url: kibanaUrl, }).component(); + const grafanaLink = this.modelView.modelBuilder.hyperlink().withProperties({ label: grafanaUrl, url: grafanaUrl }).component(); + + const endpointsTable = this.modelView.modelBuilder.declarativeTable().withProperties({ + width: '100%', + columns: [ + { + displayName: loc.name, + valueType: azdata.DeclarativeDataType.string, + isReadOnly: true, + width: '20%', + headerCssStyles: cssStyles.tableHeader, + rowCssStyles: cssStyles.tableRow + }, + { + displayName: loc.endpoint, + valueType: azdata.DeclarativeDataType.component, + isReadOnly: true, + width: '50%', + headerCssStyles: cssStyles.tableHeader, + rowCssStyles: { + ...cssStyles.tableRow, + 'overflow': 'hidden', + 'text-overflow': 'ellipsis', + 'white-space': 'nowrap', + 'max-width': '0' + } + }, + { + displayName: loc.description, + valueType: azdata.DeclarativeDataType.string, + isReadOnly: true, + width: '30%', + headerCssStyles: cssStyles.tableHeader, + rowCssStyles: cssStyles.tableRow + } + ], + data: [ + [loc.kibanaDashboard, kibanaLink, loc.kibanaDashboardDescription], + [loc.grafanaDashboard, grafanaLink, loc.grafanaDashboardDescription]] + }).component(); + content.addItem(endpointsTable); + + // Server group nodes + content.addItem(this.modelView.modelBuilder.text().withProperties({ value: loc.serverGroupNodes, CSSStyles: titleCSS }).component()); + const nodesTable = this.modelView.modelBuilder.declarativeTable().withProperties({ + width: '100%', + columns: [ + { + displayName: loc.name, + valueType: azdata.DeclarativeDataType.string, + isReadOnly: true, + width: '30%', + headerCssStyles: cssStyles.tableHeader, + rowCssStyles: cssStyles.tableRow + }, + { + displayName: loc.type, + valueType: azdata.DeclarativeDataType.string, + isReadOnly: true, + width: '25%', + headerCssStyles: cssStyles.tableHeader, + rowCssStyles: cssStyles.tableRow + }, + { + displayName: loc.fullyQualifiedDomain, + valueType: azdata.DeclarativeDataType.string, + isReadOnly: true, + width: '45%', + headerCssStyles: cssStyles.tableHeader, + rowCssStyles: cssStyles.tableRow + } + ], + data: [] + }).component(); + + const nodes = this.databaseModel.numNodes(); + for (let i = 0; i < nodes; i++) { + nodesTable.data.push([ + `${this.databaseModel.name()}-${i}`, + i === 0 ? loc.coordinatorEndpoint : loc.worker, + i === 0 ? `${endpoint.ip}:${endpoint.port}` : `${this.databaseModel.name()}-${i}.${this.databaseModel.name()}-svc.${this.databaseModel.namespace()}.svc.cluster.local`]); + } + + content.addItem(nodesTable, { CSSStyles: { 'margin-bottom': '20px' } }); + return root; + } + + protected get toolbarContainer(): azdata.ToolbarContainer { + // New database + const newDatabaseButton = this.modelView.modelBuilder.button().withProperties({ + label: loc.newDatabase, + iconPath: IconPathHelper.add + }).component(); + + newDatabaseButton.onDidClick(async () => { + const name = await vscode.window.showInputBox({ prompt: loc.databaseName }); + if (name === undefined) { return; } + const db: DuskyObjectModelsDatabase = { name: name }; // TODO support other options (sharded, owner) + try { + await this.databaseModel.createDatabase(db); + vscode.window.showInformationMessage(loc.databaseCreated(db.name)); + } catch (error) { + vscode.window.showErrorMessage(loc.databaseCreationFailed(db.name, error)); + } + }); + + // Reset password + const resetPasswordButton = this.modelView.modelBuilder.button().withProperties({ + label: loc.resetPassword, + iconPath: IconPathHelper.edit + }).component(); + + resetPasswordButton.onDidClick(async () => { + const password = await vscode.window.showInputBox({ prompt: loc.newPassword, password: true }); + if (password === undefined) { return; } + try { + await this.databaseModel.update(s => { + s.arc = s.arc ?? new DuskyObjectModelsDatabaseServiceArcPayload(); + s.arc.servicePassword = password; + }); + vscode.window.showInformationMessage(loc.passwordReset(this.databaseModel.fullName())); + } catch (error) { + vscode.window.showErrorMessage(loc.passwordResetFailed(this.databaseModel.fullName(), error)); + } + }); + + // Delete service + const deleteButton = this.modelView.modelBuilder.button().withProperties({ + label: loc.deleteText, + iconPath: IconPathHelper.delete + }).component(); + + deleteButton.onDidClick(async () => { + const response = await vscode.window.showQuickPick([loc.yes, loc.no], { + placeHolder: loc.deleteServicePrompt(this.databaseModel.fullName()) + }); + if (response !== loc.yes) { return; } + try { + await this.databaseModel.delete(); + vscode.window.showInformationMessage(loc.serviceDeleted(this.databaseModel.fullName())); + } catch (error) { + vscode.window.showErrorMessage(loc.serviceDeletionFailed(this.databaseModel.fullName(), error)); + } + }); + + // Open in Azure portal + const openInAzurePortalButton = this.modelView.modelBuilder.button().withProperties({ + label: loc.openInAzurePortal, + iconPath: IconPathHelper.openInTab + }).component(); + + openInAzurePortalButton.onDidClick(async () => { + const r = this.controllerModel.registration('postgresInstances', this.databaseModel.namespace(), this.databaseModel.name()); + if (r === undefined) { + vscode.window.showErrorMessage(loc.couldNotFindAzureResource(this.databaseModel.fullName())); + } else { + vscode.env.openExternal(vscode.Uri.parse( + `https://portal.azure.com/#resource/subscriptions/${r.subscriptionId}/resourceGroups/${r.resourceGroupName}/providers/Microsoft.AzureData/postgresInstances/${r.instanceName}`)); + } + }); + + // TODO implement click + const feedbackButton = this.modelView.modelBuilder.button().withProperties({ + label: loc.feedback, + iconPath: IconPathHelper.heart + }).component(); + + return this.modelView.modelBuilder.toolbarContainer().withToolbarItems([ + { component: newDatabaseButton }, + { component: resetPasswordButton }, + { component: deleteButton, toolbarSeparatorAfter: true }, + { component: openInAzurePortalButton }, + { component: feedbackButton } + ]).component(); + } +} diff --git a/extensions/arc/src/ui/dashboards/postgres/postgresPropertiesPage.ts b/extensions/arc/src/ui/dashboards/postgres/postgresPropertiesPage.ts new file mode 100644 index 0000000000..4a44636e7f --- /dev/null +++ b/extensions/arc/src/ui/dashboards/postgres/postgresPropertiesPage.ts @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as vscode from 'vscode'; +import * as azdata from 'azdata'; +import * as loc from '../../../localizedConstants'; +import { IconPathHelper, cssStyles } from '../../../constants'; +import { PostgresDashboardPage } from './postgresDashboardPage'; +import { KeyValueContainer, KeyValue, InputKeyValue, LinkKeyValue, TextKeyValue } from '../../components/keyValueContainer'; + + +export class PostgresPropertiesPage extends PostgresDashboardPage { + protected get title(): string { + return loc.properties; + } + + protected get id(): string { + return 'postgres-properties'; + } + + protected get icon(): { dark: string; light: string; } { + return IconPathHelper.properties; + } + + protected get container(): azdata.Component { + const root = this.modelView.modelBuilder.divContainer().component(); + const content = this.modelView.modelBuilder.divContainer().component(); + root.addItem(content, { CSSStyles: { 'margin': '20px' } }); + + content.addItem(this.modelView.modelBuilder.text().withProperties({ + value: loc.properties, + CSSStyles: { ...cssStyles.title, 'margin-bottom': '25px' } + }).component()); + + const endpoint: { ip?: string, port?: number } = this.databaseModel.endpoint(); + const connectionString = `postgresql://postgres:${this.databaseModel.password()}@${endpoint.ip}:${endpoint.port}`; + const registration = this.controllerModel.registration('postgresInstances', this.databaseModel.namespace(), this.databaseModel.name()); + + const pairs: KeyValue[] = [ + new InputKeyValue(loc.coordinatorEndpoint, connectionString), + new InputKeyValue(loc.postgresAdminUsername, 'postgres'), + new TextKeyValue(loc.status, this.databaseModel.service().status?.state ?? 'Unknown'), + new LinkKeyValue(loc.dataController, this.controllerModel.namespace(), _ => vscode.window.showInformationMessage('goto data controller')), + new LinkKeyValue(loc.nodeConfiguration, this.databaseModel.configuration(), _ => vscode.window.showInformationMessage('goto configuration')), + new TextKeyValue(loc.postgresVersion, this.databaseModel.service().spec.engine.version?.toString() ?? ''), + new TextKeyValue(loc.resourceGroup, registration?.resourceGroupName ?? ''), + new TextKeyValue(loc.subscriptionId, registration?.subscriptionId ?? '') + ]; + + const keyValueContainer = new KeyValueContainer(this.modelView.modelBuilder, pairs); + content.addItem(keyValueContainer.container); + return root; + } + + protected get toolbarContainer(): azdata.ToolbarContainer { + return this.modelView.modelBuilder.toolbarContainer().component(); + } +} diff --git a/extensions/arc/tsconfig.json b/extensions/arc/tsconfig.json new file mode 100644 index 0000000000..2c6d7abf5b --- /dev/null +++ b/extensions/arc/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../shared.tsconfig.json", + "compileOnSave": true, + "compilerOptions": { + "outDir": "./out", + "lib": [ + "es6", + "es2015.promise" + ] + }, + "include": [ + "src/**/*" + ] +} diff --git a/extensions/arc/yarn.lock b/extensions/arc/yarn.lock new file mode 100644 index 0000000000..e41762cbe3 --- /dev/null +++ b/extensions/arc/yarn.lock @@ -0,0 +1,360 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@types/caseless@*": + version "0.12.2" + resolved "https://registry.yarnpkg.com/@types/caseless/-/caseless-0.12.2.tgz#f65d3d6389e01eeb458bd54dc8f52b95a9463bc8" + integrity sha512-6ckxMjBBD8URvjB6J3NcnuAn5Pkl7t3TizAg+xdlzzQGSPSmBcXf8KoIH0ua/i+tio+ZRUHEXp0HEmvaR4kt0w== + +"@types/node@*": + version "13.11.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-13.11.1.tgz#49a2a83df9d26daacead30d0ccc8762b128d53c7" + integrity sha512-eWQGP3qtxwL8FGneRrC5DwrJLGN4/dH1clNTuLfN81HCrxVtxRjygDTUoZJ5ASlDEeo0ppYFQjQIlXhtXpOn6g== + +"@types/request@^2.48.3": + version "2.48.4" + resolved "https://registry.yarnpkg.com/@types/request/-/request-2.48.4.tgz#df3d43d7b9ed3550feaa1286c6eabf0738e6cf7e" + integrity sha512-W1t1MTKYR8PxICH+A4HgEIPuAC3sbljoEVfyZbeFJJDbr30guDspJri2XOaM2E+Un7ZjrihaDi7cf6fPa2tbgw== + dependencies: + "@types/caseless" "*" + "@types/node" "*" + "@types/tough-cookie" "*" + form-data "^2.5.0" + +"@types/tough-cookie@*": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.0.tgz#fef1904e4668b6e5ecee60c52cc6a078ffa6697d" + integrity sha512-I99sngh224D0M7XgW1s120zxCt3VYQ3IQsuw3P3jbq5GG4yc79+ZjyKznyOGIQrflfylLgcfekeZW/vk0yng6A== + +ajv@^6.5.5: + version "6.12.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.0.tgz#06d60b96d87b8454a5adaba86e7854da629db4b7" + integrity sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +asn1@~0.2.3: + version "0.2.4" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" + integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== + dependencies: + safer-buffer "~2.1.0" + +assert-plus@1.0.0, assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= + +aws-sign2@~0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" + integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= + +aws4@^1.8.0: + version "1.9.1" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.9.1.tgz#7e33d8f7d449b3f673cd72deb9abdc552dbe528e" + integrity sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug== + +bcrypt-pbkdf@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" + integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= + dependencies: + tweetnacl "^0.14.3" + +caseless@~0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" + integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= + +combined-stream@^1.0.6, combined-stream@~1.0.6: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +core-util-is@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= + dependencies: + assert-plus "^1.0.0" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= + +ecc-jsbn@~0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" + integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= + dependencies: + jsbn "~0.1.0" + safer-buffer "^2.1.0" + +extend@~3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" + integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== + +extsprintf@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" + integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= + +extsprintf@^1.2.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= + +fast-deep-equal@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4" + integrity sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA== + +fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= + +form-data@^2.5.0: + version "2.5.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.5.1.tgz#f2cbec57b5e59e23716e128fe44d4e5dd23895f4" + integrity sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.6" + mime-types "^2.1.12" + +form-data@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" + integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.6" + mime-types "^2.1.12" + +getpass@^0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" + integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= + dependencies: + assert-plus "^1.0.0" + +har-schema@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" + integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= + +har-validator@~5.1.3: + version "5.1.3" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" + integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== + dependencies: + ajv "^6.5.5" + har-schema "^2.0.0" + +http-signature@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" + integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= + dependencies: + assert-plus "^1.0.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= + +jsbn@~0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" + integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-schema@0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= + +json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= + +jsprim@^1.2.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" + integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= + dependencies: + assert-plus "1.0.0" + extsprintf "1.3.0" + json-schema "0.2.3" + verror "1.10.0" + +mime-db@1.43.0: + version "1.43.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.43.0.tgz#0a12e0502650e473d735535050e7c8f4eb4fae58" + integrity sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ== + +mime-types@^2.1.12, mime-types@~2.1.19: + version "2.1.26" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.26.tgz#9c921fc09b7e149a65dfdc0da4d20997200b0a06" + integrity sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ== + dependencies: + mime-db "1.43.0" + +oauth-sign@~0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" + integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== + +performance-now@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= + +psl@^1.1.28: + version "1.8.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" + integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== + +punycode@^2.1.0, punycode@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +qs@~6.5.2: + version "6.5.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" + integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== + +request@^2.88.0: + version "2.88.2" + resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" + integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + har-validator "~5.1.3" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + oauth-sign "~0.9.0" + performance-now "^2.1.0" + qs "~6.5.2" + safe-buffer "^5.1.2" + tough-cookie "~2.5.0" + tunnel-agent "^0.6.0" + uuid "^3.3.2" + +safe-buffer@^5.0.1, safe-buffer@^5.1.2: + version "5.2.0" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== + +safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +sshpk@^1.7.0: + version "1.16.1" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" + integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + bcrypt-pbkdf "^1.0.0" + dashdash "^1.12.0" + ecc-jsbn "~0.1.1" + getpass "^0.1.1" + jsbn "~0.1.0" + safer-buffer "^2.0.2" + tweetnacl "~0.14.0" + +tough-cookie@~2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" + integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== + dependencies: + psl "^1.1.28" + punycode "^2.1.1" + +tunnel-agent@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" + integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= + dependencies: + safe-buffer "^5.0.1" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= + +uri-js@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" + integrity sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ== + dependencies: + punycode "^2.1.0" + +uuid@^3.3.2: + version "3.4.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" + integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== + +verror@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" + integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= + dependencies: + assert-plus "^1.0.0" + core-util-is "1.0.2" + extsprintf "^1.2.0" + +vscode-nls@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.1.2.tgz#ca8bf8bb82a0987b32801f9fddfdd2fb9fd3c167" + integrity sha512-7bOHxPsfyuCqmP+hZXscLhiHwe7CSuFE4hyhbs22xPIhQ4jv99FcR4eBzfYYVLP356HNFpdvz63FFb/xw6T4Iw==