文档

ACS-BssOpenApi-SetRenewal

更新时间:

模板名称

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