Create a provider instance
POST method to add a provider instance configuration in the cluster.
Method | URL | Description |
---|---|---|
POST | https://host_name:port/platform/rest/hostfactory/providers | Add a provider instance configuration detail. Can add only one provider instance in this
RESTful API. Remember:
If the provider plug-in is enabled, you can add an enabled or disabled provider instance. If the provider plug-in is disabled, adding an enabled provider instance fails, but you can add a disabled provider instance. |
Prerequisites
You must be the cluster administrator, or your user account must be assigned the HF_ALL_PROVIDER_MANAGE permission.Request
POST https://host_name:port/platform/rest/hostfactory/providers
Parameter | Type | Required/Optional | Description |
---|---|---|---|
hfcsrftoken | string | Optional | CSRF token that is obtained with successful login. |
If you use curl, the command might look like the following example:
curl --header -b /tmp/cookie --cacert /opt/ibm/spectrumcomputing/wlp/usr/shared/resources/security/cacert.pem --tlsv1.2 -X POST https://myprimaryhost.example.com:9443/platform/rest/hostfactory/providers?hfcsrftoken=915ee7644f431e630dac68b9ab3e40bc -d '{"name": "awsinst2", "enabled": 1, "plugin": "aws", "confPath": "${HF_CONFDIR}/providers/awsinst/", "workPath": "${HF_WORKDIR}/providers/awsinst/", "logPath": "${HF_LOGDIR}/"}'
This command takes a JSON request string to create a new provider instance with the following
sample configuration details:
{
"name": "awsinst2",
"enabled": 1,
"plugin": "aws",
"confPath": "${HF_CONFDIR}/providers/awsinst/",
"workPath": "${HF_WORKDIR}/providers/awsinst/",
"logPath": "${HF_LOGDIR}/"
}
Response
The command returns to the updated hostProviders.json file at:
- $EGO_CONFDIR/../../hostfactory/conf/providers/ on Linux®
- %EGO_CONFDIR%\..\..\hostfactory\conf\providers\ on Windows
Status code | Description |
---|---|
201 | Created. |
400 | Bad request. |
500 | Internal server error. Check the log files and look for hints in the API response body. |