|
| 1 | +<!-- |
| 2 | +Copyright (c) 2019 Matthias Tafelmeier. |
| 3 | +
|
| 4 | +This file is part of godon |
| 5 | +
|
| 6 | +godon is free software: you can redistribute it and/or modify |
| 7 | +it under the terms of the GNU Affero General Public License as |
| 8 | +published by the Free Software Foundation, either version 3 of the |
| 9 | +License, or (at your option) any later version. |
| 10 | +
|
| 11 | +godon is distributed in the hope that it will be useful, |
| 12 | +but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | +GNU Affero General Public License for more details. |
| 15 | +
|
| 16 | +You should have received a copy of the GNU Affero General Public License |
| 17 | +along with this godon. If not, see <http://www.gnu.org/licenses/>. |
| 18 | +--> |
| 19 | +# Godon CLI |
| 20 | + |
| 21 | +## breeder |
| 22 | + |
| 23 | +### breeder list |
| 24 | + |
| 25 | +**OPTIONS** |
| 26 | +* hostname |
| 27 | + * flags: --hostname |
| 28 | + * type: string |
| 29 | + * desc: godon hostname |
| 30 | +* port |
| 31 | + * flags: --port |
| 32 | + * type: number |
| 33 | + * desc: godon port |
| 34 | +* api_version |
| 35 | + * flags: --api-version |
| 36 | + * type: string |
| 37 | + * desc: godon api version |
| 38 | + |
| 39 | + |
| 40 | +> List all configured breeders |
| 41 | +
|
| 42 | +~~~bash |
| 43 | +set -eEux |
| 44 | + |
| 45 | +__api_version="${api_version:-v0}" |
| 46 | + |
| 47 | +curl --request GET "http://${hostname}:${port}/${__api_version}/breeders" |
| 48 | +~~~ |
| 49 | + |
| 50 | +### breeder create |
| 51 | + |
| 52 | +**OPTIONS** |
| 53 | +* file |
| 54 | + * flags: --file |
| 55 | + * type: string |
| 56 | + * desc: definition file of breeder to be created |
| 57 | +* hostname |
| 58 | + * flags: --hostname |
| 59 | + * type: string |
| 60 | + * desc: godon hostname |
| 61 | +* port |
| 62 | + * flags: --port |
| 63 | + * type: number |
| 64 | + * desc: godon port |
| 65 | +* api_version |
| 66 | + * flags: --api-version |
| 67 | + * type: string |
| 68 | + * desc: godon api version |
| 69 | + |
| 70 | +> Create a breeder |
| 71 | +
|
| 72 | +~~~bash |
| 73 | +set -eEux |
| 74 | + |
| 75 | +__api_version="${api_version:-v0}" |
| 76 | +__file="${file}" |
| 77 | +__temp_file_json_tranfer="$(mktemp)" |
| 78 | + |
| 79 | +cat "${__file}" | python -c 'import sys, yaml, json; json.dump(yaml.safe_load(sys.stdin), sys.stdout, indent=4)' > "${__temp_file_json_tranfer}" |
| 80 | + |
| 81 | +curl --request POST \ |
| 82 | + -H 'Content-Type: application/json' \ |
| 83 | + --data @"${__temp_file_json_tranfer}" \ |
| 84 | + "http://${hostname}:${port}/${__api_version}/breeders" |
| 85 | +~~~ |
| 86 | + |
| 87 | +### breeder purge |
| 88 | + |
| 89 | +**OPTIONS** |
| 90 | +* uuid |
| 91 | + * flags: --uuid |
| 92 | + * type: string |
| 93 | + * desc: uuid of breeder to be purged |
| 94 | +* hostname |
| 95 | + * flags: --hostname |
| 96 | + * type: string |
| 97 | + * desc: godon hostname |
| 98 | +* port |
| 99 | + * flags: --port |
| 100 | + * type: number |
| 101 | + * desc: godon port |
| 102 | +* api_version |
| 103 | + * flags: --api-version |
| 104 | + * type: string |
| 105 | + * desc: godon api version |
| 106 | + |
| 107 | +> Purge a breeder |
| 108 | +
|
| 109 | +~~~bash |
| 110 | +set -eEux |
| 111 | + |
| 112 | +__api_version="${api_version:-v0}" |
| 113 | + |
| 114 | +curl --request DELETE \ |
| 115 | + "http://${hostname}:${port}/${__api_version}/breeder?uuid=${uuid}" |
| 116 | +~~~ |
| 117 | + |
| 118 | +### breeder update |
| 119 | + |
| 120 | +**OPTIONS** |
| 121 | +* file |
| 122 | + * flags: --file |
| 123 | + * type: string |
| 124 | + * desc: definition file of breeder to be updated |
| 125 | +* hostname |
| 126 | + * flags: --hostname |
| 127 | + * type: string |
| 128 | + * desc: godon hostname |
| 129 | +* port |
| 130 | + * flags: --port |
| 131 | + * type: number |
| 132 | + * desc: godon port |
| 133 | +* api_version |
| 134 | + * flags: --api-version |
| 135 | + * type: string |
| 136 | + * desc: godon api version |
| 137 | + |
| 138 | +> Update a breeder |
| 139 | +
|
| 140 | +~~~bash |
| 141 | + |
| 142 | +set -eEux |
| 143 | + |
| 144 | +__api_version="${api_version:-v0}" |
| 145 | +__temp_file_json_tranfer="$(mktemp)" |
| 146 | + |
| 147 | +cat "${file}" | python -c 'import sys, yaml, json; json.dump(yaml.safe_load(sys.stdin), sys.stdout, indent=4)' > "${__temp_file_json_tranfer}" |
| 148 | + |
| 149 | +curl --request PUT \ |
| 150 | + -H 'Content-Type: application/json' \ |
| 151 | + --data @"${__temp_file_json_tranfer}" \ |
| 152 | + "http://${hostname}:${port}/${__api_version}/breeders" |
| 153 | +~~~ |
| 154 | + |
| 155 | +### breeder show |
| 156 | + |
| 157 | +**OPTIONS** |
| 158 | +* uuid |
| 159 | + * flags: --uuid |
| 160 | + * type: string |
| 161 | + * desc: uuid of breeder to get details from |
| 162 | +* hostname |
| 163 | + * flags: --hostname |
| 164 | + * type: string |
| 165 | + * desc: godon hostname |
| 166 | +* port |
| 167 | + * flags: --port |
| 168 | + * type: number |
| 169 | + * desc: godon port |
| 170 | +* api_version |
| 171 | + * flags: --api-version |
| 172 | + * type: string |
| 173 | + * desc: godon api version |
| 174 | + |
| 175 | +> Show a breeder |
| 176 | +
|
| 177 | +~~~bash |
| 178 | +set -eEux |
| 179 | + |
| 180 | +__api_version="${api_version:-v0}" |
| 181 | + |
| 182 | +curl --request GET \ |
| 183 | + -H 'Content-Type: application/json' \ |
| 184 | + --data "{ \"id\": \"${uuid}\" }" \ |
| 185 | + "http://${hostname}:${port}/${__api_version}/breeder?uuid=${uuid}" |
| 186 | +~~~ |
0 commit comments