From 0bd0d9c3d76b4de79ba9f72ecea07a8ed974588a Mon Sep 17 00:00:00 2001 From: Robert Zhang Date: Sat, 14 Mar 2020 14:43:10 +0800 Subject: [PATCH] 1) New query parameters "state" and "health" for GET /cluster/nodes 2) New APIs: GET /cluster/nodes/stats/state and GET /cluster/nodes/stats/health --- api/default.service.ts | 79 ++++++++++++++++++++++++++++++++++----- model/models.ts | 1 + model/nodeStatOfHealth.ts | 18 +++++++++ 3 files changed, 88 insertions(+), 10 deletions(-) create mode 100644 model/nodeStatOfHealth.ts diff --git a/api/default.service.ts b/api/default.service.ts index b8fab0d..5c258cc 100644 --- a/api/default.service.ts +++ b/api/default.service.ts @@ -25,6 +25,7 @@ import { NodeAvailability } from '../model/nodeAvailability'; import { NodeGroup } from '../model/nodeGroup'; import { NodeGroupOperation } from '../model/nodeGroupOperation'; import { NodeMetric } from '../model/nodeMetric'; +import { NodeStatOfHealth } from '../model/nodeStatOfHealth'; import { NodeStatOfState } from '../model/nodeStatOfState'; import { OperationLog } from '../model/operationLog'; import { RestObject } from '../model/restObject'; @@ -1193,16 +1194,16 @@ export class DefaultService { } /** - * Get Cluster Node Stat + * Get Cluster Node Stat of Health * * @param x_ms_as_user The name of user whom you want to make request as. You must be an HPC Pack administrator or HPC Pack Job administrator to make it work. * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public getClusterNodeStat(x_ms_as_user?: string, observe?: 'body', reportProgress?: boolean): Observable; - public getClusterNodeStat(x_ms_as_user?: string, observe?: 'response', reportProgress?: boolean): Observable>; - public getClusterNodeStat(x_ms_as_user?: string, observe?: 'events', reportProgress?: boolean): Observable>; - public getClusterNodeStat(x_ms_as_user?: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + public getClusterNodeStatOfHealth(x_ms_as_user?: string, observe?: 'body', reportProgress?: boolean): Observable; + public getClusterNodeStatOfHealth(x_ms_as_user?: string, observe?: 'response', reportProgress?: boolean): Observable>; + public getClusterNodeStatOfHealth(x_ms_as_user?: string, observe?: 'events', reportProgress?: boolean): Observable>; + public getClusterNodeStatOfHealth(x_ms_as_user?: string, observe: any = 'body', reportProgress: boolean = false ): Observable { let headers = this.defaultHeaders; @@ -1230,7 +1231,55 @@ export class DefaultService { 'application/json' ]; - return this.httpClient.get(`${this.basePath}/cluster/nodes/stat`, + return this.httpClient.get(`${this.basePath}/cluster/nodes/stats/health`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); + } + + /** + * Get Cluster Node Stat of State + * + * @param x_ms_as_user The name of user whom you want to make request as. You must be an HPC Pack administrator or HPC Pack Job administrator to make it work. + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getClusterNodeStatOfState(x_ms_as_user?: string, observe?: 'body', reportProgress?: boolean): Observable; + public getClusterNodeStatOfState(x_ms_as_user?: string, observe?: 'response', reportProgress?: boolean): Observable>; + public getClusterNodeStatOfState(x_ms_as_user?: string, observe?: 'events', reportProgress?: boolean): Observable>; + public getClusterNodeStatOfState(x_ms_as_user?: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + + + let headers = this.defaultHeaders; + if (x_ms_as_user !== undefined && x_ms_as_user !== null) { + headers = headers.set('x-ms-as-user', String(x_ms_as_user)); + } + + // authentication (basic) required + if (this.configuration.username || this.configuration.password) { + headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password)); + } + + // to determine the Accept header + let httpHeaderAccepts: string[] = [ + 'application/json', + 'application/xml' + ]; + const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); + if (httpHeaderAcceptSelected != undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + + return this.httpClient.get(`${this.basePath}/cluster/nodes/stats/state`, { withCredentials: this.configuration.withCredentials, headers: headers, @@ -1247,13 +1296,17 @@ export class DefaultService { * @param names A comma-separated list of node names. * @param jobs A comma-separated list of job ids. * @param group A node group name. + * @param state Node state. + * @param health Node health. * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public getClusterNodes(x_ms_as_user?: string, names?: string, jobs?: string, group?: string, observe?: 'body', reportProgress?: boolean): Observable>; - public getClusterNodes(x_ms_as_user?: string, names?: string, jobs?: string, group?: string, observe?: 'response', reportProgress?: boolean): Observable>>; - public getClusterNodes(x_ms_as_user?: string, names?: string, jobs?: string, group?: string, observe?: 'events', reportProgress?: boolean): Observable>>; - public getClusterNodes(x_ms_as_user?: string, names?: string, jobs?: string, group?: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + public getClusterNodes(x_ms_as_user?: string, names?: string, jobs?: string, group?: string, state?: 'Unknown' | 'Provisioning' | 'Offline' | 'Starting' | 'Online' | 'Draining' | 'Rejected' | 'Removing' | 'NotDeployed' | 'Stopping', health?: 'OK' | 'Warning' | 'Error' | 'Transitional' | 'Unapproved', observe?: 'body', reportProgress?: boolean): Observable>; + public getClusterNodes(x_ms_as_user?: string, names?: string, jobs?: string, group?: string, state?: 'Unknown' | 'Provisioning' | 'Offline' | 'Starting' | 'Online' | 'Draining' | 'Rejected' | 'Removing' | 'NotDeployed' | 'Stopping', health?: 'OK' | 'Warning' | 'Error' | 'Transitional' | 'Unapproved', observe?: 'response', reportProgress?: boolean): Observable>>; + public getClusterNodes(x_ms_as_user?: string, names?: string, jobs?: string, group?: string, state?: 'Unknown' | 'Provisioning' | 'Offline' | 'Starting' | 'Online' | 'Draining' | 'Rejected' | 'Removing' | 'NotDeployed' | 'Stopping', health?: 'OK' | 'Warning' | 'Error' | 'Transitional' | 'Unapproved', observe?: 'events', reportProgress?: boolean): Observable>>; + public getClusterNodes(x_ms_as_user?: string, names?: string, jobs?: string, group?: string, state?: 'Unknown' | 'Provisioning' | 'Offline' | 'Starting' | 'Online' | 'Draining' | 'Rejected' | 'Removing' | 'NotDeployed' | 'Stopping', health?: 'OK' | 'Warning' | 'Error' | 'Transitional' | 'Unapproved', observe: any = 'body', reportProgress: boolean = false ): Observable { + + @@ -1269,6 +1322,12 @@ export class DefaultService { if (group !== undefined && group !== null) { queryParameters = queryParameters.set('group', group); } + if (state !== undefined && state !== null) { + queryParameters = queryParameters.set('state', state); + } + if (health !== undefined && health !== null) { + queryParameters = queryParameters.set('health', health); + } let headers = this.defaultHeaders; if (x_ms_as_user !== undefined && x_ms_as_user !== null) { diff --git a/model/models.ts b/model/models.ts index 1ccd987..a3934cf 100644 --- a/model/models.ts +++ b/model/models.ts @@ -9,6 +9,7 @@ export * from './nodeGroupOperation'; export * from './nodeHealth'; export * from './nodeMetric'; export * from './nodeServiceRole'; +export * from './nodeStatOfHealth'; export * from './nodeStatOfState'; export * from './nodeState'; export * from './operationLog'; diff --git a/model/nodeStatOfHealth.ts b/model/nodeStatOfHealth.ts new file mode 100644 index 0000000..04be0a1 --- /dev/null +++ b/model/nodeStatOfHealth.ts @@ -0,0 +1,18 @@ +/** + * HPC Pack REST API 2016 + * This is the API spec for Microsoft HPC Pack 2016 Update 3. + * + * OpenAPI spec version: 2016-11-01.5.3 + * Contact: hpcpack@microsoft.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +import { NodeHealth } from './nodeHealth'; + + +export interface NodeStatOfHealth { + Name?: NodeHealth; + Value?: number; +}