forked from mboldt/docs-tiledev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget-credhub-vars.html.md.erb
97 lines (76 loc) · 2.76 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
87
88
89
90
91
92
93
94
95
96
97
---
title: Fetching variable names and values with CredHub
owner: CredHub
---
CredHub has two API endpoints to identify and reuse variables. To see all the credentials
associated with your product, or you want to troubleshoot problems specific to one virtual machine (VM),
you 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.
### <a id="use-api-endpoints"></a> Using the API endpoints
You can Use endpoints to view variables for any product in Tanzu Operations Manager, except the BOSH Director. These
endpoints are read-only. You
cannot use them to add, remove, or rotate variables.
## <a id="fetch-variables"></a> 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>://OPS-MAN-FQDN/api/variables"
-X GET \
-H "Authorization: Bearer EXAMPLE_UAA_ACCESS_TOKEN"
</pre>
### <a id="example-response"></a> Example response
<pre class="terminal">
HTTP/1.1 200 OK
{
"variables": ["FIRST-EXAMPLE-VARIABLE", "SECOND-EXAMPLE-VARIABLE", "THIRD-EXAMPLE-VARIABLE"]
}
</pre>
### <a id="query-params"></a> Query parameters
<table class=“table”>
<thead>
<th>Parameter</th>
<th>Description</th>
<tr>
</thead>
<td>product_guid</td>
<td>The unique product identifier, formatted as a text string</td>
</tr>
</thead>
</table>
This endpoint returns the name of the variable. Use the name in the next endpoint to return the
variable value.
## <a id="fetch-var-values"></a> Fetching variable values
This endpoint returns the value of a variable stored in
CredHub. Not all variables are stored in CredHub, because if you call a
variable that is not in CredHub, the call returns an empty value.
<pre class="terminal">
$ curl "http<span>s</span>://OPS-MAN-FQDN/api/variables" name=EXAMPLE-VARIABLE-NAME" \
-X GET \
-H "Authorization: Bearer UAA_ACCESS_TOKEN"
</pre>
### <a id="example-response"></a> Example response
<pre class="terminal">
HTTP/1.1 200 OK
{
"credhub-password": "EXAMPLE-PASSWORD"
}
</pre>
### <a id="query-params-values"></a> Query parameters
<table class=“table”>
<thead>
<th>Parameter</th>
<th>Description</th>
<tr>
</thead>
<td>variable_name</td>
<td>The name of the variable, formatted as a text string</td>
</tr>
</thead>
<tr>
<td>product_guid</td>
<td>The unique product identifier, formatted as a text string</td>
</tr>
</table>