Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
update get sku types API
Browse files Browse the repository at this point in the history
  • Loading branch information
yiyione committed Sep 20, 2020
1 parent 404625e commit f61ef9d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
26 changes: 26 additions & 0 deletions src/api/v2/clients/clusterClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { Util } from '@pai/commom/util';

import { ISkuType } from '../models/virtualCluster';

import { OpenPAIBaseClient } from './baseClient';

/**
* OpenPAI Cluster client.
*/
export class ClusterClient extends OpenPAIBaseClient {

/**
* Get sku types.
* @param vcName The name of virtual cluster.
*/
public async getSkuTypes(vcName?: string): Promise<{ [id: string]: ISkuType; }> {
const url: string = Util.fixUrl(
`${this.cluster.rest_server_uri}/api/v2/cluster/sku-types`,
this.cluster.https
);
return await this.httpClient.get(url, undefined, undefined, { vc: vcName });
}
}
14 changes: 0 additions & 14 deletions src/api/v2/clients/virtualClusterClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import { IPAICluster, IVirtualCluster } from '@api/v2';
import { Util } from '@pai/commom/util';

import { ISkuType } from '../models/virtualCluster';

import { OpenPAIBaseClient } from './baseClient';

/**
Expand Down Expand Up @@ -38,16 +36,4 @@ export class VirtualClusterClient extends OpenPAIBaseClient {
);
return await this.httpClient.get(url);
}

/**
* Get sku types in the virtual cluster.
* @param vcName The name of virtual cluster.
*/
public async getVirtualClusterSkuTypes(vcName: string): Promise<{ [id: string]: ISkuType; }> {
const url: string = Util.fixUrl(
`${this.cluster.rest_server_uri}/api/v2/virtual-clusters/${vcName}/sku-types`,
this.cluster.https
);
return await this.httpClient.get(url);
}
}
2 changes: 2 additions & 0 deletions src/api/v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
UserClient,
VirtualClusterClient
} from './clients';
import { ClusterClient } from './clients/clusterClient';
import { GroupClient } from './clients/groupClient';
import { StorageNodeV2 as StorageNode } from './clients/storageClient';
import { IAuthnInfo, ILoginInfo } from './models/authn';
Expand All @@ -32,6 +33,7 @@ import { INodeResource, IVirtualCluster } from './models/virtualCluster';
*/
export {
AuthnClient,
ClusterClient,
JobClient,
OpenPAIClient,
OpenPAIBaseClient,
Expand Down

0 comments on commit f61ef9d

Please sign in to comment.