Atšķirības starp "Hostnet OpenStack Cloud Compute API" versijām
No ''Hostnet Wiki''
| 38. rindiņa: | 38. rindiņa: | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
| − | curl -s -X GET https://identity.api.cloud.hostnet.lv/v3/ | + | curl -s -X GET https://identity.api.cloud.hostnet.lv/v3/auth/catalog \ |
-H "X-Auth-Token: $OS_TOKEN" | python -m json.tool | -H "X-Auth-Token: $OS_TOKEN" | python -m json.tool | ||
| − | # Set env variable for public compute and | + | # Set env variable for public compute, image and network endpoints: |
export ENDPOINT="{computeURL}" | export ENDPOINT="{computeURL}" | ||
export IMG_ENDPOINT="{imageURL}" | export IMG_ENDPOINT="{imageURL}" | ||
| + | export NET_ENDPOINT="{networkURL}" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| 66. rindiņa: | 67. rindiņa: | ||
# Choose an image from the list and note its id. | # Choose an image from the list and note its id. | ||
export IMAGE_ID="{imageId}" | export IMAGE_ID="{imageId}" | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | # List available networks: | ||
| + | |||
| + | <syntaxhighlight lang=bash> | ||
| + | ~ curl -s -X GET $NET_ENDPOINT/v2.0/networks \ | ||
| + | -H "X-Auth-Token: $OS_TOKEN" | python -m json.tool | ||
| + | |||
| + | # Choose an network from the list and note its id. | ||
| + | export NET_ID="{networkId}" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Versija, kas saglabāta 2017. gada 5. jūnijs, plkst. 10.46
Once you have these pieces of information, you can pass them into the SDK by replacing {username}, {password} and {projectID} with your info:
- {username}, {password} below are placeholders, do not enclose '{}' when you replace them with actual credentials.
~ curl -i \
-H "Content-Type: application/json" \
-d '
{ "auth": {
"identity": {
"methods": [
"password"
],
"password": {
"user": {
"name": "{username}",
"domain": {
"id": "default"
},
"password": "{password}"
}
}
},
"scope": {
"project": {
"id": "{projectID}"
}
}
}
}' \
https://identity.api.cloud.hostnet.lv/v3/auth/tokens
# From the resulting, set environment variable as X-Subject-Token value:
export OS_TOKEN="{X-Subject-Token}"
- Get service endpoints:
curl -s -X GET https://identity.api.cloud.hostnet.lv/v3/auth/catalog \
-H "X-Auth-Token: $OS_TOKEN" | python -m json.tool
# Set env variable for public compute, image and network endpoints:
export ENDPOINT="{computeURL}"
export IMG_ENDPOINT="{imageURL}"
export NET_ENDPOINT="{networkURL}"
- List available flavors:
~ curl -s -X GET $ENDPOINT/flavors \
-H "X-Auth-Token: $OS_TOKEN" | python -m json.tool
# Choose a flavor from the list and note its id.
export FLAVOR_ID="{flavorId}"
!!!Full list of flavors!!!
- List available images:
~ curl -s -X GET $IMG_ENDPOINT/v2/images \
-H "X-Auth-Token: $OS_TOKEN" | python -m json.tool
# Choose an image from the list and note its id.
export IMAGE_ID="{imageId}"
- List available networks:
~ curl -s -X GET $NET_ENDPOINT/v2.0/networks \
-H "X-Auth-Token: $OS_TOKEN" | python -m json.tool
# Choose an network from the list and note its id.
export NET_ID="{networkId}"