airflow/contrib/hooks/gcp_container_hook.py
def delete_cluster(self, name, project_id=None, retry=DEFAULT, timeout=DEFAULT):
        """
        Deletes the cluster, including the Kubernetes endpoint and all
        worker nodes. Firewalls and routes that were configured during
        cluster creation are also deleted. Other Google Compute Engine
        resources that might be in use by the cluster (e.g. load balancer
        resources) will not be deleted if they weren’t present at the
        initial create time.

        :param name: The name of the cluster to delete
        :type name: str
        :param project_id: Google Cloud Platform project ID
        :type project_id: str
        :param retry: Retry object used to determine when/if to retry requests.
            If None is specified, requests will not be retried.
        :type retry: google.api_core.retry.Retry
        :param timeout: The amount of time, in seconds, to wait for the request to
            complete. Note that if retry is specified, the timeout applies to each
            individual attempt.
        :type timeout: float
        :return: The full url to the delete operation if successful, else None
        """

        self.log.info(
            "Deleting (project_id=%s, zone=%s, cluster_id=%s)", self.project_id, self.location, name
        )

        try:
            op = self.get_client().delete_cluster(project_id=project_id or self.project_id,
                                                  zone=self.location,
                                                  cluster_id=name,
                                                  retry=retry,
                                                  timeout=timeout)
            op = self.wait_for_operation(op)
            # Returns server-defined url for the resource
            return op.self_link
        except NotFound as error:
            self.log.info('Assuming Success: %s', error.message)
def delete_cluster(self, name, project_id=None, retry=DEFAULT, timeout=DEFAULT):
        """
        Deletes the cluster, including the Kubernetes endpoint and all
        worker nodes. Firewalls and routes that were configured during
        cluster creation are also deleted. Other Google Compute Engine
        resources that might be in use by the cluster (e.g. load balancer
        resources) will not be deleted if they weren’t present at the
        initial create time.

        :param name: The name of the cluster to delete
        :type name: str
        :param project_id: Google Cloud Platform project ID
        :type project_id: str
        :param retry: Retry object used to determine when/if to retry requests.
            If None is specified, requests will not be retried.
        :type retry: google.api_core.retry.Retry
        :param timeout: The amount of time, in seconds, to wait for the request to
            complete. Note that if retry is specified, the timeout applies to each
            individual attempt.
        :type timeout: float
        :return: The full url to the delete operation if successful, else None
        """

        self.log.info(
            "Deleting (project_id=%s, zone=%s, cluster_id=%s)", self.project_id, self.location, name
        )

        try:
            op = self.get_client().delete_cluster(project_id=project_id or self.project_id,
                                                  zone=self.location,
                                                  cluster_id=name,
                                                  retry=retry,
                                                  timeout=timeout)
            op = self.wait_for_operation(op)
            # Returns server-defined url for the resource
            return op.self_link
        except NotFound as error:
            self.log.info('Assuming Success: %s', error.message)
Deletes the cluster, including the Kubernetes endpoint and all
        worker nodes. Firewalls and routes that were configured during
        cluster creation are also deleted. Other Google Compute Engine
        resources that might be in use by the cluster (e.g. load balancer
        resources) will not be deleted if they weren’t present at the
        initial create time.

        :param name: The name of the cluster to delete
        :type name: str
        :param project_id: Google Cloud Platform project ID
        :type project_id: str
        :param retry: Retry object used to determine when/if to retry requests.
            If None is specified, requests will not be retried.
        :type retry: google.api_core.retry.Retry
        :param timeout: The amount of time, in seconds, to wait for the request to
            complete. Note that if retry is specified, the timeout applies to each
            individual attempt.
        :type timeout: float
        :return: The full url to the delete operation if successful, else None