El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Creating an AS Policy (V2)

Updated on 2022-08-15 GMT+08:00

Function

This API is used to create an AS policy for an AS group or bandwidth.

The difference between the V2 and V1 APIs for creating an AS policy is that V2 supports creating an AS policy for adjusting bandwidth and differentiating scaling resources by their types.

URI

POST /autoscaling-api/v2/{project_id}/scaling_policy

Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

Request Message

  • Request parameters
    Table 2 Request parameters

    Parameter

    Mandatory

    Type

    Description

    scaling_policy_name

    Yes

    String

    Specifies the AS policy name. The name contains only letters, digits, underscores (_), and hyphens (-), and cannot exceed 64 characters.

    scaling_resource_id

    Yes

    String

    Specifies the scaling resource ID, which is the unique ID of an AS group or bandwidth.

    • If scaling_resource_type is set to SCALING_GROUP, this parameter indicates the unique AS group ID.
    • If scaling_resource_type is set to BANDWIDTH, this parameter indicates the unique bandwidth ID.

    scaling_resource_type

    Yes

    String

    Specifies the scaling resource type.

    • AS group: SCALING_GROUP
    • Bandwidth: BANDWIDTH

    scaling_policy_type

    Yes

    String

    Specifies the AS policy type.

    • ALARM (corresponding to alarm_id): indicates that the scaling action is triggered by an alarm.
    • SCHEDULED (corresponding to scheduled_policy): indicates that the scaling action is triggered as scheduled.
    • RECURRENCE (corresponding to scheduled_policy): indicates that the scaling action is triggered periodically.

    alarm_id

    No

    String

    Specifies the alarm rule ID. This parameter is mandatory when scaling_policy_type is set to ALARM. After this parameter is specified, the value of scheduled_policy does not take effect.

    After you create an alarm policy, the system automatically adds an alarm triggering activity of the autoscaling type to the alarm_actions field in the alarm rule specified by the parameter value.

    You can obtain the parameter value by querying Cloud Eye alarm rules.

    scheduled_policy

    No

    scheduled_policy object

    Specifies the periodic or scheduled AS policy. This parameter is mandatory when scaling_policy_type is set to SCHEDULED or RECURRENCE. After this parameter is specified, the value of alarm_id does not take effect. For details, see Table 3.

    scaling_policy_action

    No

    scaling_policy_action object

    Specifies the scaling action of the AS policy. For details, see Table 4.

    cool_down_time

    No

    Integer

    Specifies the cooldown period (in seconds). The value ranges from 0 to 86400 and is 300 by default.

    description

    No

    String

    Specifies the description of the AS policy. The value can contain 1 to 256 characters.

    Table 3 scheduled_policy field description

    Parameter

    Mandatory

    Type

    Description

    launch_time

    Yes

    String

    Specifies the time when the scaling action is triggered. The time format complies with UTC.

    • If scaling_policy_type is set to SCHEDULED, the time format is YYYY-MM-DDThh:mmZ.
    • If scaling_policy_type is set to RECURRENCE, the time format is hh:mm.

    recurrence_type

    No

    String

    Specifies the periodic triggering type. This parameter is mandatory when scaling_policy_type is set to RECURRENCE.

    • Daily: indicates that the scaling action is triggered once a day.
    • Weekly: indicates that the scaling action is triggered once a week.
    • Monthly: indicates that the scaling action is triggered once a month.

    recurrence_value

    No

    String

    Specifies the day when a periodic scaling action is triggered. This parameter is mandatory when scaling_policy_type is set to RECURRENCE.

    • If recurrence_type is set to Daily, the value is null, indicating that the scaling action is triggered once a day.
    • If recurrence_type is set to Weekly, the value ranges from 1 (Sunday) to 7 (Saturday). The digits refer to dates in each week and separated by a comma, such as 1,3,5.
    • If recurrence_type is set to Monthly, the value ranges from 1 to 31. The digits refer to the dates in each month and separated by a comma, such as 1,10,13,28.
      NOTE:

      When recurrence_type is set to Daily, this parameter does not take effect.

    start_time

    No

    String

    Specifies the start time of the scaling action triggered periodically. The time format complies with UTC. The default value is the local time.

    The time format is YYYY-MM-DDThh:mmZ.

    end_time

    No

    String

    Specifies the end time of the scaling action triggered periodically. The time format complies with UTC. This parameter is mandatory when scaling_policy_type is set to RECURRENCE. When the scaling action is triggered periodically, the end time cannot be earlier than the current and start time.

    The time format is YYYY-MM-DDThh:mmZ.

    Table 4 scaling_policy_action field description

    Parameter

    Mandatory

    Type

    Description

    operation

    No

    String

    Specifies the operation to be performed. The default operation is ADD.
    • If scaling_resource_type is set to SCALING_GROUP, the following operations are supported:
      • ADD: indicates adding instances.
      • REMOVE/REDUCE: indicates removing or reducing instances.
      • SET: indicates setting the number of instances to a specified value.
    • If scaling_resource_type is set to BANDWIDTH, the following operations are supported:
      • ADD: indicates adding instances.
      • REDUCE: indicates reducing instances.
      • SET: indicates setting the number of instances to a specified value.

    size

    No

    Integer

    Specifies the operation size. The value is an integer from 0 to 300. The default value is 1. This parameter can be set to 0 only when operation is set to SET.

    • If scaling_resource_type is set to SCALING_GROUP, this parameter indicates the number of instances. The value is an integer from 0 to 300 and the default value is 1.
    • If scaling_resource_type is set to BANDWIDTH, this parameter indicates the bandwidth (Mbit/s). The value is an integer from 1 to 300 and the default value is 1.
    • If scaling_resource_type is set to SCALING_GROUP, either size or percentage can be set.

    percentage

    No

    Integer

    Specifies the percentage of instances to be operated. If operation is set to ADD, REMOVE, or REDUCE, the value of this parameter is an integer from 1 to 20000. If operation is set to SET, the value is an integer from 0 to 20000.

    • If scaling_resource_type is set to SCALING_GROUP, either size or percentage can be set. If neither size nor percentage is set, the default value of size is 1.
    • If scaling_resource_type is set to BANDWIDTH, percentage is unavailable.

    limits

    No

    Integer

    Specifies the operation restrictions.

    If scaling_resource_type is set to BANDWIDTH and operation is not SET, this parameter takes effect and the unit is Mbit/s.

    • If operation is set to ADD, this parameter indicates the maximum bandwidth allowed.
    • If operation is set to REDUCE, this parameter indicates the minimum bandwidth allowed.
  • Example request
    This example shows how to create an alarm policy named hth_aspolicy_1 with the following configurations: The alarm rule ID is al1513822380493GvlJKZwA8; when the alarm threshold is reached according to the alarm rule, the bandwidth with ID 8ade64b5-d685-40b8-8582-4ce306ea37a6 will be increased by 1 Mbit/s until the bandwidth reaches 10 Mbit/s.
    POST https://{Endpoint}/autoscaling-api/v2/{project_id}/scaling_policy
    
    { 
        "alarm_id": "al1513822380493GvlJKZwA8",
        "cool_down_time": 900,
        "scaling_resource_id": "8ade64b5-d685-40b8-8582-4ce306ea37a6",
        "scaling_resource_type": "BANDWIDTH",
        "scaling_policy_action": {
               "size": 1,
               "operation": "ADD",
               "limits": 10
        },
        "scaling_policy_name": "hth_aspolicy_1",
        "scaling_policy_type": "ALARM"
    }

