-
Notifications
You must be signed in to change notification settings - Fork 23
/
get-credhub-vars.html.md.erb
86 lines (63 loc) · 2.57 KB
/
get-credhub-vars.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
title: Fetching Variable Names and Values
owner: CredHub
---
<strong><%= modified_date %></strong>
## Overview
CredHub has two API endpoints to identify and re-use variables. Operators who want to see all the credentials associated with their product, or support engineers who want to troubleshoot issues specific to one virtual machine (VM), can use these APIs for those purposes.
The API endpoints perform these functions:
* Identifying and printing the name of a variable
* Using the name of the variable to identify and print the value of the variable
### Using the API Endpoints
Use these endpoints to view variables for any product in Ops Manager, except the Ops Manager Director. These endpoints are read-only. You cannot use them to add, remove, or rotate variables.
## Fetching Variables
This endpoint returns the list of variables associated with a product that are stored in CredHub. Not all variables are stored in CredHub. If you call a variable that is not stored in CredHub, the call returns an empty value.
<pre class="terminal">
$ curl "http<span>s</span>://example.com/api/v0/deployed/products/product-guid/variables" \
-X GET \
-H "Authorization: Bearer EXAMPLE_UAA_ACCESS_TOKEN"
</pre>
### Example Response
<pre class="terminal">
HTTP/1.1 200 OK
{
"variables": ["FIRST-EXAMPLE-VARIABLE", "SECOND-EXAMPLE-VARIABLE", "THIRD-EXAMPLE-VARIABLE"]
}
</pre>
### Query Parameters
<table class="nice">
<th>Parameter</th>
<th>Description</th>
<tr>
<td>product_guid</td>
<td>The unique product identifier, formatted as a text string</td>
</tr>
</table>
This endpoint returns a variable's name. Use the name in the next endpoint to return the variable's value.
## Fetching Variable Values
This endpoint returns the value of a variable stored in CredHub. Not all variables are stored in CredHub, so if you call a variable that isn't in CredHub, the call will return an empty value.
<pre class="terminal">
$ curl "http<span>s</span>://example.com/api/v0/deployed/products/product-guid/variables?name=EXAMPLE-VARIABLE-NAME" \
-X GET \
-H "Authorization: Bearer UAA_ACCESS_TOKEN"
</pre>
### Example Response
<pre class="terminal">
HTTP/1.1 200 OK
{
"credhub-password": "EXAMPLE-PASSWORD"
}
</pre>
### Query Parameters
<table>
<th>Parameter</th>
<th>Description</th>
<tr>
<td>variable_name</td>
<td>The name of the variable, formatted as a text string</td>
</tr>
<tr>
<td>product_guid</td>
<td>The unique product identifier, formatted as a text string</td>
</tr>
</table>