pai-dsw-20220101/v2/main.tea (2,889 lines of code) (raw):

/** * */ import OpenApi; import OpenApi.OpenApiUtil; extends OpenApi; init(config: OpenApiUtil.Config){ super(config); @endpointRule = ''; checkConfig(config); @endpoint = getEndpoint('pai-dsw', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint); } function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{ if (!$isNull(endpoint)) { return endpoint; } if (!$isNull(endpointMap) && !$isNull(endpointMap[regionId])) { return endpointMap[regionId]; } return OpenApiUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix); } model BandwidthLimit { egressRate?: string(name='EgressRate'), egressWhitelists?: [ string ](name='EgressWhitelists'), ingressRate?: string(name='IngressRate'), ingressWhitelists?: [ string ](name='IngressWhitelists'), } model CredentialConfig { aliyunEnvRoleKey?: string(name='AliyunEnvRoleKey', example='0'), configs?: [ { key?: string(name='Key', description='This parameter is required.', example='0'), roles?: [ { assumeRoleFor?: string(name='AssumeRoleFor', example='123******'), policy?: string(name='Policy', example='{}'), roleArn?: string(name='RoleArn', description='This parameter is required.', example='acs:ram::123******:role/****'), roleType?: string(name='RoleType', description='This parameter is required.', example='service'), userInfo?: { accessKeyId?: string(name='AccessKeyId', example='LT********'), id?: string(name='Id', example='456******'), securityToken?: string(name='SecurityToken', example='********'), type?: string(name='Type', example='S'), }(name='UserInfo'), } ](name='Roles'), type?: string(name='Type', description='This parameter is required.', example='Role'), } ](name='Configs'), enable?: boolean(name='Enable', example='true'), } model DemoCategory { categoryCode?: string(name='CategoryCode', example='sdk'), categoryName?: string(name='CategoryName', example='SDK Usage'), order?: long(name='Order', example='12'), subCategories?: [ DemoCategory ](name='SubCategories'), } model DynamicMount { enable?: boolean(name='Enable'), mountPoints?: [ DynamicMountPoint ](name='MountPoints'), } model DynamicMountPoint { options?: string(name='Options'), rootPath?: string(name='RootPath', description='This parameter is required.'), } model ForwardInfo { accessType?: [ string ](name='AccessType'), containerName?: string(name='ContainerName', example='dsw-notebook'), eipAllocationId?: string(name='EipAllocationId', example='eip-25877c70gddh****'), enable?: boolean(name='Enable', example='true'), externalPort?: string(name='ExternalPort', example='10086'), forwardPort?: string(name='ForwardPort', example='22'), name?: string(name='Name', example='ssh'), natGatewayId?: string(name='NatGatewayId', example='ngw-bp1uewa15k4iy5770****'), SSHPublicKey?: string(name='SSHPublicKey'), } model ForwardInfoResponse { accessType?: [ string ](name='AccessType'), connectInfo?: { internet?: { endpoint?: string(name='Endpoint', example='47.111.119.114'), port?: string(name='Port', example='22'), }(name='Internet'), intranet?: { endpoint?: string(name='Endpoint', example='dsw-notebook-22-urz3u6cnu0uts7ej9r.dsw-5cc6083084818f60.dsw.pai.alibaba.com'), port?: string(name='Port', example='22'), }(name='Intranet'), message?: string(name='Message', example='DNAT and privateZone are both ready.'), phase?: string(name='Phase', example='Ready'), }(name='ConnectInfo'), containerName?: string(name='ContainerName', example='dsw-notebook'), eipAllocationId?: string(name='EipAllocationId', example='eip-25877c70gddh****'), enable?: boolean(name='Enable', example='true'), externalPort?: string(name='ExternalPort', example='1024'), forwardPort?: string(name='ForwardPort', example='22'), name?: string(name='Name', example='ssh'), natGatewayId?: string(name='NatGatewayId', example='ngw-bp1uewa15k4iy5770****'), SSHPublicKey?: string(name='SSHPublicKey'), } model CreateIdleInstanceCullerRequest { cpuPercentThreshold?: int32(name='CpuPercentThreshold', description='The CPU utilization threshold. Unit: percentage. Valid values: 1 to 100. If the CPU utilization of the instance is lower than this threshold, the instance is considered idle.', example='20'), gpuPercentThreshold?: int32(name='GpuPercentThreshold', description='The GPU utilization threshold. Unit: percentage. Valid values: 1 to 100. This parameter takes effect only if the instance is of the GPU instance type. If both CPU and GPU utilization is lower than the thresholds, the instance is considered idle.', example='10'), maxIdleTimeInMinutes?: int32(name='MaxIdleTimeInMinutes', description='The maximum time duration for which the instance is idle. Unit: minutes. If the time duration for which the instance is idle exceeds this value, the system automatically stops the instance.', example='60'), } model CreateIdleInstanceCullerResponseBody = { code?: string(name='Code', description='The status code. Valid values: * InternalError: an internal error. All errors, except for parameter validation errors, are classified as internal errors. * ValidationError: a parameter validation error.', example='null'), instanceId?: string(name='InstanceId', description='The instance ID.', example='dsw-730xxxxxxxxxx'), message?: string(name='Message', description='The error message.', example='"XXX"'), requestId?: string(name='RequestId', description='The request ID.', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values: * true * false', example='true'), } model CreateIdleInstanceCullerResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: CreateIdleInstanceCullerResponseBody(name='body'), } /** * @summary Creates an automatic stop policy for a specific Data Science Workshop (DSW) instance. When the conditions are met, the instance is automatically stopped. You can create only one automatic stop policy for an idle DSW instance. If the specific instance has an automatic stop policy, call DeleteIdleInstanceCuller to delete it first. * * @param request CreateIdleInstanceCullerRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return CreateIdleInstanceCullerResponse */ async function createIdleInstanceCullerWithOptions(InstanceId: string, request: CreateIdleInstanceCullerRequest, headers: map[string]string, runtime: $RuntimeOptions): CreateIdleInstanceCullerResponse { request.validate(); var body : map[string]any = {}; if (!$isNull(request.cpuPercentThreshold)) { body['CpuPercentThreshold'] = request.cpuPercentThreshold; } if (!$isNull(request.gpuPercentThreshold)) { body['GpuPercentThreshold'] = request.gpuPercentThreshold; } if (!$isNull(request.maxIdleTimeInMinutes)) { body['MaxIdleTimeInMinutes'] = request.maxIdleTimeInMinutes; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApiUtil.Params{ action = 'CreateIdleInstanceCuller', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}/idleinstanceculler`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Creates an automatic stop policy for a specific Data Science Workshop (DSW) instance. When the conditions are met, the instance is automatically stopped. You can create only one automatic stop policy for an idle DSW instance. If the specific instance has an automatic stop policy, call DeleteIdleInstanceCuller to delete it first. * * @param request CreateIdleInstanceCullerRequest * @return CreateIdleInstanceCullerResponse */ async function createIdleInstanceCuller(InstanceId: string, request: CreateIdleInstanceCullerRequest): CreateIdleInstanceCullerResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return createIdleInstanceCullerWithOptions(InstanceId, request, headers, runtime); } model CreateInstanceRequest { accessibility?: string(name='Accessibility', description='The instance accessibility. Valid values: * PUBLIC: The instances are accessible to all members in the workspace. * PRIVATE: The instances are accessible only to you and the administrator of the workspace.', example='PRIVATE'), affinity?: { CPU?: { enable?: boolean(name='Enable', description='Specifies whether to enable the CPU affinity feature. * false * true', example='true'), }(name='CPU', description='The CPU affinity configuration. Only subscription instances that use general-purpose computing resources support CPU affinity configuration.'), }(name='Affinity', description='The affinity configuration.'), cloudDisks?: [ { capacity?: string(name='Capacity', description='If **Resource Type** is **Public Resource** or if **Resource Quota** is subscription-based general-purpose computing resources (CPU cores ≥ 2 and memory ≥ 4 GB, or configured with GPU): Each instance has a free system disk of 100 GiB for persistent storage. **If the DSW instance is stopped and not launched for more than 15 days, the disk is cleared**. The disk can be expanded. For specific pricing, refer to the console. ** **Warning** * After the expansion, you cannot reduce the storage space. Proceed with caution. * After the expansion, the disk is not cleared if the instance is stopped for more than 15 days. However, it will continue to incur fees. * If you delete the instance, the system disk is also released and the data stored in the disk is deleted. Make sure that you have backed up your data before you delete the instance. If you need persistent storage, you can **mount a dataset** or add the OSS, NAS, or CPFS path to the **storage path**.', example='100Gi'), mountPath?: string(name='MountPath', description='The mount path of the cloud disk.', example='/mnt/systemDisk'), path?: string(name='Path', description='The subpath of the cloud disk that is mounted to the instance.', example='workspace'), status?: { available?: long(name='Available', description='The available capacity. Unit: bytes.', example='31841058816'), capacity?: long(name='Capacity', description='The capacity. Unit: bytes.', example='32212254720'), usage?: long(name='Usage', description='The used capacity. Unit: bytes.', example='371195904'), }(name='Status', description='The disk or snapshot usage.'), subType?: string(name='SubType', description='The cloud disk type. * rootfs: Mounts the disk as a system disk. The system environment is stored on the disk.', example='rootfs'), } ](name='CloudDisks', description='The cloud disks.', example='[]'), credentialConfig?: CredentialConfig(name='CredentialConfig', description='The credential configuration.'), datasets?: [ { datasetId?: string(name='DatasetId', description='The dataset ID. If the dataset is read-only, you cannot change the dataset permission from read-only to read and write by using MountAccess. You can call [ListDatasets](https://help.aliyun.com/document_detail/457222.html) to obtain the dataset ID. If you configure the dataset ID, you cannot configure the dataset URI.', example='d-vsqjvsjp4orp5l206u'), datasetVersion?: string(name='DatasetVersion', description='The dataset version. You must also configure DatasetId. If you leave this parameter empty, the value v1 is used by default.', example='v1'), dynamic?: boolean(name='Dynamic', description='Specifies whether to enable dynamic mounting. Default value: false. * Currently, only instances using general-purpose computing resources are supported. * Currently, only OSS datasets are supported. The mounted datasets are read-only. * The mount path of the dynamically mounted dataset must be a subpath of the root path. Example: /mnt/dynamic/data1/ * A dynamically mounted dataset must be after non-dynamic datasets.', example='true'), mountAccess?: string(name='MountAccess', description='The read and write permissions of the dataset. If the dataset is read-only, it cannot be changed to read and write.', example='RW'), mountPath?: string(name='MountPath', description='The mount path of the dataset.', example='/mnt/data'), optionType?: string(name='OptionType', description='The mount type. You cannot specify Options at the same time. This is deprecated, and you can use Options instead.', example='ReadOnly', deprecated=true), options?: string(name='Options', description='The custom dataset mount options. Only OSS is supported. You cannot specify OptionType at the same time. For more information, see [DSW mount configurations](https://www.alibabacloud.com/help/en/pai/user-guide/read-and-write-dataset-data).', example='{ "fs.oss.download.thread.concurrency": "10", "fs.oss.upload.thread.concurrency": "10", "fs.jindo.args": "-oattr_timeout=3 -oentry_timeout=0 -onegative_timeout=0 -oauto_cache -ono_symlink" }'), uri?: string(name='Uri', description='The URI of the storage service directory, which can be directly mounted. This parameter is mutually exclusive with DatasetId. URI formats of different types of storage: * OSS: oss://bucket-name.oss-cn-shanghai-internal.aliyuncs.com/data/path/ * NAS: nas://29\\\\*\\\\*d-b12\\\\*\\\\*\\\\*\\\\*446.cn-hangzhou.nas.aliyuncs.com/data/path/ * Extreme NAS: nas://29\\\\*\\\\*\\\\*\\\\*123-y\\\\*\\\\*r.cn-hangzhou.extreme.nas.aliyuncs.com/data/path/ * CPFS: cpfs://cpfs-213\\\\*\\\\*\\\\*\\\\*87.cn-wulanchabu/ptc-292\\\\*\\\\*\\\\*\\\\*\\\\*cbb/exp-290\\\\*\\\\*\\\\*\\\\*\\\\*\\\\*\\\\*\\\\*03e/data/path/ * Lingjun CPFS: bmcpfs://cpfs-290\\\\*\\\\*\\\\*\\\\*\\\\*\\\\*foflh-vpc-x\\\\*\\\\*\\\\*\\\\*8r.cn-wulanchabu.cpfs.aliyuncs.com/data/path/', example='oss://bucket-name.oss-cn-shanghai-internal.aliyuncs.com/data/path/'), } ](name='Datasets', description='The datasets.'), driver?: string(name='Driver', description='The NVIDIA driver configuration.', example='535.54.03'), dynamicMount?: DynamicMount(name='DynamicMount', description='The dynamic mount configuration.'), ecsSpec?: string(name='EcsSpec', description='The ECS instance type of the instance. You can call [ListEcsSpecs](https://help.aliyun.com/document_detail/470423.html) to obtain the ECS instance type.', example='ecs.c6.large'), environmentVariables?: map[string]string(name='EnvironmentVariables', description='The environment variables.', example='{userName: "Chris"}'), imageAuth?: string(name='ImageAuth', description='The Base64-encoded account and password for the user\\\\"s private image. The password will be hidden.', example='****'), imageId?: string(name='ImageId', description='The image ID. You can call [ListImages](https://help.aliyun.com/document_detail/449118.html) to obtain the image ID.', example='image-05cefd0be2exxxx'), imageUrl?: string(name='ImageUrl', description='The image address. You can call [ListImages](https://help.aliyun.com/document_detail/449118.html) to obtain the image address.', example='registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu'), instanceName?: string(name='InstanceName', description='The instance name. The name must meet the following requirements: * The name can contain only letters, digits, and underscores (_). * The name can be up to 27 characters in length.', example='training_data'), labels?: [ { key?: string(name='Key', description='The custom label key.', example='stsTokenOwner'), value?: string(name='Value', description='The custom label value.', example='123xxxxxxxx'), } ](name='Labels', description='The custom labels.', example='{\\\\"foo\\\\": \\\\"bar\\\\"}'), priority?: long(name='Priority', description='The priority based on which resources are allocated to instances. Valid values: 1 to 9. * 1: the lowest priority. * 9: the highest priority.', example='1'), requestedResource?: { CPU?: string(name='CPU', description='The number of CPU cores.', example='32'), GPU?: string(name='GPU', description='The number of GPUs.', example='4'), GPUType?: string(name='GPUType', description='The GPU memory type. Valid values: * V100 * A100 * T4 * A10 * P100', example='v100'), memory?: string(name='Memory', description='The memory size. Unit: GB.', example='32'), sharedMemory?: string(name='SharedMemory', description='The size of the shared memory. Unit: GB.', example='32'), }(name='RequestedResource', description='The resource configurations.', example='{"CPU":"4","Memory":"8Gi","SharedMemory":"4Gi","GPU":"1","GPUType":"Tesla-V100-16G"}'), resourceId?: string(name='ResourceId', description='The ID of the resource group. This parameter is configured during prepayment. For information about how to create a dedicated resource group, see [Create a dedicated resource group and purchase general computing resources](https://help.aliyun.com/document_detail/202827.html).', example='dsw-123456789'), tag?: [ { key?: string(name='Key', description='The tag key.', example='tag1'), value?: string(name='Value', description='The tag value.', example='value1'), } ](name='Tag', description='The tags.'), userId?: string(name='UserId', description='The ID of the instance owner. Valid values: Alibaba Cloud account and RAM user.', example='161228528250****'), userVpc?: { bandwidthLimit?: BandwidthLimit(name='BandwidthLimit'), defaultRoute?: string(name='DefaultRoute', description='The default route. Valid values: * eth0: The default network interface is used to access the Internet through the public gateway. * eth1: The user\\\\"s elastic network interface (ENI) is used to access the Internet through the private gateway. For more information about the configuration method, see [Enable Internet access for a DSW instance by using a private Internet NAT gateway](https://help.aliyun.com/document_detail/2525343.html).', example='eth0'), extendedCIDRs?: [ string ](name='ExtendedCIDRs', description='The extended CIDR blocks. * If you leave the SwitchId and ExtendedCIDRs parameters empty, the system automatically obtains all CIDR blocks in a VPC. * If you configure the SwitchId and ExtendedCIDRs parameters, we recommend that you specify all CIDR blocks in a VPC.', example='["192.168.0.1/24", "192.168.1.1/24"]'), forwardInfos?: [ ForwardInfo ](name='ForwardInfos', description='The forward information.'), securityGroupId?: string(name='SecurityGroupId', description='The security group ID.', example='sg-xxxxxx'), vSwitchId?: string(name='VSwitchId', description='The vSwitch ID.', example='vsw-xxxxx'), vpcId?: string(name='VpcId', description='The VPC ID.', example='vpc-xxxxx'), }(name='UserVpc', description='The virtual private cloud (VPC) configurations.'), workspaceId?: string(name='WorkspaceId', description='The workspace ID. You can call [ListWorkspaces](https://help.aliyun.com/document_detail/449124.html) to obtain the workspace ID.', example='40823'), workspaceSource?: string(name='WorkspaceSource', description='The storage corresponding to the working directory. You can mount disks or datasets to /mnt/workspace at the same time. OSS datasets and dynamically mounted datasets are not supported. Valid values: * rootfsCloudDisk: Mount the disk to the working directory. * Mount path of the dataset, such as /mnt/data: Datasets in URI format only support this method. * Dataset ID, such as d-vsqjvs\\\\*\\\\*\\\\*\\\\*rp5l206u: If a single dataset is mounted to multiple paths, the first path is selected. We recommend that you do not use this method, use the mount path instead. If you leave this parameter empty: * If the instance uses cloud disks, cloud disks are selected by default. * if no cloud disks are available, the first NAS or CPFS dataset is selected as the working directory. * If no cloud disks, and NAS or CPFS datasets are available, the host space is used.', example='rootfsCloudDisk'), } model CreateInstanceResponseBody = { code?: string(name='Code', description='The status code. Valid values: * InternalError: an internal error. All errors, except for parameter validation errors, are classified as internal errors. * ValidationError: a parameter validation error.', example='null'), httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code. Valid values: * 400 * 404 * 200', example='null'), instanceId?: string(name='InstanceId', description='The instance ID.', example='dsw-730xxxxxxxxxx'), message?: string(name='Message', description='The response message.', example='"XXX"'), requestId?: string(name='RequestId', description='The request ID.', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values: * true * false', example='true'), } model CreateInstanceResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: CreateInstanceResponseBody(name='body'), } /** * @summary Creates a Data Science Workshop (DSW) instance. * * @param request CreateInstanceRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return CreateInstanceResponse */ async function createInstanceWithOptions(request: CreateInstanceRequest, headers: map[string]string, runtime: $RuntimeOptions): CreateInstanceResponse { request.validate(); var body : map[string]any = {}; if (!$isNull(request.accessibility)) { body['Accessibility'] = request.accessibility; } if (!$isNull(request.affinity)) { body['Affinity'] = request.affinity; } if (!$isNull(request.cloudDisks)) { body['CloudDisks'] = request.cloudDisks; } if (!$isNull(request.credentialConfig)) { body['CredentialConfig'] = request.credentialConfig; } if (!$isNull(request.datasets)) { body['Datasets'] = request.datasets; } if (!$isNull(request.driver)) { body['Driver'] = request.driver; } if (!$isNull(request.dynamicMount)) { body['DynamicMount'] = request.dynamicMount; } if (!$isNull(request.ecsSpec)) { body['EcsSpec'] = request.ecsSpec; } if (!$isNull(request.environmentVariables)) { body['EnvironmentVariables'] = request.environmentVariables; } if (!$isNull(request.imageAuth)) { body['ImageAuth'] = request.imageAuth; } if (!$isNull(request.imageId)) { body['ImageId'] = request.imageId; } if (!$isNull(request.imageUrl)) { body['ImageUrl'] = request.imageUrl; } if (!$isNull(request.instanceName)) { body['InstanceName'] = request.instanceName; } if (!$isNull(request.labels)) { body['Labels'] = request.labels; } if (!$isNull(request.priority)) { body['Priority'] = request.priority; } if (!$isNull(request.requestedResource)) { body['RequestedResource'] = request.requestedResource; } if (!$isNull(request.resourceId)) { body['ResourceId'] = request.resourceId; } if (!$isNull(request.tag)) { body['Tag'] = request.tag; } if (!$isNull(request.userId)) { body['UserId'] = request.userId; } if (!$isNull(request.userVpc)) { body['UserVpc'] = request.userVpc; } if (!$isNull(request.workspaceId)) { body['WorkspaceId'] = request.workspaceId; } if (!$isNull(request.workspaceSource)) { body['WorkspaceSource'] = request.workspaceSource; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApiUtil.Params{ action = 'CreateInstance', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Creates a Data Science Workshop (DSW) instance. * * @param request CreateInstanceRequest * @return CreateInstanceResponse */ async function createInstance(request: CreateInstanceRequest): CreateInstanceResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return createInstanceWithOptions(request, headers, runtime); } model CreateInstanceShutdownTimerRequest { dueTime?: string(name='DueTime', description='The scheduled stop time.', example='2021-01-12T14:36:01Z'), remainingTimeInMs?: long(name='RemainingTimeInMs', description='The time duration before the instance is stopped. Unit: milliseconds.', example='3600000'), } model CreateInstanceShutdownTimerResponseBody = { code?: string(name='Code', description='The status code. Valid values: * InternalError: an internal error. All errors, except for parameter validation errors, are classified as internal errors. * ValidationError: a parameter validation error.', example='null'), httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code. Valid values: * 400 * 404', example='null'), instanceId?: string(name='InstanceId', description='The instance ID.', example='dsw-730xxxxxxxxxx'), message?: string(name='Message', description='The response message.', example='"XXX"'), requestId?: string(name='RequestId', description='The request ID.', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values: * true * false', example='true'), } model CreateInstanceShutdownTimerResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: CreateInstanceShutdownTimerResponseBody(name='body'), } /** * @summary Creates a scheduled stop task for an instance. * * @param request CreateInstanceShutdownTimerRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return CreateInstanceShutdownTimerResponse */ async function createInstanceShutdownTimerWithOptions(InstanceId: string, request: CreateInstanceShutdownTimerRequest, headers: map[string]string, runtime: $RuntimeOptions): CreateInstanceShutdownTimerResponse { request.validate(); var body : map[string]any = {}; if (!$isNull(request.dueTime)) { body['DueTime'] = request.dueTime; } if (!$isNull(request.remainingTimeInMs)) { body['RemainingTimeInMs'] = request.remainingTimeInMs; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApiUtil.Params{ action = 'CreateInstanceShutdownTimer', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}/shutdowntimer`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Creates a scheduled stop task for an instance. * * @param request CreateInstanceShutdownTimerRequest * @return CreateInstanceShutdownTimerResponse */ async function createInstanceShutdownTimer(InstanceId: string, request: CreateInstanceShutdownTimerRequest): CreateInstanceShutdownTimerResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return createInstanceShutdownTimerWithOptions(InstanceId, request, headers, runtime); } model CreateInstanceSnapshotRequest { excludePaths?: [ string ](name='ExcludePaths'), imageUrl?: string(name='ImageUrl', description='This parameter is required.', example='registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu'), labels?: [ { key?: string(name='Key', example='stsTokenOwner'), value?: string(name='Value', example='123xxxxxxxx'), } ](name='Labels', example='{\\\\"foo\\\\": \\\\"bar\\\\"}'), overwrite?: boolean(name='Overwrite'), snapshotDescription?: string(name='SnapshotDescription', example='training_data_env'), snapshotName?: string(name='SnapshotName', description='This parameter is required.', example='training_data_env'), } model CreateInstanceSnapshotResponseBody = { code?: string(name='Code', example='null'), httpStatusCode?: int32(name='HttpStatusCode', example='null'), instanceId?: string(name='InstanceId', example='dsw-730xxxxxxxxxx'), message?: string(name='Message', example='"XXX"'), requestId?: string(name='RequestId', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), snapshotId?: string(name='SnapshotId', example='snp-05cexxxxxxxxx'), success?: boolean(name='Success', example='true'), } model CreateInstanceSnapshotResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: CreateInstanceSnapshotResponseBody(name='body'), } /** * @summary 创建实例快照 * * @param request CreateInstanceSnapshotRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return CreateInstanceSnapshotResponse */ async function createInstanceSnapshotWithOptions(InstanceId: string, request: CreateInstanceSnapshotRequest, headers: map[string]string, runtime: $RuntimeOptions): CreateInstanceSnapshotResponse { request.validate(); var body : map[string]any = {}; if (!$isNull(request.excludePaths)) { body['ExcludePaths'] = request.excludePaths; } if (!$isNull(request.imageUrl)) { body['ImageUrl'] = request.imageUrl; } if (!$isNull(request.labels)) { body['Labels'] = request.labels; } if (!$isNull(request.overwrite)) { body['Overwrite'] = request.overwrite; } if (!$isNull(request.snapshotDescription)) { body['SnapshotDescription'] = request.snapshotDescription; } if (!$isNull(request.snapshotName)) { body['SnapshotName'] = request.snapshotName; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApiUtil.Params{ action = 'CreateInstanceSnapshot', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}/snapshots`, method = 'POST', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 创建实例快照 * * @param request CreateInstanceSnapshotRequest * @return CreateInstanceSnapshotResponse */ async function createInstanceSnapshot(InstanceId: string, request: CreateInstanceSnapshotRequest): CreateInstanceSnapshotResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return createInstanceSnapshotWithOptions(InstanceId, request, headers, runtime); } model DeleteIdleInstanceCullerResponseBody = { code?: string(name='Code', description='The status code. Valid values: * InternalError: an internal error. All errors, except for parameter validation errors, are classified as internal errors. * ValidationError: a parameter validation error.', example='ValidationError'), instanceId?: string(name='InstanceId', description='The instance ID.', example='dsw-730xxxxxxxxxx'), message?: string(name='Message', description='The response message. * If the request is successful, null is returned. * If the request fails, the failure cause is returned.', example='"XXX"'), requestId?: string(name='RequestId', description='The request ID.', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values: * true * false', example='true'), } model DeleteIdleInstanceCullerResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: DeleteIdleInstanceCullerResponseBody(name='body'), } /** * @summary Deletes the automatic stop policy of an instance. * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return DeleteIdleInstanceCullerResponse */ async function deleteIdleInstanceCullerWithOptions(InstanceId: string, headers: map[string]string, runtime: $RuntimeOptions): DeleteIdleInstanceCullerResponse { var req = new OpenApiUtil.OpenApiRequest{ headers = headers, }; var params = new OpenApiUtil.Params{ action = 'DeleteIdleInstanceCuller', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}/idleinstanceculler`, method = 'DELETE', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Deletes the automatic stop policy of an instance. * * @return DeleteIdleInstanceCullerResponse */ async function deleteIdleInstanceCuller(InstanceId: string): DeleteIdleInstanceCullerResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return deleteIdleInstanceCullerWithOptions(InstanceId, headers, runtime); } model DeleteInstanceResponseBody = { code?: string(name='Code', description='The status code. Valid values: * InternalError: an internal error. All errors, except for parameter validation errors, are classified as internal errors. * ValidationError: a parameter validation error.', example='null'), httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code. Valid values: * 400 * 404 * 200', example='null'), instanceId?: string(name='InstanceId', description='The instance ID.', example='dsw-730xxxxxxxxxx'), message?: string(name='Message', description='The response message.', example='"XXX"'), requestId?: string(name='RequestId', description='The request ID.', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', description='Indicates whether the request was successful. * true * false', example='true'), } model DeleteInstanceResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: DeleteInstanceResponseBody(name='body'), } /** * @summary Deletes a specific instance. * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return DeleteInstanceResponse */ async function deleteInstanceWithOptions(InstanceId: string, headers: map[string]string, runtime: $RuntimeOptions): DeleteInstanceResponse { var req = new OpenApiUtil.OpenApiRequest{ headers = headers, }; var params = new OpenApiUtil.Params{ action = 'DeleteInstance', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}`, method = 'DELETE', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Deletes a specific instance. * * @return DeleteInstanceResponse */ async function deleteInstance(InstanceId: string): DeleteInstanceResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return deleteInstanceWithOptions(InstanceId, headers, runtime); } model DeleteInstanceLabelsRequest { labelKeys?: string(name='LabelKeys', description='The keys of the tags that you want to delete. Separate multiple tags with commas (,). This parameter is required.', example='labelKey1,labelKey2,labelKey3'), } model DeleteInstanceLabelsResponseBody = { requestId?: string(name='RequestId', description='The request ID.', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3****'), } model DeleteInstanceLabelsResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: DeleteInstanceLabelsResponseBody(name='body'), } /** * @summary Delete tags from a Data Science Workshop (DSW) instance. * * @param request DeleteInstanceLabelsRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return DeleteInstanceLabelsResponse */ async function deleteInstanceLabelsWithOptions(InstanceId: string, request: DeleteInstanceLabelsRequest, headers: map[string]string, runtime: $RuntimeOptions): DeleteInstanceLabelsResponse { request.validate(); var query : map[string]any = {}; if (!$isNull(request.labelKeys)) { query['LabelKeys'] = request.labelKeys; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApiUtil.Params{ action = 'DeleteInstanceLabels', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}/labels`, method = 'DELETE', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Delete tags from a Data Science Workshop (DSW) instance. * * @param request DeleteInstanceLabelsRequest * @return DeleteInstanceLabelsResponse */ async function deleteInstanceLabels(InstanceId: string, request: DeleteInstanceLabelsRequest): DeleteInstanceLabelsResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return deleteInstanceLabelsWithOptions(InstanceId, request, headers, runtime); } model DeleteInstanceShutdownTimerResponseBody = { code?: string(name='Code', description='The status code. Valid values: * InternalError: an internal error. All errors, except for parameter validation errors, are classified as internal errors. * ValidationError: a parameter validation error.', example='null'), httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code. Valid values: * 400 * 404', example='null'), instanceId?: string(name='InstanceId', description='The instance ID.', example='dsw-730xxxxxxxxxx'), message?: string(name='Message', description='The response message.', example='"XXX"'), requestId?: string(name='RequestId', description='The request ID.', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values: * true * false', example='true'), } model DeleteInstanceShutdownTimerResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: DeleteInstanceShutdownTimerResponseBody(name='body'), } /** * @summary Deletes a scheduled stop task of an instance. * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return DeleteInstanceShutdownTimerResponse */ async function deleteInstanceShutdownTimerWithOptions(InstanceId: string, headers: map[string]string, runtime: $RuntimeOptions): DeleteInstanceShutdownTimerResponse { var req = new OpenApiUtil.OpenApiRequest{ headers = headers, }; var params = new OpenApiUtil.Params{ action = 'DeleteInstanceShutdownTimer', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}/shutdowntimer`, method = 'DELETE', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Deletes a scheduled stop task of an instance. * * @return DeleteInstanceShutdownTimerResponse */ async function deleteInstanceShutdownTimer(InstanceId: string): DeleteInstanceShutdownTimerResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return deleteInstanceShutdownTimerWithOptions(InstanceId, headers, runtime); } model DeleteInstanceSnapshotResponseBody = { code?: string(name='Code', example='null'), httpStatusCode?: int32(name='HttpStatusCode', example='null'), instanceId?: string(name='InstanceId', example='dsw-730xxxxxxxxxx'), message?: string(name='Message', example='"XXX"'), requestId?: string(name='RequestId', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), snapshotId?: string(name='SnapshotId', example='snp-05cexxxxxxxxx'), success?: boolean(name='Success', example='true'), } model DeleteInstanceSnapshotResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: DeleteInstanceSnapshotResponseBody(name='body'), } /** * @summary 获取实例快照详情 * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return DeleteInstanceSnapshotResponse */ async function deleteInstanceSnapshotWithOptions(InstanceId: string, SnapshotId: string, headers: map[string]string, runtime: $RuntimeOptions): DeleteInstanceSnapshotResponse { var req = new OpenApiUtil.OpenApiRequest{ headers = headers, }; var params = new OpenApiUtil.Params{ action = 'DeleteInstanceSnapshot', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}/snapshots/${$URL.percentEncode(SnapshotId)}`, method = 'DELETE', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 获取实例快照详情 * * @return DeleteInstanceSnapshotResponse */ async function deleteInstanceSnapshot(InstanceId: string, SnapshotId: string): DeleteInstanceSnapshotResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return deleteInstanceSnapshotWithOptions(InstanceId, SnapshotId, headers, runtime); } model GetIdleInstanceCullerResponseBody = { code?: string(name='Code', description='The status code. Valid values: * InternalError: an internal error. All errors, except for parameter validation errors, are classified as internal errors. * ValidationError: a parameter validation error.', example='ValidationError'), cpuPercentThreshold?: int32(name='CpuPercentThreshold', description='The CPU utilization threshold. Unit: percentage. Valid values: 1 to 100. If the CPU utilization of the instance is lower than this threshold, the instance is considered idle.', example='20'), gpuPercentThreshold?: int32(name='GpuPercentThreshold', description='The GPU utilization threshold. Unit: percentage. Valid values: 1 to 100. This parameter takes effect only if the instance is of the GPU instance type. If both CPU and GPU utilization is lower than the thresholds, the instance is considered idle.', example='10'), idleTimeInMinutes?: int32(name='IdleTimeInMinutes', description='The time duration for which the instance is idle. Unit: minutes.', example='30'), instanceId?: string(name='InstanceId', description='The instance ID.', example='dsw-730xxxxxxxxxx'), maxIdleTimeInMinutes?: int32(name='MaxIdleTimeInMinutes', description='The maximum time duration for which the instance is idle. Unit: minutes. If the time duration for which the instance is idle exceeds this value, the system automatically stops the instance.', example='60'), message?: string(name='Message', description='The error message.', example='"XXX"'), requestId?: string(name='RequestId', description='The request ID.', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', description='Indicates whether the request was successful. * true * false', example='true'), } model GetIdleInstanceCullerResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: GetIdleInstanceCullerResponseBody(name='body'), } /** * @summary Queries the information about an auto stop policy for a specific idle instance. * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return GetIdleInstanceCullerResponse */ async function getIdleInstanceCullerWithOptions(InstanceId: string, headers: map[string]string, runtime: $RuntimeOptions): GetIdleInstanceCullerResponse { var req = new OpenApiUtil.OpenApiRequest{ headers = headers, }; var params = new OpenApiUtil.Params{ action = 'GetIdleInstanceCuller', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}/idleinstanceculler`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Queries the information about an auto stop policy for a specific idle instance. * * @return GetIdleInstanceCullerResponse */ async function getIdleInstanceCuller(InstanceId: string): GetIdleInstanceCullerResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return getIdleInstanceCullerWithOptions(InstanceId, headers, runtime); } model GetInstanceRequest { token?: string(name='Token', description='The sharing token information.', example='WUzWCMr325LV0bH2JH4C4HoDaKIU6C4S'), } model GetInstanceResponseBody = { acceleratorType?: string(name='AcceleratorType', description='The accelerator type of the instance. Valid values: * CPU * GPU', example='CPU'), accessibility?: string(name='Accessibility', description='The accessibility. Valid values: * PRIVATE: Accessible only to you and the administrator of the workspace. * PUBLIC: Accessible to all members in the workspace.', example='PRIVATE'), accumulatedRunningTimeInMs?: long(name='AccumulatedRunningTimeInMs', description='The accumulated running duration. Unit: milliseconds.', example='3600000'), affinity?: { CPU?: { enable?: boolean(name='Enable', description='Indicates whether CPU affinity is enabled. true false', example='true'), }(name='CPU', description='The CPU affinity configuration. Only subscription instances that use general-purpose computing resources support CPU affinity configuration.'), }(name='Affinity', description='The affinity configuration.'), cloudDisks?: [ { capacity?: string(name='Capacity', description='Disk Capacity', example='30Gi'), mountPath?: string(name='MountPath', description='The mount path of the cloud disk in the container.', example='/mmt/workspace'), path?: string(name='Path', description='The directory on the cloud disk that is mounted to the container.', example='/workspace'), subType?: string(name='SubType', description='The usage mode of the cloud disk. The value rootfs indicates that the cloud disk is used as the root file system.', example='rootfs'), } ](name='CloudDisks', description='The cloud disks of the instance.', example='[]'), code?: string(name='Code', description='The status code. Valid values: * InternalError: All errors, except for parameter validation errors, are internal errors. * ValidationError: A parameter validation error.', example='null'), credentialConfig?: CredentialConfig(name='CredentialConfig', description='The credential injection configuration.'), datasets?: [ { datasetId?: string(name='DatasetId', description='The dataset ID.', example='d-vsqjvsjp4orp5l206u'), datasetVersion?: string(name='DatasetVersion', description='The dataset version.', example='v1'), dynamic?: boolean(name='Dynamic', description='Indicates whether dynamic mounting is enabled. Default value: false.', example='false'), mountAccess?: string(name='MountAccess', description='The read and write permissions. Valid values: RW and RO.', example='RW'), mountPath?: string(name='MountPath', description='The mount path in the container.', example='/mnt/data'), optionType?: string(name='OptionType', description='The mount type of the dataset (deprecated).', example='FastReadWrite'), options?: string(name='Options', description='The mount type of the dataset.', example='{ "fs.oss.download.thread.concurrency": "10", "fs.oss.upload.thread.concurrency": "10", "fs.jindo.args": "-oattr_timeout=3 -oentry_timeout=0 -onegative_timeout=0 -oauto_cache -ono_symlink" }'), uri?: string(name='Uri', description='The dataset URI.', example='oss://bucket-name.oss-cn-shanghai-internal.aliyuncs.com/data/path/'), } ](name='Datasets', description='The datasets.'), driver?: string(name='Driver', description='The NVIDIA driver configuration.', example='535.54.03'), dynamicMount?: DynamicMount(name='DynamicMount', description='The dynamic mount configuration.'), ecsSpec?: string(name='EcsSpec', description='The ECS instance type of the instance.', example='ecs.c6.large'), environmentVariables?: map[string]string(name='EnvironmentVariables', description='The environment variables.', example='{userName: "Chris"}'), gmtCreateTime?: string(name='GmtCreateTime', description='The creation time of the instance.', example='2021-01-12T14:36:01Z'), gmtModifiedTime?: string(name='GmtModifiedTime', description='The last modified time of the instance.', example='2021-01-12T14:36:01Z'), httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code. Valid values: * 400 * 404', example='null'), idleInstanceCuller?: { cpuPercentThreshold?: int32(name='CpuPercentThreshold', description='The CPU utilization threshold. Unit: percentage. Valid values: 1 to 100. If the CPU utilization of the instance is lower than this threshold, the instance is considered idle.', example='20'), gpuPercentThreshold?: int32(name='GpuPercentThreshold', description='The GPU utilization threshold. Unit: percentage. Valid values: 1 to 100. This parameter takes effect only if the instance is of the GPU instance type. If both CPU and GPU utilization is lower than the thresholds, the instance is considered idle.', example='10'), idleTimeInMinutes?: int32(name='IdleTimeInMinutes', description='The current time duration for which the instance is idle. Unit: minutes.', example='30'), instanceId?: string(name='InstanceId', description='The instance ID.', example='dsw-730xxxxxxxxxx'), maxIdleTimeInMinutes?: int32(name='MaxIdleTimeInMinutes', description='The maximum time duration for which the instance is idle. Unit: minutes. If the time duration for which the instance is idle exceeds this value, the system automatically stops the instance.', example='60'), }(name='IdleInstanceCuller', description='The automatic shutdown settings.', example='{"InstanceId":"dsw-05cefd0be2e5a278","CpuPercentThreshold":20,"GpuPercentThreshold":10,"MaxIdleTimeInMinutes":120,"IdleTimeInMinutes":30}'), imageAuth?: string(name='ImageAuth', description='The Base64-encoded account and password for the user‘s private image. The password will be hidden.', example='YWxpeXVuNjUzMzM5MjIwMzoqKioqKio='), imageId?: string(name='ImageId', description='The image ID.', example='image-05cefd0be2exxxx'), imageName?: string(name='ImageName', description='The image name.', example='py36_cpu_tf1.12_ubuntu'), imageUrl?: string(name='ImageUrl', description='The image address.', example='registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu'), instanceId?: string(name='InstanceId', description='The instance ID.', example='dsw-730xxxxxxxxxx'), instanceName?: string(name='InstanceName', description='The instance name.', example='training_data'), instanceShutdownTimer?: { dueTime?: string(name='DueTime', description='The scheduled stop time.', example='2021-01-12T14:36:01Z'), gmtCreateTime?: string(name='GmtCreateTime', description='The creation time.', example='2021-01-12T14:36:01Z'), gmtModifiedTime?: string(name='GmtModifiedTime', description='The modified time.', example='2021-01-12T14:36:01Z'), instanceId?: string(name='InstanceId', description='The instance ID.', example='dsw-730xxxxxxxxxx'), remainingTimeInMs?: long(name='RemainingTimeInMs', description='The remaining time before the instance is stopped. Unit: milliseconds.', example='3600000'), }(name='InstanceShutdownTimer', description='The scheduled stop tasks.'), instanceSnapshotList?: [ { gmtCreateTime?: string(name='GmtCreateTime', description='The time when the snapshot was created.', example='2021-01-12T14:36:01Z'), gmtModifiedTime?: string(name='GmtModifiedTime', description='The time when the snapshot was modified.', example='2021-01-12T14:36:01Z'), imageId?: string(name='ImageId', description='The image ID.', example='image-05cefd0be2exxxx'), imageName?: string(name='ImageName', description='The image name.', example='py36_cpu_tf1.12_ubuntu'), imageUrl?: string(name='ImageUrl', description='The image URL.', example='registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu'), reasonCode?: string(name='ReasonCode', description='The error code of the instance snapshot.', example='Internal Error'), reasonMessage?: string(name='ReasonMessage', description='The error message of the instance snapshot.', example='ImagePullBackOff'), repositoryUrl?: string(name='RepositoryUrl', description='The image repository URL.', example='https://cr.console.aliyun.com/repository/cn-hangzhou/zouxu/kf/images'), status?: string(name='Status', description='The instance snapshot status.', example='Pushing'), } ](name='InstanceSnapshotList', description='The instance snapshots.', example='[]'), instanceUrl?: string(name='InstanceUrl', description='The instance URL.', example='https://dsw-cn-shanghai.data.aliyun.com/notebook.htm?instance=39772#/'), jupyterlabUrl?: string(name='JupyterlabUrl', description='The JupyterLab URL.', example='https://dsw-gateway-cn-shanghai.aliyun.com/dsw-39772/lab/'), labels?: [ { key?: string(name='Key', description='The tag key.', example='stsTokenOwner'), value?: string(name='Value', description='The tag value.', example='123xxxxxxxx'), } ](name='Labels', description='The custom tags.', example='{\\\\"foo\\\\": \\\\"bar\\\\"}'), latestSnapshot?: { gmtCreateTime?: string(name='GmtCreateTime', description='The time when the snapshot was created.', example='2021-01-12T14:36:01Z'), gmtModifiedTime?: string(name='GmtModifiedTime', description='The time when the snapshot was modified.', example='2021-01-12T14:36:01Z'), imageId?: string(name='ImageId', description='The image ID.', example='image-05cefd0be2exxxx'), imageName?: string(name='ImageName', description='The image name.', example='py36_cpu_tf1.12_ubuntu'), imageUrl?: string(name='ImageUrl', description='The image URL.', example='registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu'), reasonCode?: string(name='ReasonCode', description='The error code of the instance snapshot.', example='Internal Error'), reasonMessage?: string(name='ReasonMessage', description='The error message of the instance snapshot.', example='ImagePullBackOff'), repositoryUrl?: string(name='RepositoryUrl', description='The image repository URL.', example='https://cr.console.aliyun.com/repository/cn-hangzhou/zouxu/kf/images'), status?: string(name='Status', description='The instance snapshot status. Valid values: * Committing * Pushing * Failed * Saved', example='Pushing'), }(name='LatestSnapshot', description='The latest user image saved.'), message?: string(name='Message', description='The error message. Valid values: * If the request is successful, null is returned. * If the request fails, the cause for the failure is returned.', example='"XXX"'), nodeErrorRecovery?: { autoSwitchCountdownSeconds?: long(name='autoSwitchCountdownSeconds', description='The number of seconds to wait before automatic switchover.', example='30'), enableAutoSwitchOnNodeError?: boolean(name='enableAutoSwitchOnNodeError', description='Indicates whether to enable automatic switchover when a node error occurs.', example='true'), hasNodeError?: boolean(name='hasNodeError', description='Indicates whether the node has an error.', example='false'), }(name='NodeErrorRecovery', description='The error recovery configuration of the node.'), paymentType?: string(name='PaymentType', description='The billing method. Valid values: * PayAsYouGo * Subscription', example='PayAsYouGo'), priority?: long(name='Priority', description='The priority based on which resources are allocated to instances.', example='1'), proxyPath?: string(name='ProxyPath', description='The proxy path.', example='dsw-170197/proxy/'), reasonCode?: string(name='ReasonCode', description='The error code of the instance.', example='Internal Error'), reasonMessage?: string(name='ReasonMessage', description='The cause of the instance error.', example='ImagePullBackOff'), requestId?: string(name='RequestId', description='The request ID.', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), requestedResource?: { CPU?: string(name='CPU', description='The number of CPU cores.', example='32'), GPU?: string(name='GPU', description='The number of GPUs.', example='4'), GPUType?: string(name='GPUType', description='The GPU type. Valid values: * V100 * A100 * T4 * A10 * P100', example='v100'), memory?: string(name='Memory', description='The memory size. Unit: GB.', example='32'), sharedMemory?: string(name='SharedMemory', description='The shared memory size. Unit: GB.', example='32'), }(name='RequestedResource', description='The resource configurations in subscription scenarios.', example='{"CPU":"4","Memory":"8Gi","SharedMemory":"4Gi","GPU":"1","GPUType":"Tesla-V100-16G"}'), resourceId?: string(name='ResourceId', description='The resource ID. This parameter is available if the billing method is subscription.', example='dsw-123456789'), resourceName?: string(name='ResourceName', description='The specification type. * For subscription, this is the requested CPU and memory size. * For pay-as-you-go, this is the selected ECS instance type.', example='ecs.g7.xlarge'), status?: string(name='Status', description='The instance status. Valid values: * Creating * SaveFailed * Stopped * Failed * ResourceAllocating * Stopping * Updating * Saving * Queuing * Recovering * Starting * Running * Saved * Deleting * EnvPreparing', example='Running'), success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values: * true * false', example='true'), tags?: [ { tagKey?: string(name='TagKey', description='The tag key.', example='tag1'), tagValue?: string(name='TagValue', description='The tag value.', example='value1'), } ](name='Tags', description='The tags.'), terminalUrl?: string(name='TerminalUrl', description='The terminal URL.', example='https://dsw-gateway-cn-shanghai.aliyun.com/dsw-39772/tty/'), userId?: string(name='UserId', description='The user ID.', example='1612285282502324'), userName?: string(name='UserName', description='The username.', example='测试用户'), userVpc?: { bandwidthLimit?: BandwidthLimit(name='BandwidthLimit'), defaultRoute?: string(name='DefaultRoute', description='Default Route', example='eth0 | eth1'), extendedCIDRs?: [ string ](name='ExtendedCIDRs', description='The extended CIDR block. * If you leave VSwitchId empty, this parameter is not required and the system automatically obtains all CIDR blocks in the VPC. * If VSwitchId is not empty, this parameter is required. Specify all CIDR blocks in the VPC.', example='["192.168.0.1/24", "192.168.1.1/24"]'), forwardInfos?: [ ForwardInfoResponse ](name='ForwardInfos', description='The forward information.'), securityGroupId?: string(name='SecurityGroupId', description='The security group ID.', example='sg-xxxxxx'), vSwitchId?: string(name='VSwitchId', description='The vSwitch ID.', example='vsw-xxxxx'), vpcId?: string(name='VpcId', description='The VPC ID.', example='vpc-xxxxx'), }(name='UserVpc', description='The virtual private cloud (VPC) configurations.'), webIDEUrl?: string(name='WebIDEUrl', description='The Web IDE URL.', example='https://dsw-gateway-cn-shanghai.aliyun.com/dsw-39772/ide/'), workspaceId?: string(name='WorkspaceId', description='The workspace ID.', example='40823'), workspaceName?: string(name='WorkspaceName', description='The workspace name.', example='training_data'), workspaceSource?: string(name='WorkspaceSource', description='The storage for the workspace. If you leave this parameter empty, the workspace uses File Storage NAS (NAS) storage, cloud disks, or local disks in sequence.', example='d-123456789'), } model GetInstanceResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: GetInstanceResponseBody(name='body'), } /** * @summary Queries the details of a DSW instance. * * @param request GetInstanceRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return GetInstanceResponse */ async function getInstanceWithOptions(InstanceId: string, request: GetInstanceRequest, headers: map[string]string, runtime: $RuntimeOptions): GetInstanceResponse { request.validate(); var query : map[string]any = {}; if (!$isNull(request.token)) { query['Token'] = request.token; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApiUtil.Params{ action = 'GetInstance', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Queries the details of a DSW instance. * * @param request GetInstanceRequest * @return GetInstanceResponse */ async function getInstance(InstanceId: string, request: GetInstanceRequest): GetInstanceResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return getInstanceWithOptions(InstanceId, request, headers, runtime); } model GetInstanceEventsRequest { endTime?: string(name='EndTime', description='The end of the time range to query.', example='2020-11-08T15:00:00Z'), maxEventsNum?: int32(name='MaxEventsNum', description='The maximum number of events. Default value: 2000.', example='2000'), startTime?: string(name='StartTime', description='The beginning of the time range to query.', example='2020-11-08T15:00:00Z'), token?: string(name='Token', description='The token used to share the URL.'), } model GetInstanceEventsResponseBody = { code?: string(name='Code', description='The status code. Valid values: * InternalError: an internal error. All errors, except for parameter validation errors, are classified as internal errors. * ValidationError: a parameter validation error.', example='None'), events?: [ string ](name='Events', description='The events.'), httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code. Valid values: * 400: One or more parameters are invalid. * 404: The instance does not exist. * 200: The request is normal.', example='200'), instanceId?: string(name='InstanceId', description='The instance ID.', example='dsw-730xxxxxxxxxx'), message?: string(name='Message', description='The response message.', example='XXX'), requestId?: string(name='RequestId', description='The request ID.', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', description='Indicates whether the request was successful. * true * false', example='true'), } model GetInstanceEventsResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: GetInstanceEventsResponseBody(name='body'), } /** * @summary Queries a list of system events for a Data Science Workshop (DSW) instance. * * @param request GetInstanceEventsRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return GetInstanceEventsResponse */ async function getInstanceEventsWithOptions(InstanceId: string, request: GetInstanceEventsRequest, headers: map[string]string, runtime: $RuntimeOptions): GetInstanceEventsResponse { request.validate(); var query : map[string]any = {}; if (!$isNull(request.endTime)) { query['EndTime'] = request.endTime; } if (!$isNull(request.maxEventsNum)) { query['MaxEventsNum'] = request.maxEventsNum; } if (!$isNull(request.startTime)) { query['StartTime'] = request.startTime; } if (!$isNull(request.token)) { query['Token'] = request.token; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApiUtil.Params{ action = 'GetInstanceEvents', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}/events`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Queries a list of system events for a Data Science Workshop (DSW) instance. * * @param request GetInstanceEventsRequest * @return GetInstanceEventsResponse */ async function getInstanceEvents(InstanceId: string, request: GetInstanceEventsRequest): GetInstanceEventsResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return getInstanceEventsWithOptions(InstanceId, request, headers, runtime); } model GetInstanceMetricsRequest { endTime?: string(name='EndTime', description='The end of the time range to query.', example='2020-11-08T15:00:00Z'), metricType?: string(name='MetricType', description='The metric type. Valid values: * GpuCoreUsage: the GPU utilization. * GpuMemoryUsage: the GPU memory utilization. * CpuCoreUsage: the CPU utilization. * MemoryUsage: the memory utilization. * NetworkInputRate: the network ingress rate. * NetworkOutputRate: the network egress rate. * DiskReadRate: the disk read rate. * DiskWriteRate: the disk write rate. This parameter is required.', example='GpuCoreUsage'), startTime?: string(name='StartTime', description='The beginning of the time range to query.', example='2020-11-08T15:00:00Z'), timeStep?: string(name='TimeStep', description='The interval at which metrics are returned. Unit: minutes.', example='15m'), } model GetInstanceMetricsResponseBody = { code?: string(name='Code', description='The status code. Valid values: * InternalError: an internal error. All errors, except for parameter validation errors, are classified as internal errors. * ValidationError: a parameter validation error.', example='null'), httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code. Valid values: * 400 * 404', example='null'), instanceId?: string(name='InstanceId', description='The instance ID.', example='dsw-730xxxxxxxxxx'), message?: string(name='Message', description='The response message.', example='"XXX"'), podMetrics?: [ { metrics?: [ { time?: long(name='Time', description='The timestamp corresponding to the metric.', example='1670890560'), value?: float(name='Value', description='The metric value.', example='25.901031'), } ](name='Metrics', description='The metrics of the pod that corresponds to the instance.'), podId?: string(name='PodId', description='The ID of the pod that corresponds to the instance.', example='dsw-15870-695f44c5bc-hd6xm'), } ](name='PodMetrics', description='The information about the metrics of the pod that corresponds to the instance.'), requestId?: string(name='RequestId', description='The request ID.', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', description='Indicates whether the request was successful. * true * false', example='true'), } model GetInstanceMetricsResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: GetInstanceMetricsResponseBody(name='body'), } /** * @summary Queries the resource metrics of an instance. * * @param request GetInstanceMetricsRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return GetInstanceMetricsResponse */ async function getInstanceMetricsWithOptions(InstanceId: string, request: GetInstanceMetricsRequest, headers: map[string]string, runtime: $RuntimeOptions): GetInstanceMetricsResponse { request.validate(); var query : map[string]any = {}; if (!$isNull(request.endTime)) { query['EndTime'] = request.endTime; } if (!$isNull(request.metricType)) { query['MetricType'] = request.metricType; } if (!$isNull(request.startTime)) { query['StartTime'] = request.startTime; } if (!$isNull(request.timeStep)) { query['TimeStep'] = request.timeStep; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApiUtil.Params{ action = 'GetInstanceMetrics', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instance/${$URL.percentEncode(InstanceId)}/metrics`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Queries the resource metrics of an instance. * * @param request GetInstanceMetricsRequest * @return GetInstanceMetricsResponse */ async function getInstanceMetrics(InstanceId: string, request: GetInstanceMetricsRequest): GetInstanceMetricsResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return getInstanceMetricsWithOptions(InstanceId, request, headers, runtime); } model GetInstanceShutdownTimerResponseBody = { code?: string(name='Code', example='null'), dueTime?: string(name='DueTime', example='2021-01-12T14:36:01Z'), gmtCreateTime?: string(name='GmtCreateTime', example='2021-01-12T14:36:01Z'), gmtModifiedTime?: string(name='GmtModifiedTime', example='2021-01-12T14:36:01Z'), httpStatusCode?: int32(name='HttpStatusCode', example='null'), instanceId?: string(name='InstanceId', example='dsw-730xxxxxxxxxx'), message?: string(name='Message', example='"XXX"'), remainingTimeInMs?: long(name='RemainingTimeInMs', example='3600000'), requestId?: string(name='RequestId', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', example='true'), } model GetInstanceShutdownTimerResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: GetInstanceShutdownTimerResponseBody(name='body'), } /** * @summary 获取定时关机任务 * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return GetInstanceShutdownTimerResponse */ async function getInstanceShutdownTimerWithOptions(InstanceId: string, headers: map[string]string, runtime: $RuntimeOptions): GetInstanceShutdownTimerResponse { var req = new OpenApiUtil.OpenApiRequest{ headers = headers, }; var params = new OpenApiUtil.Params{ action = 'GetInstanceShutdownTimer', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}/shutdowntimer`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 获取定时关机任务 * * @return GetInstanceShutdownTimerResponse */ async function getInstanceShutdownTimer(InstanceId: string): GetInstanceShutdownTimerResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return getInstanceShutdownTimerWithOptions(InstanceId, headers, runtime); } model GetInstanceSnapshotResponseBody = { code?: string(name='Code', example='null'), excludePaths?: [ string ](name='ExcludePaths'), gmtCreateTime?: string(name='GmtCreateTime', example='2021-01-12T14:36:01Z'), gmtModifiedTime?: string(name='GmtModifiedTime', example='2021-01-12T14:36:01Z'), httpStatusCode?: int32(name='HttpStatusCode', example='null'), imageId?: string(name='ImageId', example='image-05cefd0be2exxxx'), imageUrl?: string(name='ImageUrl', example='registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu'), instanceId?: string(name='InstanceId', example='dsw-730xxxxxxxxxx'), labels?: [ { key?: string(name='Key', example='stsTokenOwner'), value?: string(name='Value', example='123xxxxxxxx'), } ](name='Labels', example='{\\"foo\\": \\"bar\\"}'), message?: string(name='Message', example='"XXX"'), reasonCode?: string(name='ReasonCode', example='Internal Error'), reasonMessage?: string(name='ReasonMessage', example='ImagePullBackOff'), requestId?: string(name='RequestId', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), snapshotId?: string(name='SnapshotId', example='snp-05cexxxxxxxxx'), snapshotName?: string(name='SnapshotName', example='training_data_env'), status?: string(name='Status', example='Pushing'), success?: boolean(name='Success', example='true'), } model GetInstanceSnapshotResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: GetInstanceSnapshotResponseBody(name='body'), } /** * @summary 获取实例快照详情 * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return GetInstanceSnapshotResponse */ async function getInstanceSnapshotWithOptions(InstanceId: string, SnapshotId: string, headers: map[string]string, runtime: $RuntimeOptions): GetInstanceSnapshotResponse { var req = new OpenApiUtil.OpenApiRequest{ headers = headers, }; var params = new OpenApiUtil.Params{ action = 'GetInstanceSnapshot', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}/snapshots/${$URL.percentEncode(SnapshotId)}`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 获取实例快照详情 * * @return GetInstanceSnapshotResponse */ async function getInstanceSnapshot(InstanceId: string, SnapshotId: string): GetInstanceSnapshotResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return getInstanceSnapshotWithOptions(InstanceId, SnapshotId, headers, runtime); } model GetLifecycleRequest { endTime?: string(name='EndTime', description='The end of the time range to query.', example='2020-11-08T15:00:00Z'), limit?: int32(name='Limit', description='The number of sessions to query.', example='1'), order?: string(name='Order', description='The sorting order of the results. Valid values: * ASC: sorted by time in ascending order. * DESC: sorted by time in descending order.', example='DESC'), sessionNumber?: int32(name='SessionNumber', description='A session refers to the process of an instance from startup to failure or shutdown. The sessionNumber indicates the offset value for the instance\\\\"s session sequence.', example='1'), startTime?: string(name='StartTime', description='The beginning of the time range to query.', example='2020-11-08T15:00:00Z'), token?: string(name='Token', description='The token used to share the URL.'), } model GetLifecycleResponseBody = { code?: string(name='Code', description='The status code. Valid values: * InternalError: All errors, except for parameter validation errors, are internal errors. * ValidationError: A parameter validation error.', example='null'), lifecycle?: [[ { status?: string(name='Status', description='The status of the instance. Valid values: * Creating * SaveFailed: The instance image failed to be saved. * Stopped * Failed * ResourceAllocating * Stopping * Updating * Saving * Starting * Running * Saved * EnvPreparing: Preparing environment. * ArrearStopping: The service is being stopped due to overdue payments. * Arrearge: The service is stopped due to overdue payments. * Queuing * Recovering', example='Starting'), reasonCode?: string(name='ReasonCode', description='The reason code that corresponds to an event.', example='“”'), reasonMessage?: string(name='ReasonMessage', description='The reason message that corresponds to an event.', example='“”'), gmtCreateTime?: string(name='GmtCreateTime', description='The time the status was created, specifically the time the instance transitioned to this status (in GMT).', example='2022-10-21T07:27:44Z'), } ] ](name='Lifecycle', description='The lifecycle details.', example='[[{"Status":"Creating","GmtCreateTime":"2022-09-19T22:38:00Z","Reason":"","ReasonCode":""}]]'), message?: string(name='Message', description='The returned message.', example='"XXX"'), requestId?: string(name='RequestId', description='The request ID.', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values: * true * false', example='true'), totalCount?: int32(name='TotalCount', description='The total number of queried sessions.', example='35'), } model GetLifecycleResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: GetLifecycleResponseBody(name='body'), } /** * @summary Obtains the lifecycle of an instance * * @description Obtains the lifecycle transition information for an instance, including details on the status an instance transitions to at a specific point in time. * * @param request GetLifecycleRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return GetLifecycleResponse */ async function getLifecycleWithOptions(InstanceId: string, request: GetLifecycleRequest, headers: map[string]string, runtime: $RuntimeOptions): GetLifecycleResponse { request.validate(); var query : map[string]any = {}; if (!$isNull(request.endTime)) { query['EndTime'] = request.endTime; } if (!$isNull(request.limit)) { query['Limit'] = request.limit; } if (!$isNull(request.order)) { query['Order'] = request.order; } if (!$isNull(request.sessionNumber)) { query['SessionNumber'] = request.sessionNumber; } if (!$isNull(request.startTime)) { query['StartTime'] = request.startTime; } if (!$isNull(request.token)) { query['Token'] = request.token; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApiUtil.Params{ action = 'GetLifecycle', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}/lifecycle`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Obtains the lifecycle of an instance * * @description Obtains the lifecycle transition information for an instance, including details on the status an instance transitions to at a specific point in time. * * @param request GetLifecycleRequest * @return GetLifecycleResponse */ async function getLifecycle(InstanceId: string, request: GetLifecycleRequest): GetLifecycleResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return getLifecycleWithOptions(InstanceId, request, headers, runtime); } model GetMetricsRequest { dimensions?: string(name='Dimensions', example='{"userId":"16122852825*****","jobId":"dsw-328d2bbf605*****","regionId":"cn-wulanchabu","pod":"dsw-45680-76766f8778-95gxh"}'), endTime?: string(name='EndTime', example='2020-11-08T16:00:00Z'), length?: string(name='Length', example='10'), metricName?: string(name='MetricName', example='INSTANCE_SPEC_MEMORY_SWAP'), namespace?: string(name='Namespace', example='acs_pai_dsw'), nextToken?: string(name='NextToken', example='15761485350009dd70bb64cff1f0fff750b08ffff073be5fb1e785e2b020f1a949d5ea14aea7fed82f01dd8****'), period?: string(name='Period', example='60'), startTime?: string(name='StartTime', example='2020-11-08T15:00:00Z'), } model GetMetricsResponseBody = { code?: string(name='Code', example='200'), datapoints?: string(name='Datapoints'), message?: string(name='Message', example='Succeed'), nextToken?: string(name='NextToken', example='15761485350009dd70bb64cff1f0fff750b08ffff073be5fb1e785e2b020f1a949d5ea14aea7fed82f01dd8****'), period?: string(name='Period', example='60'), requestId?: string(name='RequestId', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E'), success?: boolean(name='Success', example='true'), } model GetMetricsResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: GetMetricsResponseBody(name='body'), } /** * @summary 获取metrics数据 * * @param request GetMetricsRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return GetMetricsResponse */ async function getMetricsWithOptions(InstanceId: string, request: GetMetricsRequest, headers: map[string]string, runtime: $RuntimeOptions): GetMetricsResponse { request.validate(); var query : map[string]any = {}; if (!$isNull(request.dimensions)) { query['Dimensions'] = request.dimensions; } if (!$isNull(request.endTime)) { query['EndTime'] = request.endTime; } if (!$isNull(request.length)) { query['Length'] = request.length; } if (!$isNull(request.metricName)) { query['MetricName'] = request.metricName; } if (!$isNull(request.namespace)) { query['Namespace'] = request.namespace; } if (!$isNull(request.nextToken)) { query['NextToken'] = request.nextToken; } if (!$isNull(request.period)) { query['Period'] = request.period; } if (!$isNull(request.startTime)) { query['StartTime'] = request.startTime; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApiUtil.Params{ action = 'GetMetrics', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instance/${$URL.percentEncode(InstanceId)}/cms/metrics`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 获取metrics数据 * * @param request GetMetricsRequest * @return GetMetricsResponse */ async function getMetrics(InstanceId: string, request: GetMetricsRequest): GetMetricsResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return getMetricsWithOptions(InstanceId, request, headers, runtime); } model GetResourceGroupStatisticsRequest { endTime?: string(name='EndTime', description='This parameter is required.', example='2020-11-08T15:00:00Z'), resourceId?: string(name='ResourceId', description='This parameter is required.', example='rg-123456789'), startTime?: string(name='StartTime', description='This parameter is required.', example='2020-11-08T15:00:00Z'), workspaceIds?: string(name='WorkspaceIds', description='This parameter is required.', example='27218,34956'), } model GetResourceGroupStatisticsResponseBody = { code?: string(name='Code', example='InternalError'), httpStatusCode?: int32(name='HttpStatusCode', example='400'), message?: string(name='Message', example='"XXX"'), requestId?: string(name='RequestId', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), statistics?: map[string]object(name='Statistics'), success?: boolean(name='Success', example='true'), } model GetResourceGroupStatisticsResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: GetResourceGroupStatisticsResponseBody(name='body'), } /** * @param request GetResourceGroupStatisticsRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return GetResourceGroupStatisticsResponse */ async function getResourceGroupStatisticsWithOptions(request: GetResourceGroupStatisticsRequest, headers: map[string]string, runtime: $RuntimeOptions): GetResourceGroupStatisticsResponse { request.validate(); var query : map[string]any = {}; if (!$isNull(request.endTime)) { query['EndTime'] = request.endTime; } if (!$isNull(request.resourceId)) { query['ResourceId'] = request.resourceId; } if (!$isNull(request.startTime)) { query['StartTime'] = request.startTime; } if (!$isNull(request.workspaceIds)) { query['WorkspaceIds'] = request.workspaceIds; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApiUtil.Params{ action = 'GetResourceGroupStatistics', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/resourcegroupstatistics`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @param request GetResourceGroupStatisticsRequest * @return GetResourceGroupStatisticsResponse */ async function getResourceGroupStatistics(request: GetResourceGroupStatisticsRequest): GetResourceGroupStatisticsResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return getResourceGroupStatisticsWithOptions(request, headers, runtime); } model GetTokenRequest { expireTime?: int32(name='ExpireTime', description='The validity period. Unit: seconds.', example='60'), instanceId?: string(name='InstanceId', description='The instance ID. This parameter is required.', example='dsw-730xxxxxxxxxx'), } model GetTokenResponseBody = { code?: string(name='Code', description='The status code. Valid values: * InternalError: All errors, except for parameter validation errors, are internal errors. * ValidationError: A parameter validation error.', example='ValidationError'), message?: string(name='Message', description='The error message.', example='"XXX"'), requestId?: string(name='RequestId', description='The request ID.', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values: * true * false', example='true'), token?: string(name='Token', description='The temporary authentication information of the DSW instance.', example='*******'), } model GetTokenResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: GetTokenResponseBody(name='body'), } /** * @summary Obtains the temporary authentication information of a DSW instance. * * @param request GetTokenRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return GetTokenResponse */ async function getTokenWithOptions(request: GetTokenRequest, headers: map[string]string, runtime: $RuntimeOptions): GetTokenResponse { request.validate(); var query : map[string]any = {}; if (!$isNull(request.expireTime)) { query['ExpireTime'] = request.expireTime; } if (!$isNull(request.instanceId)) { query['InstanceId'] = request.instanceId; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApiUtil.Params{ action = 'GetToken', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/tokens`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Obtains the temporary authentication information of a DSW instance. * * @param request GetTokenRequest * @return GetTokenResponse */ async function getToken(request: GetTokenRequest): GetTokenResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return getTokenWithOptions(request, headers, runtime); } model GetUserConfigResponseBody = { accountSufficient?: boolean(name='AccountSufficient', example='false'), code?: string(name='Code', example='null'), enableEciDisk?: boolean(name='EnableEciDisk', example='true'), freeTier?: { endTime?: string(name='EndTime', example='2020-11-08T15:00:00Z'), initBaseUnit?: string(name='InitBaseUnit', example='个'), initBaseValue?: double(name='InitBaseValue', example='5000'), initShowUnit?: string(name='InitShowUnit', example='个'), initShowValue?: string(name='InitShowValue', example='5000'), isFreeTierUser?: boolean(name='IsFreeTierUser', example='true'), periodBaseUnit?: string(name='PeriodBaseUnit', example='个'), periodBaseValue?: double(name='PeriodBaseValue', example='3000'), periodShowUnit?: string(name='PeriodShowUnit', example='个'), periodShowValue?: string(name='PeriodShowValue', example='3000'), startTime?: string(name='StartTime', example='2020-11-08T15:00:00Z'), status?: string(name='Status', example='valid'), }(name='FreeTier'), freeTierSpecAvailable?: boolean(name='FreeTierSpecAvailable', example='true'), httpStatusCode?: int32(name='HttpStatusCode', example='null'), message?: string(name='Message', example='"Access denied"'), requestId?: string(name='RequestId', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', example='true'), } model GetUserConfigResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: GetUserConfigResponseBody(name='body'), } /** * @summary 获取用户配置 * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return GetUserConfigResponse */ async function getUserConfigWithOptions(headers: map[string]string, runtime: $RuntimeOptions): GetUserConfigResponse { var req = new OpenApiUtil.OpenApiRequest{ headers = headers, }; var params = new OpenApiUtil.Params{ action = 'GetUserConfig', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/userconfig`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 获取用户配置 * * @return GetUserConfigResponse */ async function getUserConfig(): GetUserConfigResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return getUserConfigWithOptions(headers, runtime); } model ListEcsSpecsRequest { acceleratorType?: string(name='AcceleratorType', description='The accelerator type. * CPU: Only CPU computing is used. * GPU: GPUs are used to accelerate computing. This parameter is required.', example='CPU'), order?: string(name='Order', description='The sorting order. Valid values: * ASC * DESC', example='DESC'), pageNumber?: long(name='PageNumber', description='The page number. Pages start from page 1. Default value: 1.', example='1'), pageSize?: long(name='PageSize', description='The number of entries per page.', example='10'), sortBy?: string(name='SortBy', description='The field by which the query results are sorted. Set the value to gmtCreate.', example='gmtCreate'), } model ListEcsSpecsResponseBody = { code?: string(name='Code', description='The status code. Valid values: * InternalError: an internal error. All errors, except for parameter validation errors, are classified as internal errors. * ValidationError: a parameter validation error.', example='null'), ecsSpecs?: [ { acceleratorType?: string(name='AcceleratorType', description='The accelerator type.', example='CPU'), CPU?: long(name='CPU', description='The number of vCPUs.', example='32'), currency?: string(name='Currency', description='The currency unit.', example='CNY'), GPU?: long(name='GPU', description='The number of GPUs.', example='4'), GPUMemorySize?: float(name='GPUMemorySize'), GPUType?: string(name='GPUType', description='The GPU type. Valid values: * V100 * A100 * A10 * T4 * P100', example='v100'), instanceBandwidthRx?: long(name='InstanceBandwidthRx', description='The inbound bandwidth of the instance.', example='5120000'), instanceType?: string(name='InstanceType', description='The instance type.', example='ecs.gn5-c28g1.7xlarge'), isAvailable?: boolean(name='IsAvailable', description='Indicates whether the resource was available.', example='True'), labels?: [ { key?: string(name='Key', description='The label key added to the ECS specification.', example='SupportResourcePackDeduction'), value?: string(name='Value', description='The label value added to the ECS specification.', example='true'), } ](name='Labels', description='The labels of the ECS specification.', example='{\\\\"foo\\\\": \\\\"bar\\\\"}'), memory?: float(name='Memory', description='The memory size. Unit: GB.', example='32'), price?: double(name='Price', description='The price.', example='22.8'), spotStockStatus?: string(name='SpotStockStatus'), systemDiskCapacity?: long(name='SystemDiskCapacity', description='The size of the system disk. Unit: GB.', example='500'), } ](name='EcsSpecs', description='The specifications of the ECS instances returned on this page.'), httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code. Valid values: * 400 * 404', example='null'), message?: string(name='Message', description='The response message.', example='"XXX"'), requestId?: string(name='RequestId', description='The request ID.', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values: * true * false', example='true'), totalCount?: long(name='TotalCount', description='The total number of ECS instances.', example='35'), } model ListEcsSpecsResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: ListEcsSpecsResponseBody(name='body'), } /** * @summary Queries a list of specifications of ECS instances. * * @param request ListEcsSpecsRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return ListEcsSpecsResponse */ async function listEcsSpecsWithOptions(request: ListEcsSpecsRequest, headers: map[string]string, runtime: $RuntimeOptions): ListEcsSpecsResponse { request.validate(); var query : map[string]any = {}; if (!$isNull(request.acceleratorType)) { query['AcceleratorType'] = request.acceleratorType; } if (!$isNull(request.order)) { query['Order'] = request.order; } if (!$isNull(request.pageNumber)) { query['PageNumber'] = request.pageNumber; } if (!$isNull(request.pageSize)) { query['PageSize'] = request.pageSize; } if (!$isNull(request.sortBy)) { query['SortBy'] = request.sortBy; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApiUtil.Params{ action = 'ListEcsSpecs', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/ecsspecs`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Queries a list of specifications of ECS instances. * * @param request ListEcsSpecsRequest * @return ListEcsSpecsResponse */ async function listEcsSpecs(request: ListEcsSpecsRequest): ListEcsSpecsResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return listEcsSpecsWithOptions(request, headers, runtime); } model ListInstanceSnapshotRequest { order?: string(name='Order', example='DESC'), pageNumber?: long(name='PageNumber', example='1'), pageSize?: long(name='PageSize', example='10'), sortBy?: string(name='SortBy', example='gmtCreate'), } model ListInstanceSnapshotResponseBody = { code?: string(name='Code', example='null'), httpStatusCode?: int32(name='HttpStatusCode', example='null'), message?: string(name='Message', example='"XXX"'), requestId?: string(name='RequestId', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), snapshots?: [ { excludePaths?: [ string ](name='ExcludePaths', example='["/path1","/path2"]'), gmtCreateTime?: string(name='GmtCreateTime', example='2021-01-12T14:36:01Z'), gmtModifiedTime?: string(name='GmtModifiedTime', example='2021-01-12T14:36:01Z'), imageId?: string(name='ImageId', example='image-05cefd0be2exxxx'), imageUrl?: string(name='ImageUrl', example='registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu'), instanceId?: string(name='InstanceId', example='dsw-730xxxxxxxxxx'), labels?: [ { key?: string(name='Key', example='stsTokenOwner'), value?: string(name='Value', example='123xxxxxxxx'), } ](name='Labels', example='{\\\\"foo\\\\": \\\\"bar\\\\"}'), reasonCode?: string(name='ReasonCode', example='Internal Error'), reasonMessage?: string(name='ReasonMessage', example='ImagePullBackOff'), snapshotId?: string(name='SnapshotId', example='snp-05cexxxxxxxxx'), snapshotName?: string(name='SnapshotName', example='training_data_env'), status?: string(name='Status', example='Pushing'), } ](name='Snapshots'), success?: boolean(name='Success', example='true'), totalCount?: long(name='TotalCount', example='35'), } model ListInstanceSnapshotResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: ListInstanceSnapshotResponseBody(name='body'), } /** * @summary 查询实例快照列表 * * @param request ListInstanceSnapshotRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return ListInstanceSnapshotResponse */ async function listInstanceSnapshotWithOptions(InstanceId: string, request: ListInstanceSnapshotRequest, headers: map[string]string, runtime: $RuntimeOptions): ListInstanceSnapshotResponse { request.validate(); var query : map[string]any = {}; if (!$isNull(request.order)) { query['Order'] = request.order; } if (!$isNull(request.pageNumber)) { query['PageNumber'] = request.pageNumber; } if (!$isNull(request.pageSize)) { query['PageSize'] = request.pageSize; } if (!$isNull(request.sortBy)) { query['SortBy'] = request.sortBy; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApiUtil.Params{ action = 'ListInstanceSnapshot', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}/snapshots`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 查询实例快照列表 * * @param request ListInstanceSnapshotRequest * @return ListInstanceSnapshotResponse */ async function listInstanceSnapshot(InstanceId: string, request: ListInstanceSnapshotRequest): ListInstanceSnapshotResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return listInstanceSnapshotWithOptions(InstanceId, request, headers, runtime); } model ListInstanceStatisticsRequest { workspaceIds?: string(name='WorkspaceIds', description='This parameter is required.', example='27218,34956'), } model ListInstanceStatisticsResponseBody = { code?: string(name='Code', example='InternalError'), httpStatusCode?: int32(name='HttpStatusCode', example='400'), message?: string(name='Message', example='"XXX"'), requestId?: string(name='RequestId', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), statistics?: map[string]object(name='Statistics'), success?: boolean(name='Success', example='true'), } model ListInstanceStatisticsResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: ListInstanceStatisticsResponseBody(name='body'), } /** * @summary 获取实例统计信息 * * @param request ListInstanceStatisticsRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return ListInstanceStatisticsResponse */ async function listInstanceStatisticsWithOptions(request: ListInstanceStatisticsRequest, headers: map[string]string, runtime: $RuntimeOptions): ListInstanceStatisticsResponse { request.validate(); var query : map[string]any = {}; if (!$isNull(request.workspaceIds)) { query['WorkspaceIds'] = request.workspaceIds; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApiUtil.Params{ action = 'ListInstanceStatistics', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instancestatistics`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 获取实例统计信息 * * @param request ListInstanceStatisticsRequest * @return ListInstanceStatisticsResponse */ async function listInstanceStatistics(request: ListInstanceStatisticsRequest): ListInstanceStatisticsResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return listInstanceStatisticsWithOptions(request, headers, runtime); } model ListInstancesRequest { acceleratorType?: string(name='AcceleratorType', description='The accelerator type. * CPU: Only CPU computing is used. * GPU: GPUs are used to accelerate computing.', example='CPU'), accessibility?: string(name='Accessibility', description='The accessibility. Valid values: * PRIVATE (default): The instances are accessible only to you and the administrator of the workspace. * PUBLIC: The instances are accessible only to all members in the workspace.', example='PRIVATE'), createUserId?: string(name='CreateUserId', description='The UID of the creator.', example='12345*****67890'), gpuType?: string(name='GpuType', description='The GPU type.', example='NVIDIA A10'), imageName?: string(name='ImageName', description='The image name.', example='modelscope:1.9.4-pytorch2.0.1tensorflow2.13.0-cpu-py38-ubuntu20.04'), instanceId?: string(name='InstanceId', description='The instance ID. You can call [ListInstances](https://help.aliyun.com/document_detail/470439.html) to obtain the instance ID.', example='dsw-730xxxxxxxxxx'), instanceName?: string(name='InstanceName', description='The instance name.', example='training_data'), labels?: map[string]any(name='Labels', description='The labels. A maximum of four labels are supported.', example='{ "key1": "value1", "key2": "value2", "key3": "value3" }'), maxCpu?: string(name='MaxCpu', description='The maximum number of CPUs. Unit: 0.001 CPU. The value 1000 indicates one CPU.', example='30000'), maxGpu?: string(name='MaxGpu', description='The maximum number of GPUs. Unit: 0.001 GPU. The value 1000 indicates one GPU.', example='8000'), maxGpuMemory?: string(name='MaxGpuMemory', description='The maximum memory size per GPU card. Unit: GB.', example='16'), maxMemory?: string(name='MaxMemory', description='The maximum memory size. Unit: GB.', example='48'), minCpu?: string(name='MinCpu', description='The minimum number of CPUs. Unit: 0.001 CPU. The value 1000 indicates one CPU.', example='2000'), minGpu?: string(name='MinGpu', description='The minimum number of GPUs. Unit: 0.001 GPU. The value 1000 indicates one GPU.', example='100'), minGpuMemory?: string(name='MinGpuMemory', description='The minimum memory size per GPU card. Unit: GB.', example='8'), minMemory?: string(name='MinMemory', description='The minimum memory size. Unit: GB.', example='4'), order?: string(name='Order', description='The order that you use to sort the query results. Valid values: * ASC * DESC', example='DESC'), oversoldInfo?: string(name='OversoldInfo'), oversoldType?: string(name='OversoldType'), pageNumber?: long(name='PageNumber', description='The page number. Pages start from page 1. Default value: 1.', example='1'), pageSize?: long(name='PageSize', description='The number of entries per page.', example='10'), paymentType?: string(name='PaymentType', description='The billing method. Valid values: * PayAsYouGo * Subscription', example='PayAsYouGo'), resourceId?: string(name='ResourceId', description='The resource group ID. If you leave this parameter empty, the instances in the pay-as-you-go resource group are queried. If you set this parameter to ALL, all instances are queried.', example='rg-123456789'), sortBy?: string(name='SortBy', description='The field that you use to sort the query results. Valid values: * Priority * GmtCreateTime * GmtModifiedTime', example='gmtCreate'), status?: string(name='Status', description='The instance status. Valid values: * Creating * SaveFailed * Stopped * Failed * ResourceAllocating * Stopping * Updating * Saving * Queuing * Recovering * Starting * Running * Saved * Deleting * EnvPreparing', example='Running'), tag?: [ { key?: string(name='Key', description='The tag key.', example='tag1'), value?: string(name='Value', description='The tag value.', example='value1'), } ](name='Tag', description='The tags.'), workspaceId?: string(name='WorkspaceId', description='The workspace ID. You can call [ListWorkspaces](https://help.aliyun.com/document_detail/449124.html) to obtain the workspace ID.', example='40823'), } model ListInstancesShrinkRequest { acceleratorType?: string(name='AcceleratorType', description='The accelerator type. * CPU: Only CPU computing is used. * GPU: GPUs are used to accelerate computing.', example='CPU'), accessibility?: string(name='Accessibility', description='The accessibility. Valid values: * PRIVATE (default): The instances are accessible only to you and the administrator of the workspace. * PUBLIC: The instances are accessible only to all members in the workspace.', example='PRIVATE'), createUserId?: string(name='CreateUserId', description='The UID of the creator.', example='12345*****67890'), gpuType?: string(name='GpuType', description='The GPU type.', example='NVIDIA A10'), imageName?: string(name='ImageName', description='The image name.', example='modelscope:1.9.4-pytorch2.0.1tensorflow2.13.0-cpu-py38-ubuntu20.04'), instanceId?: string(name='InstanceId', description='The instance ID. You can call [ListInstances](https://help.aliyun.com/document_detail/470439.html) to obtain the instance ID.', example='dsw-730xxxxxxxxxx'), instanceName?: string(name='InstanceName', description='The instance name.', example='training_data'), labelsShrink?: string(name='Labels', description='The labels. A maximum of four labels are supported.', example='{ "key1": "value1", "key2": "value2", "key3": "value3" }'), maxCpu?: string(name='MaxCpu', description='The maximum number of CPUs. Unit: 0.001 CPU. The value 1000 indicates one CPU.', example='30000'), maxGpu?: string(name='MaxGpu', description='The maximum number of GPUs. Unit: 0.001 GPU. The value 1000 indicates one GPU.', example='8000'), maxGpuMemory?: string(name='MaxGpuMemory', description='The maximum memory size per GPU card. Unit: GB.', example='16'), maxMemory?: string(name='MaxMemory', description='The maximum memory size. Unit: GB.', example='48'), minCpu?: string(name='MinCpu', description='The minimum number of CPUs. Unit: 0.001 CPU. The value 1000 indicates one CPU.', example='2000'), minGpu?: string(name='MinGpu', description='The minimum number of GPUs. Unit: 0.001 GPU. The value 1000 indicates one GPU.', example='100'), minGpuMemory?: string(name='MinGpuMemory', description='The minimum memory size per GPU card. Unit: GB.', example='8'), minMemory?: string(name='MinMemory', description='The minimum memory size. Unit: GB.', example='4'), order?: string(name='Order', description='The order that you use to sort the query results. Valid values: * ASC * DESC', example='DESC'), oversoldInfo?: string(name='OversoldInfo'), oversoldType?: string(name='OversoldType'), pageNumber?: long(name='PageNumber', description='The page number. Pages start from page 1. Default value: 1.', example='1'), pageSize?: long(name='PageSize', description='The number of entries per page.', example='10'), paymentType?: string(name='PaymentType', description='The billing method. Valid values: * PayAsYouGo * Subscription', example='PayAsYouGo'), resourceId?: string(name='ResourceId', description='The resource group ID. If you leave this parameter empty, the instances in the pay-as-you-go resource group are queried. If you set this parameter to ALL, all instances are queried.', example='rg-123456789'), sortBy?: string(name='SortBy', description='The field that you use to sort the query results. Valid values: * Priority * GmtCreateTime * GmtModifiedTime', example='gmtCreate'), status?: string(name='Status', description='The instance status. Valid values: * Creating * SaveFailed * Stopped * Failed * ResourceAllocating * Stopping * Updating * Saving * Queuing * Recovering * Starting * Running * Saved * Deleting * EnvPreparing', example='Running'), tagShrink?: string(name='Tag', description='The tags.'), workspaceId?: string(name='WorkspaceId', description='The workspace ID. You can call [ListWorkspaces](https://help.aliyun.com/document_detail/449124.html) to obtain the workspace ID.', example='40823'), } model ListInstancesResponseBody = { code?: string(name='Code', description='The status code. Valid values: * InternalError: an internal error. All errors, except for parameter validation errors, are classified as internal errors. * ValidationError: a parameter validation error.', example='null'), httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code. Valid values: * 400 * 404', example='null'), instances?: [ { acceleratorType?: string(name='AcceleratorType', description='The accelerator type of the instance. Valid values: * CPU * GPU', example='CPU'), accessibility?: string(name='Accessibility', description='The accessibility. Valid values: * PRIVATE (default): The instances are accessible only to you and the administrator of the workspace. * PUBLIC: The instances are accessible only to all members in the workspace.', example='PRIVATE'), accumulatedRunningTimeInMs?: long(name='AccumulatedRunningTimeInMs', description='The accumulated running duration. Unit: milliseconds.', example='3600000'), affinity?: { CPU?: { enable?: boolean(name='Enable', description='Indicates whether the CPU affinity feature was enabled. true false', example='true'), }(name='CPU', description='The CPU affinity configuration. Only subscription instances that use general-purpose computing resources support CPU affinity configuration.'), }(name='Affinity', description='The affinity configuration.'), cloudDisks?: [ { capacity?: string(name='Capacity', description='The cloud disk capacity.', example='30Gi'), mountPath?: string(name='MountPath', description='The mount path of the cloud disk in the container.', example='/mmt/workspace'), path?: string(name='Path', description='The directory on the cloud disk that is mounted to the container.', example='/workspace'), subType?: string(name='SubType', description='The cloud disk type. The value rootfs indicates that the cloud disk is used as the root file system (rootfs).', example='rootfs'), } ](name='CloudDisks', description='The cloud disks of the instance.', example='[]'), credentialConfig?: CredentialConfig(name='CredentialConfig', description='The credential configuration.'), datasets?: [ { datasetId?: string(name='DatasetId', description='The dataset ID.', example='d-vsqjvsjp4orp5l206u'), datasetVersion?: string(name='DatasetVersion', description='The dataset version.', example='v1'), dynamic?: boolean(name='Dynamic', description='Indicates whether dynamic mounting was enabled. Default value: false.', example='false'), mountAccess?: string(name='MountAccess', description='The read and write permissions. Valid values: RW and RO.', example='RW'), mountPath?: string(name='MountPath', description='The mount path in the container.', example='/mnt/data'), optionType?: string(name='OptionType', description='The type of the mount option.', example='FastReadWrite'), options?: string(name='Options', description='The mount type of the dataset.', example='{ "fs.oss.download.thread.concurrency": "10", "fs.oss.upload.thread.concurrency": "10", "fs.jindo.args": "-oattr_timeout=3 -oentry_timeout=0 -onegative_timeout=0 -oauto_cache -ono_symlink" }'), uri?: string(name='Uri', description='The dataset URI.', example='oss://bucket-name.oss-cn-shanghai-internal.aliyuncs.com/data/path/'), } ](name='Datasets', description='The datasets.'), driver?: string(name='Driver', description='The NVIDIA driver configuration.', example='535.54.03'), dynamicMount?: DynamicMount(name='DynamicMount', description='The dynamic mount configurations.'), ecsSpec?: string(name='EcsSpec', description='The ECS instance type of the instance.', example='ecs.c6.large'), environmentVariables?: map[string]string(name='EnvironmentVariables', description='The environment variables.', example='{userName: "Chris"}'), gmtCreateTime?: string(name='GmtCreateTime', description='The time when the instance was created.', example='2021-01-12T14:36:01Z'), gmtModifiedTime?: string(name='GmtModifiedTime', description='The time when the instance was modified.', example='2021-01-12T14:36:01Z'), idleInstanceCuller?: { cpuPercentThreshold?: int32(name='CpuPercentThreshold', description='The CPU utilization threshold. Unit: percentage. Valid values: 1 to 100. If the CPU utilization of the instance is lower than this threshold, the instance is considered idle.', example='20'), gpuPercentThreshold?: int32(name='GpuPercentThreshold', description='The GPU utilization threshold. Unit: percentage. Valid values: 1 to 100. This parameter takes effect only if the instance is of the GPU instance type. If both CPU and GPU utilization is lower than the thresholds, the instance is considered idle.', example='10'), idleTimeInMinutes?: int32(name='IdleTimeInMinutes', description='The time duration for which the instance is idle. Unit: minutes.', example='30'), instanceId?: string(name='InstanceId', description='The instance ID.', example='dsw-730xxxxxxxxxx'), maxIdleTimeInMinutes?: int32(name='MaxIdleTimeInMinutes', description='The maximum time duration for which the instance is idle. Unit: minutes. If the time duration for which the instance is idle exceeds this value, the system automatically stops the instance.', example='60'), }(name='IdleInstanceCuller', description='The rule for stopping idle instances.', example='{"InstanceId":"dsw-05cefd0be2e5a278","CpuPercentThreshold":20,"GpuPercentThreshold":10,"MaxIdleTimeInMinutes":120,"IdleTimeInMinutes":30}'), imageAuth?: string(name='ImageAuth', description='The Base64-encoded account and password for the user\\\\"s private image. The password will be hidden.', example='aGFyYm9yYWlAeGltYWxheWE6KioqKioq'), imageId?: string(name='ImageId', description='The image ID.', example='image-05cefd0be2exxxx'), imageName?: string(name='ImageName', description='The image name.', example='py36_cpu_tf1.12_ubuntu'), imageUrl?: string(name='ImageUrl', description='The image address.', example='registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu'), instanceId?: string(name='InstanceId', description='The instance ID.', example='dsw-730xxxxxxxxxx'), instanceName?: string(name='InstanceName', description='The instance name.', example='training_data'), instanceShutdownTimer?: { dueTime?: string(name='DueTime', description='The scheduled stop time.', example='2021-01-12T14:36:01Z'), gmtCreateTime?: string(name='GmtCreateTime', description='The time when the instance was created.', example='2021-01-12T14:36:01Z'), gmtModifiedTime?: string(name='GmtModifiedTime', description='The time when the instance was modified.', example='2021-01-12T14:36:01Z'), instanceId?: string(name='InstanceId', description='The instance ID.', example='dsw-730xxxxxxxxxx'), remainingTimeInMs?: long(name='RemainingTimeInMs', description='The remaining time before the instance is stopped.', example='3600000'), }(name='InstanceShutdownTimer', description='The scheduled stop task.'), instanceSnapshotList?: [ { gmtCreateTime?: string(name='GmtCreateTime', description='The time when the snapshot was created.', example='2021-01-12T14:36:01Z'), gmtModifiedTime?: string(name='GmtModifiedTime', description='The time when the snapshot was modified.', example='2021-01-12T14:36:01Z'), imageId?: string(name='ImageId', description='The image ID.', example='image-05cefd0be2exxxx'), imageName?: string(name='ImageName', description='The image name.', example='py36_cpu_tf1.12_ubuntu'), imageUrl?: string(name='ImageUrl', description='The image URL.', example='registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu'), reasonCode?: string(name='ReasonCode', description='The error code of the instance snapshot.', example='Internal Error'), reasonMessage?: string(name='ReasonMessage', description='The error message of the instance snapshot.', example='ImagePullBackOff'), repositoryUrl?: string(name='RepositoryUrl', description='The URL of the image repository.', example='https://cr.console.aliyun.com/repository/cn-hangzhou/zouxu/kf/images'), status?: string(name='Status', description='The status of the instance snapshot.', example='Pushing'), } ](name='InstanceSnapshotList', description='The instance snapshots.', example='[]'), instanceUrl?: string(name='InstanceUrl', description='The instance URL.', example='https://dsw-cn-shanghai.data.aliyun.com/notebook.htm?instance=39772#/'), jupyterlabUrl?: string(name='JupyterlabUrl', description='The JupyterLab URL.', example='https://dsw-gateway-cn-shanghai.aliyun.com/dsw-39772/lab/'), labels?: [ { key?: string(name='Key', description='The custom label key.', example='stsTokenOwner'), value?: string(name='Value', description='The custom label value.', example='123xxxxxxxx'), } ](name='Labels', description='The custom labels.', example='{\\\\"foo\\\\": \\\\"bar\\\\"}'), latestSnapshot?: { gmtCreateTime?: string(name='GmtCreateTime', description='The time when the snapshot was created.', example='2021-01-12T14:36:01Z'), gmtModifiedTime?: string(name='GmtModifiedTime', description='The time when the snapshot was modified.', example='2021-01-12T14:36:01Z'), imageId?: string(name='ImageId', description='The image ID.', example='image-05cefd0be2exxxx'), imageName?: string(name='ImageName', description='The image name.', example='py36_cpu_tf1.12_ubuntu'), imageUrl?: string(name='ImageUrl', description='The image URL.', example='registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu'), reasonCode?: string(name='ReasonCode', description='The error code of the instance snapshot.', example='Internal Error'), reasonMessage?: string(name='ReasonMessage', description='The error message of the instance snapshot.', example='ImagePullBackOff'), repositoryUrl?: string(name='RepositoryUrl', description='The URL of the image repository.', example='https://cr.console.aliyun.com/repository/cn-hangzhou/zouxu/kf/images'), status?: string(name='Status', description='The status of the instance snapshot.', example='Pushing'), }(name='LatestSnapshot', description='The user image that was latest saved.'), oversoldInfo?: string(name='OversoldInfo'), oversoldType?: string(name='OversoldType'), paymentType?: string(name='PaymentType', description='The billing method. Valid values: * PayAsYouGo * Subscription', example='PayAsYouGo'), priority?: long(name='Priority', description='The priority based on which resources are allocated to instances. Resources are preferentially allocated to instances with higher priorities.', example='1'), reasonCode?: string(name='ReasonCode', description='The error code of the instance.', example='Internal Error'), reasonMessage?: string(name='ReasonMessage', description='The cause of the instance error.', example='ImagePullBackOff'), requestedResource?: { CPU?: string(name='CPU', description='The number of CPU cores.', example='32'), GPU?: string(name='GPU', description='The number of GPUs.', example='4'), GPUType?: string(name='GPUType', description='The GPU memory type.', example='v100'), memory?: string(name='Memory', description='The memory size.', example='32'), sharedMemory?: string(name='SharedMemory', description='The size of the shared memory.', example='32'), }(name='RequestedResource', description='The resource configurations.', example='{"CPU":"4","Memory":"8Gi","SharedMemory":"4Gi","GPU":"1","GPUType":"Tesla-V100-16G"}'), resourceId?: string(name='ResourceId', description='The resource ID. This parameter is valid only if you set PaymentType to Subscription.', example='dsw-123456789'), resourceName?: string(name='ResourceName', description='The specifications. * In pay-as-you-go scenarios, the value is the specifications of the purchased ECS instance type. * In subscription scenarios, the value is the requested number of CPU cores and memory size.', example='resource_group'), status?: string(name='Status', description='The instance status.', example='Running'), tags?: [ { tagKey?: string(name='TagKey', description='The tag key.', example='tag1'), tagValue?: string(name='TagValue', description='The tag value.', example='value1'), } ](name='Tags', description='The tags.'), terminalUrl?: string(name='TerminalUrl', description='The terminal URL.', example='https://dsw-gateway-cn-shanghai.aliyun.com/dsw-39772/tty/'), userId?: string(name='UserId', description='The user ID.', example='1612285282502324'), userName?: string(name='UserName', description='The username.', example='测试用户'), userVpc?: { bandwidthLimit?: BandwidthLimit(name='BandwidthLimit'), defaultRoute?: string(name='DefaultRoute', description='The default route.', example='eth0 | eth1'), extendedCIDRs?: [ string ](name='ExtendedCIDRs', description='The extended CIDR blocks.', example='["192.168.0.1/24", "192.168.1.1/24"]'), forwardInfos?: [ ForwardInfoResponse ](name='ForwardInfos', description='The forward information.'), securityGroupId?: string(name='SecurityGroupId', description='The security group ID.', example='sg-xxxxxx'), vSwitchId?: string(name='VSwitchId', description='The vSwitch ID.', example='vsw-xxxxx'), vpcId?: string(name='VpcId', description='The VPC ID.', example='vpc-xxxxx'), }(name='UserVpc', description='The virtual private cloud (VPC) configurations.'), webIDEUrl?: string(name='WebIDEUrl', description='The Web IDE URL.', example='https://dsw-gateway-cn-shanghai.aliyun.com/dsw-39772/ide/'), workspaceId?: string(name='WorkspaceId', description='The workspace ID.', example='40823'), workspaceName?: string(name='WorkspaceName', description='The workspace name.', example='training_data'), workspaceSource?: string(name='WorkspaceSource', description='The storage for the workspace. If you leave this parameter empty, the workspace uses File Storage NAS (NAS) storage, cloud disks, or local disks in sequence.', example='d-123456789'), } ](name='Instances', description='The instances returned on this page.'), message?: string(name='Message', description='The response message.', example='"XXX"'), requestId?: string(name='RequestId', description='The request ID.', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', description='Indicates whether the request was successful. * true * false', example='true'), totalCount?: long(name='TotalCount', description='The total number of instances.', example='35'), } model ListInstancesResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: ListInstancesResponseBody(name='body'), } /** * @summary Queries a list of Data Science Workshop (DSW) instances. * * @param tmpReq ListInstancesRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return ListInstancesResponse */ async function listInstancesWithOptions(tmpReq: ListInstancesRequest, headers: map[string]string, runtime: $RuntimeOptions): ListInstancesResponse { tmpReq.validate(); var request = new ListInstancesShrinkRequest{}; OpenApiUtil.convert(tmpReq, request); if (!$isNull(tmpReq.labels)) { request.labelsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.labels, 'Labels', 'json'); } if (!$isNull(tmpReq.tag)) { request.tagShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tag, 'Tag', 'json'); } var query : map[string]any = {}; if (!$isNull(request.acceleratorType)) { query['AcceleratorType'] = request.acceleratorType; } if (!$isNull(request.accessibility)) { query['Accessibility'] = request.accessibility; } if (!$isNull(request.createUserId)) { query['CreateUserId'] = request.createUserId; } if (!$isNull(request.gpuType)) { query['GpuType'] = request.gpuType; } if (!$isNull(request.imageName)) { query['ImageName'] = request.imageName; } if (!$isNull(request.instanceId)) { query['InstanceId'] = request.instanceId; } if (!$isNull(request.instanceName)) { query['InstanceName'] = request.instanceName; } if (!$isNull(request.labelsShrink)) { query['Labels'] = request.labelsShrink; } if (!$isNull(request.maxCpu)) { query['MaxCpu'] = request.maxCpu; } if (!$isNull(request.maxGpu)) { query['MaxGpu'] = request.maxGpu; } if (!$isNull(request.maxGpuMemory)) { query['MaxGpuMemory'] = request.maxGpuMemory; } if (!$isNull(request.maxMemory)) { query['MaxMemory'] = request.maxMemory; } if (!$isNull(request.minCpu)) { query['MinCpu'] = request.minCpu; } if (!$isNull(request.minGpu)) { query['MinGpu'] = request.minGpu; } if (!$isNull(request.minGpuMemory)) { query['MinGpuMemory'] = request.minGpuMemory; } if (!$isNull(request.minMemory)) { query['MinMemory'] = request.minMemory; } if (!$isNull(request.order)) { query['Order'] = request.order; } if (!$isNull(request.oversoldInfo)) { query['OversoldInfo'] = request.oversoldInfo; } if (!$isNull(request.oversoldType)) { query['OversoldType'] = request.oversoldType; } if (!$isNull(request.pageNumber)) { query['PageNumber'] = request.pageNumber; } if (!$isNull(request.pageSize)) { query['PageSize'] = request.pageSize; } if (!$isNull(request.paymentType)) { query['PaymentType'] = request.paymentType; } if (!$isNull(request.resourceId)) { query['ResourceId'] = request.resourceId; } if (!$isNull(request.sortBy)) { query['SortBy'] = request.sortBy; } if (!$isNull(request.status)) { query['Status'] = request.status; } if (!$isNull(request.tagShrink)) { query['Tag'] = request.tagShrink; } if (!$isNull(request.workspaceId)) { query['WorkspaceId'] = request.workspaceId; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApiUtil.Params{ action = 'ListInstances', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances`, method = 'GET', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Queries a list of Data Science Workshop (DSW) instances. * * @param request ListInstancesRequest * @return ListInstancesResponse */ async function listInstances(request: ListInstancesRequest): ListInstancesResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return listInstancesWithOptions(request, headers, runtime); } model StartInstanceResponseBody = { code?: string(name='Code', example='null'), httpStatusCode?: int32(name='HttpStatusCode', example='null'), instanceId?: string(name='InstanceId', example='dsw-730xxxxxxxxxx'), message?: string(name='Message', example='"XXX"'), requestId?: string(name='RequestId', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', example='true'), } model StartInstanceResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: StartInstanceResponseBody(name='body'), } /** * @summary 启动实例 * * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return StartInstanceResponse */ async function startInstanceWithOptions(InstanceId: string, headers: map[string]string, runtime: $RuntimeOptions): StartInstanceResponse { var req = new OpenApiUtil.OpenApiRequest{ headers = headers, }; var params = new OpenApiUtil.Params{ action = 'StartInstance', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}/start`, method = 'PUT', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 启动实例 * * @return StartInstanceResponse */ async function startInstance(InstanceId: string): StartInstanceResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return startInstanceWithOptions(InstanceId, headers, runtime); } model StopInstanceRequest { saveImage?: boolean(name='SaveImage', example='false'), } model StopInstanceResponseBody = { code?: string(name='Code', example='null'), httpStatusCode?: int32(name='HttpStatusCode', example='null'), instanceId?: string(name='InstanceId', example='dsw-730xxxxxxxxxx'), message?: string(name='Message', example='"XXX"'), requestId?: string(name='RequestId', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', example='true'), } model StopInstanceResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: StopInstanceResponseBody(name='body'), } /** * @summary 停止实例 * * @param request StopInstanceRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return StopInstanceResponse */ async function stopInstanceWithOptions(InstanceId: string, request: StopInstanceRequest, headers: map[string]string, runtime: $RuntimeOptions): StopInstanceResponse { request.validate(); var query : map[string]any = {}; if (!$isNull(request.saveImage)) { query['SaveImage'] = request.saveImage; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, query = OpenApiUtil.query(query), }; var params = new OpenApiUtil.Params{ action = 'StopInstance', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}/stop`, method = 'PUT', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary 停止实例 * * @param request StopInstanceRequest * @return StopInstanceResponse */ async function stopInstance(InstanceId: string, request: StopInstanceRequest): StopInstanceResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return stopInstanceWithOptions(InstanceId, request, headers, runtime); } model UpdateInstanceRequest { accessibility?: string(name='Accessibility', description='The visibility of the instance. Valid values: * PUBLIC: Accessible to all members in the workspace. * PRIVATE: Accessible only to you and the administrator of the workspace.', example='PRIVATE'), affinity?: { CPU?: { enable?: boolean(name='Enable', description='Specifies whether CPU affinity is enabled. * true * false', example='true'), }(name='CPU', description='The CPU affinity configuration. Only subscription instances that use general-purpose computing resources support CPU affinity configuration.'), }(name='Affinity', description='The affinity configuration.'), cloudDisks?: [ { capacity?: string(name='Capacity', description='If **Resource Type** is **Public Resource** or if **Resource Quota** is subscription-based general-purpose computing resources (CPU cores ≥ 2 and memory ≥ 4 GB, or configured with GPU): Each instance has a free system disk quota of 100 GiB for persistent storage. **If the DSW instance is stopped and not launched for more than 15 days, the disk is cleared**. The disk can be expanded. For specific pricing, refer to the console. ** **Warning** * After the expansion, you cannot reduce the storage space. Proceed with caution. * After the expansion, the disk is not cleared if the instance is stopped for more than 15 days. However, it will continue to incur fees. * If you delete the instance, the system disk is also released and the data stored in the disk is deleted. Make sure that you have backed up your data before you delete the instance. If you need persistent storage, you can **mount a dataset** or add the OSS, NAS, or CPFS path to the **storage path**.', example='100Gi'), subType?: string(name='SubType', description='Disk type: * rootfs: Mounts the disk as a system disk. The system environment is stored on the disk.', example='rootfs'), } ](name='CloudDisks', description='The cloud disks.', example='[]'), credentialConfig?: CredentialConfig(name='CredentialConfig', description='The credential configuration.'), datasets?: [ { datasetId?: string(name='DatasetId', description='The dataset ID. If the dataset is read-only, you cannot change the dataset pemission from read-only to read and write by using MountAccess. You can call [ListDatasets](https://help.aliyun.com/document_detail/457222.html) to obtain the dataset ID. If you configure the dataset ID, you cannot configure the dataset URI.', example='d-vsqjvsjp4orp5l206u'), datasetVersion?: string(name='DatasetVersion', description='The dataset version. You must also configure DatasetId. If you leave this parameter empty, the value v1 is used by default.', example='v1'), dynamic?: boolean(name='Dynamic', description='Specifies whether dynamic mounting is enabled. Default value: false. * Currently, only instances using general-purpose computing resources are supported. * Currently, only OSS datasets are supported. The mounted datasets are read-only. * The MountPath of the dynamically mounted dataset must be a subpath of the root path. Example: /mnt/dynamic/data1/ * A dynamically mounted dataset must be after non-dynamic datasets.', example='false'), mountAccess?: string(name='MountAccess', description='The read and write permissions of the dataset. If the dataset is read-only, it cannot be changed to read and write.', example='RW'), mountPath?: string(name='MountPath', description='The mount path of the dataset.', example='/mnt/data'), optionType?: string(name='OptionType', description='The mount type. You cannot specify Options at the same time. This is deprecated, you can use Options instead.', example='ReadOnly', deprecated=true), options?: string(name='Options', description='The custom dataset mount options. Only OSS is supported. You cannot specify OptionType at the same time. For more information, see [DSW mount configurations](https://www.alibabacloud.com/help/en/pai/user-guide/read-and-write-dataset-data).', example='{ "fs.oss.download.thread.concurrency": "10", "fs.oss.upload.thread.concurrency": "10", "fs.jindo.args": "-oattr_timeout=3 -oentry_timeout=0 -onegative_timeout=0 -oauto_cache -ono_symlink" }'), uri?: string(name='Uri', description='The URI of the storage service directory, which can be directly mounted. This parameter is mutually exclusive with DatasetId. URI formats of different types of storage: * OSS: oss://bucket-name.oss-cn-shanghai-internal.aliyuncs.com/data/path/ * NAS: nas://29\\\\*\\\\*d-b12\\\\*\\\\*\\\\*\\\\*446.cn-hangzhou.nas.aliyuncs.com/data/path/ * Extreme NAS: nas://29\\\\*\\\\*\\\\*\\\\*123-y\\\\*\\\\*r.cn-hangzhou.extreme.nas.aliyuncs.com/data/path/ * CPFS: cpfs://cpfs-213\\\\*\\\\*\\\\*\\\\*87.cn-wulanchabu/ptc-292\\\\*\\\\*\\\\*\\\\*\\\\*cbb/exp-290\\\\*\\\\*\\\\*\\\\*\\\\*\\\\*\\\\*\\\\*03e/data/path/ * Lingjun CPFS: bmcpfs://cpfs-290\\\\*\\\\*\\\\*\\\\*\\\\*\\\\*foflh-vpc-x\\\\*\\\\*\\\\*\\\\*8r.cn-wulanchabu.cpfs.aliyuncs.com/data/path/', example='oss://bucket-name.oss-cn-shanghai-internal.aliyuncs.com/data/path/'), } ](name='Datasets', description='The datasets.'), disassociateCredential?: boolean(name='DisassociateCredential', description='Specifies whether to delete the credential injection information.', example='false'), disassociateDatasets?: boolean(name='DisassociateDatasets', description='Specifies whether to delete the associated datasets. * true * false', example='false'), disassociateDriver?: boolean(name='DisassociateDriver', description='Specifies whether to delete the NVIDIA driver configuration.', example='false'), disassociateForwardInfos?: boolean(name='DisassociateForwardInfos', description='Specifies whether to delete the associated forward information.', example='false'), disassociateVpc?: boolean(name='DisassociateVpc', description='Specifies whether to delete the associated user VPC.', example='false'), driver?: string(name='Driver', description='The NVIDIA driver configuration.', example='535.54.03'), dynamicMount?: DynamicMount(name='DynamicMount', description='The dynamic mount configuration.'), ecsSpec?: string(name='EcsSpec', description='The ECS instance type of the instance. You can call [ListEcsSpecs](https://help.aliyun.com/document_detail/470423.html) to obtain the ECS instance type.', example='ecs.c6.large'), imageAuth?: string(name='ImageAuth', description='The Base64-encoded account and password for the user‘s private image. The password will be hidden.', example='****'), imageId?: string(name='ImageId', description='The image ID. You can call [ListImages](https://help.aliyun.com/document_detail/449118.html) to obtain the image ID.', example='image-05cefd0be2exxxx'), imageUrl?: string(name='ImageUrl', description='The image address. You can call [ListImages](https://help.aliyun.com/document_detail/449118.html) to obtain the image address.', example='registry.cn-shanghai.aliyuncs.com/pai_product/tensorflow:py36_cpu_tf1.12_ubuntu'), instanceName?: string(name='InstanceName', description='The instance name. Format requirements: * The name can contain only letters, digits, and underscores (_). * The name can be up to 27 characters in length.', example='training_data'), priority?: long(name='Priority', description='The priority based on which resources are allocated to instances. Valid values: 1 to 9. * 1: the lowest priority. * 9 is the highest priority.', example='1'), requestedResource?: { CPU?: string(name='CPU', description='The number of vCPU cores.', example='32'), GPU?: string(name='GPU', description='The number of GPUs.', example='4'), GPUType?: string(name='GPUType', description='The GPU type.', example='v100'), memory?: string(name='Memory', description='The memory size. Unit: GB.', example='32'), sharedMemory?: string(name='SharedMemory', description='The shared memory size. Unit: GB.', example='32'), }(name='RequestedResource', description='The resource configurations.', example='{"CPU":"4","Memory":"8Gi","SharedMemory":"4Gi","GPU":"1","GPUType":"Tesla-V100-16G"}'), userId?: string(name='UserId', description='the User ID of the instance.', example='16122**********'), userVpc?: { bandwidthLimit?: BandwidthLimit(name='BandwidthLimit'), defaultRoute?: string(name='DefaultRoute', description='The default route. Valid values: * eth0: The default network interface is used to access the Internet through the public gateway. * eth1: The user\\\\"s Elastic Network Interface is used to access the Internet through the private gateway.', example='eth0'), extendedCIDRs?: [ string ](name='ExtendedCIDRs', description='The extended CIDR blocks. * If you leave VSwitchId empty, this parameter is not required and the system automatically obtains all CIDR blocks in the VPC. * If VSwitchId is not empty, this parameter is required. Specify all CIDR blocks in the VPC.', example='["192.168.0.1/24", "192.168.1.1/24"]'), forwardInfos?: [ ForwardInfo ](name='ForwardInfos', description='The forward configuration of the instance.'), securityGroupId?: string(name='SecurityGroupId', description='The security group ID.', example='sg-xxxxxx'), vSwitchId?: string(name='VSwitchId', description='The vSwitch ID.', example='vsw-xxxxx'), vpcId?: string(name='VpcId', description='The VPC ID.', example='vpc-xxxxx'), }(name='UserVpc', description='The virtual private cloud (VPC) configurations.'), workspaceSource?: string(name='WorkspaceSource', description='Specifies the storage corresponding to the working directory. You can mount disks or datasets to /mnt/workspace at the same time. OSS datasets and dynamically mounted datasets are not supported. Valid values: * rootfsCloudDisk: Mount disk to the working directory. * Mount path of the dataset, such as /mnt/data: Datasets in URI format only support this method. * Dataset ID, such as d-vsqjvs\\\\*\\\\*\\\\*\\\\*rp5l206u: If a single dataset is mounted to multiple paths, the first path is selected. We recommend that you do not use this method, use the mount path instead. If you leave this parameter empty: * If the instance uses cloud disks, cloud disks are selected by default. * if no disks are available, the first NAS or CPFS dataset is selected as the working directory. * If no disk, NAS, or CPFS datasets is available, the host space is used.', example='/mnt/data'), } model UpdateInstanceResponseBody = { code?: string(name='Code', description='The status code. Valid values: * InternalError: an internal error. All errors, except for parameter validation errors, are classified as internal errors. * ValidationError: a parameter validation error.', example='null'), httpStatusCode?: int32(name='HttpStatusCode', description='The HTTP status code. Valid values: * 400 * 404', example='null'), instanceId?: string(name='InstanceId', description='The instance ID.', example='dsw-730xxxxxxxxxx'), message?: string(name='Message', description='The response message.', example='"XXX"'), requestId?: string(name='RequestId', description='The request ID.', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values: * true * false', example='true'), } model UpdateInstanceResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: UpdateInstanceResponseBody(name='body'), } /** * @summary Updates the properties of a DSW instance. * * @param request UpdateInstanceRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return UpdateInstanceResponse */ async function updateInstanceWithOptions(InstanceId: string, request: UpdateInstanceRequest, headers: map[string]string, runtime: $RuntimeOptions): UpdateInstanceResponse { request.validate(); var body : map[string]any = {}; if (!$isNull(request.accessibility)) { body['Accessibility'] = request.accessibility; } if (!$isNull(request.affinity)) { body['Affinity'] = request.affinity; } if (!$isNull(request.cloudDisks)) { body['CloudDisks'] = request.cloudDisks; } if (!$isNull(request.credentialConfig)) { body['CredentialConfig'] = request.credentialConfig; } if (!$isNull(request.datasets)) { body['Datasets'] = request.datasets; } if (!$isNull(request.disassociateCredential)) { body['DisassociateCredential'] = request.disassociateCredential; } if (!$isNull(request.disassociateDatasets)) { body['DisassociateDatasets'] = request.disassociateDatasets; } if (!$isNull(request.disassociateDriver)) { body['DisassociateDriver'] = request.disassociateDriver; } if (!$isNull(request.disassociateForwardInfos)) { body['DisassociateForwardInfos'] = request.disassociateForwardInfos; } if (!$isNull(request.disassociateVpc)) { body['DisassociateVpc'] = request.disassociateVpc; } if (!$isNull(request.driver)) { body['Driver'] = request.driver; } if (!$isNull(request.dynamicMount)) { body['DynamicMount'] = request.dynamicMount; } if (!$isNull(request.ecsSpec)) { body['EcsSpec'] = request.ecsSpec; } if (!$isNull(request.imageAuth)) { body['ImageAuth'] = request.imageAuth; } if (!$isNull(request.imageId)) { body['ImageId'] = request.imageId; } if (!$isNull(request.imageUrl)) { body['ImageUrl'] = request.imageUrl; } if (!$isNull(request.instanceName)) { body['InstanceName'] = request.instanceName; } if (!$isNull(request.priority)) { body['Priority'] = request.priority; } if (!$isNull(request.requestedResource)) { body['RequestedResource'] = request.requestedResource; } if (!$isNull(request.userId)) { body['UserId'] = request.userId; } if (!$isNull(request.userVpc)) { body['UserVpc'] = request.userVpc; } if (!$isNull(request.workspaceSource)) { body['WorkspaceSource'] = request.workspaceSource; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApiUtil.Params{ action = 'UpdateInstance', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}`, method = 'PUT', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Updates the properties of a DSW instance. * * @param request UpdateInstanceRequest * @return UpdateInstanceResponse */ async function updateInstance(InstanceId: string, request: UpdateInstanceRequest): UpdateInstanceResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return updateInstanceWithOptions(InstanceId, request, headers, runtime); } model UpdateInstanceLabelsRequest { labels?: [ { key?: string(name='Key', description='The key of the custom tag. This parameter is required.', example='customLabelKey'), value?: string(name='Value', description='The value of the custom tag. This parameter is required.', example='labelValue'), } ](name='Labels', description='The tags that you want to update. This parameter is required.'), } model UpdateInstanceLabelsResponseBody = { requestId?: string(name='RequestId', description='The request ID.', example='E7D55162-4489-1619-AAF5-3F97D5FCA948'), } model UpdateInstanceLabelsResponse = { headers?: map[string]string(name='headers'), statusCode?: int32(name='statusCode'), body?: UpdateInstanceLabelsResponseBody(name='body'), } /** * @summary Updates the tags of a Data Science Workshop (DSW) instance. If the tags do not exist, the system adds tags. * * @param request UpdateInstanceLabelsRequest * @param headers map * @param runtime runtime options for this request RuntimeOptions * @return UpdateInstanceLabelsResponse */ async function updateInstanceLabelsWithOptions(InstanceId: string, request: UpdateInstanceLabelsRequest, headers: map[string]string, runtime: $RuntimeOptions): UpdateInstanceLabelsResponse { request.validate(); var body : map[string]any = {}; if (!$isNull(request.labels)) { body['Labels'] = request.labels; } var req = new OpenApiUtil.OpenApiRequest{ headers = headers, body = OpenApiUtil.parseToMap(body), }; var params = new OpenApiUtil.Params{ action = 'UpdateInstanceLabels', version = '2022-01-01', protocol = 'HTTPS', pathname = `/api/v2/instances/${$URL.percentEncode(InstanceId)}/labels`, method = 'PUT', authType = 'AK', style = 'ROA', reqBodyType = 'json', bodyType = 'json', }; return callApi(params, req, runtime); } /** * @summary Updates the tags of a Data Science Workshop (DSW) instance. If the tags do not exist, the system adds tags. * * @param request UpdateInstanceLabelsRequest * @return UpdateInstanceLabelsResponse */ async function updateInstanceLabels(InstanceId: string, request: UpdateInstanceLabelsRequest): UpdateInstanceLabelsResponse { var runtime = new $RuntimeOptions{}; var headers : map[string]string = {}; return updateInstanceLabelsWithOptions(InstanceId, request, headers, runtime); }