def list(self, project, service_account_file=""):
        stub = repo_pb2_grpc.SourcerepoRepoServiceStub(channel.Channel())
        request = repo_pb2.ListSourcerepoRepoRequest()
        request.service_account_file = service_account_file
        request.Project = project

        return stub.ListSourcerepoRepo(request).items
Пример #2
0
    def delete(self, project, name, service_account_file=""):
        stub = repo_pb2_grpc.SourcerepoRepoServiceStub(channel.Channel())
        request = repo_pb2.DeleteSourcerepoRepoRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Name = name

        response = stub.DeleteSourcerepoRepo(request)
    def delete(self):
        stub = repo_pb2_grpc.SourcerepoRepoServiceStub(channel.Channel())
        request = repo_pb2.DeleteSourcerepoRepoRequest()
        request.service_account_file = self.service_account_file
        if Primitive.to_proto(self.name):
            request.resource.name = Primitive.to_proto(self.name)

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

        response = stub.DeleteSourcerepoRepo(request)
    def apply(self):
        stub = repo_pb2_grpc.SourcerepoRepoServiceStub(channel.Channel())
        request = repo_pb2.ApplySourcerepoRepoRequest()
        if Primitive.to_proto(self.name):
            request.resource.name = Primitive.to_proto(self.name)

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

        request.service_account_file = self.service_account_file

        response = stub.ApplySourcerepoRepo(request)
        self.name = Primitive.from_proto(response.name)
        self.size = Primitive.from_proto(response.size)
        self.url = Primitive.from_proto(response.url)
        self.pubsub_configs = RepoPubsubConfigsArray.from_proto(
            response.pubsub_configs)
        self.project = Primitive.from_proto(response.project)