Repository Binding¶
Bind a Consumer to a Repository¶
Bind a consumer to a repository’s distributor for the purpose of consuming published content. Binding the consumer is performed in the following steps:
Create the binding on server.
Optionally send a request to the consumer to create the binding.
The distributor may support configuration options that it may use for that particular binding. These options would be used when generating the payload that is sent to consumers so they may access the repository. See the individual distributor’s documentation for more information on the format.
/pulp/api/v2/consumers/<consumer_id>/bindings/
repo_id (string) - unique identifier for the repository
distributor_id (string) - identifier for the distributor
options (object) - (optional) options passed to the handler on the consumer
notify_agent (boolean) - (optional) indicates if the consumer should be sent a message about the new binding; defaults to true if unspecified
binding_config (object) - (optional) options to be used by the distributor for this binding
200 - if the bind request was fully processed on the server
202 - if an additional task was created to update consumer agents
400 - if one or more of the parameters is invalid
404 - if the consumer does not exist
Sample Request:
{
"repo_id": "test-repo",
"distributor_id": "dist-1"
}
Tags:
Each task created to add the binding to a consumer
will be created with the following tags: "pulp:repository:<repo_id>",
"pulp:consumer:<consumer_id>"
"pulp:repository_distributor:<distributor-id>"
"pulp:action:bind"
Unbind a Consumer¶
Remove a binding between a consumer and a repository’s distributor.
Unbinding the consumer is performed in the following steps:
Mark the binding as deleted on the server.
Send a request to the consumer to remove the binding.
Once the consumer has confirmed that the binding has been removed, it is permanently deleted on the server.
The steps for a forced unbind are as follows:
The binding is deleted on the server. This happens synchronously with the call.
Send a request to the consumer to remove the binding. The ID of the request to the consumer is returned via the spawned_tasks field of the Call Report.
If the notify_agent parameter was set to false when the binding was created, no request is sent to the consumer to remove the binding, so the binding is immediately deleted.
/pulp/api/v2/consumers/<consumer_id>/bindings/<repo_id>/<distributor_id>
force (boolean) - (optional) delete the binding immediately and discontinue tracking consumer actions
options (object) - (optional) options passed to the handler on the consumer
200 - if notify_agent was set to false for the binding and it was immediately deleted
202 - the unbind request was accepted
400 - if one or more of the parameters is invalid
404 - if the consumer, repo, or distributor IDs don’t exist, or if the binding does not exist
Tags:
Each task created to delete the binding from a consumer
will be created with the following tags: "pulp:repository:<repo_id>",
"pulp:consumer:<consumer_id>"
"pulp:repository_distributor:<distributor-id>"
"pulp:action:unbind"
Retrieve a Single Binding¶
Retrieves information on a single binding between a consumer and a repository.
/pulp/api/v2/consumers/<consumer_id>/bindings/<repo_id>/<distributor_id>
200 - if the bind exists
404 - if the given IDs don’t exist, or if no bind exists with the given IDs
Sample 200 Response Body:
{
"_href": "/pulp/api/v2/consumers/test-consumer/bindings/test-repo/yum_distributor/",
"_id": {
"$oid": "55097a6045ef4829b243f102"
},
"_ns": "consumer_bindings",
"binding_config": {},
"consumer_actions": [
{
"action": "bind",
"id": "d991aef8-cd50-402e-9e1b-84a2729b34a3",
"status": "pending",
"timestamp": 1426684512.37454
}
],
"consumer_id": "test-consumer",
"deleted": false,
"details": {
"ca_cert": null,
"client_cert": null,
"gpg_keys": [],
"protocols": [
"https"
],
"relative_path": "/pulp/repos/test-repo",
"repo_name": "test-repo",
"server_name": "example.com"
},
"distributor_id": "yum_distributor",
"id": "55097a6045ef4829b243f102",
"notify_agent": true,
"repo_id": "test-repo",
"type_id": "yum_distributor"
}
Retrieve All Bindings¶
Retrieves information on all bindings for the specified consumer.
/pulp/api/v2/consumers/<consumer_id>/bindings/
200 - if the consumer exists
404 - if the given consumer does not exist
Sample 200 Response Body:
[
{
"_href": "/pulp/api/v2/consumers/test-consumer/bindings/test-repo/yum_distributor/",
"_id": {
"$oid": "55097cd045ef4829b081fd28"
},
"_ns": "consumer_bindings",
"binding_config": {},
"consumer_actions": [
{
"action": "bind",
"id": "99613d18-1cff-424f-a5dd-9c4357a3f194",
"status": "pending",
"timestamp": 1426685136.733399
}
],
"consumer_id": "test-consumer",
"deleted": false,
"details": {
"ca_cert": null,
"client_cert": null,
"gpg_keys": [],
"protocols": [
"https"
],
"relative_path": "/pulp/repos/test-repo",
"repo_name": "test-repo",
"server_name": "example.com"
},
"distributor_id": "yum_distributor",
"id": "55097cd045ef4829b081fd28",
"notify_agent": true,
"repo_id": "test-repo",
"type_id": "yum_distributor"
},
{
"_href": "/pulp/api/v2/consumers/test-consumer/bindings/repo1/yum_distributor/",
"_id": {
"$oid": "55097a6045ef4829b243f102"
},
"_ns": "consumer_bindings",
"binding_config": {},
"consumer_actions": [
{
"action": "bind",
"id": "d991aef8-cd50-402e-9e1b-84a2729b34a3",
"status": "pending",
"timestamp": 1426684512.37454
}
],
"consumer_id": "test-consumer",
"deleted": false,
"details": {
"ca_cert": null,
"client_cert": null,
"gpg_keys": [],
"protocols": [
"https"
],
"relative_path": "/pulp/repos/repo1",
"repo_name": "repo1",
"server_name": "example.com"
},
"distributor_id": "yum_distributor",
"id": "55097a6045ef4829b243f102",
"notify_agent": true,
"repo_id": "repo1",
"type_id": "yum_distributor"
}
]
Retrieve Binding By Consumer And Repository¶
Retrieves information on all bindings between a consumer and a repository.
/pulp/api/v2/consumers/<consumer_id>/bindings/<repo_id>/
200 - if both the consumer and repository IDs are valid
404 - if one or both of the given ids are not valid
Sample 200 Response Body:
[
{
"notify_agent": true,
"repo_id": "test_repo",
"_href": "/pulp/api/v2/consumers/test_consumer/bindings/test_repo/test_distributor/",
"type_id": "test_distributor",
"consumer_actions": [
{
"status": "pending",
"action": "bind",
"id": "3a8713bb-6902-4f11-a725-17c7f1f6586a",
"timestamp": 1402688658.785708
}
],
"_ns": "consumer_bindings",
"distributor_id": "test_distributor",
"consumer_id": "test_consumer",
"deleted": false,
"binding_config": {},
"details": {
"server_name": "pulp.example.com",
"ca_cert": null,
"relative_path": "/pulp/repos/test_repo",
"gpg_keys": [],
"client_cert": null,
"protocols": [
"https"
],
"repo_name": "test_repo"
},
"_id": {
"$oid": "539b54927bc8f6388640871d"
},
"id": "539b54927bc8f6388640871d"
}
]