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
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 a Stack

Updated on 2022-02-22 GMT+08:00

Function

This API is used to create a stack.

NOTE:

The stack input consists of the template and input parameters.

  • Template defines the framework of the stack, and determines the structure of the internal nodes of the stack, the relationships between nodes, and the value or source of the attributes of each node.
  • Input parameters are one of the sources of the node attribute values in the template. They are defined in the input fields of the template and are triggered by the get_input function in the template.

URI

POST /v2/stacks

Request

  • Request parameters
    Table 1 Request parameters

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Stack name Restrictions are the same as the name field in Table 2.

    project_id

    Yes

    String

    ID of the project to which the stack belongs. The default value is the project to which the user token belongs. If this parameter is set, the value must be the same as the project information in the user token.

    The value supports a maximum of 63 character and cannot start or end with a hyphen (-). Only lowercase letters, digits, and hyphens are allowed.

    description

    No

    String

    Stack description Restrictions are the same as the description field in Table 2.

    template_id

    Yes

    String

    ID of the template used by the stack. The value supports a maximum of 64 characters.

    inputs_json

    No

    Object

    Input parameter of the template used by the stack.

    Each key-value structure in this parameter corresponds to a key field in the inputs, and the input value is value.

    If a key is not specified, the default value specified by the key is used. If no default value is specified, an error is reported.

    Example: "{'template_input_key': 'value'}"

    force

    No

    Boolean

    Force tailoring ID of the stack. This parameter is applicable to tailoring scenarios.

    labels

    No

    Object

    Stack label. Each internal key-value indicates a label. The key/value field supports a maximum of 64 characters, and must comply with the regular expression ^[a-zA-Z0-9_]+[-.a-zA-Z0-9_]*$.

    namespace

    No

    String

    This parameter must be specified when CCE resources and applications are orchestrated. If the value is not read from CCE, default is used by default.

    cluster_id

    No

    String

    This parameter must be specified when CCE resources and applications are orchestrated. ID of the cluster to which the stack belongs.

    action_parameters

    No

    Object

    After a stack is created, lifecycle configurations are automatically executed and installed. Restrictions are the same as those in Table 2.

    Table 2 Lifecycle configurations

    Parameter

    Mandatory

    Type

    Description

    failure_strategy

    No

    String

    Failure strategy. The default value is DoNothing. The value can be DoNothing or Rollback.

    auto_create

    Yes

    Boolean

    The default value is true.

    timeout

    No

    Integer

    Lifecycle timeout period (in minutes). The default value is 60 minutes. The value supports a maximum of 1440 minutes (that is, one day).

    NOTE:

    When the inputs_json parameter is set to the attribute of a VM application and a valid URL is not entered in the url or name field, the name/version/repository field is used to access SWR for fuzzy search. The efficiency is low when there are a large number of files in the software repository. A feasible solution is to fill in the url field to avoid fuzzy search or specify the name, version, repository parameters in detail to reduce the search scope.

    • url: http://SWR.url/xxx/file.tgz (recommended)
    • name: file.tgz; version: v1; repository: myProject (good)
    • name: file.tgz (low-efficiency)
  • Example request
    {
        "name": "aos-lm-verydows-t1",
        "template_id": "b417b635-6ab2-1fed-b593-b129a9923ba2",
        "project_id": "10556c2112784111b8bf10512591189e",
        "cluster_id": "46c547ca-e96c-11e7-98b9-0255ac102005",
        "inputs_json": {
            "ecsng-image": "192.168.3.88:20202/default/verydows-ecsng:2.1.1",
            "mysql-image": "192.168.3.88:20202/tangtao/verydows-mysql:5.6.35",
            "redis-image": "192.168.3.88:20202/default/verydows-redis:4.0.2_passwd",
            "verydows-image": "192.168.3.88:20202/default/verydows:2.3.1",
            "verydows-install-image": "192.168.3.88:20202/default/verydows:2.3.1",
            "mysql-name": "verydows-mysql-t1"
        }
    }

Response

  • Response parameters

    A response parameter is a stack structure or response structure.

    • The stack structure is returned when the creation is successful.
    • The error response structure is returned when the creation fails.

    The stack structure is shown in Table 3 Response parameters and the returned incorrect response structure is shown in Table 5.

    Table 3 Response parameters

    Parameter

    Type

    Description

    name

    String

    Stack name

    guid

    String

    Stack ID

    description

    String

    Stack description

    project_id

    String

    ID of the project to which the stack belongs

    domain_id

    String

    Account to which the stack belongs

    template_id

    String

    Template ID

    template_name

    String

    Template name

    inputs_json

    String

    Input parameter of the template used by the stack

    status

    String

    Stack status

    create_at

    String

    Stack creation time

    update_at

    String

    Stack update time

    force

    Boolean

    Force tailoring ID of the stack. This parameter is applicable to tailoring scenarios.

    labels

    String

    Stack label

    cluster_id

    String

    ID of the cluster where the stack is located

    cluster_name

    String

    Name of the cluster where the stack is located

    namespace

    String

    Namespace to which the stack belongs

    template_version

    String

    Version of the template used by the stack

    dsl_version

    String

    Syntax version of the template used by the stack

  • Example response when the request is successful
    {
        "force": true,
        "guid": "d956ea24-e979-11e7-9764-0255ac103504",
        "namespace": "default",
        "project_id": "c261c106051448479eb7c66549866011",
        "cluster_name": "test-not-delete",
        "cluster_id": "46c547ca-e96c-11e7-98b9-0255ac102005",
        "domain_id": "ef09dd6cc93f4653b5557181b802ee71",
        "name": "aos-lm-verydows-t1",
        "description": "",
        "status": "",
        "template_id": "b417b635-6ab2-1fed-b593-b129a9923ba2",
        "previous_template_id": "",
        "template_name": "verydows",
        "healthy": true,
        "healthy_message": "",
        "inputs_json": "{\"ecsng-container-port\":80,\"ecsng-image\":\"192.168.3.88:20202/default/verydows-ecsng:2.1.1\",\"imagePullPolicy\":\"IfNotPresent\",\"mysql-container-port\":3306,\"mysql-database\":\"verydows\",\"mysql-image\":\"192.168.3.88:20202/tangtao/verydows-mysql:5.6.35\",\"mysql-name\":\"verydows-mysql-t1\",\"mysql-password\":\"******\",\"mysql-port\":13306,\"mysql-root-password\":\"******\",\"mysql-user\":\"verydows\",\"redis-container-port\":6379,\"redis-image\":\"192.168.3.88:20202/default/verydows-redis:4.0.2_passwd\",\"redis-password\":\"******\",\"redis-port\":16379,\"verydows-container-port\":80,\"verydows-http-host\":\"\",\"verydows-image\":\"192.168.3.88:20202/default/verydows:2.3.1\",\"verydows-install-image\":\"192.168.3.88:20202/default/verydows:2.3.1\",\"verydows-port\":8088}",
        "previous_inputs_json": "",
        "create_at": "",
        "update_at": "",
        "labels": "",
        "template_version": "2.0.1",
        "dsl_version": "cloud_tosca_version_1_0"
    }
  • Example response when the request fails
    {
        "message": "The request body is invalid, please check. Error: The stack name is already existed.",
        "code": "02030008",
        "extend": ""
    }

Status Code

  • Normal
    Table 4 Status code

    Status Code

    Description

    201

    The stack is successfully created.

  • Abnormal
    Table 5 Status code

    Status Code

    Description

    400

    The request parameter is invalid or more than one package exists.

    404

    The package defined in the template does not exist.

    500

    The server fails to process the request due to an unexpected condition.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback