## Operation defines
##
## - name: OperationName                  # unique name of an operation.
##   target: cluster                      # target type of an operation, contain: cluster, tenant, undefined.
##   categories: ["dedicated"]  # categories of an operation for searching.
##   description:                         # description of an operation.
##   actions:                             # actions of an operation.
##   - name: PauseCluster                   # a required action.
##     preferStartPolicy: "schedule"        # the default start policy on UI, contain: manual, immediate, schedule.
##     preferScheduleHour: 3                # the default schedule hour on UI when start policy is schedule.
##   - name: ActionName                     # a optional action.
##     optional: true                      
##   params:                              # params of an operation.
##     cluster_id:
##        type: string                      # type of a param, contain: string, int
##     oncall_category:                     
##       type: string                     
##       desc: oncall category              # description of a param.
##       const: value                       # a const param.
##     tenant_region:                       
##       type: string                      
##     component:                           
##       type: string
##       optional: true                     # this is param is optional.                  
##       enum: ["tidb", "tikv", "pd"]       # a enum param.
##   approvalTips: ""                     # some texts shown on approval.
##   approval:                            # approval template
##     ...

- name: PauseCluster
  alias: Pause a Existing Cluster
  target: cluster
  description: pause a cluster, and may resume it later.
  internal: true
  categories: ["dedicated"]
  actions:
  - name: PauseCluster
  - name: ResumeCluster
    optional: true
  params:
    cluster_id:
      type: string
    tenant_region: 
      type: string
  approval:
    nodes:
    - fromParam:
        paramName: tenant_region
        paramValueMapping:
          APAC:
            userGroup: cloud-operation-region-admin
      method: ANY

- name: ResumeCluster
  alias: Resume a Existing Cluster
  target: cluster
  description: resume a cluster.
  categories: ["dedicated"]
  actions:
  - name: ResumeCluster
  params:
    cluster_id:
      type: string
    tenant_region:
      type: string
  approval:
    nodes:
    - userGroup: cloud-operation-cloud-admin
      method: ANY

- name: ScaleCluster
  alias: Scale a Existing Cluster
  target: cluster
  description: scale a cluster.
  internal: true
  categories: ["dedicated"]
  actions:
  - name: ScaleCluster
  params:
    cluster_id:
      type: string
    cluster_components_to_scale:
      type: string
    tenant_region:
      type: string
  approval:
    nodes:
    - emails:
      - sihao.yu@pingcap.com
      - xieyujie@pingcap.com
      method: ANY

