/** * Copyright (c) 2014 Baidu.com, Inc. All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * * @file src/aihc_client.ts * @author atorber */ import BceBaseClient from './bce_base_client'; import type { BceConfig, BceResponse } from './types/common'; /** 资源池配置 */ interface ResourcePool { id: string; name: string; description?: string; status: string; createTime: string; } /** 队列配置 */ interface Queue { name: string; description?: string; deserved: { cpu: number; memory: number; }; parentQueue: string; queueType: 'Regular' | 'Preemptible'; disableOversell?: boolean; } /** AI 任务配置 */ interface AIJob { jobId?: string; name: string; description?: string; queue: string; framework: string; image: string; command: string[]; workingDir?: string; env?: Record; resources: { cpu: number; memory: number; gpu?: number; }; } /** 客户端选项 */ interface AihcClientOptions { maxKeys?: number; marker?: string; config?: Partial; } /** * AIHC service API client * * @see https://cloud.baidu.com/doc/AIHC/s/dly5i8vfs */ export default class AihcClient extends BceBaseClient { /** * 构造函数 * @param config AIHC 客户端配置 */ constructor(config: BceConfig); /** * 获取资源池列表 * * @param options 选项 * @returns Promise 解析为资源池列表 */ listResourcepools(options?: AihcClientOptions): Promise>; /** * 获取资源池详情 * * @param resourcePoolId 资源池ID * @param options 选项 * @returns Promise 解析为资源池详情 */ getResourcepool(resourcePoolId: string, options?: AihcClientOptions): Promise>; /** * 获取资源池节点列表 * * @param resourcePoolId 资源池ID * @param options 选项 * @returns Promise 解析为节点列表 */ listResourcepoolNodes(resourcePoolId: string, options?: AihcClientOptions): Promise>; /** * 获取队列列表 * * @param resourcePoolId 资源池ID * @param options 选项 * @returns Promise 解析为队列列表 */ listResourcepoolQueues(resourcePoolId: string, options?: AihcClientOptions): Promise>; /** * 获取队列详情 * * @param resourcePoolId 资源池ID * @param queueName 队列名称 * @param options 选项 * @returns Promise 解析为队列详情 */ getResourcepoolQueue(resourcePoolId: string, queueName: string, options?: AihcClientOptions): Promise>; /** * 删除队列 * * @param resourcePoolId 资源池ID * @param queueName 队列名称 * @param options 选项 * @returns Promise 解析为删除结果 */ deleteResourcepoolQueue(resourcePoolId: string, queueName: string, options?: AihcClientOptions): Promise>; /** * 创建队列 * * @param resourcePoolId 资源池ID * @param queueConfig 队列配置 * @param options 选项 * @returns Promise 解析为创建结果 */ createResourcepoolQueue(resourcePoolId: string, queueConfig: Queue, options?: AihcClientOptions): Promise>; /** * 更新队列 * * @param resourcePoolId 资源池ID * @param queueName 队列名称 * @param queueConfig 队列配置 * @param options 选项 * @returns Promise 解析为更新结果 */ updateResourcepoolQueue(resourcePoolId: string, queueName: string, queueConfig: Partial, options?: AihcClientOptions): Promise>; /** * 创建 AI 训练任务 * * @param resourcePoolId 资源池ID * @param jobConfig 任务配置 * @param options 选项 * @returns Promise 解析为创建结果 */ createAIJob(resourcePoolId: string, jobConfig: AIJob, options?: AihcClientOptions): Promise>; /** * 获取 AI 训练任务列表 * * @param resourcePoolId 资源池ID * @param options 选项 * @returns Promise 解析为任务列表 */ listAIJobs(resourcePoolId: string, options?: AihcClientOptions): Promise>; /** * 获取 AI 训练任务详情 * * @param resourcePoolId 资源池ID * @param jobId 任务ID * @param options 选项 * @returns Promise 解析为任务详情 */ getAIJob(resourcePoolId: string, jobId: string, options?: AihcClientOptions): Promise>; /** * 获取客户端令牌 * @returns Promise 解析为令牌 */ private getClientToken; } export {}; //# sourceMappingURL=aihc_client.d.ts.map