AddImage

Updated at:

Adds a custom image to a workspace.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

paiimage:AddImage

create

*All Resource

*

None None

Request syntax

POST /api/v1/images HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request struct.

Name

string

Yes

The name of the image. The naming rules are as follows:

  • The name must be 1 to 50 characters in length.

  • The name can contain lowercase letters, digits, and hyphens (-), and must start with a letter.

  • The name must be unique within the same workspace.

nlp-compression

Description

string

No

The description of the image.

NLP model compression training image

ImageUri

string

Yes

The URI of the image. The URI can be duplicated. For more information about how to view the image URI, see ListImage.

registry.cn-hangzhou.aliyuncs.com/pai-compression/nlp:gpu

Labels

array<object>

No

The labels of the image. This parameter is an array, and each item in the array contains the key and value fields. Official images have the following label: system.official=true. The following keys are supported:

  • system.chipType

  • system.dsw.cudaVersion

  • system.dsw.fromImageId

  • system.dsw.fromInstanceId

  • system.dsw.id

  • system.dsw.os

  • system.dsw.osVersion

  • system.dsw.resourceType

  • system.dsw.rootImageId

  • system.dsw.stage

  • system.dsw.tag

  • system.dsw.type

  • system.framework

  • system.origin

  • system.pythonVersion

  • system.source

  • system.supported.dlc

  • system.supported.dsw

object

No

The label.

Key

string

No

The key of the label.

system.chipType

Value

string

No

The value of the label.

GPU

WorkspaceId

string

No

The ID of the workspace to which the image belongs. For more information about how to obtain the workspace ID, see ListWorkspaces.

15******45

Accessibility

string

No

The visibility of the image. Valid values:

  • PUBLIC: All members in the current workspace can manage the image.

  • PRIVATE: Only the creator can manage the image.

PUBLIC

Size

integer

No

The size of the image. Unit: GB.

2

ImageId

string

No

The ID of the image. If you do not specify this parameter, the system automatically generates an image ID. The format is image- followed by 18 uppercase or lowercase letters or digits.

image-k83*****cv

SourceType

string

No

The source type of the image. Valid values:

  • Import: The image is imported.

  • Build: The image is built.

Build

SourceId

string

No

The source ID of the image. If the source type of the image is Build, the source ID is the image build ID.

build-****ks92

UserId

string

No

The user ID (UID) of the image creator.

1611******3000

Response elements

Element

Type

Description

Example

object

The response struct.

RequestId

string

The ID of the request.

5A14FA81-DD4E-******-6343FE44B941

ImageId

string

The ID of the image.

image-4c62******53uor

Examples

Success response

JSON format

{
  "RequestId": "5A14FA81-DD4E-******-6343FE44B941",
  "ImageId": "image-4c62******53uor"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.