All Products
Search
Document Center

Container Registry:CreateRepoSyncRule

Last Updated:May 23, 2025

Creates an image synchronization rule for an image repository.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
cr:CreateSyncRulecreate
*Repository
acs:cr:{#regionId}:{#accountId}:repository/{#instanceid}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The source instance ID.

cri-hpdfkc6utbaq****
NamespaceNamestringYes

The namespace name of the source instance.

ns1
RepoNamestringNo

The name of the image repository in the source instance.

repo1
TargetRegionIdstringYes

The region ID of the destination instance.

cn-shanghai
TargetInstanceIdstringYes

The destination instance ID.

cri-ibxs3piklys3****
TargetNamespaceNamestringYes

The namespace name of the destination instance.

ns1
TargetRepoNamestringNo

The name of the image repository in the destination instance.

repo1
RepoNameFilterstringNo

The regular expression that is used to filter repositories.

Note This parameter is valid only when SyncScope is set to NAMESPACE.
.*
TagFilterstringYes

The regular expression that is used to filter image tags.

.*
SyncScopestringYes

The synchronization scope. Valid values:

  • REPO: synchronizes the image tags in an image repository that meet the synchronization rule.
  • NAMESPACE: synchronizes the image tags in a namespace that meet the synchronization rule.
REPO
SyncRuleNamestringYes

The name of the image synchronization rule.

rule
SyncTriggerstringYes

The mode of triggering the synchronization rule. Valid values:

  • INITIATIVE: manually triggers the synchronization rule.
  • PASSIVE: automatically triggers the synchronization rule.
PASSIVE
TargetUserIdstringNo

The user ID (UID) of the account to which the destination instance belongs.

Note If you synchronize images across accounts, you must use the UID.
12645940***

Response parameters

ParameterTypeDescriptionExample
object
Codestring

The HTTP status code.

success
SyncRuleIdstring

The ID of the synchronization rule.

crsr-gk5p2ns1kzns****
IsSuccessboolean

Indicates whether the request is successful.

true
RequestIdstring

The request ID.

8F8A0BA6-7F06-4BAE-B147-10BD6A25****

Examples

Sample success responses

JSONformat

{
  "Code": "success",
  "SyncRuleId": "crsr-gk5p2ns1kzns****",
  "IsSuccess": true,
  "RequestId": "8F8A0BA6-7F06-4BAE-B147-10BD6A25****"
}

Error codes

HTTP status codeError codeError message
403NoPrivilegeAccess denied for this user.
500SystemErrorUnknown error.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-12-24The Error code has changed. The request parameters of the API has changedView Change Details