Creates an image scan task.

Before you call the PublicCreateImageScanTask operation, we recommend that you call the PublicPreCheckImageScanTask operation to query the number of images to scan and the quota for container image scan to be consumed by the image scan task. Make sure that the remaining quota for container image scan is sufficient. This prevents the task from being stopped due to an insufficient quota.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes PublicCreateImageScanTask

The operation that you want to perform. Set the value to PublicCreateImageScanTask.

SourceIp String No 1.2.X.X

The source IP address of the request.

RegistryTypes String No acr

The type of the image repository. Separate multiple types with commas (,). Valid values:

  • acr
  • harbor
  • quay
RegionIds String No cn-hangzhou

The region ID of the image. Separate multiple IDs with commas (,).

InstanceIds String No i-uf6j8vq9l4r5ntht****

The ID of the Container Registry instance in which the image repository is created. Separate multiple IDs with commas (,).

RepoNamespaces String No hanghai-namespace

The namespace to which the image repository belongs. Separate multiple namespaces with commas (,).

RepoIds String No crr-vridcl4****

The ID of the image repository. Separate multiple IDs with commas (,).

RepoNames String No centos

The name of the image repository. Separate multiple names with commas (,).

Digests String No 6a5e103187b31a94592a47a5858617f7a6c

The SHA-256 value of the digest of the image. Separate multiple SHA-256 values with commas (,).

Tags String No 0.2

The tag added to the image. Separate multiple tags with commas (,).

Response parameters

Parameter Type Example Description
RequestId String F9353221-40F4-5F98-B73C-2803DC804033

The ID of the request, which is used to locate and troubleshoot issues.

Data Object

The data returned if the call is successful.

TaskId String a410bb3e68c217a3368bc0238c66886d

The ID of the image scan task.

TotalCount Integer 5

The total number of images to scan.

FinishCount Integer 5

The number of images that have been scanned.

CollectTime Long 1644286364150

The timestamp when the information about the image was collected. Unit: milliseconds.

ExecTime Long 1644286364150

The timestamp when the image scan task started to run. Unit: milliseconds.

Status String SUCCESS

The status of the image scan task. Valid values:

  • INIT: The task is being initialized.
  • PRE_ANALYZER: The task is being pre-processed.
  • SUCCESS: The task is successful.
  • FAIL: The task fails.
Progress Integer 100

The progress of the image scan task in percentage.

Result String SUCCESS

The result of the image scan task. Valid values:

  • SUCCESS: The task is successful.
  • TASK_NOT_SUPPORT_REGION: The image is deployed in a region that is not supported by container image scan.
Note For more information about the regions supported by container image scan, see the table that follows the "Response parameters" section of this topic.
CanCreate Boolean true

Indicates whether you can continue to create an image scan task. Valid values:

  • true: yes
  • false: no
Note By default, a maximum of 10 image scan tasks can be running at the same time. If more than 10 image scan tasks are running, you cannot create an image scan task by calling this operation. You must wait for at least one of the 10 existing image scan tasks to complete before you can create an image scan task.
Regions supported by container image scan

Region

City

Region ID

China (Hangzhou)

Hangzhou

cn-hangzhou

China (Shanghai)

Shanghai

cn-shanghai

China (Shenzhen)

Shenzhen

cn-shenzhen

China (Qingdao)

Qingdao

cn-qingdao

China (Beijing)

Beijing

cn-beijing

China (Zhangjiakou)

Zhangjiakou

cn-zhangjiakou

China (Hohhot)

Hohhot

cn-huhehaote

China (Hong Kong)

Hong Kong

cn-hongkong

Japan (Tokyo)

Tokyo

ap-northeast-1

Indonesia (Jakarta)

Jakarta

ap-southeast-5

US (Silicon Valley)

Silicon Valley

us-west-1

US (Virginia)

Virginia

us-east-1

Germany (Frankfurt)

Frankfurt

eu-central-1

UK (London)

London

eu-west-1

Examples

Sample requests

http(s)://[Endpoint]/?Action=PublicCreateImageScanTask
&SourceIp=1.2.X.X
&RegistryTypes=acr
&RegionIds=cn-hangzhou
&InstanceIds=i-uf6j8vq9l4r5ntht****
&RepoNamespaces=hanghai-namespace
&RepoIds=crr-vridcl4****
&RepoNames=centos
&Digests=6a5e103187b31a94592a47a5858617f7****
&Tags=0.2
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<PublicCreateImageScanTaskResponse>
    <RequestId>F9353221-40F4-5F98-B73C-2803DC804033</RequestId>
    <Data>
        <TaskId>a410bb3e68c217a3368bc0238c66886d</TaskId>
        <TotalCount>5</TotalCount>
        <FinishCount>5</FinishCount>
        <CollectTime>1644286364150</CollectTime>
        <ExecTime>1644286364150</ExecTime>
        <Status>SUCCESS</Status>
        <Progress>100</Progress>
        <Result>SUCCESS</Result>
        <CanCreate>true</CanCreate>
    </Data>
</PublicCreateImageScanTaskResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "F9353221-40F4-5F98-B73C-2803DC804033",
  "Data" : {
    "TaskId" : "a410bb3e68c217a3368bc0238c66886d",
    "TotalCount" : 5,
    "FinishCount" : 5,
    "CollectTime" : 1644286364150,
    "ExecTime" : 1644286364150,
    "Status" : "SUCCESS",
    "Progress" : 100,
    "Result" : "SUCCESS",
    "CanCreate" : true
  }
}

Error codes

HTTP status code Error code Error message Description
500 ServerError ServerError The error message returned because a server error occurred.

For a list of error codes, visit the API Error Center.