全部產品
Search
文件中心

CloudOps Orchestration Service:ACS-BssOpenApi-SetRenewal

更新時間:Sep 06, 2024

模板名稱

ACS-BssOpenApi-SetRenewal 修改資源自動續約屬性

立即執行

模板描述

修改資源自動續約屬性

模板類型

自動化

所有者

Alibaba Cloud

輸入參數

參數名稱

描述

類型

是否必填

預設值

約束

resourceIds

資源ID

List

renewalPeriodUnit

續約時間單位

String

renewalPeriod

續約時間長度

Number

renewalStatus

續約狀態

String

productCode

產品代碼

String

regionId

地區ID

String

{{ ACS::RegionId }}

OOSAssumeRole

OOS扮演的RAM角色

String

""

輸出參數

執行此模板需要的權限原則

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:RenewInstance"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "rds:RenewInstance"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "kvstore:RenewInstance"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "bssopenapi:RenewInstance",
                "bssopenapi:SetRenewal"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

詳情

ACS-BssOpenApi-SetRenewal詳情

模板內容

FormatVersion: OOS-2019-06-01
Description:
  en: Modify resource auto renew attribute
  zh-cn: 修改資源自動續約屬性
  name-en: ACS-BssOpenApi-SetRenewal
  name-zh-cn: 修改資源自動續約屬性
