全部产品
Search
文档中心

资源编排:ALIYUN::CR::RepoSyncRule

更新时间:Feb 26, 2026

ALIYUN::CR::RepoSyncRule类型用于创建镜像仓库同步规则。

语法

{
  "Type": "ALIYUN::CR::RepoSyncRule",
  "Properties": {
    "InstanceId": String,
    "NamespaceName": String,
    "SyncScope": String,
    "SyncRuleName": String,
    "SyncTrigger": String,
    "TargetInstanceId": String,
    "TargetRegionId": String,
    "TargetNamespaceName": String,
    "RepoName": String,
    "RepoNameFilter": String,
    "TagFilter": String,
    "TargetRepoName": String,
    "TargetUserId": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

InstanceId

String

源CR实例 ID。

NamespaceName

String

源实例命名空间名称。

SyncScope

String

同步类型。

取值:

  • REPO:按照镜像仓库同步。

  • NAMESPACE:按照命名空间同步。

SyncRuleName

String

同步规则名称。

SyncTrigger

String

触发同步动作。

取值:

  • INITIATIVE:手动触发。

  • PASSIVE:自动触发。

TargetInstanceId

String

目标实例 ID。

TargetNamespaceName

String

目标实例命名空间名称。

TargetRegionId

String

目标实例地区 ID。

RepoName

String

源实例仓库名称。

RepoNameFilter

String

仓库过滤规则。

说明

该参数仅在同步类型 SyncScope 是 NAMESPACE 时有效。

TagFilter

String

Tag 过滤规则。

TargetRepoName

String

目标实例镜像仓库名称。

TargetUserId

String

目标实例所在的账号 UID。

说明

跨账号同步镜像时,需要使用账号 UID。

返回值

Fn::GetAtt

  • SyncRuleId:同步规则 ID

示例

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  SyncScope:
    Type: String
    Description:
      en: 'The synchronization scope. Valid values: REPO, NAMESPACE'
    AllowedValues:
      - REPO
      - NAMESPACE
    Required: true
  InstanceId:
    Type: String
    Description:
      en: The ID of the CR instance.
    Required: true
  TargetInstanceId:
    Type: String
    Description:
      en: The ID of the destination instance.
    Required: true
  SyncRuleName:
    Type: String
    Description:
      en: The name of the image sync rule.
    Required: true
  NamespaceName:
    Type: String
    Description:
      en: The name of the CR namespace.
    Required: true
  SyncTrigger:
    Type: String
    Description:
      en: 'The mode of triggering the synchronization rule. Valid values: INITIATIVE, PASSIVE'
    AllowedValues:
      - INITIATIVE
      - PASSIVE
    Required: true
  TargetRegionId:
    Type: String
    Description:
      en: The ID of the destination region.
    Required: true
  TargetNamespaceName:
    Type: String
    Description:
      en: The name of the destination namespace.
    Required: true
Resources:
  ExtensionResource:
    Type: ALIYUN::CR::RepoSyncRule
    Properties:
      SyncScope:
        Ref: SyncScope
      InstanceId:
        Ref: InstanceId
      TargetInstanceId:
        Ref: TargetInstanceId
      SyncRuleName:
        Ref: SyncRuleName
      NamespaceName:
        Ref: NamespaceName
      SyncTrigger:
        Ref: SyncTrigger
      TargetRegionId:
        Ref: TargetRegionId
      TargetNamespaceName:
        Ref: TargetNamespaceName
Outputs:
  SyncRuleId:
    Description: The ID of the synchronization rule.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - SyncRuleId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "SyncScope": {
      "Type": "String",
      "Description": {
        "en": "The synchronization scope. Valid values: REPO, NAMESPACE"
      },
      "AllowedValues": [
        "REPO",
        "NAMESPACE"
      ],
      "Required": true
    },
    "InstanceId": {
      "Type": "String",
      "Description": {
        "en": "The ID of the CR instance."
      },
      "Required": true
    },
    "TargetInstanceId": {
      "Type": "String",
      "Description": {
        "en": "The ID of the destination instance."
      },
      "Required": true
    },
    "SyncRuleName": {
      "Type": "String",
      "Description": {
        "en": "The name of the image sync rule."
      },
      "Required": true
    },
    "NamespaceName": {
      "Type": "String",
      "Description": {
        "en": "The name of the CR namespace."
      },
      "Required": true
    },
    "SyncTrigger": {
      "Type": "String",
      "Description": {
        "en": "The mode of triggering the synchronization rule. Valid values: INITIATIVE, PASSIVE"
      },
      "AllowedValues": [
        "INITIATIVE",
        "PASSIVE"
      ],
      "Required": true
    },
    "TargetRegionId": {
      "Type": "String",
      "Description": {
        "en": "The ID of the destination region."
      },
      "Required": true
    },
    "TargetNamespaceName": {
      "Type": "String",
      "Description": {
        "en": "The name of the destination namespace."
      },
      "Required": true
    }
  },
  "Resources": {
    "ExtensionResource": {
      "Type": "ALIYUN::CR::RepoSyncRule",
      "Properties": {
        "SyncScope": {
          "Ref": "SyncScope"
        },
        "InstanceId": {
          "Ref": "InstanceId"
        },
        "TargetInstanceId": {
          "Ref": "TargetInstanceId"
        },
        "SyncRuleName": {
          "Ref": "SyncRuleName"
        },
        "NamespaceName": {
          "Ref": "NamespaceName"
        },
        "SyncTrigger": {
          "Ref": "SyncTrigger"
        },
        "TargetRegionId": {
          "Ref": "TargetRegionId"
        },
        "TargetNamespaceName": {
          "Ref": "TargetNamespaceName"
        }
      }
    }
  },
  "Outputs": {
    "SyncRuleId": {
      "Description": "The ID of the synchronization rule.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "SyncRuleId"
        ]
      }
    }
  }
}