def list(self, project, service_account_file=""):
        stub = http_health_check_pb2_grpc.ComputeBetaHttpHealthCheckServiceStub(
            channel.Channel())
        request = http_health_check_pb2.ListComputeBetaHttpHealthCheckRequest()
        request.service_account_file = service_account_file
        request.Project = project

        return stub.ListComputeBetaHttpHealthCheck(request).items
    def apply(self):
        stub = http_health_check_pb2_grpc.ComputeBetaHttpHealthCheckServiceStub(
            channel.Channel())
        request = http_health_check_pb2.ApplyComputeBetaHttpHealthCheckRequest(
        )
        if Primitive.to_proto(self.check_interval_sec):
            request.resource.check_interval_sec = Primitive.to_proto(
                self.check_interval_sec)

        if Primitive.to_proto(self.description):
            request.resource.description = Primitive.to_proto(self.description)

        if Primitive.to_proto(self.healthy_threshold):
            request.resource.healthy_threshold = Primitive.to_proto(
                self.healthy_threshold)

        if Primitive.to_proto(self.host):
            request.resource.host = Primitive.to_proto(self.host)

        if Primitive.to_proto(self.name):
            request.resource.name = Primitive.to_proto(self.name)

        if Primitive.to_proto(self.port):
            request.resource.port = Primitive.to_proto(self.port)

        if Primitive.to_proto(self.request_path):
            request.resource.request_path = Primitive.to_proto(
                self.request_path)

        if Primitive.to_proto(self.timeout_sec):
            request.resource.timeout_sec = Primitive.to_proto(self.timeout_sec)

        if Primitive.to_proto(self.unhealthy_threshold):
            request.resource.unhealthy_threshold = Primitive.to_proto(
                self.unhealthy_threshold)

        if Primitive.to_proto(self.project):
            request.resource.project = Primitive.to_proto(self.project)

        request.service_account_file = self.service_account_file

        response = stub.ApplyComputeBetaHttpHealthCheck(request)
        self.check_interval_sec = Primitive.from_proto(
            response.check_interval_sec)
        self.description = Primitive.from_proto(response.description)
        self.healthy_threshold = Primitive.from_proto(
            response.healthy_threshold)
        self.host = Primitive.from_proto(response.host)
        self.name = Primitive.from_proto(response.name)
        self.port = Primitive.from_proto(response.port)
        self.request_path = Primitive.from_proto(response.request_path)
        self.timeout_sec = Primitive.from_proto(response.timeout_sec)
        self.unhealthy_threshold = Primitive.from_proto(
            response.unhealthy_threshold)
        self.creation_timestamp = Primitive.from_proto(
            response.creation_timestamp)
        self.project = Primitive.from_proto(response.project)
        self.self_link = Primitive.from_proto(response.self_link)
Example #3
0
    def delete(self, project, name, service_account_file=""):
        stub = http_health_check_pb2_grpc.ComputeBetaHttpHealthCheckServiceStub(
            channel.Channel())
        request = http_health_check_pb2.DeleteComputeBetaHttpHealthCheckRequest(
        )
        request.service_account_file = service_account_file
        request.Project = project

        request.Name = name

        response = stub.DeleteComputeBetaHttpHealthCheck(request)
    def delete(self):
        stub = http_health_check_pb2_grpc.ComputeBetaHttpHealthCheckServiceStub(
            channel.Channel())
        request = http_health_check_pb2.DeleteComputeBetaHttpHealthCheckRequest(
        )
        request.service_account_file = self.service_account_file
        if Primitive.to_proto(self.check_interval_sec):
            request.resource.check_interval_sec = Primitive.to_proto(
                self.check_interval_sec)

        if Primitive.to_proto(self.description):
            request.resource.description = Primitive.to_proto(self.description)

        if Primitive.to_proto(self.healthy_threshold):
            request.resource.healthy_threshold = Primitive.to_proto(
                self.healthy_threshold)

        if Primitive.to_proto(self.host):
            request.resource.host = Primitive.to_proto(self.host)

        if Primitive.to_proto(self.name):
            request.resource.name = Primitive.to_proto(self.name)

        if Primitive.to_proto(self.port):
            request.resource.port = Primitive.to_proto(self.port)

        if Primitive.to_proto(self.request_path):
            request.resource.request_path = Primitive.to_proto(
                self.request_path)

        if Primitive.to_proto(self.timeout_sec):
            request.resource.timeout_sec = Primitive.to_proto(self.timeout_sec)

        if Primitive.to_proto(self.unhealthy_threshold):
            request.resource.unhealthy_threshold = Primitive.to_proto(
                self.unhealthy_threshold)

        if Primitive.to_proto(self.project):
            request.resource.project = Primitive.to_proto(self.project)

        response = stub.DeleteComputeBetaHttpHealthCheck(request)