Git Repository Objects#

Git Repository objects (gitrepos) are used to create and manage locally hosted Git repositories, which may be useful for automated configuration systems.

When issuing requests, the UID field in the URL can be either the actual UID of the object or the name of the object as given in the "name" field.

Data Fields#

Admin objects have several fields:

name
     Required: The name of the user on the underlying system

description
     Optional: A text string with descriptive information

public
     Optional

url
     Optional: A URL for the git repos that will be used for synchronization; note that
               either “url” or “upstream” can be defined, but not both

upstream
     Optional: A URL for an upstream git repos that will be used for synchronization;
               note that either “url” or “upstream” can be defined, but not both

branch_map
     Optional: A list of local-to-remote branch mappings

sync_period
     Optional: Time between synchronization events for this gitrepos; can be a number
               (seconds) or a string of the form “10m”, “2h”, “1d” for minutes, hours,
               or days, respectively

Additional Endpoints#

For gitrepos, several endpoints are available:

GET /gitrepo/{uid}/url
     Returns a URL string that can be used to clone the gitrepo. The output
     format is different from other ClusterWare commands – there are no “success” or
     “data” keys, just the URL string. This endpoint is public and does not require an
     authentication token

GET /gitrepo/{uid}/repo
     Returns the top-level file in the repo.  The output format is different
     from other ClusterWare commands – there are no “success” or “data” keys, just the
     (text) file. This endpoint is public and does not require an authentication token

GET /gitrepo/{uid}/repo/<PATH>
     Returns the file in the repo at location PATH.  The output format is
     different from other ClusterWare commands – there are no “success” or “data” keys,
     just the (text) file. This endpoint is public and does not require an
     authentication token

GET /gitrepo/{uid}/content
     Returns the top-level file in the repo.  The output format is different
     from other ClusterWare commands – there are no “success” or “data” keys, just the
     (text) file. This endpoint is public and does not require an authentication token

GET /gitrepo/{uid}/content/<PATH>
     Returns the file in the repo at location PATH.  The output format is
     different from other ClusterWare commands – there are no “success” or “data” keys,
     just the (text) file. This endpoint is public and does not require an
     authentication token

GET /gitrepo/{uid}/sync
     While this is a GET operation, it accepts a JSON object payload with an “action”
     key (required) and “branchmap” key (optional); action should be one of: 'status',
     'checkout', 'reset', 'pull', 'rebase'

POST /gitrepo/{uid}/sync
     Accepts a JSON object with an “action” key (required) and a “branchmap” key
     (optional); action should be one of: 'status', 'checkout', 'reset', 'pull',
     'rebase'

GET /gitrepo/{uid}/branches
     While this is a GET operation, it accepts a JSON object with optional keys:
     branchmap, all, filter; the branchmap is a list of branches to get information
     about, the all parameter is True/False, and filter allows for more arbitrary
     filtering of the gitrepos list

DELETE /gitrepo/{uid}/branches
     Accepts a JSON object with one or more optional keys:  “branches” (a list of
     branches to delete) or “all” (True/False, delete all branches in the gitrepos)