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.
URI
DELETE /v1/{project_id}/meshes/{mesh_id}
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID |
| mesh_id | Yes | String | Mesh ID |
Request 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
| 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. |
| 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 |
| Parameter | Type | Description |
|---|---|---|
| type | String | Mesh type Range: |
| 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 |
| Parameter | Type | Description |
|---|---|---|
| clusters | Array of MeshCluster objects | Cluster information in a mesh |
| 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 |
| Parameter | Type | Description |
|---|---|---|
| namespaces | Selector object | Namespace to be injected. |
| Parameter | Type | Description |
|---|---|---|
| nodes | Selector object | Node where the mesh component is installed. |
| Parameter | Type | Description |
|---|---|---|
| key | String | Key |
| operator | String | Operator. The value can only be In. |
| values | Array of strings | Value |
| Parameter | Type | Description |
|---|---|---|
| proxyConfig | ProxyConfig object | Data plane configuration of a mesh |
| telemetryConfig | TelemetryConfig object | Observability configuration of a mesh |
| 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. |
| 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. |
| Parameter | Type | Description |
|---|---|---|
| logGroupID | String | Log group ID of access logs |
| logStreamID | String | Log stream ID of access logs |
| 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. |
| Parameter | Type | Description |
|---|---|---|
| name | String | Provider instance name |
| zipkin | ZipkinTracingProvider object | Provider's Zipkin configuration |
| Parameter | Type | Description |
|---|---|---|
| service | String | Service address of Zipkin |
| port | Integer | Service port of Zipkin |
| Parameter | Type | Description |
|---|---|---|
| phase | String | Mesh status. |
| updateTimestamp | String | Time when a mesh is updated |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| errorCode | String | Error code |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| errorCode | String | Error code |
Status code: 500
| 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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot