Skip to content

Last post talked about the process of adding a v2.0 plugin to a Pulp server. This post will provide an overview of the currently available APIs. These APIs were developed with the focus of a sprint demo, so there are some holes in functionality. There is a story this sprint to revisit these and flush them out (along with correcting some conventions), but for now I wanted to provide a quick list for those interested in playing around with the plugin model.

The APIs can be found after the jump.

Repository Create, Delete, Retrieve, and Configure

Create Repository

Method POST
Path /v2/repositories/[id]/
Parameters
  • id – uniquely identifies the repository (specified in the URL)
  • display_name – (optional) user-friendly name of the repository
  • description – (optional) user-friendly description of the repository
Return True if the repository was created
Sample Request Body
{"display_name": "Demo 1 Repository"}
Sample Response
True

Delete Repository

Method DELETE
Path /v2/repositories/[id]/
Parameters
  • id – identifies the repository (specified in the URL)
Return True if the repository was deleted
Sample Request Body None
Sample Response
True

List Repositories

Method GET
Path /v2/repositories/
Parameters None
Return List of repositories and their details
Sample Request Body None
Sample Response
[{'content_unit_count': 0,
  'description': None,
  'display_name': 'Demo 1 Repository',
  'id': 'demo-1-repo',
  'notes': {}}]

Add an Importer to a Repository

Method POST
Path /v2/repositories/[id]/importers/
Parameters
  • id – identifies the repository (specified in the URL)
  • importer_type_id – identifies the type of importer being added; corresponds to the ID of the importer plugin
  • importer_config – dictionary of configuration values to pass to the importer that will be used only for the given repository; the contents will vary depending on the type of importer being added
Return True if the importer was added
Sample Request Body
{"importer_type_id": "local-rpm",
 "importer_config": {"rpm_dir": "/pulp-gc-demo/rpms"}
}
Sample Response
True

Add an Distributor to a Repository

Method POST
Path /v2/repositories/[id]/distributors/
Parameters
  • id – identifies the repository (specified in the URL)
  • distributor_type_id – identifies the type of distributor being added; corresponds to the ID of the distributor plugin
  • distributor_config – dictionary of configuration values to pass to the distributor that will be used only for the given repository; the contents will vary depending on the type of distributor being added
  • auto_publish – boolean; if true, this distributor will be published at the end of every successful sync; if false, the only way to publish this distributor is through an explicit call
  • distributor_id – (optional) since more than one distributor may be added to a repository, this is used to uniquely identify the distributor being added; if not specified Pulp will automatically generate one
Return True if the distributor was added
Sample Request Body
{"distributor_id": "http",
 "distributor_type_id": "http-rpm",
 "distributor_config": {},
 "auto_publish": true
}
Sample Response
True

Repository Actions

Synchronize Repository

Method POST
Path /v2/repositories/[id]/sync/
Parameters
  • id – identifies the repository (specified in the URL)
  • override_config – (optional) if specified, values within will override the importer_config specified when it was added to the repository; these values will take effect only for this sync operation
Return None
Sample Request Body
{"override_config": {"rpm_dir": "/pulp-gc-demo/override"}}
Sample Response None

Publish Repository

Method POST
Path /v2/repositories/[id]/publish/[distributor_id]/
Parameters
  • id – identifies the repository (specified in the URL)
  • distributor_id – identifies which distributor assigned to the repository should be published
  • override_config – (optional) if specified, values within will override the distributor_config specified when it was added to the repository; these values will take effect only for this publish operation
Return None
Sample Request Body
{"override_config": {"publish_option_1": "override_value"}}
Sample Response
True