Atšķirības starp "Hostnet OpenStack Cloud Network API" versijām
No ''Hostnet Wiki''
(Jauna lapa: Example with using curl. Once you have these pieces of information, you can pass them into the SDK by replacing {username}, {password} and {projectID} with your info: {username}, {p...) |
(Nav atšķirību)
|
Versija, kas saglabāta 2017. gada 6. jūnijs, plkst. 15.11
Example with using curl.
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 network 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
Or take endpoint URL from Hostnet OpenStack Cloud API Endpoints
# Set env variable for public compute, image and network endpoints:
export NET_ENDPOINT="{networkURL}"
Create network:
curl -s $NET_ENDPOINT/v2.0/networks \
-X POST \
-H "X-Auth-Token: $OS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "network": {"name": "MyNewNetwork"}}' | python -m json.tool
Response:
{
"network": {
"admin_state_up": true,
"availability_zone_hints": [],
"availability_zones": [],
"created_at": "2017-06-06T15:10:36Z",
"description": "",
"dns_domain": "",
"id": "90f1f881-a17d-49e6-a948-d9ec16d3f60d",
"ipv4_address_scope": null,
"ipv6_address_scope": null,
"mtu": 1450,
"name": "MyNewNetwork",
"port_security_enabled": true,
"project_id": "86320c4cde114196a211b49d3ba9c5f3",
"revision_number": 3,
"router:external": false,
"shared": false,
"status": "ACTIVE",
"subnets": [],
"tags": [],
"tenant_id": "86320c4cde114196a211b49d3ba9c5f3",
"updated_at": "2017-06-06T15:10:36Z"
}
}