- name: RestartTiDBComponents
  alias: Restart Pod/Component/Node/Cluster
  target: cluster
  description: |
    Restart single node/component/pod of the cluster, or restart the whole cluster. 
    Check the [guide](https://pingcap-cn.feishu.cn/wiki/FqdawdvgaiTXDhktKkhctn8YnKg?from=from_copylink) for more information.
  categories: ["dedicated"]
  actions:
  - name: Restart
  params:
    cluster_id:
      type: string
    tenant_id:
      type: string
    tenant_region:
      type: string
    restart_target_type:
      type: string
      enum: ["pod", "component", "node", "cluster"]
    restart_target:
      type: string
      desc: "specify the component name, like `pd`, `tidb`, or the pod name, like `db-tidb-1`"
      optional: true
    force_restart:
      type: string
      enum: ["false", "true"]
      default: "false"
      optional: true
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: ModifyTenantQuota
  alias: Modify Cluster Quota For Tenant
  target: tenant
  description: |
    Adjust cluster quotas for a tenant. [Official Doc](https://docs.pingcap.com/tidbcloud/limitations-and-quotas#cluster-quotas). 
    If tenant wants to create a cluster more than 40 nodes, please check the [Guide for Creating Large Clusters](https://pingcap.feishu.cn/wiki/UirUwGX45iC2Nwkd3k7cQp0Pn0f).
  categories: ["tenant"]
  actions:
  - name: UpdateTenantQuota
    preferStartPolicy: immediate
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
    tidb_node_quota:
      type: int
      desc: specify the quota, 0 means unchanged.
    tikv_node_quota:
      type: int
      desc: specify the quota, 0 means unchanged.
    tiflash_node_quota:
      type: int
      desc: specify the quota, 0 means unchanged.
    tiproxy_node_quota:
      type: int
      desc: specify the quota, 0 means unchanged.
  approvalTips: "请确认云厂商的 quota，管控面的资源使用率以及网络规划"
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: ModifyTenantPremiumQuota
  alias: Modify Premium Quota for Tenant
  target: tenant
  description: |
    Adjust premium resource quotas for a tenant (RCU and burst settings).
    - `instanceMaxRCU`: maximum RCU allowed per instance.
    - `totalMaxRCU`: maximum total RCU allowed for the tenant.
    - `burstyRatio`: burst ratio allowance for short-term spikes.
    - `idleResourcePoolTtlInHours`: idle resource pool retention time in hours.
    - `vcpusLimitPerResourcePool`: vCPU limit per resource pool, only used for BYOC
  categories: ["tenant", "standard"]
  actions:
  - name: UpdateRcuQuota
    preferStartPolicy: immediate
  params:
    tenant_id:
      type: string
    service_plan:
      type: string
      desc: "specify the service plan, enum: Premium"
    instanceMaxRCU:
      type: int
      desc: specify the quota, should >= 5000.
      optional: true
    totalMaxRCU:
      type: int
      desc: specify the quota, should >= 20000.
      optional: true
    burstyRatio:
      type: string
      desc: specify the quota, should >= 1.0.
    idleResourcePoolTtlInHours:
      type: int
      desc: specify the retention time for idle resource pool, default to 4.
      optional: true
    vcpusLimitPerResourcePool:
      type: int
      desc: specify the vCPU limit per resource pool, only used for BYOC.
      optional: true
  approval:
    nodes:
      - emails: [ sihao.yu@pingcap.com, xieyujie@pingcap.com, qifangfang@pingcap.com, shawn@pingcap.com, zhangpeijin@pingcap.com ]
        method: ANY

- name: ImpersonateTenant
  alias: Impersonate a Tenant
  target: tenant
  description: impersonate a tenant.
  internal: true
  categories: ["tenant"]
  actions:
  - name: AddImpersonate
    preferStartPolicy: immediate
  - name: DelImpersonate
    preferStartPolicy: schedule
    preferScheduleHour: 1
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
  approval:
    nodes: []

- name: CreateProjectCIDRManually
  alias: Create a Single Region CIDR For Project
  target: tenant
  description: Establish a regional CIDR for the project, ensuring this step is completed prior to creating the first dedicated cluster.
  categories: ["tenant", "nonstandard"]
  actions:
  - name: NotifyOncaller
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
    oncall_category:
      type: string
      const: "TiDB Dedicated"
    project_id:
      type: string
    region:
      type: string
    cidr:
      type: string
      desc: Provide the complete CIDR content, for example, 172.30.0.0/16.
  approval:
    nodes:
    - emails:
      - sihao.yu@pingcap.com
      - hu.guo@pingcap.com
      method: ANY

- name: ShutdownOperationForClusterVersionUpgrade
  alias: Shutdown Operation for Cluster Version Upgrade
  target: cluster
  description: |
    Do shutdown operation for cluster version upgrade.
    You should change only the cluster version in gitops or config center.
    Before you create Operation here, please file a PR on github and then get the Secondary Confirm Link if it's a cloud-native cluster, 
    or create a config change via ConfigCenter and get the change_id if it's a 3-layer cluster.
    Please read the [tips](https://pingcap.feishu.cn/wiki/WHa2wCmy6ip1vdkcqOpc6jyFnle) with care if the cluster has CDC.
  categories: ["dedicated"]
  actions:
    - name: PauseTC
      preferStartPolicy: "manual"
    - name: ApplyConfigChangeViaSecondaryConfirmLink
      preferStartPolicy: "manual"
    - name: ApplyConfigChangeViaConfigCenter
      preferStartPolicy: "manual"
    - name: DeleteASTSAndResumeTC
      preferStartPolicy: "manual"
  params:
    tenant_region:
      type: string
    cluster_id:
      type: string
    component_type:
      type: string
      enum: ["tidb", "tikv", "tiflash", "pd", "tiproxy", "all"]
      desc: all means all components
    secondary_confirm_link/change_id:
      type: string
      desc: secondary_confirm_link for cloud-native cluster and change_id for 3-layer cluster.
  approval:
    nodes:
    - emails:
      - fei.chen@pingcap.com
      - jianghuaxi@pingcap.com
      - le.wang@pingcap.com
      method: ANY
    ccTasks:
      emails:
      - fei.chen@pingcap.com

- name: ShutdownOperationForClusterConfigChange
  alias: Shutdown Operation for Cluster Config Change
  target: cluster
  description: |
    Do shutdown operation for cluster config change.
    Before you create Operation here, please file a PR on github and then get the Secondary Confirm Link if it's a cloud-native cluster, 
    or create a config change via ConfigCenter and get the change_id if it's a 3-layer cluster.
    Please read the [tips](https://pingcap.feishu.cn/wiki/WHa2wCmy6ip1vdkcqOpc6jyFnle) with care if the cluster has CDC.
  categories: ["dedicated"]
  actions:
    - name: PauseTC
      preferStartPolicy: "manual"
    - name: ApplyConfigChangeViaSecondaryConfirmLink
      preferStartPolicy: "manual"
    - name: ApplyConfigChangeViaConfigCenter
      preferStartPolicy: "manual"
    - name: DeleteASTSAndResumeTC
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
    component_type:
      type: string
      enum: ["tidb", "tikv", "tiflash", "pd", "tiproxy", "all"]
      desc: all means all components
    tenant_region:
      type: string
    secondary_confirm_link/change_id:
      type: string
      desc: secondary_confirm_link for cloud-native cluster and change_id for 3-layer cluster.
  approval:
    nodes:
    - emails:
      - xieyujie@pingcap.com
      - fei.chen@pingcap.com
      method: ANY
    ccTasks:
      emails:
      - xieyujie@pingcap.com
      - fei.chen@pingcap.com

- name: ShutdownOperationForClusterScaleUpDown
  alias: Shutdown Operation for Cluster Scale Up/Down
  target: cluster
  description: Do shutdown operation for cluster scale up/down.
  categories: ["dedicated"]
  actions:
    - name: PauseTC
      preferStartPolicy: "manual"
    - name: ScaleTC
      preferStartPolicy: "manual"
    - name: DeleteASTSAndResumeTC
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
    tenant_region:
      type: string
    component_type:
      type: string
      enum: ["tidb", "tikv", "tiflash"]
    node_size:
      type: string
      desc: specify the vCPU and memory specifications, for example, 16C32G.
    force_scale:
      type: string
      enum: [ "false", "true" ]
      default: "false"
      optional: true
  approval:
    nodes:
    - emails:
      - xieyujie@pingcap.com
      - fei.chen@pingcap.com
      method: ANY
    ccTasks:
      emails:
      - xieyujie@pingcap.com
      - fei.chen@pingcap.com

- name: NonStandardOperation
  alias: Non-standard Operation
  target: undefined
  description: Do non-standard operation.
  categories: ["tenant", "dedicated", "serverless", "dedicated", "nonstandard"]
  actions:
    - name: PerformOperation
      preferStartPolicy: manual
  params:
    related_cmd:
      type: string
  approval:
    nodes:
    - selfApprove: true
      method: ANY
    ccTasks:
      emails:
      - xieyujie@pingcap.com

- name: RecreateMemberForCluster
  alias: Recreate Member for Cluster
  target: cluster
  description: Recreate both node and PVC for a TiDB Cluster member, such as 'db-tikv-0'
  categories: ["dedicated"]
  actions:
    - name: CreateOperation
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
    tenant_region:
      type: string
    operation_type:
      type: string
      const: "RecreateTCMember"
    member_name:
      type: string
      desc: "specify the member name, like `db-tidb-1`"
    force:
      type: string
      desc: "ignore cluster status check"
      enum: ["false", "true"]
      default: "false"
      optional: true
  approval:
    nodes:
    - selfApprove: true
      method: ANY
    ccTasks:
      emails: [xieyujie@pingcap.com, fei.chen@pingcap.com]

- name: ShutdownOperationForUpgradingK8sNodes
  alias: Shutdown Operation for upgrading the tidb cluster's k8s nodes' version.
  target: cluster
  description: |
    Shutdown Operation for upgrading the tidb cluster's k8s nodes' version.
    Please read the [tips](https://pingcap.feishu.cn/wiki/WHa2wCmy6ip1vdkcqOpc6jyFnle) with care if the cluster has CDC.
  categories: ["dedicated"]
  actions:
    - name: CreateOperation
      preferStartPolicy: "manual"
    - name: UpgradeCDCNodes
      preferStartPolicy: "immediate"
  params:
    cluster_id:
      type: string
    tenant_region:
      type: string
    operation_type:
      type: string
      const: "ShutDownUpgradeNodes"
    desired_version:
      type: string
      desc: "upgrade k8s nodes to which version, like `1.30`"
    force:
      type: string
      desc: "ignore cluster status check"
      enum: ["false", "true"]
      default: "false"
      optional: true
  approval:
    nodes:
    - emails: [xieyujie@pingcap.com, fei.chen@pingcap.com, jianghuaxi@pingcap.com]
      method: ANY
    ccTasks:
      emails: [xieyujie@pingcap.com, fei.chen@pingcap.com, jianghuaxi@pingcap.com]

- name: ShutdownOperationForClusterConfigChangeAndScaleUpDown
  alias: Shutdown Operation for Cluster Config Change/Version Upgrade and Scale Up/Down
  target: cluster
  description: |
    Do shutdown operation for cluster config change and scale up/down.
    Before you create Operation here, please file a PR on github and then get the Secondary Confirm Link if it's a cloud-native cluster, 
    or create a config change via ConfigCenter and get the change_id if it's a 3-layer cluster.
    Please read the [tips](https://pingcap.feishu.cn/wiki/WHa2wCmy6ip1vdkcqOpc6jyFnle) with care if the cluster has CDC.
  categories: ["dedicated"]
  actions:
    - name: PauseTC
      preferStartPolicy: "manual"
    - name: ApplyConfigChangeViaSecondaryConfirmLink
      preferStartPolicy: "manual"
    - name: ApplyConfigChangeViaConfigCenter
      preferStartPolicy: "manual"
    - name: ScaleTC
      preferStartPolicy: "manual"
    - name: DeleteASTSAndResumeTC
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
    tenant_region:
      type: string
    secondary_confirm_link/change_id:
      type: string
      desc: secondary_confirm_link for cloud-native cluster and change_id for 3-layer cluster.
    component_type:
      type: string
      enum: [ "pd", "tidb", "tikv", "tiflash" ]
    node_size:
      type: string
      desc: specify the vCPU and memory specifications, for example, 16C32G.
  approval:
    nodes:
    - emails: [xieyujie@pingcap.com, fei.chen@pingcap.com]
      method: ANY
    ccTasks:
      emails: [xieyujie@pingcap.com, fei.chen@pingcap.com]

- name: CancelScaleClusterOperation
  alias: Cancel Scale Cluster Operation
  target: cluster
  description: |
    See the [technical documentation](https://pingcap.feishu.cn/wiki/YZFnwoXrziN8m5kvc08cmxXBnrc) for more details.
    A workflow may contain multiple steps with atomic relationships to ensure execution consistency. The cancel process handles the following scenarios:
    1. Workflow is Pending/None: Set to cancelled without actions.
    2. Running/Ending step supports cancel (Scale in only): Cancel directly if no atomic relationship with completed steps.
    3. Running/Ending step doesn't support cancel or has atomic relationship: Continue execution.
    4. Pending step: Cancel if no atomic relationship; otherwise continue execution.
  categories: ["dedicated"]
  actions:
    - name: CancelScaleCluster
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
  approval:
    nodes:
    - emails: [xieyujie@pingcap.com, fei.chen@pingcap.com, zhitao.chen@pingcap.com]
      method: ANY
    ccTasks:
      emails: [xieyujie@pingcap.com, fei.chen@pingcap.com, zhitao.chen@pingcap.com]

- name: ReplaceNodeForCluster
  alias: Replace Node for Cluster
  target: cluster
  description: Replace the underlying node for a TiDB Cluster member, such as 'db-tikv-0'.
  categories: ["dedicated"]
  actions:
    - name: CreateOperation
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
    tenant_region:
      type: string
    operation_type:
      type: string
      const: "ReplaceNode"
    pod_name:
      type: string
      desc: "specify the pod name, like `db-tikv-0`"
    force:
      type: string
      desc: "ignore cluster status check"
      enum: ["false", "true"]
      default: "false"
      optional: true
  approval:
    nodes:
    - selfApprove: true
      method: ANY
    ccTasks:
      emails: [xieyujie@pingcap.com, fei.chen@pingcap.com]

- name: UpdateTenant
  alias: Update a Tenant
  target: tenant
  description: update a tenant.
  internal: true
  categories: ["tenant"]
  actions:
    - name: UpdateTenant
      preferStartPolicy: "immediate"
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
    sales_owner:
      type: string
    tenant_email:
      type: string
    tenant_status:
      type: string
    tenant_type:
      type: string
  approval:
    nodes:
    - name: Review by Sales Owner
      method: ANY
      condition: 'sales_owner != ""'
      fromParam:
        paramName: sales_owner
        useParamValue: true
      skip_when_empty: true
    - name: Review by Tenant Region Approvers
      method: ANY
      condition: 'sales_owner == ""'
      fromParam:
        paramName: tenant_region
        paramValueMapping:
          APAC: { emails: ["xieyujie@pingcap.com", "liqing.zhu@pingcap.com"] }
          EMEA: { emails: ["xieyujie@pingcap.com", "liqing.zhu@pingcap.com"]  }
          JAPAN: { emails: ["xieyujie@pingcap.com", "liqing.zhu@pingcap.com"]  }
          NA: { emails: ["xieyujie@pingcap.com", "liqing.zhu@pingcap.com"]  }
        defaultApprover:
          emails: ["xieyujie@pingcap.com", "liqing.zhu@pingcap.com"]
    ccTasks:
      emails: ["xieyujie@pingcap.com", "liqing.zhu@pingcap.com"]

- name: DeleteTenant
  alias: Delete a Tenant
  target: tenant
  description: delete a tenant.
  internal: true
  categories: ["tenant"]
  actions:
    - name: DeleteTenant
      preferStartPolicy: "manual"
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
  approval:
    nodes:
    - emails: [xieyujie@pingcap.com, liqing.zhu@pingcap.com]
      method: ANY
    ccTasks:
      emails: [xieyujie@pingcap.com, liqing.zhu@pingcap.com]

- name: DeleteProject
  alias: Delete a Project
  target: tenant
  description: delete a project.
  internal: true
  categories: ["tenant", "project"]
  actions:
    - name: DeleteProject
      preferStartPolicy: "immediate"
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
    project_id:
      type: string
  approval:
    nodes:
    - emails: [xieyujie@pingcap.com, liqing.zhu@pingcap.com]
      method: ANY
    ccTasks:
      emails: [xieyujie@pingcap.com, liqing.zhu@pingcap.com]

- name: DeleteUser
  alias: Delete a User
  target: user
  description: delete a user.
  internal: true
  categories: ["user"]
  actions:
    - name: DeleteUser
      preferStartPolicy: "immediate"
  params:
    user_id:
      type: string
    user_email:
      type: string
  approval:
    nodes:
    - emails: [xieyujie@pingcap.com, liqing.zhu@pingcap.com]
      method: ANY
    ccTasks:
      emails: [xieyujie@pingcap.com, liqing.zhu@pingcap.com]

- name: AddUserToTenant
  alias: Add User to Tenant
  target: tenant
  description: add user to tenant.
  internal: true
  categories: ["tenant", "user"]
  actions:
    - name: AddUserToTenant
      preferStartPolicy: "immediate"
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
    user_id:
      type: string
    user_email:
      type: string
    user_role:
      type: string
  approval:
    nodes:
    - emails: [xieyujie@pingcap.com, liqing.zhu@pingcap.com]
      method: ANY
    ccTasks:
      emails: [xieyujie@pingcap.com, liqing.zhu@pingcap.com]

- name: AddUserToProject
  alias: Add User to Project
  target: tenant
  description: add user to project.
  internal: true
  categories: ["tenant", "project", "user"]
  actions:
    - name: AddUserToProject
      preferStartPolicy: "immediate"
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
    project_id:
      type: string
    user_id:
      type: string
    user_email:
      type: string
    user_role:
      type: string
  approval:
    nodes:
    - emails: [xieyujie@pingcap.com, liqing.zhu@pingcap.com]
      method: ANY
    ccTasks:
      emails: [xieyujie@pingcap.com, liqing.zhu@pingcap.com]

- name: RemoveUserFromProject
  alias: Remove User from Project
  target: tenant
  description: remove user from project.
  internal: true
  categories: ["tenant", "project", "user"]
  actions:
    - name: RemoveUserFromProject
      preferStartPolicy: "immediate"
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
    project_id:
      type: string
    user_id:
      type: string
    user_email:
      type: string
  approval:
    nodes:
    - emails: [xieyujie@pingcap.com, liqing.zhu@pingcap.com]
      method: ANY
    ccTasks:
      emails: [xieyujie@pingcap.com, liqing.zhu@pingcap.com]

- name: RemoveUserFromTenant
  alias: Remove User from Tenant
  target: tenant
  description: remove user from tenant.
  internal: true
  categories: ["tenant", "user"]
  actions:
    - name: RemoveUserFromTenant
      preferStartPolicy: "immediate"
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
    user_id:
      type: string
    user_email:
      type: string
  approval:
    nodes:
    - emails: [xieyujie@pingcap.com, liqing.zhu@pingcap.com]
      method: ANY
    ccTasks:
      emails: [xieyujie@pingcap.com, liqing.zhu@pingcap.com]

- name: AddCreditsForTenant
  alias: Add Credits For Tenant
  target: tenant
  description: add credits for tenant.
  internal: true
  categories: ["tenant"]
  actions:
    - name: CreateCredits
      preferStartPolicy: "immediate"
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
    department:
      type: string
    expired_date:
      type: string
    usage:
      type: string
    use_case:
      type: string
    total_credits:
      type: string
    unit_filters:
      type: string
    discount_enable:
      type: string
    apply_for_test:
      type: string
  approval:
    nodes:
    - userGroup: internal-credit-admin-dev
      method: ANY

- name: DeployNewRegion
  alias: Deploy A New Region
  target: undefined # todo change to region
  description: Deploy a new region. Check the [guide](https://pingcap.feishu.cn/wiki/WaVJwYYJXif8u8kHqsicpy9bnXg) for more information.
  internal: false
  categories: ["region", "nonstandard"]
  actions:
    - name: DeployNewRegion
      preferStartPolicy: "manual"
  params:
    tidb_cloud_instance:
      type: string
      enum: [ "dev" ]
      default: "dev"
      desc: "TiDB cloud env"
    cloud_provider:
      type: string
      enum: [ "aws", "azure" ]
      desc: "On which cloud should the region be deployed"
    region_name:
      type: string
      desc: "The name of the cloud region, like `ap-northeast-1`"
    logical_region_name:
      type: string
      desc: "Recommend to use region prefix, like `ap-northeast-1-eric`"
    o11y_region_name:
      type: string
      desc: "Logical region name for O11Y that should be used by control plane"
    spus_collection_name:
      type: string
      desc: "Select the spus collection name"
    sku_collection_name:
      type: string
      desc: "Input the sku collection name"
    m_account:
      type: string
      desc: "Cloud account to deploy control plane. For azure, input {aws_account}:{tenant_id}:{subscription_id}:{client_id}"
    d_accounts:
      type: string
      desc: "Cloud accounts to deploy data plane, splited with comma. For azure, input {subscription_id}"
    o11y_account:
      type: string
      desc: "Cloud account of O11Y region. For azure, input {subscription_id}"
  approval:
    nodes:
    - emails: [lili@pingcap.com, qiaodan@pingcap.com, xukai@pingcap.com]
      method: ANY
    - emails: [fuchao.lan@pingcap.com, zhoushuai@pingcap.com]
      method: ANY

- name: DeployNewBYOCRegion
  alias: Deploy A New BYOC Region
  target: undefined # todo change to region
  description: Deploy a new BYOC region. Check the [guide](https://pingcap-cn.feishu.cn/wiki/JrJPww1rNivz47kY53xcZIZhnPd) for more information.
  internal: false
  categories: ["region", "nonstandard"]
  actions:
    - name: DeployNewBYOCRegion
      preferStartPolicy: "manual"
  params:
    tidb_cloud_instance:
      type: string
      enum: [ "dev" ]
      default: "dev"
      desc: "TiDB cloud env"
    tenant_id:
      type: string
      desc: "BYOC tenant id, please input exactly one tenant id"
    cloud_provider:
      type: string
      enum: [ "aws" ]
      desc: "On which cloud should the region be deployed"
    region_name:
      type: string
      desc: "The name of the cloud region, like `ap-northeast-1`"
    availability_zones:
      type: string
      desc: "Availability zone ids of the region, splited with comma, like `apne1-az1,apne1-az2,apne1-az3`"
    logical_region_name:
      type: string
      desc: "Recommend to use region prefix, like `ap-northeast-1-byoc-0701`"
    m_account:
      type: string
      desc: "Cloud account to deploy control plane, please input exactly one account"
    d_account:
      type: string
      desc: "Cloud account to deploy data plane, please input exactly one account"
    o11y_account:
      type: string
      desc: "Cloud account of O11Y region, please input exactly one account"
    rds_name:
      type: string
      desc: "RDS name of the region, please input RDS name without region and env prefix, like `ng-rds`"
    create_rds:
      type: string
      desc: "Whether to create RDS for the region, default is false"
      enum: ["false", "true"]
      default: "false"
    pca_arn:
      type: string
      optional: true
      desc: "PCA ARN of the region, please input exactly one PCA ARN"
    tidb_hosted_zone_name:
      type: string
      desc: "Hosted zone name of d_account, please input exactly one hosted zone name"
    o11y_hosted_zone_name:
      type: string
      desc: "O11Y hosted zone name of d_account, please input exactly one hosted zone name"
    ecr:
      type: string
      desc: "ECR address, like ${d_account}.dkr.ecr.us-west-2.amazonaws.com"
  approval:
    nodes:
    - emails: [lili@pingcap.com, qiaodan@pingcap.com, xukai@pingcap.com]
      method: ANY
    - emails: [fuchao.lan@pingcap.com, zhoushuai@pingcap.com]
      method: ANY

- name: DeployNewNextGenRegion
  alias: Deploy A New Next Gen Region
  target: undefined # todo change to region
  description: Deploy a new Next Gen region. Check the [guide](https://pingcap-cn.feishu.cn/wiki/JrJPww1rNivz47kY53xcZIZhnPd) for more information.
  internal: false
  categories: ["region", "nonstandard"]
  actions:
    - name: DeployNewNextGenRegion
      preferStartPolicy: "manual"
  params:
    tidb_cloud_instance:
      type: string
      enum: [ "dev" ]
      default: "dev"
      desc: "TiDB cloud env"
    cloud_provider:
      type: string
      enum: [ "aws" ]
      desc: "On which cloud should the region be deployed"
    region_name:
      type: string
      desc: "The name of the cloud region, like `ap-northeast-1`"
    availability_zones:
      type: string
      desc: "Availability zone ids of the region, splited with comma, like `apne1-az1,apne1-az2,apne1-az3`"
    logical_region_name:
      type: string
      desc: "Recommend to use region prefix, like `ap-northeast-1-byoc-0701`"
    m_account:
      type: string
      desc: "Cloud account to deploy control plane, please input exactly one account"
    d_accounts:
      type: string
      desc: "Cloud account to deploy data plane, please input exactly one account"
    o11y_account:
      type: string
      desc: "Cloud account of O11Y region, please input exactly one account"
    rds_name:
      type: string
      desc: "RDS name of the region, please input RDS name without region and env prefix, like `ng-rds`"
    create_rds:
      type: string
      desc: "Whether to create RDS for the region, default is false"
      enum: ["false", "true"]
      default: "false"
  approval:
    nodes:
    - emails: [lili@pingcap.com]
      method: ANY
    - emails: [fuchao.lan@pingcap.com, zhoushuai@pingcap.com]
      method: ANY

- name: UpdateGlobalVersion
  alias: Update Global Version
  target: undefined
  description: Update a global version.
  internal: true
  categories: ["configuration"]
  actions:
  - name: UpdateDefaultVersion
    optional: true
  params:
    version:
      type: string
    cluster_type:
      type: string
      enum: [ "DEDICATED_TIDB", "TICDC"]
      default: "DEDICATED_TIDB"
  approval:
    nodes:
    - userGroup: cloud-operation-release-kernel
      method: ANY

- name: SyncGitopsVersions
  alias: Sync Versions from gitops
  target: undefined
  description: sync tidb versions from gitops.
  internal: true
  categories: ["configuration"]
  actions:
  - name: SyncGitopsVersions
    optional: true
  params:
    cluster_type:
      type: string
      enum: [ "DEDICATED_TIDB" ]
      default: "DEDICATED_TIDB"
    min_version:
      type: string
    max_version:
      type: string
    gitops_branch:
      type: string
    tier_branch:
      type: string
      default: main
  approval:
    nodes:
    - userGroup: cloud-operation-release-kernel
      method: ANY

- name: UpdateTenantDefaultTemplateBinding
  alias: Update Tenant Default Template Binding
  target: tenant
  description: update tenant default template binding.
  internal: true
  categories: ["configuration"]
  actions:
  - name: UpdateDefaultTemplateBinding
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
    update_default_template_binding_request:
      type: string
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: DeleteTenantDefaultTemplateBinding
  alias: Delete Tenant Default Template Binding
  target: tenant
  description: delete tenant default template binding.
  internal: true
  categories: ["configuration"]
  actions:
  - name: DeleteDefaultTemplateBinding
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
    delete_default_template_binding_request:
      type: string
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: ModifyClusterVolume
  alias: Modify Cluster Volume
  target: cluster
  description: "Modify cluster volume. The throughput higher than limit is ineffective: https://docs.aws.amazon.com/ec2/latest/instancetypes/gp.html#gp_instance-store"
  internal: false
  categories: ["dedicated"]
  actions:
    - name: ModifyClusterVolume
      preferStartPolicy: "immediate"
  params:
    cluster_id:
      type: string
    tenant_id:
      type: string
    tenant_region:
      type: string
    component_type:
      type: string
      enum: ["tikv", "tiflash"]
    storage_type:
      type: string
      enum: ["data", "raft_log"]
      default: "data"
    volume_size:
      type: string
      desc: specify the volume size(GiB), for example, 100. Empty if unchanged.
      optional: true
    volume_iops:
      type: string
      desc: specify the volume IOPS, for example, 1000. Empty if unchanged.
      optional: true
    volume_additional_iops:
      type: string
      desc: specify the volume additional IOPS for data disk, for example, 1000. Empty if unchanged.
      optional: true
    volume_throughput:
      type: string
      desc: specify the volume throughput(MiB/s), for example, 1000. Empty if unchanged.
      optional: true
    volume_type:
      type: string
      enum: [ "gp3", "io2", "pd-ssd", "premiumv2", "ultrassd"]
      optional: true
      default: ""
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: ScaleClusterPDSize
  alias: Scale Cluster PD Size
  target: cluster
  description: scale cluster PD size.
  categories: ["dedicated"]
  actions:
    - name: ScaleClusterPdComponent
      preferStartPolicy: immediate
  params:
    cluster_id:
      type: string
    tenant_id:
      type: string
    tenant_region:
      type: string
    node_size:
      type: string
      desc: specify the vCPU and memory specifications, for example, 16C32G.
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: ScaleClusterTiProxy
  alias: Scale Cluster TiProxy
  target: cluster
  description: scale cluster tiproxy.
  categories: ["dedicated"]
  actions:
    - name: ScaleClusterTiProxyComponent
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
    tenant_id:
      type: string
    tenant_region:
      type: string
    node_size:
      type: string
      desc: specify the vCPU and memory specifications, for example, 16C32G.
    replicas:
      type: string
      desc: specify the component count.
      optional: true
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: PatchSpu
  alias: Patch Spu
  target: undefined
  description: upsert a spu
  categories: ["spu/sku", "spu"]
  actions:
    - name: PatchSpu
      preferStartPolicy: "manual"
  params:
    patch_spu_body:
      type: string
    patch_spu_info:
      type: string
    spu_id:
      type: string
  approval:
    nodes:
    - emails: [hu.guo@pingcap.com, cwen@pingcap.com, xuyifan02@pingcap.com, liuzhi@pingcap.com]
      method: ANY
    ccTasks:
      emails: [huoyao@pingcap.com, qiaodan@pingcap.com, mayhu@pingcap.com]

- name: PatchSku
  alias: Patch Sku
  target: undefined
  description: upsert a sku
  categories: ["spu/sku", "sku"]
  actions:
    - name: PatchSku
      preferStartPolicy: "manual"
  params:
    patch_sku_body:
      type: string
    patch_sku_info:
      type: string
    sku_id:
      type: string
  approval:
    nodes:
    - emails: [hu.guo@pingcap.com, cwen@pingcap.com, xuyifan02@pingcap.com, liuzhi@pingcap.com]
      method: ANY
    ccTasks:
      emails: [huoyao@pingcap.com, qiaodan@pingcap.com, mayhu@pingcap.com]
  
- name: ShutdownOperationForK8sUpgrade
  alias: Shutdown Operation for dataplane k8s upgrade.
  target: cluster
  description: Shutdown Operation for upgrading the dataplane's controlplane, tidb cluster's nodes, ticdc nodes, and admin nodes.
  categories: ["dedicated"]
  actions:
    - name: UpgradeControlPlane
      preferStartPolicy: "manual"
    - name: CreateOperation
      preferStartPolicy: "immediate"
    - name: UpgradeCDCNodes
      preferStartPolicy: "immediate"
    - name: UpgradeAdminNodes
      preferStartPolicy: "immediate"
  params:
    cluster_id:
      type: string
    tenant_region:
      type: string
    operation_type:
      type: string
      const: "ShutDownUpgradeNodes"
    desired_version:
      type: string
      desc: "upgrade k8s nodes to which version, like `1.30`"
    force:
      type: string
      desc: "ignore cluster status check"
      enum: ["false", "true"]
      default: "false"
      optional: true
  approval:
    nodes:
    - emails: [jianghuaxi@pingcap.com, xieyujie@pingcap.com, fei.chen@pingcap.com]
      method: ANY

- name: ShutdownOperationForUpgradeTiCDCNodes
  alias: Shutdown Operation for upgrading TiCDC nodes' version.
  target: cluster
  description: Shutdown Operation for upgrading the dataplane's ticdc nodes.
  categories: ["dedicated"]
  actions:
    - name: UpgradeCDCNodes
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
    tenant_region:
      type: string
    desired_version:
      type: string
      desc: "upgrade k8s nodes to which version, like `1.30`"
  approval:
    nodes:
    - emails: [jianghuaxi@pingcap.com, xieyujie@pingcap.com, fei.chen@pingcap.com]
      method: ANY

- name: UpdateServerlessClusterResourceConfig
  alias: Update Serverless Cluster Resource Config.
  target: cluster
  description: Update Serverless Cluster Resource Config.
  categories: ["serverless"]
  actions:
    - name: UpdateClusterResourceConfig
      preferStartPolicy: "immediate"
  params:
    cluster_id:
      type: string
    tenant_id:
      type: string
    tenant_region:
      type: string
    project_id:
      type: string
    min_tidb_replicas:
      type: string
      optional: true
      desc: "the minimum number of TiDB instances for a TiDB cluster, like `2`"
    max_tidb_replicas:
      type: string
      optional: true
      desc: "the maximum number of TiDB instances for a TiDB cluster, like `10`"
    min_rcu:
      type: string
      optional: true
      desc: "the minimum request capacity units for essential plan cluster, like `2000`"
    max_rcu:
      type: string
      optional: true
      desc: "the maximum request capacity units for essential plan cluster, like `4000`"
    tidb_pool:
      type: string
      enum: [ "Free", "VIP", "Super VIP" ]
      optional: true
      default: ""
    ru_mode:
      type: string
      enum: [ "Standard", "Throttled" ]
      optional: true
      default: ""
      desc: "resource control limit: standard or throttled"
    canary:
      type: string
      enum: [ "True", "False" ]
      optional: true
      default: ""
  approval:
    nodes:
    - userGroup: cloud-operation-serverless
      method: ANY

- name: FixTiKVIllegalBoundaryForCluster
  alias: Fix TiKV illegal boundary for cluster
  target: cluster
  description: Check and fix TiKV illegal regions and remove TiFlash invalid learner peers
  categories: ["dedicated"]
  actions:
    - name: CreateOperation
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
    tenant_region:
      type: string
    operation_type:
      type: string
      const: "FixTiKVIllegalBoundary"
    dry_run:
      type: string
      desc: "skip all write action, and only do checking"
      enum: ["false", "true"]
      default: "true"
    force:
      type: string
      desc: "ignore cluster status check"
      enum: ["false", "true"]
      default: "false"
      optional: true
  approval:
    nodes:
    - emails: [xieyujie@pingcap.com, fei.chen@pingcap.com, junlin.chen@pingcap.com]
      method: ANY
    ccTasks:
      emails: [xieyujie@pingcap.com, fei.chen@pingcap.com, junlin.chen@pingcap.com]

- name: RestartCDC
  alias: Restart CDC
  target: undefined
  description: restart a cdc cluster
  categories: ["cdc-meta", "cdc-restart"]
  actions:
    - name: RestartCDC
      preferStartPolicy: "manual"
  params:
    ticdc_cluster_id:
      type: string
    cluster_type:
      type: string
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: RestartChangefeed
  alias: Restart Changefeed
  target: undefined
  description: restart a changefeed
  categories: ["cdc-meta", "changefeed-restart"]
  actions:
    - name: RestartChangefeed
      preferStartPolicy: "manual"
  params:
    changefeed_id:
      type: string
    cluster_type:
      type: string
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: PauseChangefeed
  alias: Pause Changefeed
  target: undefined
  description: pause a changefeed
  categories: ["cdc-meta", "changefeed-pause"]
  actions:
    - name: PauseChangefeed
      preferStartPolicy: "manual"
  params:
    changefeed_id:
      type: string
    cluster_type:
      type: string
  approval:
    nodes:
    - selfApprove: true
      method: ANY
      
- name: ResumeChangefeed
  alias: Resume Changefeed
  target: undefined
  description: resume a changefeed
  categories: ["cdc-meta", "changefeed-resume"]
  actions:
    - name: ResumeChangefeed
      preferStartPolicy: "manual"
  params:
    changefeed_id:
      type: string
    cluster_type:
      type: string
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: ScaleNextGenResourcePool
  alias: Scale Next Gen Resource Pool
  target: resource_pool
  description: scale next gen resource pool.
  categories: ["resource-pool"]
  actions:
    - name: ScaleNextGenResourcePool
      preferStartPolicy: "manual"
  params:
    resource_pool_id:
      type: string
    tenant_id:
      type: string
    tenant_region:
      type: string
    component_type:
      type: string
      enum: ["TIKV", "PD", "TICDC", "TIKV_WORKER", "COPROCESSOR_WORKER", "TIDB_WORKER", "PD_TSO", "PD_SCHEDULING", "TIFLASH_WRITE", "TIFLASH_COMPUTE"]
      desc: specify the component type to scale
    node_count:
      type: int
      desc: specify the node count
    cpu_cores:
      type: int
      desc: specify the vcpu count.
      optional: true
    memory_gi:
      type: int
      desc: specify the memory size in GiB.
      optional: true
    force_scale:
      type: string
      enum: [ "false", "true" ]
      default: "false"
      optional: true
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: ScaleNextGenResourcePoolQuota
  alias: Scale Next Gen Resource Pool Quota
  target: resource_pool
  description: scale next gen resource pool quota.
  categories: ["resource-pool"]
  actions:
    - name: ScaleNextGenResourcePoolQuota
      preferStartPolicy: "manual"
  params:
    resource_pool_id:
      type: string
    tenant_id:
      type: string
    tenant_region:
      type: string
    component_type:
      type: string
      enum: ["TIKV", "PD", "TICDC", "TIKV_WORKER", "COPROCESSOR_WORKER", "TIDB_WORKER", "PD_TSO", "PD_SCHEDULING", "TIFLASH_WRITE", "TIFLASH_COMPUTE"]
      desc: specify the component type to scale
    component_id:
      type: string
    max_node_count:
      type: int
      desc: specify the max node count, empty means unchanged.
      optional: true
    min_node_count:
      type: int
      desc: specify the max node count, empty means unchanged.
      optional: true
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: ScaleNextGenTiProxy
  alias: Scale Next Gen TiProxy
  target: cluster
  description: scale next gen TiProxy.
  categories: ["premium"]
  actions:
    - name: ScaleNextGenTiProxy
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
    resource_pool_id:
      type: string
    tenant_region:
      type: string
    node_count:
      type: int
      desc: specify the node count
    cpu_cores:
      type: int
      desc: specify the vcpu count.
      optional: true
    memory_gi:
      type: int
      desc: specify the memory size in GiB.
      optional: true
    force_scale:
      type: string
      enum: [ "false", "true" ]
      default: "false"
      optional: true
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: ScaleNextGenTiProxyQuota
  alias: Scale Next Gen TiProxy Quota
  target: resource_pool
  description: scale next gen tiproxy quota.
  categories: ["premium"]
  actions:
    - name: ScaleNextGenTiProxyQuota
      preferStartPolicy: "manual"
  params:
    resource_pool_id:
      type: string
    tenant_id:
      type: string
    tenant_region:
      type: string
    component_id:
      type: string
    max_node_count:
      type: int
      desc: specify the max node count, empty means unchanged.
      optional: true
    min_node_count:
      type: int
      desc: specify the max node count, empty means unchanged.
      optional: true
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: ScaleNextGenTiDBGroup
  alias: Scale Next Gen TiDB Group
  target: cluster
  description: scale next gen TiDB group.
  categories: ["premium"]
  actions:
    - name: ScaleNextGenTiDBGroup
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
    tenant_region:
      type: string
    tidb_group_id:
      type: string
    node_count:
      type: int
      desc: specify the node count
      optional: true
    cpu_cores:
      type: int
      desc: specify the vcpu count.
      optional: true
    memory_gi:
      type: int
      desc: specify the memory size in GiB.
      optional: true
    force_scale:
      type: string
      enum: [ "false", "true" ]
      default: "false"
      optional: true
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: ScaleNextGenTiDBGroupQuota
  alias: Scale Next Gen TiDBGroup Quota
  target: resource_pool
  description: scale next gen tidb group quota.
  categories: ["premium"]
  actions:
    - name: ScaleNextGenTiDBGroupQuota
      preferStartPolicy: "manual"
  params:
    resource_pool_id:
      type: string
    tenant_id:
      type: string
    tenant_region:
      type: string
    component_id:
      type: string
    max_node_count:
      type: int
      desc: specify the max node count, empty means unchanged.
      optional: true
    min_node_count:
      type: int
      desc: specify the max node count, empty means unchanged.
      optional: true
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: RestartPremiumClusterComponent
  alias: Restart Pod/Component/Node For Premium Cluster
  target: cluster
  description: |
    Restart single node/component/pod of the cluster for a premium cluster.
  categories: ["premium"]
  actions:
  - name: RestartNextGenClusterComponent
  params:
    cluster_id:
      type: string
    tenant_id:
      type: string
    tenant_region:
      type: string
    restart_target_type:
      type: string
      enum: ["pod", "component", "node"]
    restart_target:
      type: string
      desc: "specify the component name, like `tiproxy`, `tidb`, or the pod name."
    restart_target_group:
      type: string
      desc: "specify the component group id"
    force_restart:
      type: string
      enum: ["false", "true"]
      default: "false"
      optional: true
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: RestartNextGenResourcePoolComponent
  alias: Restart Pod/Component/Node For Next Gen Resource Pool
  target: resource_pool
  description: Restart single node/component/pod of the resource pool for a resource pool.
  categories: ["resource-pool"]
  actions:
    - name: RestartNextGenResourcePoolComponent
  params:
    resource_pool_id:
      type: string
    restart_target_type:
      type: string
      enum: ["pod", "component", "node"]
    restart_target:
      type: string
      desc: "specify the component name, like `tikv`, `tiflash`, or the pod name."
    restart_target_group:
      type: string
      desc: "specify the component group id"
    force_restart:
      type: string
      enum: ["false", "true"]
      default: "false"
      optional: true
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: ModifyNextGenResourcePoolVolume
  alias: Modify Next Gen Resource Pool Volume
  target: resource_pool
  description: "Modify volume of next gen shared pool components. The throughput higher than limit is ineffective: https://docs.aws.amazon.com/ec2/latest/instancetypes/gp.html#gp_instance-store"
  categories: ["resource-pool"]
  actions:
    - name: ModifyNextGenResourcePoolVolume
      preferStartPolicy: "manual"
  params:
    resource_pool_id:
      type: string
    tenant_region:
      type: string
    component_type:
      type: string
      enum: ["TIKV", "PD", "TIFLASH_WRITE", "TIFLASH_COMPUTE"]
      desc: specify the component type to scale.
    volume_name:
      type: string
      enum: ["DATA","RAFTLOG","SLOWLOG","INDEXACCELERATION"]
      desc: specify the disk name
    volume_type:
      type: string
      desc: specify the volume type. Empty if unchanged.
      optional: true
    volume_size_gi:
      type: int
      desc: specify the memory size in GiB. Empty if unchanged.
      optional: true
    volume_iops:
      type: int
      desc: specify the volume iops. Empty if unchanged.
      optional: true
    volume_throughput_mbs:
      type: int
      desc: specify the volume throughput(MiB/s), for example, 1000. Empty if unchanged.
      optional: true
    force_modify:
      type: string
      enum: ["false", "true"]
      default: "false"
      optional: true
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: CreateResourcePool
  alias: Create a Resource Pool
  target: tenant
  description: Create a new resource pool.
  categories: ["tenant", "resource-pool"]
  actions:
    - name: CreateResourcePool
      preferStartPolicy: "manual"
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
    name:
      type: string
      desc: specify the name of the resource pool.
    cloud_provider:
      type: string
      enum: [ "AWS", "GCP", "AZURE", "ALICLOUD" ]
      optional: true
      default: "AWS"
    region_name:
      type: string
      desc: "the region of the k8s cluster, like `us-west-2`"
    service_plan:
      type: string
      enum: ["Premium", "BYOC"]
      desc: specify the service plan.
    cidr:
      type: string
      desc: specify the CIDR of the resource pool.
      default: "10.0.0.0/16"
    k8s_service_cidr:
      type: string
      desc: specify the CIDR of the K8S service, default value is 172.20.0.0/16.
      default: "172.20.0.0/16"
      optional: true
    initial_rcu:
      type: int
      desc: specify the initial RCU of the resource pool.
      default: 20000
    instance_limit:
      type: int
      desc: specify the instance limit of the resource pool.
      default: 50
      optional: true
    vcpus_limit:
      type: int
      desc: specify the vCPU limit of the resource pool, only used for BYOC.
      default: 0
      optional: true
    meta_profile_id:
      type: string
      desc: initial meta profile id, leave empty if no need.
      optional: true

    tikv_data.volume_type:
      type: string
      enum: [ "GP3", "IO2", "LocalSSD", "CloudESSD", "CloudAuto", "PremiumSSDV2"]
      desc: specify the volume type.
    tikv_data.volume_size_gi:
      type: int
      desc: specify the memory size in GiB.
      optional: true
    tikv_data.volume_iops:
      type: int
      desc: specify the volume iops.
      optional: true
    tikv_data.volume_throughput_mbs:
      type: int
      desc: specify the volume throughput(MiB/s), for example, 1000.
      optional: true

    tikv_raftlog.volume_type:
      type: string
      enum: [ "GP3", "IO2", "LocalSSD", "CloudESSD", "CloudAuto", "PremiumSSDV2"]
      desc: specify the volume type.
    tikv_raftlog.volume_size_gi:
      type: int
      desc: specify the memory size in GiB.
      optional: true
    tikv_raftlog.volume_iops:
      type: int
      desc: specify the volume iops.
      optional: true
    tikv_raftlog.volume_throughput_mbs:
      type: int
      desc: specify the volume throughput(MiB/s), for example, 1000.
      optional: true

    tiflash_compute.volume_type:
      type: string
      enum: [ "GP3", "IO2", "LocalSSD", "CloudESSD", "CloudAuto", "PremiumSSDV2"]
      desc: specify the volume type.
    tiflash_compute.volume_size_gi:
      type: int
      desc: specify the memory size in GiB.
      optional: true
    tiflash_compute.volume_iops:
      type: int
      desc: specify the volume iops.
      optional: true
    tiflash_compute.volume_throughput_mbs:
      type: int
      desc: specify the volume throughput(MiB/s), for example, 1000.
      optional: true

    tiflash_write.volume_type:
      type: string
      enum: [ "GP3", "IO2", "LocalSSD", "CloudESSD", "CloudAuto", "PremiumSSDV2"]
      desc: specify the volume type.
    tiflash_write.volume_size_gi:
      type: int
      desc: specify the memory size in GiB.
      optional: true
    tiflash_write.volume_iops:
      type: int
      desc: specify the volume iops.
      optional: true
    tiflash_write.volume_throughput_mbs:
      type: int
      desc: specify the volume throughput(MiB/s), for example, 1000.
      optional: true
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: CreateNextGenTiKVGroup
  alias: Create Next Gen TiKV Group
  target: resource_pool
  description: Create a new TiKV group in a resource pool.
  categories: ["resource-pool", "premium"]
  actions:
    - name: CreateTiKVGroup
      preferStartPolicy: "manual"
  params:
    resource_pool_id:
      type: string
    tikv_group_id:
      type: string
      desc: specify the TiKV group id.
    node_count:
      type: int
      desc: specify the node count.
    cpu_cores:
      type: int
      desc: specify the vcpu count.
    memory_gi:
      type: int
      desc: specify the memory size in GiB.
    data_storage_type:
      type: string
      desc: the storage type, aws s3/io2, or gcp gcs, or azure blob
    data_storage_size_gi:
      type: int
      desc: specify the volume size in GiB.
    data_storage_iops:
      type: int
      desc: specify the volume iops.
      optional: true
    data_storage_throughput_mbs:
      type: int
      desc: specify the volume throughput(MiB/s), for example, 1000.
      optional: true
    raftlog_storage_type:
      type: string
      desc: the storage type, aws s3/io2, or gcp gcs, or azure blob
    raftlog_storage_size_gi:
      type: int
      desc: specify the volume size in GiB.
    raftlog_storage_iops:
      type: int
      desc: specify the volume iops.
      optional: true
    raftlog_storage_throughput_mbs:
      type: int
      desc: specify the volume throughput(MiB/s), for example, 1000.
      optional: true
    labels:
      type: map
      desc: specify labels as JSON, e.g. {"zone":"us-east-1"}.
      optional: true
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: SetDefaultResourcePool
  alias: Set Default Resource Pool
  target: tenant
  description: Set the default resource pool for tenant.
  categories: ["resource-pool", "tenant"]
  actions:
    - name: SetDefaultResourcePool
      preferStartPolicy: "manual"
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
    cloud_provider:
      type: string
      enum: [ "AWS", "GCP", "AZURE", "ALICLOUD" ]
      optional: true
      default: "AWS"
    region_name:
      type: string
      desc: "the region of the k8s cluster, like `us-west-2`"
    resource_pool_id:
      type: string
      desc: specify the ID of the resource pool.
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: DeleteResourcePool
  alias: Delete Resource Pool
  target: tenant
  description: Delete the resource pool.
  categories: ["resource-pool"]
  actions:
    - name: DeleteResourcePool
      preferStartPolicy: "manual"
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
    resource_pool_id:
      type: string
      desc: specify the ID of the resource pool.
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: UpdateResourcePoolInstanceLimit
  alias: Update Resource Pool Instance Limit
  target: resource_pool
  description: Update the instance limit for the resource pool.
  categories: ["resource-pool"]
  actions:
    - name: UpdateResourcePoolInstanceLimit
      preferStartPolicy: "manual"
  params:
    tenant_id:
      type: string
    tenant_region:
      type: string
    resource_pool_id:
      type: string
      desc: specify the ID of the resource pool.
    instance_limit:
      type: int
      desc: specify the instance limit for the resource pool.
      default: 50
    vcpus_limit:
      type: int
      desc: specify the vCPU limit for the resource pool, only used for BYOC.
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: UpdateGatewayHPAMinReplicas
  alias: Update Gateway HPA Min Replicas.
  target: cluster
  description: Update the minimum number of replicas for the Gateway HPA.
  categories: ["serverless"]
  actions:
    - name: UpdateGatewayHPAMinReplicas
      preferStartPolicy: "manual"
  params:
    cloud_provider:
      type: string
      enum: [ "aws", "gcp", "azure", "alicloud" ]
      optional: true
      default: "aws"
    region:
      type: string
      desc: "the region of the k8s cluster, like `us-west-2`"
    k8s_cluster:
      type: string
    namespace:
      type: string
    min_replicas:
      type: string
      desc: "the minimum number of replicas for the Gateway HPA, like `2`"
  approval:
    nodes:
    - userGroup: cloud-operation-serverless
      method: ANY

- name: UpdateTiDBAutoscalingThreshold
  alias: Update TiDB Auto-scaling Threshold.
  target: cluster
  description: Update the average value threshold for TiDB auto-scaling based on a metric.
  categories: ["serverless"]
  actions:
    - name: UpdateTiDBAutoscalingThreshold
      preferStartPolicy: "manual"
  params:
    cloud_provider:
      type: string
      enum: [ "aws", "gcp", "azure", "alicloud" ]
      optional: true
      default: "aws"
    region:
      type: string
      desc: "the region of the k8s cluster, like `us-west-2`"
    k8s_cluster:
      type: string
    namespace:
      type: string
    metric:
      type: string
    avg_value:
      type: string
  approval:
    nodes:
    - userGroup: cloud-operation-serverless
      method: ANY

- name: RegisterRegion
  alias: Register Region
  target: region
  description: Register a new region.
  internal: true
  categories: ["region"]
  actions:
    - name: RegisterRegion
      preferStartPolicy: "manual"
  params:
    region_deploy_type:
      type: string
      enum: ["DEPLOY_TYPE_SERVERLESS"]
    register_region_request:
      type: string
  approval:
    nodes:
    - userGroup: cloud-operation-serverless
      method: ANY

- name: UpdateRegion
  alias: Update Region
  target: region
  description: Update a region.
  internal: true
  categories: ["region"]
  actions:
    - name: UpdateRegion
      preferStartPolicy: "manual"
  params:
    region_deploy_type:
      type: string
      enum: ["DEPLOY_TYPE_SERVERLESS"]
    update_region_request:
      type: string
    update_region_request_changed:
      type: string
  approval:
    nodes:
    - userGroup: cloud-operation-serverless
      method: ANY

- name: AddSecondaryCIDR
  alias: Add Secondary CIDR
  target: project
  description: Add Secondary CIDR for a Project.
  internal: true
  categories: ["project"]
  actions:
    - name: AddSecondaryCIDR
  params:
    tenant_id:
      type: string
    project_id:
      type: string
    cloud_provider:
      type: string
    region:
      type: string
    vpc_id:
      type: string
    secondary_cidr:
      type: string
  approval:
    nodes:
    - userGroup: cloud-operation-project-vpc
      method: ANY

- name: ShutdownTiCDC
  alias: Shutdown TiCDC
  target: cluster
  description: Shutdown a TiCDC Cluster.
  internal: true
  categories: ["cdc-meta", "shutdown-ticdc"]
  actions:
    - name: TicdcPauseReconcile
      preferStartPolicy: "manual"
    - name: ApplyConfigChangeViaConfigCenter
      preferStartPolicy: "manual"
    - name: TicdcDeletePodsAndResumeReconcile
      preferStartPolicy: "manual"
  params:
    ticdc_cluster_id:
      type: string
    secondary_confirm_link/change_id:
      type: string
      desc: secondary_confirm_link for cloud-native cluster and change_id for 3-layer cluster.
  approval:
    nodes:
    - emails: [hu.guo@pingcap.com, le.wang@pingcap.com, yuanrui.cai@pingcap.com]
      method: ANY

- name: UpgradeTiCDCNodes
  alias: Upgrading TiCDC nodes' version for cloud native arch.
  target: cluster
  description: Operation for upgrading the dataplane's ticdc nodes.
  categories: ["dedicated"]
  actions:
    - name: UpgradeCDCNodes
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
    tenant_region:
      type: string
  approval:
    nodes:
    - emails: [jianghuaxi@pingcap.com, qiang.wu@pingcap.com]
      method: ANY

- name: MigratePrivateLinkForDedicatedCluster
  alias: Migrate PrivateLink for A Dedicated Cluster
  target: cluster
  description: Migrate PrivateLink for a dedicated cluster.
  categories: ["dedicated"]
  internal: true
  actions:
    - name: MigrateClusterPrivateLink
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
      desc: "the cluster id of the source cluster"
    migrate_privatelink_request:
      type: string
      desc: "the request with json format for migrating privatelink"
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: CreateMigrationClusterForDedicatedCluster
  alias: Create Migration Cluster for A Dedicated Cluster
  target: cluster
  description: Create Migration Cluster for a dedicated cluster.
  internal: true
  categories: ["dedicated"]
  actions:
    - name: CreateMigrationCluster
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
      desc: "the cluster id of the source cluster"
    create_migration_cluster_request:
      type: string
      desc: "the request with json format for migrating dedicated cluster"
  approval:
    nodes:
    - selfApprove: true
      method: ANY

- name: EnableProxyProtocolForCluster
  alias: Enable Proxy Protocol for cluster
  target: cluster
  description: Enable Proxy-Protocol on cluster's components(TiDB, TiProxy) and NLB
  categories: ["dedicated"]
  actions:
    - name: CreateOperation
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
    tenant_region:
      type: string
    # used only for notification on web.
    provider:
      type: string
      const: "AWS"
    # used only for notification on web.
    confirm_rolling_restart_TiDB:
      type: string
      const: "true"
    operation_type:
      type: string
      const: "EnableProxyProtocolForCluster"
  approval:
    nodes:
    - emails: [xieyujie@pingcap.com, fei.chen@pingcap.com, junlin.chen@pingcap.com]
      method: ANY
    ccTasks:
      emails: [xieyujie@pingcap.com, fei.chen@pingcap.com, junlin.chen@pingcap.com]

- name: UpdateNgGlobalComponentImage
  alias: Update Ng Global Component Image
  target: undefined
  description: update image for component(ng) globally
  categories: ["cloudconfig/component", "ng-global"]
  actions:
    - name: ModifyNgGlobalImage
      preferStartPolicy: "manual"
  params:
    cluster_type:
      type: string
    component:
      type: string
    version:
      type: string
    base_image:
      type: string
    tag:
      type: string
  approval:
    nodes:
    - emails:
      - hu.guo@pingcap.com
      - yinsu@pingcap.com
      method: ANY

- name: CreateChangefeedVPCPeering
  alias: Create VPC Peering for Changefeed
  target: cluster
  description: Create VPC Peering for the Changefeed.
  internal: true
  categories: ["premium"]
  actions:
    - name: CreateChangefeedVPCPeering
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
      desc: "the cluster id of the source cluster"
    create_vpc_peering_request:
      type: string
      desc: "the request with json format for create VPC Peering"
  approval:
    nodes:
      - selfApprove: true
        method: ANY

- name: DeleteChangefeedVPCPeering
  alias: Delete a VPC Peering of Changefeed
  target: cluster
  description: Delete a VPC Peering of the Changefeed.
  internal: true
  categories: ["premium"]
  actions:
    - name: DeleteChangefeedVPCPeering
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
      desc: "the cluster id of the source cluster"
    vpc_peering_id:
      type: string
  approval:
    nodes:
      - selfApprove: true
        method: ANY

- name: ModifyLoadBalanceLogs
  alias: Modify LB Logs for cluster
  target: cluster
  description: Enable, disable or modify LB Logs configuration
  categories: ["dedicated"]
  actions:
    - name: CreateOperation
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
    tenant_region:
      type: string
    provider:
      type: string
      const: "GCP"
    operation_type:
      type: string
      const: "ModifyLoadBalanceLogs"
    enabled:
      type: string
      enum: ["true", "false"]
    sample_rate:
      type: string
      desc: "Recommended: 0.05. Must be (0.0, 1.0]: 1.0 means all requests are logged, 0 means none."
      optional: true
    optional_mode:
      type: string
      enum: [
        "EXCLUDE_ALL_OPTIONAL",
        "INCLUDE_ALL_OPTIONAL",
        "CUSTOM",
      ]
      optional: true
    optional_fields:
      type: string
      desc: "Like: serverInstance,serverGkeDetails.cluster. Be available when optional_mode is set to CUSTOM."
      optional: true
  approval:
    nodes:
      - selfApprove: true
        method: ANY
    ccTasks:
      emails: [fei.chen@pingcap.com, junlin.chen@pingcap.com]

- name: ModifyVPCFlowLogs
  alias: Modify VPC Flow Logs for cluster
  target: cluster
  description: Enable, disable or modify VPC Flow Logs configuration
  categories: ["dedicated"]
  actions:
    - name: CreateOperation
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
    tenant_region:
      type: string
    provider:
      type: string
      const: "GCP"
    operation_type:
      type: string
      const: "ModifyVPCFlowLogs"
    enabled:
      type: string
      enum: ["false", "true"]
      default: "true"
    sample_rate:
      type: string
      desc: "Recommended: 0.05. Must be (0.0, 1.0]: 1.0 means all requests are logged, 0 means none."
      optional: true
    aggregation_interval:
      type: string
      enum: [
        "INTERVAL_5_SEC",
        "INTERVAL_30_SEC",
        "INTERVAL_1_MIN",
        "INTERVAL_5_MIN",
        "INTERVAL_10_MIN",
        "INTERVAL_15_MIN",
      ]
    metadata_mode:
      type: string
      enum: [
        "EXCLUDE_ALL_METADATA",
        "INCLUDE_ALL_METADATA",
        "CUSTOM_METADATA",
      ]
      optional: true
    metadata_fields:
      type: string
      desc: "Like: src_instance,dest_instance etc. Be available when optional_mode is set to CUSTOM_METADATA."
      optional: true
  approval:
    nodes:
      - selfApprove: true
        method: ANY
    ccTasks:
      emails: [fei.chen@pingcap.com, junlin.chen@pingcap.com]

- name: CreateMetaProfileInConfigCenter
  alias: Create a Meta Profile
  target: tenant
  description: create a meta profile
  internal: true
  categories: ["config", "tenant"]
  actions:
    - name: CreateMetaProfileInConfigCenter
      preferStartPolicy: "manual"
  params:
    tenant_id:
      type: string
      desc: "tenant id"
    create_meta_profile_request:
      type: string
      desc: "create meta profile request in json format"
  approval:
    nodes:
      - selfApprove: true
        method: ANY

- name: UpdateRegionOpsAuditLogSetting
  alias: Update Region Ops Audit Log Setting
  target: region
  description: Update Region Ops Audit Log Setting.
  internal: true
  categories: ["byoc"]
  actions:
    - name: UpdateRegionOpsAuditLogSetting
      preferStartPolicy: "manual"
  params:
    tenant_id:
      type: string
      desc: "tenant id"
    update_region_ops_audit_log_setting_request:
      type: string
      desc: "the request with json format for updating region ops audit log setting"
  approval:
    nodes:
      - selfApprove: true
        method: ANY

- name: CreateClusterTrafficReplay
  alias: Create a traffic replay for cluster
  target: cluster
  description: create a traffic replay for cluster
  internal: true
  categories: ["dedicated"]
  actions:
    - name: CreateTrafficReplay
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
      desc: "cluster id"
    create_traffic_replay_request:
      type: string
      desc: "request in json format"
  approval:
    nodes:
      - selfApprove: true
        method: ANY

- name: UpdateClusterTrafficReplay
  alias: Update a traffic replay for cluster
  target: cluster
  description: update a traffic replay for cluster
  internal: true
  categories: ["dedicated"]
  actions:
    - name: UpdateTrafficReplay
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
      desc: "cluster id"
    traffic_replay_id:
      type: string
      desc: "traffic replay id"
    update_traffic_replay_request:
      type: string
      desc: "request in json format"
    update_traffic_replay_request_changed:
      type: string
      desc: "changed fields in json format"
  approval:
    nodes:
      - selfApprove: true
        method: ANY

- name: DeleteClusterTrafficReplay
  alias: Delete a traffic replay for cluster
  target: cluster
  description: delete a traffic replay for cluster
  internal: true
  categories: ["dedicated"]
  actions:
    - name: DeleteTrafficReplay
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
      desc: "cluster id"
    traffic_replay_id:
      type: string
      desc: "traffic replay id"
    delete_traffic_replay_request:
      type: string
      desc: "request in json format"
  approval:
    nodes:
      - selfApprove: true
        method: ANY

- name: StartClusterTrafficReplay
  alias: Start a traffic replay for cluster
  target: cluster
  description: start a traffic replay for cluster
  internal: true
  categories: ["dedicated"]
  actions:
    - name: StartTrafficReplay
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
      desc: "cluster id"
    traffic_replay_id:
      type: string
      desc: "traffic replay id"
    start_traffic_replay_request:
      type: string
      desc: "request in json format"
  approval:
    nodes:
      - selfApprove: true
        method: ANY

- name: StopClusterTrafficReplay
  alias: Stop a traffic replay for cluster
  target: cluster
  description: stop a traffic replay for cluster
  internal: true
  categories: ["dedicated"]
  actions:
    - name: StopTrafficReplay
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
      desc: "cluster id"
    traffic_replay_id:
      type: string
      desc: "traffic replay id"
    stop_traffic_replay_request:
      type: string
      desc: "request in json format"
  approval:
    nodes:
      - selfApprove: true
        method: ANY

- name: CreateDataSynchronization
  alias: Create Data Synchronization
  target: cluster
  description: |
    Create a data synchronization (changefeed) between two clusters.
    If the target cluster is in a different project, a privatelink endpoint will be created automatically.
  categories: ["dedicated"]
  actions:
    - name: CreateDataSynchronization
      preferStartPolicy: "manual"
  params:
    cluster_id:
      type: string
      desc: the source cluster id.
    target_cluster_id:
      type: string
      desc: the target cluster id. If not in the same project, privatelink will be created.
    data_sync_name:
      type: string
      desc: the name of the data synchronization, used to create changefeed.
    data_sync_description:
      type: string
      desc: description of the data synchronization.
      optional: true
    target_tidb_group_id:
      type: string
      desc: the target TiDB group id. If empty, the default TiDB group will be used.
      optional: true
    data_sync_rcu:
      type: int
      desc: RCU quota for the data synchronization, default 256.
      optional: true
    data_sync_start_tso:
      type: string
      desc: start TSO for the changefeed. If empty, starts from current time.
      optional: true
    target_cluster_username:
      type: string
      desc: username for the target cluster. If empty, cloud_admin will be used.
      optional: true
    target_cluster_password:
      type: string
      desc: password for the target cluster. Required if username is set.
      optional: true
  approval:
    nodes:
    - selfApprove: true
      method: ANY
