# Create a service version

Interface should be called on the server side, seeHattori API

# Interface Dxplaination

# Interface name

createCloudbaseServiceVersion

# Functional description

Through this interface, you can create a service version, if you encounter problems during use, you can use theOpen Platform Service Provider ZonePosting exchanges.

# Calling mode

# HTTPS call


POST https://api.weixin.qq.com/componenttcb/createcloudbaserunserverversion?access_token=ACCESS_TOKEN 

# Request parameters

attribute type Default value Required Introductions
access_Token string yes Third-party interface calls token component_access_Token
env_id string yes Environment ID
upload_type string yes Enumeration (package/repository/image/jar/war)
flow_ratio number yes Flow ratio
cpu float yes The size of the cpu, in units: core
mem float yes Size of Mem, in G
min_num number yes Min replicas, minimum value: 0
max_num number yes Maximum replicas, maximum value: 50
policy_type string yes Type of policy(Enumeration values: such as cpu)
policy_threshold number yes Policy threshold
container_port number yes Service port
server_name string yes Name of service
repository_type string no Type of repository(Coding/Gitlab/github/Coding)
Dockerfile_path string no Dockerfile address
build_dir string no Build Directory
env_params string no Environmental variables
repository string no Repository address
branch string no Branching
version_remark string no Version notes
package_name string no Code Package Name
package_version string no Version of the code package
image_info CloudBaseRunImageInfo no Details of Image
code_detail CloudBaseCodeRepoDetail no Details on Github etc. Pull Code
image_secret_info CloudBaseRunImageSecretInfo no Private mirror key information
image_pull_secret string no Private mirror Name of certification
custom_logs string no User Defined Acquisition Log Path
initial_delay_seconds number no How long to delay the start of the health check (units s)
mount_volume_info Array. no Cfs mount information
access_type number no 4 Delegates can only access WeChat link
es_info CloudBaseEsInfo no Es Information
enable_union bool no Use a unified domain name
server_path string no Service path
sidecar_specs Array.<CloudBaseRunSideSpec&gt no Description file for container
security CloudBaseSecurityContext no Safety features
service_volumes Array. no Service Disk Mount
is_create_jns_GW number no Whether to create JnsGw 0 Not created by default 1 Created 2 Not created
service_volume_mounts Array.<CloudBaseRunServiceVolumeMount&gt no Data Volume Mount Parameters
has_Dockerfile number no Is there a Dockerfile: 0-default has, 1-has, 2-has not
base_image string no Base mirror
entry_point string no Container start entry command
Repo_language string no Warehouse language
upload_Filename string yes
policy_detail Array.<HpaPolicy&gt no Automatic Capacity Expansion Policy Group

CloudBaseRunImageInfo The structure of the

attribute type Default value Required Introductions
repository_name string no Mirror Warehouse Name
is_public bool no Whether it is publicly owned
tag_name string no Mirror tag name
server_addr string no Mirror server
image_url string no Mirror pull address

CloudBaseCodeRepoDetail The structure of the

attribute type Default value Required Introductions
name CloudBaseCodeRepoName no The name of the repo
url string no Repo's url

CloudBaseCodeRepoName The structure of the

attribute type Default value Required Introductions
name string no The name of the repo
full_name string no The full name of the repo

CloudBaseRunImageSecretInfo The structure of the

attribute type Default value Required Introductions
registry_server string no Mirror address
user_name string no User name
password string no Warehouse password
email string no mailbox

CloudBaseRunVolumeMount The structure of the

attribute type Default value Required Introductions
name string no Resource name
mount_path string no Mount path
read_only bool no Whether it is read only
nfs_volumes Array. no Nfs mount information

CloudBaseRunNfsVolumeSource The structure of the

attribute type Default value Required Introductions
server string no NFS Mount Server
path string no Server路径
read_only bool no Whether it is read only
secret_name string no secret name
enable_empty_dir_volume bool no Temporary directory

CloudBaseEsInfo The structure of the

