Add worker resource to perms table (#2241)
This commit is contained in:
1 parent
a537491cbc
commit
79440c5d82
2 files changed
+141
-8
No files matched your search
@@ -76,6 +76,7 @@ func main() {
|
||||
session,
|
||||
target,
|
||||
user,
|
||||
worker,
|
||||
)
|
||||
|
||||
fileContents, err := ioutil.ReadFile(permsFile)
|
||||
@@ -253,16 +254,9 @@ func sortedKeys(in map[string]string) []string {
|
||||
return out
|
||||
}
|
||||
|
||||
func clActions(typ string) []*Action {
|
||||
func lActions(typ string) []*Action {
|
||||
listVersion := strings.TrimPrefix(strings.TrimPrefix(typ, "an "), "a ")
|
||||
return []*Action{
|
||||
{
|
||||
Name: "create",
|
||||
Description: fmt.Sprintf("Create %s", typ),
|
||||
Examples: []string{
|
||||
"type=<type>;actions=create",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "list",
|
||||
Description: fmt.Sprintf("List %ss", listVersion),
|
||||
@@ -273,6 +267,18 @@ func clActions(typ string) []*Action {
|
||||
}
|
||||
}
|
||||
|
||||
func clActions(typ string) []*Action {
|
||||
return append([]*Action{
|
||||
{
|
||||
Name: "create",
|
||||
Description: fmt.Sprintf("Create %s", typ),
|
||||
Examples: []string{
|
||||
"type=<type>;actions=create",
|
||||
},
|
||||
},
|
||||
}, lActions(typ)...)
|
||||
}
|
||||
|
||||
func rudActions(typ string, pin bool) []*Action {
|
||||
ret := []*Action{
|
||||
{
|
||||
@@ -828,3 +834,37 @@ var user = &Resource{
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var worker = &Resource{
|
||||
Type: "Worker",
|
||||
Scopes: []string{"Global"},
|
||||
Endpoints: []*Endpoint{
|
||||
{
|
||||
Path: "/workers",
|
||||
Params: map[string]string{
|
||||
"Type": "workers",
|
||||
},
|
||||
Actions: append(
|
||||
lActions("a worker"),
|
||||
&Action{
|
||||
Name: "create:worker-led",
|
||||
Description: "Create a worker using the worker-led workflow",
|
||||
Examples: []string{
|
||||
"type=<type>;actions=create",
|
||||
"type=<type>;actions=create:worker-led",
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
{
|
||||
Path: "/workers/<id>",
|
||||
Params: map[string]string{
|
||||
"ID": "<id>",
|
||||
"Type": "workers",
|
||||
},
|
||||
Actions: append(
|
||||
rudActions("a worker", false),
|
||||
),
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1442,6 +1442,99 @@ documentation](https://www.boundaryproject.io/api-docs) for guidance.
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowSpan="2">Worker</td>
|
||||
<td rowSpan="2">
|
||||
<ul>
|
||||
<li>Global</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<code>/workers</code>
|
||||
</td>
|
||||
<td>
|
||||
<ul>
|
||||
<li>Type</li>
|
||||
<ul>
|
||||
<li>
|
||||
<code>workers</code>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<ul>
|
||||
<li>
|
||||
<code>list</code>: List workers
|
||||
</li>
|
||||
<ul>
|
||||
<li>
|
||||
<code>type=<type>;actions=list</code>
|
||||
</li>
|
||||
</ul>
|
||||
<li>
|
||||
<code>create:worker-led</code>: Create a worker using the worker-led workflow
|
||||
</li>
|
||||
<ul>
|
||||
<li>
|
||||
<code>type=<type>;actions=create</code>
|
||||
</li>
|
||||
<li>
|
||||
<code>type=<type>;actions=create:worker-led</code>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>/workers/<id></code>
|
||||
</td>
|
||||
<td>
|
||||
<ul>
|
||||
<li>ID</li>
|
||||
<ul>
|
||||
<li>
|
||||
<code><id></code>
|
||||
</li>
|
||||
</ul>
|
||||
<li>Type</li>
|
||||
<ul>
|
||||
<li>
|
||||
<code>workers</code>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<ul>
|
||||
<li>
|
||||
<code>read</code>: Read a worker
|
||||
</li>
|
||||
<ul>
|
||||
<li>
|
||||
<code>id=<id>;actions=read</code>
|
||||
</li>
|
||||
</ul>
|
||||
<li>
|
||||
<code>update</code>: Update a worker
|
||||
</li>
|
||||
<ul>
|
||||
<li>
|
||||
<code>id=<id>;actions=update</code>
|
||||
</li>
|
||||
</ul>
|
||||
<li>
|
||||
<code>delete</code>: Delete a worker
|
||||
</li>
|
||||
<ul>
|
||||
<li>
|
||||
<code>id=<id>;actions=delete</code>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
Reference in new issue
Block a user