|
| 1 | +--- |
| 2 | +--- |
| 3 | + |
| 4 | +## Configuration Script Payloads |
| 5 | + |
| 6 | +Management of configuration script payloads is provided through the following |
| 7 | +collection: |
| 8 | + |
| 9 | +``` data |
| 10 | +/api/configuration_script_payloads |
| 11 | +``` |
| 12 | + |
| 13 | +The following actions on configuration script payloads are available: |
| 14 | + |
| 15 | +- [Querying Configuration Script Payloads](#querying-configuration-script-payloads) |
| 16 | + |
| 17 | +- [Editing Configuration Script Payloads](#editing-configuration-script-payloads) |
| 18 | + |
| 19 | +- [Updating Configuration Script Payloads](#updating-configuration-script-payloads) |
| 20 | + |
| 21 | +- [Querying Configuration Script Payload Authentication](#querying-configuration-script-payload-authentication) |
| 22 | + |
| 23 | +- [Creating Configuration Script Payload Authentication](#creating-configuration-script-payload-authentication) |
| 24 | + |
| 25 | +### Querying Configuration Script Payloads |
| 26 | + |
| 27 | +Query all configuration script payloads in the system: |
| 28 | + |
| 29 | + GET /api/configuration_script_payloads |
| 30 | + |
| 31 | +Example response: |
| 32 | + |
| 33 | +``` json |
| 34 | +{ |
| 35 | + "name": "configuration_script_payloads", |
| 36 | + "count": 2, |
| 37 | + "subcount": 2, |
| 38 | + "pages": 1, |
| 39 | + "resources": [ |
| 40 | + { |
| 41 | + "href": "http://localhost:3000/api/configuration_script_payloads/1" |
| 42 | + }, |
| 43 | + { |
| 44 | + "href": "http://localhost:3000/api/configuration_script_payloads/1" |
| 45 | + } |
| 46 | + ], |
| 47 | + "actions": [ |
| 48 | + { |
| 49 | + "name": "edit", |
| 50 | + "method": "post", |
| 51 | + "href": "http://localhost:3000/api/configuration_script_payloads" |
| 52 | + } |
| 53 | + ], |
| 54 | + "links": { |
| 55 | + "self": "http://localhost:3000/api/configuration_script_payloads?offset=0", |
| 56 | + "first": "http://localhost:3000/api/configuration_script_payloads?offset=0", |
| 57 | + "last": "http://localhost:3000/api/configuration_script_payloads?offset=0" |
| 58 | + } |
| 59 | +} |
| 60 | +``` |
| 61 | + |
| 62 | +Query the details on a specific configuration script payload: |
| 63 | + |
| 64 | + GET /api/configuration_script_payloads/:id |
| 65 | + |
| 66 | +Example response: |
| 67 | + |
| 68 | +``` json |
| 69 | +{ |
| 70 | + "href": "http://localhost:3000/api/configuration_script_payloads/1", |
| 71 | + "id": "1", |
| 72 | + "manager_id": "2", |
| 73 | + "manager_ref": null, |
| 74 | + "name": "provision-vm-service/list-providers.asl", |
| 75 | + "description": null, |
| 76 | + "variables": null, |
| 77 | + "created_at": "2023-11-08T17:43:30Z", |
| 78 | + "updated_at": "2023-11-08T17:46:03Z", |
| 79 | + "survey_spec": null, |
| 80 | + "inventory_root_group_id": null, |
| 81 | + "type": "ManageIQ::Providers::Workflows::AutomationManager::Workflow", |
| 82 | + "parent_id": null, |
| 83 | + "configuration_script_source_id": "11", |
| 84 | + "run_by_userid": null, |
| 85 | + "payload": "{\n \"Comment\": \"List Providers.\",\n \"StartAt\": \"ListProviders\",\n \"States\": {\n \"ListProviders\": {\n \"Type\": \"Task\",\n \"Resource\": \"docker://docker.io/agrare/list-providers:latest\",\n \"End\": true,\n \"Credentials\": {\n \"api_user.$\": \"$.api_user\",\n \"api_password.$\": \"$.api_password\",\n \"api_token.$\": \"$.api_token\",\n \"api_bearer_token.$\": \"$.api_bearer_token\"\n },\n \"Parameters\": {\n \"API_URL.$\": \"$$.Execution._manageiq_api_url\",\n \"VERIFY_SSL.$\": \"$.dialog.dialog_verify_ssl\",\n\n \"PROVIDER_TYPE\": \"ManageIQ::Providers::Vmware::InfraManager\"\n }\n }\n }\n}\n", |
| 86 | + "payload_type": "json", |
| 87 | + "credentials": null, |
| 88 | + "context": null, |
| 89 | + "output": null, |
| 90 | + "status": null, |
| 91 | + "miq_task_id": null, |
| 92 | + "payload_valid": true, |
| 93 | + "payload_error": null, |
| 94 | + "actions": [ |
| 95 | + { |
| 96 | + "name": "edit", |
| 97 | + "method": "post", |
| 98 | + "href": "http://localhost:3000/api/configuration_script_payloads/1" |
| 99 | + }, |
| 100 | + { |
| 101 | + "name": "edit", |
| 102 | + "method": "patch", |
| 103 | + "href": "http://localhost:3000/api/configuration_script_payloads/1" |
| 104 | + }, |
| 105 | + { |
| 106 | + "name": "edit", |
| 107 | + "method": "put", |
| 108 | + "href": "http://localhost:3000/api/configuration_script_payloads/1" |
| 109 | + } |
| 110 | + ] |
| 111 | +} |
| 112 | +``` |
| 113 | + |
| 114 | +### Editing configuration script payloads |
| 115 | + |
| 116 | +Configuration script payloads can be edited by using a POST to the configuration script payloads collection: |
| 117 | + |
| 118 | + POST /api/configuration_script_payloads |
| 119 | + |
| 120 | + |
| 121 | +POST /api/configuration_script_payloads |
| 122 | + |
| 123 | +``` json |
| 124 | +{ |
| 125 | + "action": "edit", |
| 126 | + "resources": [ |
| 127 | + {"id": 1, "description": "A Helpful Description"} |
| 128 | + ] |
| 129 | +} |
| 130 | +``` |
| 131 | + |
| 132 | +Example response: |
| 133 | + |
| 134 | +``` json |
| 135 | +{ |
| 136 | + "results": [ |
| 137 | + { |
| 138 | + "href": "http://localhost:3000/api/configuration_script_payloads/1", |
| 139 | + "description": "A Helpful Description", |
| 140 | + "credentials": { |
| 141 | + "api_user.$": { |
| 142 | + "credential_ref": "manageiq_api", |
| 143 | + "credential_field": "userid" |
| 144 | + }, |
| 145 | + "api_password.$": { |
| 146 | + "credential_ref": "manageiq_api", |
| 147 | + "credential_field": "password" |
| 148 | + } |
| 149 | + }, |
| 150 | + "id": "1", |
| 151 | + "manager_id": "2", |
| 152 | + "manager_ref": null, |
| 153 | + "name": "provision-vm-service/list-providers.asl", |
| 154 | + "variables": null, |
| 155 | + "created_at": "2023-11-08T17:43:30Z", |
| 156 | + "updated_at": "2023-11-15T20:14:28Z", |
| 157 | + "survey_spec": null, |
| 158 | + "inventory_root_group_id": null, |
| 159 | + "type": "ManageIQ::Providers::Workflows::AutomationManager::Workflow", |
| 160 | + "parent_id": null, |
| 161 | + "configuration_script_source_id": "2", |
| 162 | + "run_by_userid": null, |
| 163 | + "payload": "{\n \"Comment\": \"List Providers.\",\n \"StartAt\": \"ListProviders\",\n \"States\": {\n \"ListProviders\": {\n \"Type\": \"Task\",\n \"Resource\": \"docker://docker.io/agrare/list-providers:latest\",\n \"End\": true,\n \"Credentials\": {\n \"api_user.$\": \"$.api_user\",\n \"api_password.$\": \"$.api_password\",\n \"api_token.$\": \"$.api_token\",\n \"api_bearer_token.$\": \"$.api_bearer_token\"\n },\n \"Parameters\": {\n \"API_URL.$\": \"$$.Execution._manageiq_api_url\",\n \"VERIFY_SSL.$\": \"$.dialog.dialog_verify_ssl\",\n\n \"PROVIDER_TYPE\": \"ManageIQ::Providers::Vmware::InfraManager\"\n }\n }\n }\n}\n", |
| 164 | + "payload_type": "json", |
| 165 | + "context": null, |
| 166 | + "output": null, |
| 167 | + "status": null, |
| 168 | + "miq_task_id": null, |
| 169 | + "payload_valid": true, |
| 170 | + "payload_error": null |
| 171 | + } |
| 172 | + ] |
| 173 | +} |
| 174 | +``` |
| 175 | + |
| 176 | + |
| 177 | +For instance, configuration script payloads can be edited to map credentials: |
| 178 | + |
| 179 | + POST /api/configuration_script_payloads |
| 180 | + |
| 181 | +``` json |
| 182 | +{ |
| 183 | + "action": "edit", |
| 184 | + "resources": [ |
| 185 | + { |
| 186 | + "id": 1, |
| 187 | + "credentials": [ |
| 188 | + {"my-cred-user": {"credential_ref": "my-credential", "credential_field": "userid"}}, |
| 189 | + {"my-cred-password": {"credential_ref": "my-credential", "credential_field": "password"}} |
| 190 | + ] |
| 191 | + } |
| 192 | + ] |
| 193 | +} |
| 194 | +``` |
| 195 | + |
| 196 | +### Updating configuration script payloads |
| 197 | + |
| 198 | +Configuration script payloads can be updated by using a PUT method or PATCH method. |
| 199 | + |
| 200 | +PUT method: |
| 201 | + |
| 202 | + PUT /api/configuration_script_payloads/:id |
| 203 | + |
| 204 | +Example request: |
| 205 | + |
| 206 | + PUT /api/configuration_script_payloads/1 {"description": "A Helpful Description"} |
| 207 | + |
| 208 | +Response: |
| 209 | + |
| 210 | +``` json |
| 211 | +{ |
| 212 | + "results": [ |
| 213 | + { |
| 214 | + "href": "http://localhost:3000/api/configuration_script_payloads/1", |
| 215 | + "description": "A Helpful Description", |
| 216 | + "credentials": { |
| 217 | + "api_user.$": { |
| 218 | + "credential_ref": "manageiq_api", |
| 219 | + "credential_field": "userid" |
| 220 | + }, |
| 221 | + "api_password.$": { |
| 222 | + "credential_ref": "manageiq_api", |
| 223 | + "credential_field": "password" |
| 224 | + } |
| 225 | + }, |
| 226 | + "id": "1", |
| 227 | + "manager_id": "2", |
| 228 | + "manager_ref": null, |
| 229 | + "name": "provision-vm-service/list-providers.asl", |
| 230 | + "variables": null, |
| 231 | + "created_at": "2023-11-08T17:43:30Z", |
| 232 | + "updated_at": "2023-11-15T20:14:28Z", |
| 233 | + "survey_spec": null, |
| 234 | + "inventory_root_group_id": null, |
| 235 | + "type": "ManageIQ::Providers::Workflows::AutomationManager::Workflow", |
| 236 | + "parent_id": null, |
| 237 | + "configuration_script_source_id": "2", |
| 238 | + "run_by_userid": null, |
| 239 | + "payload": "{\n \"Comment\": \"List Providers.\",\n \"StartAt\": \"ListProviders\",\n \"States\": {\n \"ListProviders\": {\n \"Type\": \"Task\",\n \"Resource\": \"docker://docker.io/agrare/list-providers:latest\",\n \"End\": true,\n \"Credentials\": {\n \"api_user.$\": \"$.api_user\",\n \"api_password.$\": \"$.api_password\",\n \"api_token.$\": \"$.api_token\",\n \"api_bearer_token.$\": \"$.api_bearer_token\"\n },\n \"Parameters\": {\n \"API_URL.$\": \"$$.Execution._manageiq_api_url\",\n \"VERIFY_SSL.$\": \"$.dialog.dialog_verify_ssl\",\n\n \"PROVIDER_TYPE\": \"ManageIQ::Providers::Vmware::InfraManager\"\n }\n }\n }\n}\n", |
| 240 | + "payload_type": "json", |
| 241 | + "context": null, |
| 242 | + "output": null, |
| 243 | + "status": null, |
| 244 | + "miq_task_id": null, |
| 245 | + "payload_valid": true, |
| 246 | + "payload_error": null |
| 247 | + } |
| 248 | + ] |
| 249 | +} |
| 250 | +``` |
| 251 | + |
| 252 | +### Patch method: |
| 253 | + |
| 254 | + PATCH /api/configuration_script_payloads/:id |
| 255 | + |
| 256 | +Example request: |
| 257 | + |
| 258 | + PATCH /api/configuration_script_payloads/1 {"description": "A Helpful Description"} |
| 259 | + |
| 260 | +Response: |
| 261 | + |
| 262 | +``` json |
| 263 | +{ |
| 264 | + "results": [ |
| 265 | + { |
| 266 | + "href": "http://localhost:3000/api/configuration_script_payloads/1", |
| 267 | + "description": "A Helpful Description", |
| 268 | + "credentials": { |
| 269 | + "api_user.$": { |
| 270 | + "credential_ref": "manageiq_api", |
| 271 | + "credential_field": "userid" |
| 272 | + }, |
| 273 | + "api_password.$": { |
| 274 | + "credential_ref": "manageiq_api", |
| 275 | + "credential_field": "password" |
| 276 | + } |
| 277 | + }, |
| 278 | + "id": "1", |
| 279 | + "manager_id": "2", |
| 280 | + "manager_ref": null, |
| 281 | + "name": "provision-vm-service/list-providers.asl", |
| 282 | + "variables": null, |
| 283 | + "created_at": "2023-11-08T17:43:30Z", |
| 284 | + "updated_at": "2023-11-15T20:14:28Z", |
| 285 | + "survey_spec": null, |
| 286 | + "inventory_root_group_id": null, |
| 287 | + "type": "ManageIQ::Providers::Workflows::AutomationManager::Workflow", |
| 288 | + "parent_id": null, |
| 289 | + "configuration_script_source_id": "2", |
| 290 | + "run_by_userid": null, |
| 291 | + "payload": "{\n \"Comment\": \"List Providers.\",\n \"StartAt\": \"ListProviders\",\n \"States\": {\n \"ListProviders\": {\n \"Type\": \"Task\",\n \"Resource\": \"docker://docker.io/agrare/list-providers:latest\",\n \"End\": true,\n \"Credentials\": {\n \"api_user.$\": \"$.api_user\",\n \"api_password.$\": \"$.api_password\",\n \"api_token.$\": \"$.api_token\",\n \"api_bearer_token.$\": \"$.api_bearer_token\"\n },\n \"Parameters\": {\n \"API_URL.$\": \"$$.Execution._manageiq_api_url\",\n \"VERIFY_SSL.$\": \"$.dialog.dialog_verify_ssl\",\n\n \"PROVIDER_TYPE\": \"ManageIQ::Providers::Vmware::InfraManager\"\n }\n }\n }\n}\n", |
| 292 | + "payload_type": "json", |
| 293 | + "context": null, |
| 294 | + "output": null, |
| 295 | + "status": null, |
| 296 | + "miq_task_id": null, |
| 297 | + "payload_valid": true, |
| 298 | + "payload_error": null |
| 299 | + } |
| 300 | + ] |
| 301 | +} |
| 302 | +``` |
| 303 | + |
| 304 | + |
| 305 | +### Querying Configuration Script Payload Authentication |
| 306 | + |
| 307 | +Query the authentication credentials for a specific configuration script payload: |
| 308 | + |
| 309 | + GET /api/configuration_script_payloads/:id/authentications |
| 310 | + |
| 311 | +Example response: |
| 312 | + |
| 313 | +``` json |
| 314 | +{ |
| 315 | + "name": "authentications", |
| 316 | + "count": 7, |
| 317 | + "subcount": 1, |
| 318 | + "pages": 1, |
| 319 | + "resources": [ |
| 320 | + { |
| 321 | + "href": "http://localhost:3000/api/configuration_script_payloads/2/authentications/3" |
| 322 | + } |
| 323 | + ], |
| 324 | + "actions": [ |
| 325 | + { |
| 326 | + "name": "create", |
| 327 | + "method": "post", |
| 328 | + "href": "http://localhost:3000/api/configuration_script_payloads/2/authentications" |
| 329 | + } |
| 330 | + ], |
| 331 | + "links": { |
| 332 | + "self": "http://localhost:3000/api/configuration_script_payloads/2/authentications?offset=0", |
| 333 | + "first": "http://localhost:3000/api/configuration_script_payloads/2/authentications?offset=0", |
| 334 | + "last": "http://localhost:3000/api/configuration_script_payloads/2/authentications?offset=0" |
| 335 | + } |
| 336 | +} |
| 337 | +``` |
| 338 | + |
| 339 | +Get the details on a specific authentication credential for a configuration script payload: |
| 340 | + |
| 341 | + GET /api/configuration_script_payloads/:id/authentications/:id |
| 342 | + |
| 343 | +Example response: |
| 344 | + |
| 345 | +``` json |
| 346 | +{ |
| 347 | + "href": "http://localhost:3000/api/configuration_script_payloads/2/authentications/3", |
| 348 | + "id": "3", |
| 349 | + "name": "manageiq_api", |
| 350 | + "authtype": null, |
| 351 | + "userid": "admin", |
| 352 | + "password": null, |
| 353 | + "resource_id": "25", |
| 354 | + "resource_type": "ExtManagementSystem", |
| 355 | + "created_on": "2023-11-15T19:59:23Z", |
| 356 | + "updated_on": "2023-11-15T19:59:23Z", |
| 357 | + "last_valid_on": null, |
| 358 | + "last_invalid_on": null, |
| 359 | + "credentials_changed_on": null, |
| 360 | + "status": null, |
| 361 | + "status_details": null, |
| 362 | + "type": "ManageIQ::Providers::Workflows::AutomationManager::WorkflowCredential", |
| 363 | + "auth_key": null, |
| 364 | + "fingerprint": null, |
| 365 | + "service_account": null, |
| 366 | + "public_key": null, |
| 367 | + "manager_ref": "3", |
| 368 | + "options": null, |
| 369 | + "evm_owner_id": null, |
| 370 | + "miq_group_id": "1", |
| 371 | + "tenant_id": "1", |
| 372 | + "become_username": null, |
| 373 | + "become_password": null, |
| 374 | + "auth_key_password": null, |
| 375 | + "ems_ref": "manageiq_api", |
| 376 | + "become_method": null |
| 377 | +} |
| 378 | +``` |
| 379 | + |
| 380 | + |
| 381 | +### Creating Configuration Script Payload Authentication |
| 382 | + |
| 383 | +Authentication credentials for a configuration script payload can be created by using a POST to the configuration script payload collection: |
| 384 | + |
| 385 | + POST /api/configuration_script_payloads/:id/authentications |
| 386 | + |
| 387 | +``` json |
| 388 | +{ |
| 389 | + "action": "create", |
| 390 | + "description": "Description", |
| 391 | + "name": "my credential", |
| 392 | + "type": "ManageIQ::Providers::AnsibleTower::AutomationManager::Credential" |
| 393 | +} |
| 394 | +``` |
0 commit comments