Пример #1
0
    def delete(self):
        stub = notification_channel_pb2_grpc.MonitoringNotificationChannelServiceStub(
            channel.Channel())
        request = notification_channel_pb2.DeleteMonitoringNotificationChannelRequest(
        )
        request.service_account_file = self.service_account_file
        if Primitive.to_proto(self.description):
            request.resource.description = Primitive.to_proto(self.description)

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

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

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

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

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

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

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

        response = stub.DeleteMonitoringNotificationChannel(request)
Пример #2
0
    def list(self, project, service_account_file=""):
        stub = notification_channel_pb2_grpc.MonitoringNotificationChannelServiceStub(
            channel.Channel())
        request = notification_channel_pb2.ListMonitoringNotificationChannelRequest(
        )
        request.service_account_file = service_account_file
        request.Project = project

        return stub.ListMonitoringNotificationChannel(request).items
Пример #3
0
    def delete(self, project, name, service_account_file=""):
        stub = notification_channel_pb2_grpc.MonitoringNotificationChannelServiceStub(
            channel.Channel())
        request = notification_channel_pb2.DeleteMonitoringNotificationChannelRequest(
        )
        request.service_account_file = service_account_file
        request.Project = project

        request.Name = name

        response = stub.DeleteMonitoringNotificationChannel(request)
Пример #4
0
    def apply(self):
        stub = notification_channel_pb2_grpc.MonitoringNotificationChannelServiceStub(
            channel.Channel())
        request = notification_channel_pb2.ApplyMonitoringNotificationChannelRequest(
        )
        if Primitive.to_proto(self.description):
            request.resource.description = Primitive.to_proto(self.description)

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

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

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

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

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

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

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

        request.service_account_file = self.service_account_file

        response = stub.ApplyMonitoringNotificationChannel(request)
        self.description = Primitive.from_proto(response.description)
        self.display_name = Primitive.from_proto(response.display_name)
        self.enabled = Primitive.from_proto(response.enabled)
        self.labels = Primitive.from_proto(response.labels)
        self.name = Primitive.from_proto(response.name)
        self.type = Primitive.from_proto(response.type)
        self.user_labels = Primitive.from_proto(response.user_labels)
        self.verification_status = NotificationChannelVerificationStatusEnum.from_proto(
            response.verification_status)
        self.project = Primitive.from_proto(response.project)