Adds images to Security Center on the Assets page and creates an image scan task to scan the images.

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 PublicSyncAndCreateImageScanTask

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

SourceIp String No 1.2.X.X

The source IP address of the request.

Images String No [{"registryType":"acr","repoId":"crr-red9kgqqi0fh75d5","instanceId":"cri-1x2qtjd75ofqvfa8","repoNamespace":"1125","regionId":"cn-hangzhou","repoName":"script1","digest":"b1064a5007786b6f82a50772858e8156bc1e5fbddb7dd20af6922761ad197fe4","tag":"v0113-ver2","createTime":1641267666666,"updateTime":1641267909090}]

The information about the images. The value of this parameter is in the JSON format and contains the following fields:

  • RegistryType: the type of the image repository. Valid values:
    • acr
    • harbor
    • quay
  • RepoId: the ID of the image repository.
  • InstanceId: the ID of the Container Registry instance to which the image repository belongs.
  • RepoNamespace: the namespace to which the image repository belongs.
  • RegionId: the region ID of the image.
  • RepoName: the name of the image repository.
  • Digest: the digest of the image.
  • Tag: the tag added to the image.
  • CreateTime: the timestamp when the image was created. Unit: milliseconds.
  • UpdateTime: the timestamp when the image was updated. Unit: milliseconds.

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.

Result String SUCCESS

The result of the image scan task. Valid values:

  • SUCCESS: The task is successful.
  • TASK_NOT_SUPPORT_REGION: The image is in a region that is not supported by container image scan.
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.

Examples

Sample requests

http(s)://[Endpoint]/?Action=PublicSyncAndCreateImageScanTask
&SourceIp=1.2.X.X
&Images=[{"registryType":"acr","repoId":"crr-red9kgqqi0fh75d5","instanceId":"cri-1x2qtjd75ofqvfa8","repoNamespace":"1125","regionId":"cn-hangzhou","repoName":"script1","digest":"b1064a5007786b6f82a50772858e8156bc1e5fbddb7dd20af6922761ad197fe4","tag":"v0113-ver2","createTime":1641267666666,"updateTime":1641267909090}]
&Common request parameters

Sample success responses

XML format

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

<PublicSyncAndCreateImageScanTaskResponse>
    <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>
</PublicSyncAndCreateImageScanTaskResponse>

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.