def list(self, project, service_account_file=""):
        stub = uptime_check_config_pb2_grpc.MonitoringUptimeCheckConfigServiceStub(
            channel.Channel())
        request = uptime_check_config_pb2.ListMonitoringUptimeCheckConfigRequest(
        )
        request.service_account_file = service_account_file
        request.Project = project

        return stub.ListMonitoringUptimeCheckConfig(request).items
    def delete(self):
        stub = uptime_check_config_pb2_grpc.MonitoringUptimeCheckConfigServiceStub(
            channel.Channel())
        request = uptime_check_config_pb2.DeleteMonitoringUptimeCheckConfigRequest(
        )
        request.service_account_file = self.service_account_file
        if Primitive.to_proto(self.name):
            request.resource.name = Primitive.to_proto(self.name)

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

        if UptimeCheckConfigMonitoredResource.to_proto(
                self.monitored_resource):
            request.resource.monitored_resource.CopyFrom(
                UptimeCheckConfigMonitoredResource.to_proto(
                    self.monitored_resource))
        else:
            request.resource.ClearField("monitored_resource")
        if UptimeCheckConfigResourceGroup.to_proto(self.resource_group):
            request.resource.resource_group.CopyFrom(
                UptimeCheckConfigResourceGroup.to_proto(self.resource_group))
        else:
            request.resource.ClearField("resource_group")
        if UptimeCheckConfigHttpCheck.to_proto(self.http_check):
            request.resource.http_check.CopyFrom(
                UptimeCheckConfigHttpCheck.to_proto(self.http_check))
        else:
            request.resource.ClearField("http_check")
        if UptimeCheckConfigTcpCheck.to_proto(self.tcp_check):
            request.resource.tcp_check.CopyFrom(
                UptimeCheckConfigTcpCheck.to_proto(self.tcp_check))
        else:
            request.resource.ClearField("tcp_check")
        if Primitive.to_proto(self.period):
            request.resource.period = Primitive.to_proto(self.period)

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

        if UptimeCheckConfigContentMatchersArray.to_proto(
                self.content_matchers):
            request.resource.content_matchers.extend(
                UptimeCheckConfigContentMatchersArray.to_proto(
                    self.content_matchers))
        if Primitive.to_proto(self.private_checkers):
            request.resource.private_checkers.extend(
                Primitive.to_proto(self.private_checkers))
        if Primitive.to_proto(self.selected_regions):
            request.resource.selected_regions.extend(
                Primitive.to_proto(self.selected_regions))
        if Primitive.to_proto(self.project):
            request.resource.project = Primitive.to_proto(self.project)

        response = stub.DeleteMonitoringUptimeCheckConfig(request)
Ejemplo n.º 3
0
    def delete(self, project, name, service_account_file=""):
        stub = uptime_check_config_pb2_grpc.MonitoringUptimeCheckConfigServiceStub(
            channel.Channel())
        request = uptime_check_config_pb2.DeleteMonitoringUptimeCheckConfigRequest(
        )
        request.service_account_file = service_account_file
        request.Project = project

        request.Name = name

        response = stub.DeleteMonitoringUptimeCheckConfig(request)