Parameters:
  regionId:
    Label:
      en: RegionId
      zh-cn: 地區ID
    Type: String
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  resourceIds:
    Label:
      en: ResourceIds
      zh-cn: 資源ID
    Type: List
  renewalPeriodUnit:
    Label:
      en: RenewalPeriodUnit
      zh-cn: 續約時間單位
    Type: String
    AllowedValues:
      - M
      - Y
  renewalPeriod:
    Label:
      en: RenewalPeriod
      zh-cn: 續約時間長度
    Type: Number
    AllowedValues:
      - 1
      - 2
      - 3
      - 6
      - 12
  renewalStatus:
    Label:
      en: RenewalStatus
      zh-cn: 續約狀態
    Description:
      en: 'Valid values: AutoRenewal: Auto-renewal is enabled for the instance. Normal: Auto-renewal is disabled for the instance.'
      zh-cn: 取值範圍:AutoRenewal:設定為自動續約。 ManualRenewal:手動續約。 NotRenewal:不再續約。
    Type: String
    AllowedValues:
      - AutoRenewal
      - ManualRenewal
      - NotRenewal
  productCode:
    Label:
      en: Product code
      zh-cn: 產品代碼
    Type: String
    AllowedValues:
      - ACS::Bastionhost::Instance
      - ACS::CBWP::CommonBandwidthPackage
      - ACS::ECS::Instance
      - ACS::EIP::EipAddress
      - ACS::MongoDB::DBInstance
      - ACS::Redis::DBInstance
      - ACS::ADB::DBCluster
      - ACS::RDS::DBInstance
      - ACS::PolarDB::DBCluster
      - ACS::SLB::LoadBalancer
      - ACS::DdosCoo::Instance
      - ACS::CEN::CenBandwidthPackage

  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: OOS扮演的RAM角色
    Type: String
    Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: RenewECSInstance
    Action: 'ACS::ExecuteAPI'
    When:
      Fn::Equals:
        - 'ACS::ECS::Instance'
        - '{{ productCode }}'
    Description:
      en: Renew ECS instance
      zh-cn: 續約ECS執行個體
    Properties:
      Service: ECS
      API: RenewInstance
      Parameters:
        RegionId: '{{regionId}}'
        InstanceId: '{{ ACS::TaskLoopItem }}'
        Period: '{{ renewalPeriod }}'
        PeriodUnit: 'Month'
    Loop:
      Items: '{{ resourceIds }}'
  - Name: RenewRDSInstance
    Action: 'ACS::ExecuteAPI'
    When:
      Fn::Equals:
        - 'ACS::RDS::DBInstance'
        - '{{ productCode }}'
    Description:
      en: Renew RDS instance
      zh-cn: 續約RDS執行個體
    Properties:
      Service: RDS
      API: RenewInstance
      Parameters:
        RegionId: '{{regionId}}'
        DBInstanceId: '{{ ACS::TaskLoopItem }}'
        Period: '{{ renewalPeriod }}'
    Loop:
      Items: '{{ resourceIds }}'
  - Name: RenewREDISSInstance
    Action: 'ACS::ExecuteAPI'
    When:
      Fn::Equals:
        - 'ACS::Redis::DBInstance'
        - '{{ productCode }}'
    Description:
      en: Renew REDIS instance
      zh-cn: 續約REDIS執行個體
    Properties:
      Service: R-KVSTORE
      API: RenewInstance
      Parameters:
        RegionId: '{{regionId}}'
        InstanceId: '{{ ACS::TaskLoopItem }}'
        Period: '{{ renewalPeriod }}'
    Loop:
      Items: '{{ resourceIds }}'
  - Name: RenewInstance
    Action: ACS::ExecuteAPI
    When:
      Fn::Not:
        Fn::Jq:
          - First
          - 'contains(["{{productCode}}"])'
          - [ "ACS::ECS::Instance", "ACS::RDS::DBInstance", "ACS::Redis::DBInstance" ]
    Description:
      en: Renew instance
      zh-cn: 續約執行個體
    Properties:
      Service: BssOpenApi
      API: RenewInstance
      Parameters:
        RegionId: '{{ regionId }}'
        InstanceId: '{{ ACS::TaskLoopItem }}'
        RenewPeriod: '{{ renewalPeriod }}'
        ProductCode:
          Fn::Select:
            - '{{ productCode }}'
            - ACS::CBWP::CommonBandwidthPackage: cbwp
              ACS::Bastionhost::Instance: bastionhost
              ACS::EIP::EipAddress: eip
              ACS::MongoDB::DBInstance: dds
              ACS::ADB::DBCluster: ads
              ACS::PolarDB::DBCluster: polardb
              ACS::SLB::LoadBalancer: slb
              ACS::DdosCoo::Instance: ddos
              ACS::CEN::CenBandwidthPackage: cbn
        ProductType:
          Fn::Select:
            - '{{ productCode }}'
            - ACS::CBWP::CommonBandwidthPackage: ''
              ACS::Bastionhost::Instance: bastionhost
              ACS::ECS::Instance: ''
              ACS::EIP::EipAddress: ''
              ACS::MongoDB::DBInstance: ''
              ACS::Redis::DBInstance: ''
              ACS::ADB::DBCluster: ''
              ACS::RDS::DBInstance: rds
              ACS::PolarDB::DBCluster: online
              ACS::SLB::LoadBalancer: ''
              ACS::DdosCoo::Instance: 'ddoscoo'
              ACS::CEN::CenBandwidthPackage: 'cbn_bwp_pre'
    Loop:
      Items: '{{ resourceIds }}'
  - Name: ModifyInstanceRenewAttribute
    Action: ACS::ExecuteAPI
    Description:
      en: Modify renew attribute of instance
      zh-cn: 修改執行個體自動續約屬性
    Properties:
      Service: BssOpenApi
      API: SetRenewal
      Parameters:
        RegionId: '{{ regionId }}'
        InstanceIDs:
          Fn::Join:
            - ','
            - '{{ resourceIds }}'
        RenewalStatus: '{{ renewalStatus }}'
        RenewalPeriod: '{{ renewalPeriod }}'
        RenewalPeriodUnit: '{{ renewalPeriodUnit }}'
        ProductCode:
          Fn::Select:
            - '{{ productCode }}'
            - ACS::CBWP::CommonBandwidthPackage: cbwp
              ACS::Bastionhost::Instance: bastionhost
              ACS::ECS::Instance: ecs
              ACS::EIP::EipAddress: eip
              ACS::MongoDB::DBInstance: dds
              ACS::Redis::DBInstance: redisa
              ACS::ADB::DBCluster: ads
              ACS::RDS::DBInstance: rds
              ACS::PolarDB::DBCluster: polardb
              ACS::SLB::LoadBalancer: slb
              ACS::DdosCoo::Instance: ddos
              ACS::CEN::CenBandwidthPackage: cbn
        ProductType:
          Fn::Select:
            - '{{ productCode }}'
            - ACS::CBWP::CommonBandwidthPackage: ''
              ACS::Bastionhost::Instance: bastionhost
              ACS::ECS::Instance: ''
              ACS::EIP::EipAddress: ''
              ACS::MongoDB::DBInstance: ''
              ACS::Redis::DBInstance: ''
              ACS::ADB::DBCluster: ''
              ACS::RDS::DBInstance: rds
              ACS::PolarDB::DBCluster: online
              ACS::SLB::LoadBalancer: ''
              ACS::DdosCoo::Instance: 'ddoscoo'
              ACS::CEN::CenBandwidthPackage: 'cbn_bwp_pre'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - regionId
          - productCode
          - resourceIds
        Label:
          default:
            zh-cn: 選擇資源
            en: Select Resource
      - Parameters:
          - renewalPeriodUnit
          - renewalPeriod
          - renewalStatus
        Label:
          default:
            zh-cn: 設定續約參數
            en: Configure Parameters
      - Parameters:
          - OOSAssumeRole
        Label:
          default:
            zh-cn: 進階選項
            en: Control Options