Exemplo n.º 1
0
    def patch(self, url_path, **kwargs):
        try:
            response = yield self.http_client.patch(url_path, **kwargs)
        except HTTPError as http_error:
            message = self.format_error(http_error)

            if http_error.code == 404:
                raise ResourceNotFoundException(message)
            else:
                raise KubernetesException(message, http_error.code)

        raise Return(json.loads(response.body))
Exemplo n.º 2
0
    def watch(self, url_path, on_data, **kwargs):
        try:
            return self.http_client.watch(url_path, on_data, **kwargs)
        except HTTPError as http_error:
            message = self.format_error(http_error)

            if http_error.code == 404:
                raise ResourceNotFoundException(message)
            elif http_error.code == 599:
                raise WatchDisconnectedException(message)
            else:
                raise KubernetesException(message, http_error.code)
Exemplo n.º 3
0
    def get_resource_type(self, kind):
        if kind not in self.kind_to_resource.keys():
            raise ResourceNotFoundException("Resource %s not found." % kind)

        return self.kind_to_resource[kind]