return krb5_context
- # Test functions
-
- async def test(self):
- """
- Tests the connection
- """
- return await self._request("GET", "/test")
-
- # Build actions
-
- def get_build(self, uuid):
- return self._request("/api/v1/builds/%s" % uuid, decode="json")
-
- async def build(self, path, repo=None, arches=None,
- disable_test_builds=False):
- """
- Create a new build on the hub
- """
- # Upload the souce file to the server
- upload_id = await self.upload(path)
-
- log.debug("%s has been uploaded as %s" % (path, upload_id))
-
- # Create a new build
- build_id = await self._request("POST", "/api/v1/builds",
- upload_id=upload_id,
- repo=repo,
- arches=arches,
- disable_test_builds=disable_test_builds,
- )
-
- log.debug("Build creates as %s" % build_id)
-
- return build_id
-
- # Job actions
-
- def get_job(self, uuid):
- return self._request("/jobs/%s" % uuid, decode="json")
-
- # Package actions
-
- def get_package(self, uuid):
- return self._request("/packages/%s" % uuid, decode="json")
-
# Uploads
- async def list_uploads(self):
- """
- Returns a list of all uploads
- """
- response = await self._request("GET", "/api/v1/uploads")
-
- return response.get("uploads")
-
async def upload(self, path, filename=None, show_progress=True):
"""
Uploads the file to the hub returning the upload ID
"""
return await self._proxy(JobControlConnection, *args, **kwargs)
- # Repositories
-
- async def list_repos(self, distro):
- """
- Lists all repositories
- """
- return await self._request("GET", "/api/v1/repos/%s" % distro)
-
- async def get_repo(self, distro, name):
- """
- Fetches repository information
- """
- return await self._request("GET", "/api/v1/repos/%s/%s" % (distro, name))
-
- async def create_repo(self, distro, name, description=None):
- """
- Creates a new repository
- """
- return await self._request("POST", "/api/v1/repos/%s" % distro,
- name=name, description=description)
-
- async def delete_repo(self, distro, name):
- """
- Deletes a repository
- """
- await self._request("DELETE", "/api/v1/repos/%s/%s" % (distro, name))
-
class HubObject(object):
# Disable Nagle's algorithm?