Updated on 2026-06-25 GMT+08:00

Deleting a Mesh

Function

This API is used to delete a mesh.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    asm:mesh:delete

    Write

    mesh *

    • g:EnterpriseProjectId

    • g:ResourceTag/<tag-key>

    -

    -

URI

DELETE /v1/{project_id}/meshes/{mesh_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

mesh_id

Yes

String

Mesh ID

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

API calling can be authenticated using a token or AK/SK. If you use a token, this parameter is mandatory and must be set to the token.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

apiVersion

String

API version. Fixed value: v1

kind

String

API type. Fixed value: Mesh or mesh

metadata

MeshMetadata object

Basic information about a mesh. Metadata is a collection of attributes.

spec

MeshSpec object

Detailed description of a mesh. ASM creates or updates the mesh based on spec.

status

MeshStatus object

Mesh status,

which is generated by ASM.

Table 4 MeshMetadata

Parameter

Type

Description

name

String

Mesh name

Enter 4 to 64 characters. The name must start with a lowercase letter and not end with a hyphen (-). Only lowercase letters, digits, and hyphens (-) are allowed.

uid

String

Mesh ID, which uniquely identifies a resource. The value is automatically generated after the mesh is created and cannot be specified.

creationTimestamp

String

Time when a mesh is created

Table 5 MeshSpec

Parameter

Type

Description

type

String

Mesh type

Range:

  • InCluster: mesh with an in-cluster control plane. The value is InCluster for the Basic mesh. Currently, only this type is supported.

version

String

Mesh version

extendParams

MeshExtendParams object

Extensions of a mesh

ipv6Enable

Boolean

Whether a mesh supports IPv6

tags

Array of MeshTags objects

Resource tags of a mesh. If you need to configure resource tags, ensure that the TMS service has been brought online in the current region.

config

MeshConfig object

Mesh configuration

Table 6 MeshExtendParams

Parameter

Type

Description

clusters

Array of MeshCluster objects

Cluster information in a mesh

Table 7 MeshCluster

Parameter

Type

Description

clusterID

String

Cluster ID, which is unique and can be used to query the cluster to be added

injection

InjectionConfig object

Sidecar injection configuration

installation

InstallationConfig object

Installation configuration of a mesh component

Table 8 InjectionConfig

Parameter

Type

Description

namespaces

Selector object

Namespace to be injected.

Table 9 InstallationConfig

Parameter

Type

Description

nodes

Selector object

Node where the mesh component is installed.

Table 10 Selector

Parameter

Type

Description

fieldSelector

FieldSelector object

Field selector

Table 11 FieldSelector

Parameter

Type

Description

key

String

Key

operator

String

Operator. The value can only be In.

values

Array of strings

Value

Table 12 MeshTags

Parameter

Type

Description

key

String

Key

  • Cannot be empty and can contain a maximum of 128 characters.

  • Can be letters, digits, and spaces in UTF-8 format.

  • Can contain the following special characters: _.:/=+-@

  • Cannot start with sys

value

String

Value

  • Can contain a maximum of 255 characters and can be empty but not is mandatory.

  • Can be letters, digits, and spaces in UTF-8 format.

  • Can contain the following special characters: _.:/=+-@

Table 13 MeshConfig

Parameter

Type

Description

proxyConfig

ProxyConfig object

Data plane configuration of a mesh

telemetryConfig

TelemetryConfig object

Observability configuration of a mesh

Table 14 ProxyConfig

Parameter

Type

Description

includeIPRanges

String

IP address ranges that will be included for outbound traffic redirection. Use commas (,) to separate the IP address ranges.

excludeIPRanges

String

IP address ranges that will be excluded for outbound traffic redirection. Use commas (,) to separate the IP address ranges.

excludeOutboundPorts

String

Ports that will be excluded for outbound traffic redirection. Use commas (,) to separate the ports.

excludeInboundPorts

String

Ports that will be excluded for inbound traffic redirection. Use commas (,) to separate the ports.

includeOutboundPorts

String

Ports that will be included for outbound traffic redirection. Use commas (,) to separate the ports.

includeInboundPorts

String

Ports that will be included for inbound traffic redirection. Use commas (,) to separate the ports.

Table 15 TelemetryConfig

Parameter

Type

Description

metrics

Metric object

Application metric configuration, which is used to report mesh metrics. To enable this configuration, you need to install the Cloud Native Cluster Monitoring add-on in the cluster.

accessLogging

AccessLogging object

Access log configuration, which is used to report access logs of Istio proxies in a mesh. To enable this configuration, you need to install the Cloud Native Log Collection add-on in the cluster.

tracing

Tracing object

Tracing configuration, which is used to report traces in a mesh.

Table 16 Metric

Parameter

Type

Description

aom

Array of Aom objects

AOM instance configuration

Table 17 Aom

Parameter

Type

Description

instanceID

String

AOM instance ID

Table 18 AccessLogging

Parameter

Type

Description

lts

Array of LtsConfig objects

LTS configuration

Table 19 LtsConfig

Parameter

Type

Description

logGroupID

String

Log group ID of access logs

logStreamID

String

Log stream ID of access logs

Table 20 Tracing

Parameter

Type

Description

randomSamplingPercentage

Float

Tracing sampling rate

defaultProviders

Array of strings

Name of the default provider that tracing reports data to, which must match the name field in extensionProviders or use the preset provider apm-otel of ASM.

If apm-otel is used, ensure that APM 2.0 is supported in the current region and the mesh version is later than 1.18.

extensionProviders

Array of TracingExtensionProvider objects

User-defined provider. Currently, Zipkin is supported.

If Zipkin is used, ensure that the mesh version is 1.15 or later.

Table 21 TracingExtensionProvider

Parameter

Type

Description

name

String

Provider instance name

zipkin

ZipkinTracingProvider object

Provider's Zipkin configuration

Table 22 ZipkinTracingProvider

Parameter

Type

Description

service

String

Service address of Zipkin

port

Integer

Service port of Zipkin

Table 23 MeshStatus

Parameter

Type

Description

phase

String

Mesh status.

  • Running: The mesh is running.

  • Creating: The mesh is being created.

  • CreateFailed: The mesh fails to be created.

  • Deleting: The mesh is being deleted.

  • DeleteFailed: The mesh fails to be deleted.

  • Upgrading: The mesh is being upgraded.

  • UpgradeFailed: The mesh fails to be upgraded.

  • RollingBack: The mesh is being rolled back.

  • RollbackFailed: The mesh fails to be rolled back.

updateTimestamp

String

Time when a mesh is updated

Status code: 400

Table 24 Response body parameters

Parameter

Type

Description

errorCode

String

Error code

Status code: 404

Table 25 Response body parameters

Parameter

Type

Description

errorCode

String

Error code

Status code: 500

Table 26 Response body parameters

Parameter

Type

Description

errorCode

String

Error code

Example Requests

None

Example Responses

Status code: 200

The mesh deletion task is delivered, and the mesh deletion starts.

{
  "kind" : "Mesh",
  "apiVersion" : "v1",
  "metadata" : {
    "name" : "mesh-test-api",
    "uid" : "a1efdc3e-xxxx-xxxx-xxxx-94bef433347e",
    "creationTimestamp" : "2025-04-10T07:48:37Z"
  },
  "spec" : {
    "type" : "InCluster",
    "version" : "1.18.7-r5",
    "config" : {
      "telemetryConfig" : {
        "metrics" : {
          "aom" : [ {
            "instanceID" : "602a5b7e-xxxx-xxxx-xxxx-4268c35b0424"
          } ]
        },
        "accessLogging" : {
          "lts" : [ {
            "logGroupID" : "b884eaeb-xxxx-xxxx-xxxx-f442de73c392",
            "logStreamID" : "362e11e8-xxxx-xxxx-xxxx-0afdc68da7d2"
          } ]
        },
        "tracing" : {
          "randomSamplingPercentage" : 1,
          "defaultProviders" : [ "zipkin" ],
          "extensionProviders" : [ {
            "name" : "zipkin",
            "zipkin" : {
              "service" : "zipkin.monitoring.svc.cluster.local",
              "port" : 9411
            }
          } ]
        }
      },
      "proxyConfig" : {
        "includeIPRanges" : "10.247.0.0/16"
      }
    },
    "extendParams" : {
      "clusters" : [ {
        "clusterID" : "cb0ef541-xxxx-xxxx-xxxx-0255ac1001b7"
      } ]
    }
  },
  "status" : {
    "phase" : "Deleting",
    "updateTimestamp" : "2025-04-10T08:10:45Z"
  }
}

SDK Sample Code

The SDK sample code is as follows.

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
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.asm.v1.region.AsmRegion;
import com.huaweicloud.sdk.asm.v1.*;
import com.huaweicloud.sdk.asm.v1.model.*;


public class DeleteMeshSolution {

    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);

        AsmClient client = AsmClient.newBuilder()
                .withCredential(auth)
                .withRegion(AsmRegion.valueOf("<YOUR REGION>"))
                .build();
        DeleteMeshRequest request = new DeleteMeshRequest();
        request.withMeshId("{mesh_id}");
        try {
            DeleteMeshResponse response = client.deleteMesh(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
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkasm.v1.region.asm_region import AsmRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkasm.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"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

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

    try:
        request = DeleteMeshRequest()
        request.mesh_id = "{mesh_id}"
        response = client.delete_mesh(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
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    asm "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/asm/v1"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/asm/v1/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/asm/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")
    projectId := "{project_id}"

    auth, err := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        SafeBuild()

    if err != nil {
        fmt.Println(err)
        return
    }

    hcClient, err := asm.AsmClientBuilder().
         WithRegion(region.ValueOf("<YOUR REGION>")).
         WithCredential(auth).
         SafeBuild()


    if err != nil {
        fmt.Println(err)
        return
    }

    client := asm.NewAsmClient(hcClient)

    request := &model.DeleteMeshRequest{}
	request.MeshId = "{mesh_id}"
	response, err := client.DeleteMesh(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

More

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

The mesh deletion task is delivered, and the mesh deletion starts.

400

Verification failed due to incorrect parameters.

404

The mesh was not found.

500

An error occurred during the query.

Error Codes

See Error Codes.