Deleting NetworkPolicies in Batches

Function

This API is used to delete a collection of NetworkPolicies.

URL

DELETE /apis/networking.k8s.io/v1/namespaces/{namespace}/networkpolicies

Table 1 describes the parameters of this API.

Table 1 Parameter description

Parameter

Mandatory

Description

namespace

Yes

Object name and auth scope, such as for teams and projects.

pretty

No

If 'true', then the output is pretty printed.

body

Yes

-

Request

N/A

Response

Response parameters:

For the description about response parameters, see Table 2.

Example response:

{
  "kind": "NetworkPolicyList",
  "apiVersion": "extensions/v1beta1",
  "metadata": {
    "selfLink": "/apis/extensions/v1beta1/namespaces/default/networkpolicies",
    "resourceVersion": "1105434"
  },
  "items": [
    {
      "metadata": {
        "name": "test111",
        "namespace": "default",
        "selfLink": "/apis/extensions/v1beta1/namespaces/default/networkpolicies/test111",
        "uid": "c4ca7f4e-ed3a-11e8-85b0-fa163e2ce5f0",
        "resourceVersion": "1105348",
        "generation": 1,
        "creationTimestamp": "2018-11-21T03:08:50Z",
        "labels": {
          "app": "nginx"
        }
      },
      "spec": {
        "podSelector": {
          "matchLabels": {
            "app": "nginx"
          }
        },
        "ingress": [
          {
            "ports": [
              {
                "protocol": "TCP",
                "port": 80
              }
            ],
            "from": [
              {
                "namespaceSelector": {
                  "matchLabels": {
                    "project": "default"
                  }
                }
              }
            ]
          }
        ],
        "policyTypes": [
          "Ingress"
        ]
      }
    },
    {
      "metadata": {
        "name": "test222",
        "namespace": "default",
        "selfLink": "/apis/extensions/v1beta1/namespaces/default/networkpolicies/test222",
        "uid": "9017a491-ed3a-11e8-85b0-fa163e2ce5f0",
        "resourceVersion": "1105156",
        "generation": 1,
        "creationTimestamp": "2018-11-21T03:07:21Z",
        "labels": {
          "app": "nginx"
        }
      },
      "spec": {
        "podSelector": {
          "matchLabels": {
            "app": "nginx"
          }
        },
        "ingress": [
          {
            "ports": [
              {
                "protocol": "TCP",
                "port": 80
              }
            ],
            "from": [
              {
                "podSelector": {
                  "matchLabels": {
                    "app": "nginx"
                  }
                }
              }
            ]
          }
        ],
        "policyTypes": [
          "Ingress"
        ]
      }
    }
  ]
}

Status Code

Table 2 describes the status code of this API.

Table 2 Status Code

Status Code

Description

200

OK