更新时间:2025-06-26 GMT+08:00
分享

修改关键字信息接口

功能介绍

修改关键字信息接口

调用方法

请参见如何调用API

URI

PUT /v3/{project_id}/basic-aw/{aw_id}

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

参数解释

项目UUID,项目唯一标识,固定长度32位字符(字母和数字)。获取方式请参见获取项目唯一标识

约束限制

不涉及

取值范围

32个字符组成的字符串

默认取值

不涉及

aw_id

String

参数解释

关键字id

约束限制

不涉及

取值范围

32个字符组成的字符串

默认取值

不涉及

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释:

用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

约束限制:

必传。

取值范围:

字符串长度不少于1,不超过10万。

默认取值:

不涉及。

表3 请求Body参数

参数

是否必选

参数类型

描述

description

String

参数解释

关键字描述

dft_check_point_list

Array of CheckPoint objects

参数解释

检查点列表

dft_custom_header

Array of AwParam objects

参数解释

关键字参数类列表

dft_retry_interval

String

参数解释

重试间隔时间 (ms) ,为空表示不等待(目前内部使用)

dft_retry_times

String

参数解释

重试次数(目前内部使用)

dft_variable_list

Array of AwVariable objects

参数解释

定义的变量信息

name

String

参数解释

关键字名称

param_type_and_dft_value

Array of AwParam objects

参数解释

参数类型和参数默认值对应列表

表4 CheckPoint

参数

是否必选

参数类型

描述

comparison

String

参数解释

比较符

description

String

参数解释

描述信息

function_arg

String

参数解释

类型值

function_type

String

参数解释

高级提取类型

property

String

参数解释

属性名称

value

String

参数解释

目标值

表5 AwVariable

参数

是否必选

参数类型

描述

by_order

Integer

参数解释

节点顺序

currentPermission

String

参数解释

当前人员权限

description

String

参数解释

参数描述

dynamicParam

String

参数解释

动态参数名称

dynamicParamFlag

Boolean

参数解释

动态参数标志,默认为false. true代表动态参数; false代表非动态参数

functionParams

String

参数解释

变量参数([]:空参、[a]:一参,[a,b]:两参)

function_arg

String

参数解释

提取类型的类型值

function_type

String

参数解释

高级提取类型,响应提取时要使用什么方法处理参数

isSensitiveInfo

Boolean

参数解释

是否是敏感字段

isSensitiveModified

Boolean

参数解释

敏感字段是否被修改,不敏感字段不关注此值

is_out_put

Boolean

参数解释

是否是组合关键字的输出参数,只有组合关键字下awInstance的关键字变量有该字段

name

String

参数解释

参数名称

node_id

String

参数解释

节点id

node_type

Integer

参数解释

0/null-变量节点; 1-目录节点

oldName

String

参数解释

旧名称

parent_node_id

String

参数解释

父节点唯一标识

property

String

参数解释

属性

regex

String

参数解释

内置函数枚举

sensitiveInfoSetterTime

String

参数解释

敏感参数设置时间

sensitiveInfoSetterUser

String

参数解释

敏感参数设置者名称

type

String

参数解释

类型

variableType

Integer

参数解释

变量类型(0:text,10-16:分别对应7个内置函数)

表6 AwParam

参数

是否必选

参数类型

描述

basic_value

AwParamBasicValue object

参数解释

关键字参数基本类型取值类

basic_value_list

Array of AwParamBasicValue objects

参数解释

关键字参数, valueType为1时该值有效

custom_body

String

参数解释

自定义requestBody内容,inType为2且isBodyCustom为1时有效

defaultValue

String

参数解释

默认值

description

String

参数解释

关键字参数描述

disabled

Boolean

参数解释

是否禁用,只有非必需参数才能被禁用

drop_down_value

String

参数解释

用于存储下拉菜单的值

enum_type

String

参数解释

枚举类型

enum_type_selected

String

参数解释

当前选中的枚举类型

format

String

参数解释

num和String有效

in_type

Integer

参数解释

rest接口输入参数类型: 0-query 1-path 2-body 3-header 4-formdata 5-config

isChecked

Boolean

参数解释

是否是被选中参数

is_big_field

Boolean

参数解释

是否是大字段参数

is_body_custom

Integer

参数解释

requestBody是否自定义,inType为2时有效。0-非自定义,用原有逻辑;1-自定义body,requestBody直接使用字段customBody

is_contract_param

Integer

参数解释

是否是契约关键字 0-否;1-yes

is_sensitive

Boolean

参数解释

是否敏感参数,0 是, 1 不是

item

ItemParam object

参数解释

关键字基本参数

maxItems

Integer

参数解释

Array类型最大元素数

maxLength

Long

参数解释

String类型最大长度

maximum

Object

参数解释

Number类型最大值

minItems

Integer

参数解释

Array类型最小元素数

minLength

Long

参数解释

String类型最小长度

minimum

Object

参数解释

Number类型最小值

mock

MockInfo object

参数解释

关键字实例中的mock信息

name

String

参数解释

参数名

object_value

Array of AwParam objects

参数解释

valueType为2时该值有效。valueType为3时,该值用来表示数组中单个结构体

object_value_list

Array<Array<AwParam>>

参数解释

valueType为3时该值有效

pattern

String

参数解释

num和String有效

required

Boolean

参数解释

是否必需参数

type

String

参数解释

参数类型

validate_rule

ValidateRule object

参数解释

校验规则

value_type

Integer

参数解释

参数值类型

xChoiceValue

String

参数解释

choice选择关系

表7 AwParamBasicValue

参数

是否必选

参数类型

描述

value

String

参数解释

参数默认值,用例有效

value_range

String

参数解释

参数值范围,逻辑用例有效

表8 ItemParam

参数

是否必选

参数类型

描述

basic_value

AwParamBasicValue object

参数解释

关键字参数基本类型取值类

defaultValue

String

参数解释

默认值

enum_type

String

参数解释

枚举类型

enum_type_selected

String

参数解释

当前选中的枚举类型

format

String

参数解释

num和String有效

is_big_field

Boolean

参数解释

是否是大字段参数

maxItems

Integer

参数解释

Array类型最大元素数

maxLength

Long

参数解释

String类型最大长度

maximum

Object

Number类型最大值

minItems

Integer

参数解释

Array类型最小元素数

minLength

Long

参数解释

String类型最小长度

minimum

Object

参数解释

Number类型最小值

pattern

String

参数解释

num和String有效

type

String

参数解释

参数类型

validate_rule

ValidateRule object

参数解释

校验规则

value_type

Integer

参数解释

参数值类型

xChoiceValue

String

参数解释

choice选择关系

表9 MockInfo

参数

是否必选

参数类型

描述

mock_id

String

参数解释

mock唯一标识

mock_switch

Boolean

参数解释

mock开关

mock_url

String

参数解释

mock地址

表10 ValidateRule

参数

是否必选

参数类型

描述

dependent_info

Array of ConditionInstance objects

参数解释

依赖信息列表

enabled

Boolean

参数解释

是否启用的标识符

is_configDep

Boolean

参数解释

配置依赖的标识符

is_dependent

Boolean

参数解释

是否依赖的标识符

message

String

参数解释

消息

result

String

参数解释

结果

special_char

String

参数解释

特殊字符

special_char_valid

String

参数解释

特殊字符的有效性

x_example

String

参数解释

示例

表11 ConditionInstance

参数

是否必选

参数类型

描述

conditionIndex

Integer

参数解释

条件索引,用于标识当前处理的是哪个条件

conditionMap

Map<String,Array<String>>

参数解释

条件映射,键为整数,值为字符串列表,用于存储各个条件的信息

depParamMap

Map<String,DepParamInstance>

参数解释

依赖参数实例的映射

statementIndex

Integer

参数解释

声明索引,用于标识当前处理的是哪个声明

表12 DepParamInstance

参数

是否必选

参数类型

描述

compareValue

String

参数解释

比较值

comparison

String

参数解释

比较符

condition

Boolean

参数解释

条件

inValidValues

Array of strings

参数解释

无效值列表

name

String

参数解释

名称

nullInfo

String

参数解释

空值信息

relationMap

Map<String,String>

参数解释

关系映射,key为整数,value为字符串

relationNum

Integer

参数解释

关系数量

values

Array of strings

参数解释

值列表

响应参数

状态码:200

表13 响应Body参数

参数

参数类型

描述

code

String

参数解释

错误码

error

CommonResponseErrorObject object

参数解释

统一错误返回

reason

String

参数解释

失败原因

result

Object

参数解释

结果

status

String

参数解释

响应状态

表14 CommonResponseErrorObject

参数

参数类型

描述

code

String

参数解释

错误码

reason

String

参数解释

错误原因

状态码:201

Created

状态码:401

表15 响应Body参数

参数

参数类型

描述

error_code

String

参数解释

接口调用失败错误码

取值范围

12-18个字符组成的字符串

error_msg

String

参数解释

接口调用失败错误信息

取值范围

3-1000个字符组成的字符串

状态码:403

表16 响应Body参数

参数

参数类型

描述

error_code

String

参数解释

接口调用失败错误码

取值范围

12-18个字符组成的字符串

error_msg

String

参数解释

接口调用失败错误信息

取值范围

3-1000个字符组成的字符串

状态码:404

表17 响应Body参数

参数

参数类型

描述

error_code

String

参数解释

接口调用失败错误码

取值范围

12-18个字符组成的字符串

error_msg

String

参数解释

接口调用失败错误信息

取值范围

3-1000个字符组成的字符串

请求示例

put https://{endpoint}/v3/09645c1f3f954a8d9ab29174857cffc5/basic-aw/b724d23de07f4c9cacab338f371489c7

{
  "description" : "map参数测试22222",
  "dft_check_point_list" : [ ],
  "dft_retry_interval" : "0",
  "dft_retry_times" : "0",
  "dft_variable_list" : [ ],
  "dft_custom_header" : [ {
    "type" : "String",
    "name" : "Content-Type",
    "value_type" : 0,
    "basic_value" : {
      "value" : "application/json",
      "value_range" : ""
    },
    "disabled" : false,
    "description" : null,
    "in_type" : 3,
    "minItems" : null,
    "maxItems" : null,
    "minLength" : null,
    "maxLength" : null,
    "required" : false
  }, {
    "type" : "String",
    "name" : "Accept",
    "value_type" : 0,
    "basic_value" : {
      "value" : "application/json;charset=utf-8",
      "value_range" : ""
    },
    "disabled" : false,
    "description" : null,
    "in_type" : 3,
    "minItems" : null,
    "maxItems" : null,
    "minLength" : null,
    "maxLength" : null,
    "required" : false
  } ],
  "name" : "mapTestUsingPOST",
  "param_type_and_dft_value" : [ {
    "type" : "String",
    "value_type" : 0,
    "name" : "hostURL",
    "disabled" : false,
    "description" : null,
    "minItems" : null,
    "maxItems" : null,
    "minLength" : -1001,
    "maxLength" : -1001,
    "maximum" : null,
    "minimum" : null,
    "required" : true,
    "basic_value" : {
      "value" : "10.183.232.112:9999",
      "value_range" : ""
    }
  }, {
    "type" : "StructWithMapReq",
    "name" : "mapParam",
    "disabled" : false,
    "in_type" : 2,
    "minLength" : null,
    "maxLength" : null,
    "maxItems" : null,
    "minItems" : null,
    "maximum" : null,
    "minimum" : null,
    "required" : false,
    "is_big_field" : null,
    "is_body_custom" : null,
    "value_type" : 2,
    "object_value" : [ {
      "type" : "Object",
      "name" : "mapIntInt",
      "disabled" : false,
      "in_type" : null,
      "minLength" : null,
      "maxLength" : null,
      "maxItems" : 0,
      "minItems" : 0,
      "maximum" : 0,
      "minimum" : null,
      "required" : false,
      "is_big_field" : false,
      "value_type" : 0,
      "basic_value" : {
        "value" : null,
        "value_range" : null
      }
    }, {
      "type" : "Object",
      "name" : "mapIntegerString",
      "disabled" : false,
      "in_type" : null,
      "minLength" : null,
      "maxLength" : null,
      "maxItems" : 0,
      "minItems" : 0,
      "maximum" : 0,
      "minimum" : null,
      "required" : false,
      "is_big_field" : false,
      "value_type" : 0,
      "basic_value" : {
        "value" : null,
        "value_range" : null
      }
    }, {
      "type" : "Object",
      "name" : "mapStringInteger",
      "disabled" : false,
      "in_type" : null,
      "minLength" : null,
      "maxLength" : null,
      "maxItems" : 0,
      "minItems" : 0,
      "maximum" : 0,
      "minimum" : null,
      "required" : false,
      "is_big_field" : false,
      "value_type" : 0,
      "basic_value" : {
        "value" : null,
        "value_range" : null
      }
    }, {
      "type" : "Object",
      "name" : "mapStringString",
      "disabled" : false,
      "in_type" : null,
      "minLength" : null,
      "maxLength" : null,
      "maxItems" : 0,
      "minItems" : 0,
      "maximum" : 0,
      "minimum" : null,
      "required" : false,
      "is_big_field" : false,
      "value_type" : 0,
      "basic_value" : {
        "value" : null,
        "value_range" : null
      }
    }, {
      "type" : "List<Object>",
      "name" : "mapStringStringList",
      "disabled" : false,
      "in_type" : null,
      "minLength" : null,
      "maxLength" : null,
      "maxItems" : 0,
      "minItems" : 0,
      "maximum" : 0,
      "minimum" : null,
      "required" : false,
      "is_big_field" : false,
      "value_type" : 1,
      "basic_value_list" : [ {
        "value" : null,
        "value_range" : null
      } ]
    }, {
      "type" : "Object",
      "name" : "objParam",
      "disabled" : false,
      "in_type" : null,
      "minLength" : null,
      "maxLength" : null,
      "maxItems" : 0,
      "minItems" : 0,
      "maximum" : 0,
      "minimum" : null,
      "required" : false,
      "is_big_field" : false,
      "value_type" : 0,
      "basic_value" : {
        "value" : null,
        "value_range" : null
      }
    } ]
  } ]
}

响应示例

状态码:200

OK

{
  "status" : "success",
  "result" : { },
  "reason" : null,
  "error" : null,
  "code" : null
}

SDK代码示例

SDK代码示例如下。

Java

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.cloudtest.v1.region.CloudtestRegion;
import com.huaweicloud.sdk.cloudtest.v1.*;
import com.huaweicloud.sdk.cloudtest.v1.model.*;

import java.util.List;
import java.util.ArrayList;

public class UpdateBasicAwByIdSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");

        ICredential auth = new BasicCredentials()
                .withAk(ak)
                .withSk(sk);

        CloudtestClient client = CloudtestClient.newBuilder()
                .withCredential(auth)
                .withRegion(CloudtestRegion.valueOf("<YOUR REGION>"))
                .build();
        UpdateBasicAwByIdRequest request = new UpdateBasicAwByIdRequest();
        request.withAwId("{aw_id}");
        request.withProjectId("{project_id}");
        UpdateBasicAwReq body = new UpdateBasicAwReq();
        List<AwParamBasicValue> listObjectValueBasicValueList = new ArrayList<>();
        List<AwParam> listParamTypeAndDftValueObjectValue = new ArrayList<>();
        listParamTypeAndDftValueObjectValue.add(
            new AwParam()
                .withBasicValue()
                .withDisabled(false)
                .withIsBigField(false)
                .withMaxItems(0)
                .withMaximum("0")
                .withMinItems(0)
                .withName("mapIntInt")
                .withRequired(false)
                .withType("Object")
                .withValueType(0)
        );
        listParamTypeAndDftValueObjectValue.add(
            new AwParam()
                .withBasicValue()
                .withDisabled(false)
                .withIsBigField(false)
                .withMaxItems(0)
                .withMaximum("0")
                .withMinItems(0)
                .withName("mapIntegerString")
                .withRequired(false)
                .withType("Object")
                .withValueType(0)
        );
        listParamTypeAndDftValueObjectValue.add(
            new AwParam()
                .withBasicValue()
                .withDisabled(false)
                .withIsBigField(false)
                .withMaxItems(0)
                .withMaximum("0")
                .withMinItems(0)
                .withName("mapStringInteger")
                .withRequired(false)
                .withType("Object")
                .withValueType(0)
        );
        listParamTypeAndDftValueObjectValue.add(
            new AwParam()
                .withBasicValue()
                .withDisabled(false)
                .withIsBigField(false)
                .withMaxItems(0)
                .withMaximum("0")
                .withMinItems(0)
                .withName("mapStringString")
                .withRequired(false)
                .withType("Object")
                .withValueType(0)
        );
        listParamTypeAndDftValueObjectValue.add(
            new AwParam()
                .withBasicValueList(listObjectValueBasicValueList)
                .withDisabled(false)
                .withIsBigField(false)
                .withMaxItems(0)
                .withMaximum("0")
                .withMinItems(0)
                .withName("mapStringStringList")
                .withRequired(false)
                .withType("List<Object>")
                .withValueType(1)
        );
        listParamTypeAndDftValueObjectValue.add(
            new AwParam()
                .withBasicValue()
                .withDisabled(false)
                .withIsBigField(false)
                .withMaxItems(0)
                .withMaximum("0")
                .withMinItems(0)
                .withName("objParam")
                .withRequired(false)
                .withType("Object")
                .withValueType(0)
        );
        AwParamBasicValue basicValueParamTypeAndDftValue = new AwParamBasicValue();
        basicValueParamTypeAndDftValue.withValue("10.183.232.112:9999")
            .withValueRange("");
        List<AwParam> listbodyParamTypeAndDftValue = new ArrayList<>();
        listbodyParamTypeAndDftValue.add(
            new AwParam()
                .withBasicValue(basicValueParamTypeAndDftValue)
                .withDisabled(false)
                .withMaxLength(-1001L)
                .withMinLength(-1001L)
                .withName("hostURL")
                .withRequired(true)
                .withType("String")
                .withValueType(0)
        );
        listbodyParamTypeAndDftValue.add(
            new AwParam()
                .withDisabled(false)
                .withInType(2)
                .withName("mapParam")
                .withObjectValue(listParamTypeAndDftValueObjectValue)
                .withRequired(false)
                .withType("StructWithMapReq")
                .withValueType(2)
        );
        AwParamBasicValue basicValueDftCustomHeader = new AwParamBasicValue();
        basicValueDftCustomHeader.withValue("application/json;charset=utf-8")
            .withValueRange("");
        AwParamBasicValue basicValueDftCustomHeader1 = new AwParamBasicValue();
        basicValueDftCustomHeader1.withValue("application/json")
            .withValueRange("");
        List<AwParam> listbodyDftCustomHeader = new ArrayList<>();
        listbodyDftCustomHeader.add(
            new AwParam()
                .withBasicValue(basicValueDftCustomHeader1)
                .withDisabled(false)
                .withInType(3)
                .withName("Content-Type")
                .withRequired(false)
                .withType("String")
                .withValueType(0)
        );
        listbodyDftCustomHeader.add(
            new AwParam()
                .withBasicValue(basicValueDftCustomHeader)
                .withDisabled(false)
                .withInType(3)
                .withName("Accept")
                .withRequired(false)
                .withType("String")
                .withValueType(0)
        );
        body.withParamTypeAndDftValue(listbodyParamTypeAndDftValue);
        body.withName("mapTestUsingPOST");
        body.withDftRetryTimes("0");
        body.withDftRetryInterval("0");
        body.withDftCustomHeader(listbodyDftCustomHeader);
        body.withDescription("map参数测试22222");
        request.withBody(body);
        try {
            UpdateBasicAwByIdResponse response = client.updateBasicAwById(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}

Python

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkcloudtest.v1.region.cloudtest_region import CloudtestRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcloudtest.v1 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]

    credentials = BasicCredentials(ak, sk)

    client = CloudtestClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(CloudtestRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = UpdateBasicAwByIdRequest()
        request.aw_id = "{aw_id}"
        request.project_id = "{project_id}"
        listBasicValueListObjectValue = []
        listObjectValueParamTypeAndDftValue = [
            AwParam(
                disabled=False,
                is_big_field=False,
                max_items=0,
                maximum="0",
                min_items=0,
                name="mapIntInt",
                required=False,
                type="Object",
                value_type=0
            ),
            AwParam(
                disabled=False,
                is_big_field=False,
                max_items=0,
                maximum="0",
                min_items=0,
                name="mapIntegerString",
                required=False,
                type="Object",
                value_type=0
            ),
            AwParam(
                disabled=False,
                is_big_field=False,
                max_items=0,
                maximum="0",
                min_items=0,
                name="mapStringInteger",
                required=False,
                type="Object",
                value_type=0
            ),
            AwParam(
                disabled=False,
                is_big_field=False,
                max_items=0,
                maximum="0",
                min_items=0,
                name="mapStringString",
                required=False,
                type="Object",
                value_type=0
            ),
            AwParam(
                basic_value_list=listBasicValueListObjectValue,
                disabled=False,
                is_big_field=False,
                max_items=0,
                maximum="0",
                min_items=0,
                name="mapStringStringList",
                required=False,
                type="List<Object>",
                value_type=1
            ),
            AwParam(
                disabled=False,
                is_big_field=False,
                max_items=0,
                maximum="0",
                min_items=0,
                name="objParam",
                required=False,
                type="Object",
                value_type=0
            )
        ]
        basicValueParamTypeAndDftValue = AwParamBasicValue(
            value="10.183.232.112:9999",
            value_range=""
        )
        listParamTypeAndDftValuebody = [
            AwParam(
                basic_value=basicValueParamTypeAndDftValue,
                disabled=False,
                max_length=-1001,
                min_length=-1001,
                name="hostURL",
                required=True,
                type="String",
                value_type=0
            ),
            AwParam(
                disabled=False,
                in_type=2,
                name="mapParam",
                object_value=listObjectValueParamTypeAndDftValue,
                required=False,
                type="StructWithMapReq",
                value_type=2
            )
        ]
        basicValueDftCustomHeader = AwParamBasicValue(
            value="application/json;charset=utf-8",
            value_range=""
        )
        basicValueDftCustomHeader1 = AwParamBasicValue(
            value="application/json",
            value_range=""
        )
        listDftCustomHeaderbody = [
            AwParam(
                basic_value=basicValueDftCustomHeader1,
                disabled=False,
                in_type=3,
                name="Content-Type",
                required=False,
                type="String",
                value_type=0
            ),
            AwParam(
                basic_value=basicValueDftCustomHeader,
                disabled=False,
                in_type=3,
                name="Accept",
                required=False,
                type="String",
                value_type=0
            )
        ]
        request.body = UpdateBasicAwReq(
            param_type_and_dft_value=listParamTypeAndDftValuebody,
            name="mapTestUsingPOST",
            dft_retry_times="0",
            dft_retry_interval="0",
            dft_custom_header=listDftCustomHeaderbody,
            description="map参数测试22222"
        )
        response = client.update_basic_aw_by_id(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

Go

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    cloudtest "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cloudtest/v1"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cloudtest/v1/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cloudtest/v1/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        Build()

    client := cloudtest.NewCloudtestClient(
        cloudtest.CloudtestClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.UpdateBasicAwByIdRequest{}
	request.AwId = "{aw_id}"
	request.ProjectId = "{project_id}"
    }
	disabledObjectValue:= false
	isBigFieldObjectValue:= false
	maxItemsObjectValue:= int32(0)
	maximumObjectValue:= "0"
	var maximumObjectValueInterface interface{} = maximumObjectValue
	minItemsObjectValue:= int32(0)
	nameObjectValue:= "mapIntInt"
	requiredObjectValue:= false
	typeObjectValue:= "Object"
	valueTypeObjectValue:= int32(0)
	disabledObjectValue1:= false
	isBigFieldObjectValue1:= false
	maxItemsObjectValue1:= int32(0)
	maximumObjectValue1:= "0"
	var maximumObjectValueInterface1 interface{} = maximumObjectValue1
	minItemsObjectValue1:= int32(0)
	nameObjectValue1:= "mapIntegerString"
	requiredObjectValue1:= false
	typeObjectValue1:= "Object"
	valueTypeObjectValue1:= int32(0)
	disabledObjectValue2:= false
	isBigFieldObjectValue2:= false
	maxItemsObjectValue2:= int32(0)
	maximumObjectValue2:= "0"
	var maximumObjectValueInterface2 interface{} = maximumObjectValue2
	minItemsObjectValue2:= int32(0)
	nameObjectValue2:= "mapStringInteger"
	requiredObjectValue2:= false
	typeObjectValue2:= "Object"
	valueTypeObjectValue2:= int32(0)
	disabledObjectValue3:= false
	isBigFieldObjectValue3:= false
	maxItemsObjectValue3:= int32(0)
	maximumObjectValue3:= "0"
	var maximumObjectValueInterface3 interface{} = maximumObjectValue3
	minItemsObjectValue3:= int32(0)
	nameObjectValue3:= "mapStringString"
	requiredObjectValue3:= false
	typeObjectValue3:= "Object"
	valueTypeObjectValue3:= int32(0)
	disabledObjectValue4:= false
	isBigFieldObjectValue4:= false
	maxItemsObjectValue4:= int32(0)
	maximumObjectValue4:= "0"
	var maximumObjectValueInterface4 interface{} = maximumObjectValue4
	minItemsObjectValue4:= int32(0)
	nameObjectValue4:= "mapStringStringList"
	requiredObjectValue4:= false
	typeObjectValue4:= "List<Object>"
	valueTypeObjectValue4:= int32(1)
	disabledObjectValue5:= false
	isBigFieldObjectValue5:= false
	maxItemsObjectValue5:= int32(0)
	maximumObjectValue5:= "0"
	var maximumObjectValueInterface5 interface{} = maximumObjectValue5
	minItemsObjectValue5:= int32(0)
	nameObjectValue5:= "objParam"
	requiredObjectValue5:= false
	typeObjectValue5:= "Object"
	valueTypeObjectValue5:= int32(0)
	var listObjectValueParamTypeAndDftValue = []model.AwParam{
        {
            Disabled: &disabledObjectValue,
            IsBigField: &isBigFieldObjectValue,
            MaxItems: &maxItemsObjectValue,
            Maximum: &maximumObjectValueInterface,
            MinItems: &minItemsObjectValue,
            Name: &nameObjectValue,
            Required: &requiredObjectValue,
            Type: &typeObjectValue,
            ValueType: &valueTypeObjectValue,
        },
        {
            Disabled: &disabledObjectValue1,
            IsBigField: &isBigFieldObjectValue1,
            MaxItems: &maxItemsObjectValue1,
            Maximum: &maximumObjectValueInterface1,
            MinItems: &minItemsObjectValue1,
            Name: &nameObjectValue1,
            Required: &requiredObjectValue1,
            Type: &typeObjectValue1,
            ValueType: &valueTypeObjectValue1,
        },
        {
            Disabled: &disabledObjectValue2,
            IsBigField: &isBigFieldObjectValue2,
            MaxItems: &maxItemsObjectValue2,
            Maximum: &maximumObjectValueInterface2,
            MinItems: &minItemsObjectValue2,
            Name: &nameObjectValue2,
            Required: &requiredObjectValue2,
            Type: &typeObjectValue2,
            ValueType: &valueTypeObjectValue2,
        },
        {
            Disabled: &disabledObjectValue3,
            IsBigField: &isBigFieldObjectValue3,
            MaxItems: &maxItemsObjectValue3,
            Maximum: &maximumObjectValueInterface3,
            MinItems: &minItemsObjectValue3,
            Name: &nameObjectValue3,
            Required: &requiredObjectValue3,
            Type: &typeObjectValue3,
            ValueType: &valueTypeObjectValue3,
        },
        {
            BasicValueList: &listBasicValueListObjectValue,
            Disabled: &disabledObjectValue4,
            IsBigField: &isBigFieldObjectValue4,
            MaxItems: &maxItemsObjectValue4,
            Maximum: &maximumObjectValueInterface4,
            MinItems: &minItemsObjectValue4,
            Name: &nameObjectValue4,
            Required: &requiredObjectValue4,
            Type: &typeObjectValue4,
            ValueType: &valueTypeObjectValue4,
        },
        {
            Disabled: &disabledObjectValue5,
            IsBigField: &isBigFieldObjectValue5,
            MaxItems: &maxItemsObjectValue5,
            Maximum: &maximumObjectValueInterface5,
            MinItems: &minItemsObjectValue5,
            Name: &nameObjectValue5,
            Required: &requiredObjectValue5,
            Type: &typeObjectValue5,
            ValueType: &valueTypeObjectValue5,
        },
    }
	valueBasicValue:= "10.183.232.112:9999"
	valueRangeBasicValue:= ""
	basicValueParamTypeAndDftValue := &model.AwParamBasicValue{
		Value: &valueBasicValue,
		ValueRange: &valueRangeBasicValue,
	}
	disabledParamTypeAndDftValue:= false
	maxLengthParamTypeAndDftValue:= int64(-1001)
	minLengthParamTypeAndDftValue:= int64(-1001)
	nameParamTypeAndDftValue:= "hostURL"
	requiredParamTypeAndDftValue:= true
	typeParamTypeAndDftValue:= "String"
	valueTypeParamTypeAndDftValue:= int32(0)
	disabledParamTypeAndDftValue1:= false
	inTypeParamTypeAndDftValue:= int32(2)
	nameParamTypeAndDftValue1:= "mapParam"
	requiredParamTypeAndDftValue1:= false
	typeParamTypeAndDftValue1:= "StructWithMapReq"
	valueTypeParamTypeAndDftValue1:= int32(2)
	var listParamTypeAndDftValuebody = []model.AwParam{
        {
            BasicValue: basicValueParamTypeAndDftValue,
            Disabled: &disabledParamTypeAndDftValue,
            MaxLength: &maxLengthParamTypeAndDftValue,
            MinLength: &minLengthParamTypeAndDftValue,
            Name: &nameParamTypeAndDftValue,
            Required: &requiredParamTypeAndDftValue,
            Type: &typeParamTypeAndDftValue,
            ValueType: &valueTypeParamTypeAndDftValue,
        },
        {
            Disabled: &disabledParamTypeAndDftValue1,
            InType: &inTypeParamTypeAndDftValue,
            Name: &nameParamTypeAndDftValue1,
            ObjectValue: &listObjectValueParamTypeAndDftValue,
            Required: &requiredParamTypeAndDftValue1,
            Type: &typeParamTypeAndDftValue1,
            ValueType: &valueTypeParamTypeAndDftValue1,
        },
    }
	valueBasicValue1:= "application/json;charset=utf-8"
	valueRangeBasicValue1:= ""
	basicValueDftCustomHeader := &model.AwParamBasicValue{
		Value: &valueBasicValue1,
		ValueRange: &valueRangeBasicValue1,
	}
	valueBasicValue2:= "application/json"
	valueRangeBasicValue2:= ""
	basicValueDftCustomHeader1 := &model.AwParamBasicValue{
		Value: &valueBasicValue2,
		ValueRange: &valueRangeBasicValue2,
	}
	disabledDftCustomHeader:= false
	inTypeDftCustomHeader:= int32(3)
	nameDftCustomHeader:= "Content-Type"
	requiredDftCustomHeader:= false
	typeDftCustomHeader:= "String"
	valueTypeDftCustomHeader:= int32(0)
	disabledDftCustomHeader1:= false
	inTypeDftCustomHeader1:= int32(3)
	nameDftCustomHeader1:= "Accept"
	requiredDftCustomHeader1:= false
	typeDftCustomHeader1:= "String"
	valueTypeDftCustomHeader1:= int32(0)
	var listDftCustomHeaderbody = []model.AwParam{
        {
            BasicValue: basicValueDftCustomHeader1,
            Disabled: &disabledDftCustomHeader,
            InType: &inTypeDftCustomHeader,
            Name: &nameDftCustomHeader,
            Required: &requiredDftCustomHeader,
            Type: &typeDftCustomHeader,
            ValueType: &valueTypeDftCustomHeader,
        },
        {
            BasicValue: basicValueDftCustomHeader,
            Disabled: &disabledDftCustomHeader1,
            InType: &inTypeDftCustomHeader1,
            Name: &nameDftCustomHeader1,
            Required: &requiredDftCustomHeader1,
            Type: &typeDftCustomHeader1,
            ValueType: &valueTypeDftCustomHeader1,
        },
    }
	nameUpdateBasicAwReq:= "mapTestUsingPOST"
	dftRetryTimesUpdateBasicAwReq:= "0"
	dftRetryIntervalUpdateBasicAwReq:= "0"
	descriptionUpdateBasicAwReq:= "map参数测试22222"
	request.Body = &model.UpdateBasicAwReq{
		ParamTypeAndDftValue: &listParamTypeAndDftValuebody,
		Name: &nameUpdateBasicAwReq,
		DftRetryTimes: &dftRetryTimesUpdateBasicAwReq,
		DftRetryInterval: &dftRetryIntervalUpdateBasicAwReq,
		DftCustomHeader: &listDftCustomHeaderbody,
		Description: &descriptionUpdateBasicAwReq,
	}
	response, err := client.UpdateBasicAwById(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

OK

201

Created

401

Unauthorized

403

Forbidden

404

Not Found

错误码

请参见错误码

相关文档