Register, Update, and Unregister¶
Register a Consumer¶
Register a new consumer with the Pulp server. Consumer IDs must be unique across all consumers registered to the server.
Part of the reply to this call is an x.509 certificate that is used to identify the consumer for operations performed on its behalf. The certificate should be stored with the consumer and used as its client-side SSL certificate to convey its identification.
Method: POST
Path:
/pulp/api/v2/consumers/
Permission: create
Request Body Contents:
- id (string) - unique identifier for the consumer
- display_name (string) - (optional) user-friendly name for the consumer
- description (string) - (optional) user-friendly text describing the consumer
- notes (object) - (optional) key-value pairs to programmatically tag the consumer
Response Codes:
- 201 - if the consumer was successfully registered
- 400 - if one or more of the parameters is invalid
- 409 - if there is already a consumer with the given ID
Return: details of registered consumer along with the certificate used to identify the consumer in the future
Sample Request:
{
"notes": {"arch": "x86_64", "os": "fedora16"},
"display_name": null,
"id": "test-consumer",
"description": "Fedora 16 test build machine"
}
Sample 201 Response Body:
{
"consumer": {
"display_name": "test-consumer",
"description": "Fedora 16 test build machine",
"_ns": "consumers",
"notes": {},
"rsa_pub": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgw...K7\newIDAP//\n-----END PUBLIC KEY-----\n",
"capabilities": {},
"_id": {
"$oid": "5367e982e13823076517f976"
},
"id": "test-consumer",
"_href": {
"_href": "/pulp/api/v2/consumers/test-consumer/"
}
},
"certificate": "-----BEGIN RSA PRIVATE KEY-----\nMIICX...at9E1vT0=\n-----END CERTIFICATE-----"
}
Update a Consumer¶
The update consumer call is used to change the details of an existing consumer.
Method: PUT
Path:
/pulp/api/v2/consumers/<consumer_id>/
Permission: update
Request Body Contents: The body of the request is a JSON document with a root element
called
delta
. The contents of delta are the values to update. Only changed
parameters need be specified. The following keys are allowed in the delta
object. Descriptions for each parameter can be found under the register
consumer API:- display_name
- description
- notes
Response Codes:
- 200 - if the update was executed and successful
- 404 - if there is no consumer with the given ID
- 400 - if one or more of the parameters is invalid
Return: database representation of the consumer after changes made by the update
Sample Request:
{
"delta": {"display-name": "Test Consumer",
"notes": {"arch": "x86_64"},
"description": "QA automation testing machine"}
}
Sample 200 Response Body:
{
"consumer": {
"display_name": "Test Consumer",
"description": "QA automation testing machine",
"_ns": "consumers",
"notes": {
"arch": "x86_64"
},
"rsa_pub": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgw...K7\newIDAP//\n-----END PUBLIC KEY-----\n",
"capabilities": {},
"_id": {
"$oid": "5367e982e13823076517f976"
},
"id": "test-consumer",
"_href": {
"_href": "/pulp/api/v2/consumers/test-consumer/"
}
},
"certificate": "-----BEGIN RSA PRIVATE KEY-----\nMIICX...at9E1vT0=\n-----END CERTIFICATE-----"
}
Unregister a Consumer¶
Unregister a consumer from the Pulp server. If the consumer is configured with messaging capabilities, it will be notified of its unregistration.
Method: DELETE
Path:
/pulp/api/v2/consumers/<consumer_id>/
Permission: delete
Query Parameters:
Response Codes:
- 200 - if the consumer was successfully unregistered
- 404 - if there is no consumer with the given ID
Return: null