attribute type Default value Required Introductions
id number no es的id
secret_name string no Secret name
ip string no Ip address
port number no interface
index string no Indexes
account string no User name
password string no cipher

CloudBaseRunSideSpec The structure of the

attribute type Default value Required Introductions
container_image string no Container image
container_port number no Container port
container_name string no Name of the container
env_var string no The json character string for kv
initial_delay_seconds number no InitialDelaySeconds How long is the delay in starting a health check
cpu number no CPU Size
mem number no Memory size (in M)
security CloudBaseSecurityContext no Safety features
volume_mount_News Array. no Mount Information

CloudBaseSecurityContext The structure of the

attribute type Default value Required Introductions
capabilities CloudBaseCapabilities no Safety features

CloudBaseCapabilities The structure of the

attribute type Default value Required Introductions
add Array.<string&gt no Enable a list of security capabilities
drop Array.<string&gt no Disable security capability to list

CloudRunServiceVolume The structure of the

attribute type Default value Required Introductions
name string no name
nfs CloudBaseRunNfsVolumeSource no How NFS is mounted
secret_name string no secret name
enable_empty_dir_volume bool no If you want to turn on the temporary directory to phase out, use the EmptyDir
empty_dir CloudBaseRunEmptyDirVolumeSource no Emptydir Data Volume Details

CloudBaseRunEmptyDirVolumeSource The structure of the

attribute type Default value Required Introductions
enable_empty_dir_volume bool no Enable emptydir data volumes
medium string no "","Memory","HugePages"
size_limit string no Emptydir Data Volume Size

CloudBaseRunServiceVolumeMount The structure of the

attribute type Default value Required Introductions
name string no Volume name
mount_path string no Mount path
read_only bool no Whether it is read only
sub_path string no Subpath
mount_propagation string no Spread mount mode

HpaPolicy The structure of the

attribute type Default value Required Introductions
policy_type string no Type of policy
policy_threshold number no Policy threshold

# Return value

Returned JSON Data packet

attribute type Introductions
errcode number Error code
errmsg string Error message
result string state(creating/Stn)
version_name string Version name (VersionName is returned only if Result is succ)
run_id string Operation record id

# Call Example

Example Dxplaination: HTTPS requests

# Sample Request Data


{
    "env_id": "test-6gxk23no5605e14f",
    "upload_type": "repository",
    "flow_ratio": 0,
    "cpu": 0.25,
    "mem": 0.5,
    "min_num": 0,
    "max_num": 1,
    "policy_type": "cpu",
    "policy_threshold": 60,
    "container_port": 80,
    "server_name": "test",
    "repository_type": "github",
    "dockerfile_path " : "Dockerfile",
    "repository": " test/wx-container-demo",
    "branch": "main",
    "code_detail " : {
        "name": {
            "name": "wx-container-demo",
            "full_name": " test/wx-container-demo"
        }
    },
    "has_"dockerfile" means: 1,
    "env_params": "{}"
} 

# Return Data Example


{
    "errcode": 0,
    "errmsg": "ok",
    "result": "succ",
    "version_name": "ss-012",
    "run_id": "1mz98HwJmGdACf"
} 

# Error code

Error code Error code Solutions
0 ok ok
-1 system error The system is busy, please wait for the developer to try again
-1000 system error System error
40014 invalid access_Token Illegal access_Token Please take the developer seriously. access_Token Of the validity (such as whether it is expired), or to see if you are working for the appropriate Official Account message template Call interface
40097 invalid args Parameter error
40101 missing parameter Missing required parameters
41001 access_Token missing lack access_Token parameter
42001 access_Token expired access_Token Timeout, please check access_Token Of the validity period, please refer to the Basic Support - Obtain access_Token Middle, right. access_Token Detailed mechanism explaination of the
43002 require POST method Need POST request
44002 empty post data POST The packet is empty.
47001 data format error analysis JSON/XML Content errorpost Missing parameters in the dataCheck for corrections and try again.
85088 no qbase privilege The app is not open for cloud development