Example #1
0
    def delete_all_repos(self, force=None):
        """
        Deletes all repos.
        Params:
        * force: If set to true, the repo will be removed regardless of
        errors. This argument should be used with care.
        """

        req = proto.DeleteRepoRequest(force=force, all=True)
        self.stub.DeleteRepo(req, metadata=self.metadata)
    def delete_repo(self, repo_name, force=None):
        """
        Deletes a repo and reclaims the storage space it was using.

        Params:
        * repo_name: The name of the repo.
        * force: If set to true, the repo will be removed regardless of
        errors. This argument should be used with care.
        """
        req = proto.DeleteRepoRequest(repo=proto.Repo(name=repo_name), force=force, all=False)
        self.stub.DeleteRepo(req, metadata=self.metadata)
    def delete_repo(self, repo_name=None, force=False, all=False):
        """
        Deletes a repo and reclaims the storage space it was using.

        Params:
        * repo_name: The name of the repo.
        * force: If set to true, the repo will be removed regardless of
        errors. This argument should be used with care.
        * all: Delete all repos.
        """
        if not all:
            if repo_name:
                req = proto.DeleteRepoRequest(repo=proto.Repo(name=repo_name), force=force)
                self.stub.DeleteRepo(req, metadata=self.metadata)
            else:
                raise ValueError("Either a repo_name or all=True needs to be provided")
        else:
            if not repo_name:
                req = proto.DeleteRepoRequest(force=force, all=all)
                self.stub.DeleteRepo(req, metadata=self.metadata)
            else:
                raise ValueError("Cannot specify a repo_name if all=True")