def delete(self):
        stub = trigger_pb2_grpc.EventarcBetaTriggerServiceStub(
            channel.Channel())
        request = trigger_pb2.DeleteEventarcBetaTriggerRequest()
        request.service_account_file = self.service_account_file
        if Primitive.to_proto(self.name):
            request.resource.name = Primitive.to_proto(self.name)

        if TriggerMatchingCriteriaArray.to_proto(self.matching_criteria):
            request.resource.matching_criteria.extend(
                TriggerMatchingCriteriaArray.to_proto(self.matching_criteria))
        if Primitive.to_proto(self.service_account):
            request.resource.service_account = Primitive.to_proto(
                self.service_account)

        if TriggerDestination.to_proto(self.destination):
            request.resource.destination.CopyFrom(
                TriggerDestination.to_proto(self.destination))
        else:
            request.resource.ClearField("destination")
        if TriggerTransport.to_proto(self.transport):
            request.resource.transport.CopyFrom(
                TriggerTransport.to_proto(self.transport))
        else:
            request.resource.ClearField("transport")
        if Primitive.to_proto(self.labels):
            request.resource.labels = Primitive.to_proto(self.labels)

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

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

        response = stub.DeleteEventarcBetaTrigger(request)
Example #2
0
    def list(self, project, location, service_account_file=""):
        stub = trigger_pb2_grpc.EventarcBetaTriggerServiceStub(channel.Channel())
        request = trigger_pb2.ListEventarcBetaTriggerRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Location = location

        return stub.ListEventarcBetaTrigger(request).items
    def delete(self, project, location, name, service_account_file=""):
        stub = trigger_pb2_grpc.EventarcBetaTriggerServiceStub(
            channel.Channel())
        request = trigger_pb2.DeleteEventarcBetaTriggerRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Location = location

        request.Name = name

        response = stub.DeleteEventarcBetaTrigger(request)
Example #4
0
    def apply(self):
        stub = trigger_pb2_grpc.EventarcBetaTriggerServiceStub(channel.Channel())
        request = trigger_pb2.ApplyEventarcBetaTriggerRequest()
        if Primitive.to_proto(self.name):
            request.resource.name = Primitive.to_proto(self.name)

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

        if TriggerDestination.to_proto(self.destination):
            request.resource.destination.CopyFrom(
                TriggerDestination.to_proto(self.destination)
            )
        else:
            request.resource.ClearField("destination")
        if TriggerTransport.to_proto(self.transport):
            request.resource.transport.CopyFrom(
                TriggerTransport.to_proto(self.transport)
            )
        else:
            request.resource.ClearField("transport")
        if Primitive.to_proto(self.labels):
            request.resource.labels = Primitive.to_proto(self.labels)

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

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

        request.service_account_file = self.service_account_file

        response = stub.ApplyEventarcBetaTrigger(request)
        self.name = Primitive.from_proto(response.name)
        self.create_time = Primitive.from_proto(response.create_time)
        self.update_time = Primitive.from_proto(response.update_time)
        self.service_account = Primitive.from_proto(response.service_account)
        self.destination = TriggerDestination.from_proto(response.destination)
        self.transport = TriggerTransport.from_proto(response.transport)
        self.labels = Primitive.from_proto(response.labels)
        self.etag = Primitive.from_proto(response.etag)
        self.matching_criteria = TriggerMatchingCriteriaArray.from_proto(
            response.matching_criteria
        )
        self.project = Primitive.from_proto(response.project)
        self.location = Primitive.from_proto(response.location)