Response Message

  • Response parameters
    Table 5 Response parameters

    Parameter

    Type

    Description

    scaling_policy_id

    String

    Specifies the AS policy ID.

  • Example response
    { 
         "scaling_policy_id": "0h327883-324n-4dzd-9c61-68d03ee191dd"  
    }

Returned Values

  • Normal

    200

  • Abnormal

    Returned Value

    Description

    400 Bad Request

    The server failed to process the request.

    401 Unauthorized

    You must enter the username and password to access the requested page.

    403 Forbidden

    You are forbidden to access the requested page.

    404 Not Found

    The server could not find the requested page.

    405 Method Not Allowed

    You are not allowed to use the method specified in the request.

    406 Not Acceptable

    The response generated by the server could not be accepted by the client.

    407 Proxy Authentication Required

    You must use the proxy server for authentication so that the request can be processed.

    408 Request Timeout

    The request timed out.

    409 Conflict

    The request could not be processed due to a conflict.

    500 Internal Server Error

    Failed to complete the request because of an internal service error.

    501 Not Implemented

    Failed to complete the request because the server does not support the requested function.

    502 Bad Gateway

    Failed to complete the request because the request is invalid.

    503 Service Unavailable

    Failed to complete the request because the system is unavailable.

    504 Gateway Timeout

    A gateway timeout error occurred.

Error Codes

See Error Codes.

Utilizamos cookies para mejorar nuestro sitio y tu experiencia. Al continuar navegando en nuestro sitio, tú aceptas nuestra política de cookies. Descubre más

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback