
# 修改结构化配置（不推荐） - UpdateStructTemplate
#### 功能介绍
该接口用于修改指定日志流下的结构化配置，由于参数较多且构建复杂，建议您使用8.9.2-修改结构化配置（推荐）。
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-lts/lts_api_0003.html)。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-lts/lts_api_0046.html)。
- 如果使用身份策略授权，需具备如下身份策略权限。
  
  | 授权项                                 | 访问级别  | 资源类型（\*为必须）  | 条件键                       | 别名                                                                                                                                                                                                                                                 | 依赖的授权项 |
  |:---|:---|:---|:---|:---|:---|
  | lts:structConfig:updateStructConfig | Write | logStream \* | g:ResourceTag/\<tag-key\> | - lts:topics:put  - lts:structConfig:put   | -      |
     
  
 
#### URI
PUT /v2/{project_id}/lts/struct/template
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述                                                                                                      |
|:---|:---|:---|:---|
| project_id | 是    | String | 项目ID，可以从调用API处获取，也可以从控制台获取。获取方式请参见：[获取项目ID](https://support.huaweicloud.com/api-lts/lts_api_0006.html)。 |
   
#### 请求参数
表2请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                              |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | **参数解释：** 从IAM服务获取的用户Token，获取方式请参见：[获取用户Token](https://support.huaweicloud.com/api-lts/lts_api_0004.html)。 **约束限制：** 不涉及。 **取值范围：** 不涉及。 **默认取值：** 不涉及。 |
| Content-Type | 是    | String | **参数解释：** 用于定义消息体的格式，该字段填为：application/json;charset=utf8。 **约束限制：** 不涉及。 **取值范围：** 不涉及。 **默认取值：** 不涉及。                                                  |
   
表3请求Body参数 
| 参数            | 是否必选 | 参数类型                                                                     | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
|:---|:---|:---|:---|
| log_group_id  | 是    | String                                                                   | 日志组ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| log_stream_id | 是    | String                                                                   | 日志流ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| project_id    | 是    | String                                                                   | 项目ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| content       | 是    | String                                                                   | 填写一条示例日志。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| demo_fields   | 是    | Array of [DemoFields] objects | 示例字段列表。 说明： demo_fields中的字段顺序，须和content中的字段顺序保持一致。 最大个数：200                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| parse_type    | 是    | String                                                                   | **参数解释：** 结构化类型参数，若启用系统模板，则该参数可填空字符串。 **约束限制：** 不涉及。 **取值范围：** - json：json结构化配置   - split：分词符结构化配置   - nginx：nginx结构化配置   - built_in：结构化模板配置   - custom_regex：自定义正则结构化配置    |
| regex_rules   | 否    | String                                                                   | 正则表达式（使用正则结构化规则时候需要）。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| layers        | 否    | Integer                                                                  | 最大解析层数（使用JSON方式结构化需要）。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| tokenizer     | 否    | String                                                                   | 分隔符（使用分隔符结构化时需要）。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| log_format    | 否    | String                                                                   | Nginx配置规则（使用分隔符结构化时需要）。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| tag_fields    | 是    | Array of [TagField] objects     | tag字段列表（使用tag字段解析时需要，其中系统模板不支持使用tag字段）。 最大个数：200                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| rule          | 否    | [StructRule] object           | 结构化方式                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
   
 表4DemoFields 
| 参数              | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|:---|
| fieldName       | 否    | String  | 字段名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| userDefinedName | 否    | String  | 自定义别名(json，Nginx方式中按需添加)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| type            | 是    | String  | **参数解释：** 字段类型参数。 **约束限制：** 不涉及。 **取值范围：** - string   - long   - float    |
| isAnalysis      | 否    | Boolean | 预留字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| content         | 否    | String  | 字段内容。 说明： 在系统模板中，此参数为demoLog。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| index           | 否    | Integer | 序号                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
   
 表5TagField 
| 参数         | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|:---|
| fieldName  | 是    | String  | 字段名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| content    | 否    | String  | 示例字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| type       | 是    | String  | **参数解释：** 字段数据类型。 **约束限制：** 不涉及。 **取值范围：** - string   - long   - float    |
| isAnalysis | 否    | Boolean | 预留字段。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
   
 表6StructRule 
| 参数    | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|:---|
| type  | 是    | String | **参数解释：** 结构化模板类型。 **约束限制：** 不涉及。 **取值范围：** - regex   - built_in    |
| param | 是    | String | 系统模板名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
   
#### 响应参数
**状态码：200**
表7响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 响应码。 |
   
**状态码：200**
表8响应Body参数 
| 参数        | 参数类型   | 描述          |
|:---|:---|:---|
| error_msg | String | 调用成功响应信息描述。 |
   
**状态码：400**
表9响应Body参数 
| 参数         | 参数类型   | 描述          |
|:---|:---|:---|
| error_code | String | 错误码。        |
| error_msg  | String | 调用失败响应信息描述。 |
   
**状态码：401**
表10响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                      |
|:---|:---|:---|
| error_code | String | **参数解释：** 错误码，请参见：[错误码](https://support.huaweicloud.com/api-lts/ErrorCode.html)。 **取值范围：** 不涉及。 |
| error_msg  | String | **参数解释：** 调用失败响应信息描述。 **取值范围：** 不涉及。                                                            |
   
**状态码：403**
表11响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                      |
|:---|:---|:---|
| error_code | String | **参数解释：** 错误码，请参见：[错误码](https://support.huaweicloud.com/api-lts/ErrorCode.html)。 **取值范围：** 不涉及。 |
| error_msg  | String | **参数解释：** 调用失败响应信息描述。 **取值范围：** 不涉及。                                                            |
   
**状态码：500**
表12响应Body参数 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                      |
|:---|:---|:---|
| error_code | String | **参数解释：** 错误码，请参见：[错误码](https://support.huaweicloud.com/api-lts/ErrorCode.html)。 **取值范围：** 不涉及。 |
| error_msg  | String | **参数解释：** 调用失败响应信息描述。 **取值范围：** 不涉及。                                                            |
   
**状态码：503**
表13响应Body参数 
| 参数         | 参数类型   | 描述  |
|:---|:---|:---|
| error_code | String | 响应码 |
   
**状态码：503**
表14响应Body参数 
| 参数        | 参数类型   | 描述          |
|:---|:---|:---|
| error_msg | String | 调用失败响应信息描述。 |
   
#### 请求示例
- 修改VPC方式的结构化配置。
  ```
  PUT https://{endpoint}/v2/{project_id}/lts/struct/template
  {
    "content" : "1 5f67944957444bd6bb4fe3b367de8f3d 1d515d18-1b36-47dc-a983-bd6512aed4bd 192.168.0.154 192.168.3.25 38929 53 17 1 96 1548752136 1548752736 ACCEPT OK",
    "demo_fields" : [ {
      "fieldName" : "version",
      "content" : "1",
      "type" : "long"
    }, {
      "fieldName" : "project_id",
      "content" : "5f67944957444bd6bb4fe3b367de8f3d",
      "type" : "string"
    }, {
      "fieldName" : "interface_id",
      "content" : "1d515d18-1b36-47dc-a983-bd6512aed4bd",
      "type" : "string"
    }, {
      "fieldName" : "srcaddr",
      "content" : "192.168.0.154",
      "type" : "string"
    }, {
      "fieldName" : "dstaddr",
      "content" : "192.168.3.25",
      "type" : "string"
    }, {
      "fieldName" : "srcport",
      "content" : "38929",
      "type" : "long"
    }, {
      "fieldName" : "dstport",
      "content" : "53",
      "type" : "long"
    }, {
      "fieldName" : "protocol",
      "content" : "17",
      "type" : "long"
    }, {
      "fieldName" : "packets",
      "content" : "1",
      "type" : "long"
    }, {
      "fieldName" : "bytes",
      "content" : "96",
      "type" : "long"
    }, {
      "fieldName" : "start",
      "content" : "1548752136",
      "type" : "long"
    }, {
      "fieldName" : "end",
      "content" : "1548752736",
      "type" : "long"
    }, {
      "fieldName" : "action",
      "content" : "ACCEPT",
      "type" : "string"
    }, {
      "fieldName" : "log_status",
      "content" : "OK",
      "type" : "string"
    } ],
    "rule" : {
      "type" : "built_in",
      "param" : "VPC"
    },
    "log_group_id" : "86b572f8-xxxx-xxxx-xxxx-xxxxxx3c761c",
    "log_stream_id" : "4371xxxx-xxxx-xxxx-xxxx-xxxxxxff79d0",
    "project_id" : "a0a12bxxxxxxxx1185d7cf26c3e86ada",
    "parse_type" : "built_in",
    "tag_fields" : [ {
      "fieldName" : "hostIP",
      "content" : "192.168.2.134",
      "type" : "string",
      "isAnalysis" : true
    } ]
  }
  ```
  
- 修改ELB方式的结构化配置。
  ```
  PUT https://{endpoint}/v2/{project_id}/lts/struct/template
  {
    "content" : "1594727856.337 e7c37d97-e922-457c-bbf3-dsadeqac 2020-07-14T19:57:36+08:00 elb_01 192.0.0.0:88888 200 \"GET http://prod.sss.ads.sg2.aaa/loc/ation?version=3&ip=100.0.0.0&coordinate=27.7044784,85.3007481&device_id=dsadsadasdsadasd&beyla_id=wqeb123ndadsa233ddada HTTP/1.1\" 233 293 138 0.001 \"200\" \"0.000\" \"0.001\" \"0.001\" \"100.0.0.0:9999\" \"lua-resty-http/0.14 (Lua) ngx_lua/10000\" \"-\" \"-\" loadbalancer_edsaee-4c9c-b467-5b8126b2f7f7dsa listener_6077809b-913f-466d-a96c-376f08882d5d 08cc2b3f68aa4dddd1e6a90dddd1688348a4480 pool_b2f2966c-043d-4674-ad4b-c15f2adb2c6b \"-\" 2fb78dsadadq1213das1121dab146ad3cb0 -:80 \"101.0.0.0:10000\" - - - - 9739",
    "demo_fields" : [ {
      "fieldName" : "msec",
      "content" : "1594727856.337",
      "type" : "float"
    }, {
      "fieldName" : "access_log_topic_id",
      "content" : "e7c37d97-e922-457c-bbf3-dsadeqac",
      "type" : "string"
    }, {
      "fieldName" : "time_iso8601",
      "content" : "2020-07-14T19:57:36+08:00",
      "type" : "string"
    }, {
      "fieldName" : "log_ver",
      "content" : "elb_01",
      "type" : "string"
    }, {
      "fieldName" : "remote_addr",
      "content" : "192.0.0.0",
      "type" : "string"
    }, {
      "fieldName" : "remote_port",
      "content" : "88888",
      "type" : "long"
    }, {
      "fieldName" : "status",
      "content" : "200",
      "type" : "long"
    }, {
      "fieldName" : "request_method",
      "content" : "GET",
      "type" : "string"
    }, {
      "fieldName" : "scheme",
      "content" : "http",
      "type" : "string"
    }, {
      "fieldName" : "host",
      "content" : "prod.sss.ads.sg2.aaa",
      "type" : "string"
    }, {
      "fieldName" : "router_request_uri",
      "content" : "loc/ation?version=3&ip=100.0.0.0&coordinate=27.7044784,85.3007481&device_id=dsadsadasdsadasd&beyla_id=wqeb123ndadsa233ddada",
      "type" : "string"
    }, {
      "fieldName" : "server_protocol",
      "content" : "HTTP/1.1",
      "type" : "string"
    }, {
      "fieldName" : "request_length",
      "content" : "233",
      "type" : "long"
    }, {
      "fieldName" : "bytes_sent",
      "content" : "293",
      "type" : "long"
    }, {
      "fieldName" : "body_bytes_sent",
      "content" : "138",
      "type" : "long"
    }, {
      "fieldName" : "request_time",
      "content" : "0.001",
      "type" : "float"
    }, {
      "fieldName" : "upstream_status",
      "content" : "200",
      "type" : "long"
    }, {
      "fieldName" : "upstream_connect_time",
      "content" : "0.000",
      "type" : "float"
    }, {
      "fieldName" : "upstream_header_time",
      "content" : "0.001",
      "type" : "float"
    }, {
      "fieldName" : "upstream_response_time",
      "content" : "0.001",
      "type" : "float"
    }, {
      "fieldName" : "upstream_addr",
      "content" : "100.0.0.0:9999",
      "type" : "string"
    }, {
      "fieldName" : "http_user_agent",
      "content" : "lua-resty-http/0.14 (Lua) ngx_lua/10000",
      "type" : "string"
    }, {
      "fieldName" : "http_referer",
      "content" : "-",
      "type" : "string"
    }, {
      "fieldName" : "http_x_forwarded_for",
      "content" : "-",
      "type" : "string"
    }, {
      "fieldName" : "lb_name",
      "content" : "loadbalancer_edsaee-4c9c-b467-5b8126b2f7f7dsa",
      "type" : "string"
    }, {
      "fieldName" : "listener_name",
      "content" : "listener_6077809b-913f-466d-a96c-376f08882d5d",
      "type" : "string"
    }, {
      "fieldName" : "listener_id",
      "content" : "08cc2b3f68aa4dddd1e6a90dddd1688348a4480",
      "type" : "string"
    }, {
      "fieldName" : "pool_name",
      "content" : "pool_b2f2966c-043d-4674-ad4b-c15f2adb2c6b",
      "type" : "string"
    }, {
      "fieldName" : "member_name",
      "content" : "-",
      "type" : "string"
    }, {
      "fieldName" : "tenant_id",
      "content" : "2fb78dsadadq1213das1121dab146ad3cb0",
      "type" : "string"
    }, {
      "fieldName" : "eip_address",
      "content" : "-",
      "type" : "string"
    }, {
      "fieldName" : "eip_port",
      "content" : "80",
      "type" : "long"
    }, {
      "fieldName" : "upstream_addr_priv",
      "content" : "101.0.0.0:10000",
      "type" : "string"
    }, {
      "fieldName" : "certificate_id",
      "content" : "-",
      "type" : "string"
    }, {
      "fieldName" : "ssl_protocol",
      "content" : "-",
      "type" : "string"
    }, {
      "fieldName" : "ssl_cipher",
      "content" : "-",
      "type" : "string"
    }, {
      "fieldName" : "sni_domain_name",
      "content" : "-",
      "type" : "string"
    }, {
      "fieldName" : "tcpinfo_rtt",
      "content" : "9739",
      "type" : "long"
    } ],
    "rule" : {
      "type" : "built_in",
      "param" : "ELB"
    },
    "tag_fields" : [ {
      "fieldName" : "hostIP",
      "content" : "192.168.2.134",
      "type" : "string",
      "isAnalysis" : true
    } ],
    "log_group_id" : " ",
    "log_stream_id" : " ",
    "project_id" : " ",
    "parse_type" : "built_in"
  }
  ```
  
 
#### 响应示例
**状态码：400**
非法请求。
```
{
  "error_code" : "LTS.0612",
  "error_msg" : "timee fieldType is error"
}
```
**状态码：401**
AuthFailed。鉴权失败, 请确认token后再次请求 。
```
{
  "error_code" : "LTS.0414",
  "error_msg" : "Invalid token"
}
```
**状态码：403**
Forbidden。
请求被拒绝访问。
返回该状态码，表明请求能够到达服务端，且服务端能够理解用户请求，但是拒绝做更多的事情，因为该请求被设置为拒绝访问，建议直接修改该请求，不要重试该请求。
```
{
  "error_code" : "LTS.0001",
  "error_msg" : "Invalid projectId"
}
```
**状态码：500**
InternalServerError。
表明服务端能被请求访问到，但是服务内部出错。
```
{
  "error_code" : "LTS.0102",
  "error_msg" : "Failed to create log group"
}
```
#### SDK代码示例
SDK代码示例如下。
- [Java]
  - 修改VPC方式的结构化配置。
    ```
    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.lts.v2.region.LtsRegion;
    import com.huaweicloud.sdk.lts.v2.*;
    import com.huaweicloud.sdk.lts.v2.model.*;
    import java.util.List;
    import java.util.ArrayList;
    public class UpdateStructTemplateSolution {
        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");
            String projectId = "{project_id}";
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
            LtsClient client = LtsClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(LtsRegion.valueOf("<YOUR REGION>"))
                    .build();
            UpdateStructTemplateRequest request = new UpdateStructTemplateRequest();
            LtsStructTemplateInfo body = new LtsStructTemplateInfo();
            Rule rulebody = new Rule();
            rulebody.withType("built_in")
                .withParam("VPC");
            List<TagField> listbodyTagFields = new ArrayList<>();
            listbodyTagFields.add(
                new TagField()
                    .withFieldName("hostIP")
                    .withType("string")
                    .withContent("192.168.2.134")
                    .withIsAnalysis(true)
            );
            List<StructFieldInfo> listbodyDemoFields = new ArrayList<>();
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("1")
                    .withFieldName("version")
                    .withType("long")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("5f67944957444bd6bb4fe3b367de8f3d")
                    .withFieldName("project_id")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("1d515d18-1b36-47dc-a983-bd6512aed4bd")
                    .withFieldName("interface_id")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("192.168.0.154")
                    .withFieldName("srcaddr")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("192.168.3.25")
                    .withFieldName("dstaddr")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("38929")
                    .withFieldName("srcport")
                    .withType("long")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("53")
                    .withFieldName("dstport")
                    .withType("long")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("17")
                    .withFieldName("protocol")
                    .withType("long")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("1")
                    .withFieldName("packets")
                    .withType("long")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("96")
                    .withFieldName("bytes")
                    .withType("long")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("1548752136")
                    .withFieldName("start")
                    .withType("long")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("1548752736")
                    .withFieldName("end")
                    .withType("long")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("ACCEPT")
                    .withFieldName("action")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("OK")
                    .withFieldName("log_status")
                    .withType("string")
            );
            body.withRule(rulebody);
            body.withProjectId("a0a12bxxxxxxxx1185d7cf26c3e86ada");
            body.withLogStreamId("4371xxxx-xxxx-xxxx-xxxx-xxxxxxff79d0");
            body.withParseType(LtsStructTemplateInfo.LtsStructTemplateInfo.fromValue("built_in"));
            body.withLogGroupId("86b572f8-xxxx-xxxx-xxxx-xxxxxx3c761c");
            body.withContent("1 5f67944957444bd6bb4fe3b367de8f3d 1d515d18-1b36-47dc-a983-bd6512aed4bd 192.168.0.154 192.168.3.25 38929 53 17 1 96 1548752136 1548752736 ACCEPT OK");
            body.withTagFields(listbodyTagFields);
            body.withDemoFields(listbodyDemoFields);
            request.withBody(body);
            try {
                UpdateStructTemplateResponse response = client.updateStructTemplate(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());
            }
        }
    }
    ```
    
  
  - 修改ELB方式的结构化配置。
    ```
    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.lts.v2.region.LtsRegion;
    import com.huaweicloud.sdk.lts.v2.*;
    import com.huaweicloud.sdk.lts.v2.model.*;
    import java.util.List;
    import java.util.ArrayList;
    public class UpdateStructTemplateSolution {
        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");
            String projectId = "{project_id}";
            ICredential auth = new BasicCredentials()
                    .withProjectId(projectId)
                    .withAk(ak)
                    .withSk(sk);
            LtsClient client = LtsClient.newBuilder()
                    .withCredential(auth)
                    .withRegion(LtsRegion.valueOf("<YOUR REGION>"))
                    .build();
            UpdateStructTemplateRequest request = new UpdateStructTemplateRequest();
            LtsStructTemplateInfo body = new LtsStructTemplateInfo();
            Rule rulebody = new Rule();
            rulebody.withType("built_in")
                .withParam("ELB");
            List<TagField> listbodyTagFields = new ArrayList<>();
            listbodyTagFields.add(
                new TagField()
                    .withFieldName("hostIP")
                    .withType("string")
                    .withContent("192.168.2.134")
                    .withIsAnalysis(true)
            );
            List<StructFieldInfo> listbodyDemoFields = new ArrayList<>();
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("1594727856.337")
                    .withFieldName("msec")
                    .withType("float")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("e7c37d97-e922-457c-bbf3-dsadeqac")
                    .withFieldName("access_log_topic_id")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("2020-07-14T19:57:36+08:00")
                    .withFieldName("time_iso8601")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("elb_01")
                    .withFieldName("log_ver")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("192.0.0.0")
                    .withFieldName("remote_addr")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("88888")
                    .withFieldName("remote_port")
                    .withType("long")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("200")
                    .withFieldName("status")
                    .withType("long")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("GET")
                    .withFieldName("request_method")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("http")
                    .withFieldName("scheme")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("prod.sss.ads.sg2.aaa")
                    .withFieldName("host")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("loc/ation?version=3&ip=100.0.0.0&coordinate=27.7044784,85.3007481&device_id=dsadsadasdsadasd&beyla_id=wqeb123ndadsa233ddada")
                    .withFieldName("router_request_uri")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("HTTP/1.1")
                    .withFieldName("server_protocol")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("233")
                    .withFieldName("request_length")
                    .withType("long")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("293")
                    .withFieldName("bytes_sent")
                    .withType("long")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("138")
                    .withFieldName("body_bytes_sent")
                    .withType("long")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("0.001")
                    .withFieldName("request_time")
                    .withType("float")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("200")
                    .withFieldName("upstream_status")
                    .withType("long")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("0.000")
                    .withFieldName("upstream_connect_time")
                    .withType("float")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("0.001")
                    .withFieldName("upstream_header_time")
                    .withType("float")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("0.001")
                    .withFieldName("upstream_response_time")
                    .withType("float")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("100.0.0.0:9999")
                    .withFieldName("upstream_addr")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("lua-resty-http/0.14 (Lua) ngx_lua/10000")
                    .withFieldName("http_user_agent")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("-")
                    .withFieldName("http_referer")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("-")
                    .withFieldName("http_x_forwarded_for")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("loadbalancer_edsaee-4c9c-b467-5b8126b2f7f7dsa")
                    .withFieldName("lb_name")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("listener_6077809b-913f-466d-a96c-376f08882d5d")
                    .withFieldName("listener_name")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("08cc2b3f68aa4dddd1e6a90dddd1688348a4480")
                    .withFieldName("listener_id")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("pool_b2f2966c-043d-4674-ad4b-c15f2adb2c6b")
                    .withFieldName("pool_name")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("-")
                    .withFieldName("member_name")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("2fb78dsadadq1213das1121dab146ad3cb0")
                    .withFieldName("tenant_id")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("-")
                    .withFieldName("eip_address")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("80")
                    .withFieldName("eip_port")
                    .withType("long")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("101.0.0.0:10000")
                    .withFieldName("upstream_addr_priv")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("-")
                    .withFieldName("certificate_id")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("-")
                    .withFieldName("ssl_protocol")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("-")
                    .withFieldName("ssl_cipher")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("-")
                    .withFieldName("sni_domain_name")
                    .withType("string")
            );
            listbodyDemoFields.add(
                new StructFieldInfo()
                    .withContent("9739")
                    .withFieldName("tcpinfo_rtt")
                    .withType("long")
            );
            body.withRule(rulebody);
            body.withProjectId(" ");
            body.withLogStreamId(" ");
            body.withParseType(LtsStructTemplateInfo.LtsStructTemplateInfo.fromValue("built_in"));
            body.withLogGroupId(" ");
            body.withContent("1594727856.337 e7c37d97-e922-457c-bbf3-dsadeqac 2020-07-14T19:57:36+08:00 elb_01 192.0.0.0:88888 200 "GET http://prod.sss.ads.sg2.aaa/loc/ation?version=3&ip=100.0.0.0&coordinate=27.7044784,85.3007481&device_id=dsadsadasdsadasd&beyla_id=wqeb123ndadsa233ddada HTTP/1.1" 233 293 138 0.001 "200" "0.000" "0.001" "0.001" "100.0.0.0:9999" "lua-resty-http/0.14 (Lua) ngx_lua/10000" "-" "-" loadbalancer_edsaee-4c9c-b467-5b8126b2f7f7dsa listener_6077809b-913f-466d-a96c-376f08882d5d 08cc2b3f68aa4dddd1e6a90dddd1688348a4480 pool_b2f2966c-043d-4674-ad4b-c15f2adb2c6b "-" 2fb78dsadadq1213das1121dab146ad3cb0 -:80 "101.0.0.0:10000" - - - - 9739");
            body.withTagFields(listbodyTagFields);
            body.withDemoFields(listbodyDemoFields);
            request.withBody(body);
            try {
                UpdateStructTemplateResponse response = client.updateStructTemplate(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]
  - 修改VPC方式的结构化配置。
    ```
    # coding: utf-8
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdklts.v2.region.lts_region import LtsRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdklts.v2 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"]
        projectId = "{project_id}"
        credentials = BasicCredentials(ak, sk, projectId)
        client = LtsClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(LtsRegion.value_of("<YOUR REGION>")) \
            .build()
        try:
            request = UpdateStructTemplateRequest()
            rulebody = Rule(
                type="built_in",
                param="VPC"
            )
            listTagFieldsbody = [
                TagField(
                    field_name="hostIP",
                    type="string",
                    content="192.168.2.134",
                    is_analysis=True
                )
            ]
            listDemoFieldsbody = [
                StructFieldInfo(
                    content="1",
                    field_name="version",
                    type="long"
                ),
                StructFieldInfo(
                    content="5f67944957444bd6bb4fe3b367de8f3d",
                    field_name="project_id",
                    type="string"
                ),
                StructFieldInfo(
                    content="1d515d18-1b36-47dc-a983-bd6512aed4bd",
                    field_name="interface_id",
                    type="string"
                ),
                StructFieldInfo(
                    content="192.168.0.154",
                    field_name="srcaddr",
                    type="string"
                ),
                StructFieldInfo(
                    content="192.168.3.25",
                    field_name="dstaddr",
                    type="string"
                ),
                StructFieldInfo(
                    content="38929",
                    field_name="srcport",
                    type="long"
                ),
                StructFieldInfo(
                    content="53",
                    field_name="dstport",
                    type="long"
                ),
                StructFieldInfo(
                    content="17",
                    field_name="protocol",
                    type="long"
                ),
                StructFieldInfo(
                    content="1",
                    field_name="packets",
                    type="long"
                ),
                StructFieldInfo(
                    content="96",
                    field_name="bytes",
                    type="long"
                ),
                StructFieldInfo(
                    content="1548752136",
                    field_name="start",
                    type="long"
                ),
                StructFieldInfo(
                    content="1548752736",
                    field_name="end",
                    type="long"
                ),
                StructFieldInfo(
                    content="ACCEPT",
                    field_name="action",
                    type="string"
                ),
                StructFieldInfo(
                    content="OK",
                    field_name="log_status",
                    type="string"
                )
            ]
            request.body = LtsStructTemplateInfo(
                rule=rulebody,
                project_id="a0a12bxxxxxxxx1185d7cf26c3e86ada",
                log_stream_id="4371xxxx-xxxx-xxxx-xxxx-xxxxxxff79d0",
                parse_type="built_in",
                log_group_id="86b572f8-xxxx-xxxx-xxxx-xxxxxx3c761c",
                content="1 5f67944957444bd6bb4fe3b367de8f3d 1d515d18-1b36-47dc-a983-bd6512aed4bd 192.168.0.154 192.168.3.25 38929 53 17 1 96 1548752136 1548752736 ACCEPT OK",
                tag_fields=listTagFieldsbody,
                demo_fields=listDemoFieldsbody
            )
            response = client.update_struct_template(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    ```
    
  
  - 修改ELB方式的结构化配置。
    ```
    # coding: utf-8
    import os
    from huaweicloudsdkcore.auth.credentials import BasicCredentials
    from huaweicloudsdklts.v2.region.lts_region import LtsRegion
    from huaweicloudsdkcore.exceptions import exceptions
    from huaweicloudsdklts.v2 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"]
        projectId = "{project_id}"
        credentials = BasicCredentials(ak, sk, projectId)
        client = LtsClient.new_builder() \
            .with_credentials(credentials) \
            .with_region(LtsRegion.value_of("<YOUR REGION>")) \
            .build()
        try:
            request = UpdateStructTemplateRequest()
            rulebody = Rule(
                type="built_in",
                param="ELB"
            )
            listTagFieldsbody = [
                TagField(
                    field_name="hostIP",
                    type="string",
                    content="192.168.2.134",
                    is_analysis=True
                )
            ]
            listDemoFieldsbody = [
                StructFieldInfo(
                    content="1594727856.337",
                    field_name="msec",
                    type="float"
                ),
                StructFieldInfo(
                    content="e7c37d97-e922-457c-bbf3-dsadeqac",
                    field_name="access_log_topic_id",
                    type="string"
                ),
                StructFieldInfo(
                    content="2020-07-14T19:57:36+08:00",
                    field_name="time_iso8601",
                    type="string"
                ),
                StructFieldInfo(
                    content="elb_01",
                    field_name="log_ver",
                    type="string"
                ),
                StructFieldInfo(
                    content="192.0.0.0",
                    field_name="remote_addr",
                    type="string"
                ),
                StructFieldInfo(
                    content="88888",
                    field_name="remote_port",
                    type="long"
                ),
                StructFieldInfo(
                    content="200",
                    field_name="status",
                    type="long"
                ),
                StructFieldInfo(
                    content="GET",
                    field_name="request_method",
                    type="string"
                ),
                StructFieldInfo(
                    content="http",
                    field_name="scheme",
                    type="string"
                ),
                StructFieldInfo(
                    content="prod.sss.ads.sg2.aaa",
                    field_name="host",
                    type="string"
                ),
                StructFieldInfo(
                    content="loc/ation?version=3&ip=100.0.0.0&coordinate=27.7044784,85.3007481&device_id=dsadsadasdsadasd&beyla_id=wqeb123ndadsa233ddada",
                    field_name="router_request_uri",
                    type="string"
                ),
                StructFieldInfo(
                    content="HTTP/1.1",
                    field_name="server_protocol",
                    type="string"
                ),
                StructFieldInfo(
                    content="233",
                    field_name="request_length",
                    type="long"
                ),
                StructFieldInfo(
                    content="293",
                    field_name="bytes_sent",
                    type="long"
                ),
                StructFieldInfo(
                    content="138",
                    field_name="body_bytes_sent",
                    type="long"
                ),
                StructFieldInfo(
                    content="0.001",
                    field_name="request_time",
                    type="float"
                ),
                StructFieldInfo(
                    content="200",
                    field_name="upstream_status",
                    type="long"
                ),
                StructFieldInfo(
                    content="0.000",
                    field_name="upstream_connect_time",
                    type="float"
                ),
                StructFieldInfo(
                    content="0.001",
                    field_name="upstream_header_time",
                    type="float"
                ),
                StructFieldInfo(
                    content="0.001",
                    field_name="upstream_response_time",
                    type="float"
                ),
                StructFieldInfo(
                    content="100.0.0.0:9999",
                    field_name="upstream_addr",
                    type="string"
                ),
                StructFieldInfo(
                    content="lua-resty-http/0.14 (Lua) ngx_lua/10000",
                    field_name="http_user_agent",
                    type="string"
                ),
                StructFieldInfo(
                    content="-",
                    field_name="http_referer",
                    type="string"
                ),
                StructFieldInfo(
                    content="-",
                    field_name="http_x_forwarded_for",
                    type="string"
                ),
                StructFieldInfo(
                    content="loadbalancer_edsaee-4c9c-b467-5b8126b2f7f7dsa",
                    field_name="lb_name",
                    type="string"
                ),
                StructFieldInfo(
                    content="listener_6077809b-913f-466d-a96c-376f08882d5d",
                    field_name="listener_name",
                    type="string"
                ),
                StructFieldInfo(
                    content="08cc2b3f68aa4dddd1e6a90dddd1688348a4480",
                    field_name="listener_id",
                    type="string"
                ),
                StructFieldInfo(
                    content="pool_b2f2966c-043d-4674-ad4b-c15f2adb2c6b",
                    field_name="pool_name",
                    type="string"
                ),
                StructFieldInfo(
                    content="-",
                    field_name="member_name",
                    type="string"
                ),
                StructFieldInfo(
                    content="2fb78dsadadq1213das1121dab146ad3cb0",
                    field_name="tenant_id",
                    type="string"
                ),
                StructFieldInfo(
                    content="-",
                    field_name="eip_address",
                    type="string"
                ),
                StructFieldInfo(
                    content="80",
                    field_name="eip_port",
                    type="long"
                ),
                StructFieldInfo(
                    content="101.0.0.0:10000",
                    field_name="upstream_addr_priv",
                    type="string"
                ),
                StructFieldInfo(
                    content="-",
                    field_name="certificate_id",
                    type="string"
                ),
                StructFieldInfo(
                    content="-",
                    field_name="ssl_protocol",
                    type="string"
                ),
                StructFieldInfo(
                    content="-",
                    field_name="ssl_cipher",
                    type="string"
                ),
                StructFieldInfo(
                    content="-",
                    field_name="sni_domain_name",
                    type="string"
                ),
                StructFieldInfo(
                    content="9739",
                    field_name="tcpinfo_rtt",
                    type="long"
                )
            ]
            request.body = LtsStructTemplateInfo(
                rule=rulebody,
                project_id=" ",
                log_stream_id=" ",
                parse_type="built_in",
                log_group_id=" ",
                content="1594727856.337 e7c37d97-e922-457c-bbf3-dsadeqac 2020-07-14T19:57:36+08:00 elb_01 192.0.0.0:88888 200 "GET http://prod.sss.ads.sg2.aaa/loc/ation?version=3&ip=100.0.0.0&coordinate=27.7044784,85.3007481&device_id=dsadsadasdsadasd&beyla_id=wqeb123ndadsa233ddada HTTP/1.1" 233 293 138 0.001 "200" "0.000" "0.001" "0.001" "100.0.0.0:9999" "lua-resty-http/0.14 (Lua) ngx_lua/10000" "-" "-" loadbalancer_edsaee-4c9c-b467-5b8126b2f7f7dsa listener_6077809b-913f-466d-a96c-376f08882d5d 08cc2b3f68aa4dddd1e6a90dddd1688348a4480 pool_b2f2966c-043d-4674-ad4b-c15f2adb2c6b "-" 2fb78dsadadq1213das1121dab146ad3cb0 -:80 "101.0.0.0:10000" - - - - 9739",
                tag_fields=listTagFieldsbody,
                demo_fields=listDemoFieldsbody
            )
            response = client.update_struct_template(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]
  - 修改VPC方式的结构化配置。
    ```
    package main
    import (
    "fmt"
    "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        lts "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2"
    "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2/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")
        projectId := "{project_id}"
        auth, err := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            SafeBuild()
        if err != nil {
            fmt.Println(err)
            return
        }
        hcClient, err := lts.LtsClientBuilder().
             WithRegion(region.ValueOf("<YOUR REGION>")).
             WithCredential(auth).
             SafeBuild()
        if err != nil {
            fmt.Println(err)
            return
        }
        client := lts.NewLtsClient(hcClient)
        request := &model.UpdateStructTemplateRequest{}
    rulebody := &model.Rule{
    Type: "built_in",
    Param: "VPC",
    }
    contentTagFields:= "192.168.2.134"
    isAnalysisTagFields:= true
    var listTagFieldsbody = []model.TagField{
            {
                FieldName: "hostIP",
                Type: "string",
                Content: &contentTagFields,
                IsAnalysis: &isAnalysisTagFields,
            },
        }
    contentDemoFields:= "1"
    fieldNameDemoFields:= "version"
    contentDemoFields1:= "5f67944957444bd6bb4fe3b367de8f3d"
    fieldNameDemoFields1:= "project_id"
    contentDemoFields2:= "1d515d18-1b36-47dc-a983-bd6512aed4bd"
    fieldNameDemoFields2:= "interface_id"
    contentDemoFields3:= "192.168.0.154"
    fieldNameDemoFields3:= "srcaddr"
    contentDemoFields4:= "192.168.3.25"
    fieldNameDemoFields4:= "dstaddr"
    contentDemoFields5:= "38929"
    fieldNameDemoFields5:= "srcport"
    contentDemoFields6:= "53"
    fieldNameDemoFields6:= "dstport"
    contentDemoFields7:= "17"
    fieldNameDemoFields7:= "protocol"
    contentDemoFields8:= "1"
    fieldNameDemoFields8:= "packets"
    contentDemoFields9:= "96"
    fieldNameDemoFields9:= "bytes"
    contentDemoFields10:= "1548752136"
    fieldNameDemoFields10:= "start"
    contentDemoFields11:= "1548752736"
    fieldNameDemoFields11:= "end"
    contentDemoFields12:= "ACCEPT"
    fieldNameDemoFields12:= "action"
    contentDemoFields13:= "OK"
    fieldNameDemoFields13:= "log_status"
    var listDemoFieldsbody = []model.StructFieldInfo{
            {
                Content: &contentDemoFields,
                FieldName: &fieldNameDemoFields,
                Type: "long",
            },
            {
                Content: &contentDemoFields1,
                FieldName: &fieldNameDemoFields1,
                Type: "string",
            },
            {
                Content: &contentDemoFields2,
                FieldName: &fieldNameDemoFields2,
                Type: "string",
            },
            {
                Content: &contentDemoFields3,
                FieldName: &fieldNameDemoFields3,
                Type: "string",
            },
            {
                Content: &contentDemoFields4,
                FieldName: &fieldNameDemoFields4,
                Type: "string",
            },
            {
                Content: &contentDemoFields5,
                FieldName: &fieldNameDemoFields5,
                Type: "long",
            },
            {
                Content: &contentDemoFields6,
                FieldName: &fieldNameDemoFields6,
                Type: "long",
            },
            {
                Content: &contentDemoFields7,
                FieldName: &fieldNameDemoFields7,
                Type: "long",
            },
            {
                Content: &contentDemoFields8,
                FieldName: &fieldNameDemoFields8,
                Type: "long",
            },
            {
                Content: &contentDemoFields9,
                FieldName: &fieldNameDemoFields9,
                Type: "long",
            },
            {
                Content: &contentDemoFields10,
                FieldName: &fieldNameDemoFields10,
                Type: "long",
            },
            {
                Content: &contentDemoFields11,
                FieldName: &fieldNameDemoFields11,
                Type: "long",
            },
            {
                Content: &contentDemoFields12,
                FieldName: &fieldNameDemoFields12,
                Type: "string",
            },
            {
                Content: &contentDemoFields13,
                FieldName: &fieldNameDemoFields13,
                Type: "string",
            },
        }
    request.Body = &model.LtsStructTemplateInfo{
    Rule: rulebody,
    ProjectId: "a0a12bxxxxxxxx1185d7cf26c3e86ada",
    LogStreamId: "4371xxxx-xxxx-xxxx-xxxx-xxxxxxff79d0",
    ParseType: model.GetLtsStructTemplateInfoParseTypeEnum().BUILT_IN,
    LogGroupId: "86b572f8-xxxx-xxxx-xxxx-xxxxxx3c761c",
    Content: "1 5f67944957444bd6bb4fe3b367de8f3d 1d515d18-1b36-47dc-a983-bd6512aed4bd 192.168.0.154 192.168.3.25 38929 53 17 1 96 1548752136 1548752736 ACCEPT OK",
    TagFields: listTagFieldsbody,
    DemoFields: listDemoFieldsbody,
    }
    response, err := client.UpdateStructTemplate(request)
    if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    ```
    
  
  - 修改ELB方式的结构化配置。
    ```
    package main
    import (
    "fmt"
    "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
        lts "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2"
    "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2/model"
        region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/lts/v2/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")
        projectId := "{project_id}"
        auth, err := basic.NewCredentialsBuilder().
            WithAk(ak).
            WithSk(sk).
            WithProjectId(projectId).
            SafeBuild()
        if err != nil {
            fmt.Println(err)
            return
        }
        hcClient, err := lts.LtsClientBuilder().
             WithRegion(region.ValueOf("<YOUR REGION>")).
             WithCredential(auth).
             SafeBuild()
        if err != nil {
            fmt.Println(err)
            return
        }
        client := lts.NewLtsClient(hcClient)
        request := &model.UpdateStructTemplateRequest{}
    rulebody := &model.Rule{
    Type: "built_in",
    Param: "ELB",
    }
    contentTagFields:= "192.168.2.134"
    isAnalysisTagFields:= true
    var listTagFieldsbody = []model.TagField{
            {
                FieldName: "hostIP",
                Type: "string",
                Content: &contentTagFields,
                IsAnalysis: &isAnalysisTagFields,
            },
        }
    contentDemoFields:= "1594727856.337"
    fieldNameDemoFields:= "msec"
    contentDemoFields1:= "e7c37d97-e922-457c-bbf3-dsadeqac"
    fieldNameDemoFields1:= "access_log_topic_id"
    contentDemoFields2:= "2020-07-14T19:57:36+08:00"
    fieldNameDemoFields2:= "time_iso8601"
    contentDemoFields3:= "elb_01"
    fieldNameDemoFields3:= "log_ver"
    contentDemoFields4:= "192.0.0.0"
    fieldNameDemoFields4:= "remote_addr"
    contentDemoFields5:= "88888"
    fieldNameDemoFields5:= "remote_port"
    contentDemoFields6:= "200"
    fieldNameDemoFields6:= "status"
    contentDemoFields7:= "GET"
    fieldNameDemoFields7:= "request_method"
    contentDemoFields8:= "http"
    fieldNameDemoFields8:= "scheme"
    contentDemoFields9:= "prod.sss.ads.sg2.aaa"
    fieldNameDemoFields9:= "host"
    contentDemoFields10:= "loc/ation?version=3&ip=100.0.0.0&coordinate=27.7044784,85.3007481&device_id=dsadsadasdsadasd&beyla_id=wqeb123ndadsa233ddada"
    fieldNameDemoFields10:= "router_request_uri"
    contentDemoFields11:= "HTTP/1.1"
    fieldNameDemoFields11:= "server_protocol"
    contentDemoFields12:= "233"
    fieldNameDemoFields12:= "request_length"
    contentDemoFields13:= "293"
    fieldNameDemoFields13:= "bytes_sent"
    contentDemoFields14:= "138"
    fieldNameDemoFields14:= "body_bytes_sent"
    contentDemoFields15:= "0.001"
    fieldNameDemoFields15:= "request_time"
    contentDemoFields16:= "200"
    fieldNameDemoFields16:= "upstream_status"
    contentDemoFields17:= "0.000"
    fieldNameDemoFields17:= "upstream_connect_time"
    contentDemoFields18:= "0.001"
    fieldNameDemoFields18:= "upstream_header_time"
    contentDemoFields19:= "0.001"
    fieldNameDemoFields19:= "upstream_response_time"
    contentDemoFields20:= "100.0.0.0:9999"
    fieldNameDemoFields20:= "upstream_addr"
    contentDemoFields21:= "lua-resty-http/0.14 (Lua) ngx_lua/10000"
    fieldNameDemoFields21:= "http_user_agent"
    contentDemoFields22:= "-"
    fieldNameDemoFields22:= "http_referer"
    contentDemoFields23:= "-"
    fieldNameDemoFields23:= "http_x_forwarded_for"
    contentDemoFields24:= "loadbalancer_edsaee-4c9c-b467-5b8126b2f7f7dsa"
    fieldNameDemoFields24:= "lb_name"
    contentDemoFields25:= "listener_6077809b-913f-466d-a96c-376f08882d5d"
    fieldNameDemoFields25:= "listener_name"
    contentDemoFields26:= "08cc2b3f68aa4dddd1e6a90dddd1688348a4480"
    fieldNameDemoFields26:= "listener_id"
    contentDemoFields27:= "pool_b2f2966c-043d-4674-ad4b-c15f2adb2c6b"
    fieldNameDemoFields27:= "pool_name"
    contentDemoFields28:= "-"
    fieldNameDemoFields28:= "member_name"
    contentDemoFields29:= "2fb78dsadadq1213das1121dab146ad3cb0"
    fieldNameDemoFields29:= "tenant_id"
    contentDemoFields30:= "-"
    fieldNameDemoFields30:= "eip_address"
    contentDemoFields31:= "80"
    fieldNameDemoFields31:= "eip_port"
    contentDemoFields32:= "101.0.0.0:10000"
    fieldNameDemoFields32:= "upstream_addr_priv"
    contentDemoFields33:= "-"
    fieldNameDemoFields33:= "certificate_id"
    contentDemoFields34:= "-"
    fieldNameDemoFields34:= "ssl_protocol"
    contentDemoFields35:= "-"
    fieldNameDemoFields35:= "ssl_cipher"
    contentDemoFields36:= "-"
    fieldNameDemoFields36:= "sni_domain_name"
    contentDemoFields37:= "9739"
    fieldNameDemoFields37:= "tcpinfo_rtt"
    var listDemoFieldsbody = []model.StructFieldInfo{
            {
                Content: &contentDemoFields,
                FieldName: &fieldNameDemoFields,
                Type: "float",
            },
            {
                Content: &contentDemoFields1,
                FieldName: &fieldNameDemoFields1,
                Type: "string",
            },
            {
                Content: &contentDemoFields2,
                FieldName: &fieldNameDemoFields2,
                Type: "string",
            },
            {
                Content: &contentDemoFields3,
                FieldName: &fieldNameDemoFields3,
                Type: "string",
            },
            {
                Content: &contentDemoFields4,
                FieldName: &fieldNameDemoFields4,
                Type: "string",
            },
            {
                Content: &contentDemoFields5,
                FieldName: &fieldNameDemoFields5,
                Type: "long",
            },
            {
                Content: &contentDemoFields6,
                FieldName: &fieldNameDemoFields6,
                Type: "long",
            },
            {
                Content: &contentDemoFields7,
                FieldName: &fieldNameDemoFields7,
                Type: "string",
            },
            {
                Content: &contentDemoFields8,
                FieldName: &fieldNameDemoFields8,
                Type: "string",
            },
            {
                Content: &contentDemoFields9,
                FieldName: &fieldNameDemoFields9,
                Type: "string",
            },
            {
                Content: &contentDemoFields10,
                FieldName: &fieldNameDemoFields10,
                Type: "string",
            },
            {
                Content: &contentDemoFields11,
                FieldName: &fieldNameDemoFields11,
                Type: "string",
            },
            {
                Content: &contentDemoFields12,
                FieldName: &fieldNameDemoFields12,
                Type: "long",
            },
            {
                Content: &contentDemoFields13,
                FieldName: &fieldNameDemoFields13,
                Type: "long",
            },
            {
                Content: &contentDemoFields14,
                FieldName: &fieldNameDemoFields14,
                Type: "long",
            },
            {
                Content: &contentDemoFields15,
                FieldName: &fieldNameDemoFields15,
                Type: "float",
            },
            {
                Content: &contentDemoFields16,
                FieldName: &fieldNameDemoFields16,
                Type: "long",
            },
            {
                Content: &contentDemoFields17,
                FieldName: &fieldNameDemoFields17,
                Type: "float",
            },
            {
                Content: &contentDemoFields18,
                FieldName: &fieldNameDemoFields18,
                Type: "float",
            },
            {
                Content: &contentDemoFields19,
                FieldName: &fieldNameDemoFields19,
                Type: "float",
            },
            {
                Content: &contentDemoFields20,
                FieldName: &fieldNameDemoFields20,
                Type: "string",
            },
            {
                Content: &contentDemoFields21,
                FieldName: &fieldNameDemoFields21,
                Type: "string",
            },
            {
                Content: &contentDemoFields22,
                FieldName: &fieldNameDemoFields22,
                Type: "string",
            },
            {
                Content: &contentDemoFields23,
                FieldName: &fieldNameDemoFields23,
                Type: "string",
            },
            {
                Content: &contentDemoFields24,
                FieldName: &fieldNameDemoFields24,
                Type: "string",
            },
            {
                Content: &contentDemoFields25,
                FieldName: &fieldNameDemoFields25,
                Type: "string",
            },
            {
                Content: &contentDemoFields26,
                FieldName: &fieldNameDemoFields26,
                Type: "string",
            },
            {
                Content: &contentDemoFields27,
                FieldName: &fieldNameDemoFields27,
                Type: "string",
            },
            {
                Content: &contentDemoFields28,
                FieldName: &fieldNameDemoFields28,
                Type: "string",
            },
            {
                Content: &contentDemoFields29,
                FieldName: &fieldNameDemoFields29,
                Type: "string",
            },
            {
                Content: &contentDemoFields30,
                FieldName: &fieldNameDemoFields30,
                Type: "string",
            },
            {
                Content: &contentDemoFields31,
                FieldName: &fieldNameDemoFields31,
                Type: "long",
            },
            {
                Content: &contentDemoFields32,
                FieldName: &fieldNameDemoFields32,
                Type: "string",
            },
            {
                Content: &contentDemoFields33,
                FieldName: &fieldNameDemoFields33,
                Type: "string",
            },
            {
                Content: &contentDemoFields34,
                FieldName: &fieldNameDemoFields34,
                Type: "string",
            },
            {
                Content: &contentDemoFields35,
                FieldName: &fieldNameDemoFields35,
                Type: "string",
            },
            {
                Content: &contentDemoFields36,
                FieldName: &fieldNameDemoFields36,
                Type: "string",
            },
            {
                Content: &contentDemoFields37,
                FieldName: &fieldNameDemoFields37,
                Type: "long",
            },
        }
    request.Body = &model.LtsStructTemplateInfo{
    Rule: rulebody,
    ProjectId: " ",
    LogStreamId: " ",
    ParseType: model.GetLtsStructTemplateInfoParseTypeEnum().BUILT_IN,
    LogGroupId: " ",
    Content: "1594727856.337 e7c37d97-e922-457c-bbf3-dsadeqac 2020-07-14T19:57:36+08:00 elb_01 192.0.0.0:88888 200 "GET http://prod.sss.ads.sg2.aaa/loc/ation?version=3&ip=100.0.0.0&coordinate=27.7044784,85.3007481&device_id=dsadsadasdsadasd&beyla_id=wqeb123ndadsa233ddada HTTP/1.1" 233 293 138 0.001 "200" "0.000" "0.001" "0.001" "100.0.0.0:9999" "lua-resty-http/0.14 (Lua) ngx_lua/10000" "-" "-" loadbalancer_edsaee-4c9c-b467-5b8126b2f7f7dsa listener_6077809b-913f-466d-a96c-376f08882d5d 08cc2b3f68aa4dddd1e6a90dddd1688348a4480 pool_b2f2966c-043d-4674-ad4b-c15f2adb2c6b "-" 2fb78dsadadq1213das1121dab146ad3cb0 -:80 "101.0.0.0:10000" - - - - 9739",
    TagFields: listTagFieldsbody,
    DemoFields: listDemoFieldsbody,
    }
    response, err := client.UpdateStructTemplate(request)
    if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    ```
    
   
- [更多]
  更多编程语言的SDK代码示例，请参见[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/LTS/sdk?api=UpdateStructTemplate)的代码示例页签，可生成自动对应的SDK代码示例。
#### 状态码
| 状态码 | 描述                                                                                                                                                                              |
|:---|:---|
| 200 | 响应码。                                                                                                                                                                            |
| 200 | 调用成功响应信息描述。                                                                                                                                                                     |
| 400 | 非法请求。                                                                                                                                                                           |
| 401 | AuthFailed。鉴权失败, 请确认token后再次请求 。                                                                                                                                                |
| 403 | Forbidden。 请求被拒绝访问。 返回该状态码，表明请求能够到达服务端，且服务端能够理解用户请求，但是拒绝做更多的事情，因为该请求被设置为拒绝访问，建议直接修改该请求，不要重试该请求。 |
| 500 | InternalServerError。 表明服务端能被请求访问到，但是服务内部出错。                                                                                             |
| 503 | 响应码                                                                                                                                                                             |
| 503 | 调用失败响应信息描述。                                                                                                                                                                     |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-lts/ErrorCode.html)。
