Atšķirības starp "Hostnet OpenStack Cloud Compute API" versijām

No ''Hostnet Wiki''
Pārlēkt uz: navigācija, meklēt
1. rindiņa: 1. rindiņa:
Once you have these pieces of information, you can pass them into the SDK by replacing {username}, {password}, {domain} and {projectID} with your info:
+
Once you have these pieces of information, you can pass them into the SDK by replacing {username}, {password} and {projectID} with your info:
  
# {username}, {apiKey} below are placeholders, do not enclose '{}' when you replace them with actual credentials.
+
# {username}, {password} below are placeholders, do not enclose '{}' when you replace them with actual credentials.
  
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
16. rindiņa: 16. rindiņa:
 
           "name": "{username}",
 
           "name": "{username}",
 
           "domain": {
 
           "domain": {
             "id": "{domain}"
+
             "id": "default"
 
           },
 
           },
 
           "password": "{password}"
 
           "password": "{password}"
30. rindiņa: 30. rindiņa:
 
}' \
 
}' \
 
   https://identity.api.cloud.hostnet.lv/v3/auth/tokens
 
   https://identity.api.cloud.hostnet.lv/v3/auth/tokens
</syntaxhighlight>
 
  
 
# From the resulting, set environment variable as X-Subject-Token value:
 
# From the resulting, set environment variable as X-Subject-Token value:
 
+
export OS_TOKEN="{X-Subject-Token}"
  export OS_TOKEN="{X-Subject-Token}"
+
</syntaxhighlight>
  
 
# Get service endpoints:
 
# Get service endpoints:
40. rindiņa: 39. rindiņa:
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
 
curl -s -X GET https://identity.api.cloud.hostnet.lv/v3/endpoints \                         
 
curl -s -X GET https://identity.api.cloud.hostnet.lv/v3/endpoints \                         
-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 image URL:
 +
export ENDPOINT="{computeURL}"
 +
export IMG_ENDPOINT="{imageURL}"
 
</syntaxhighlight>
 
</syntaxhighlight>
 
# Set env variable for public compute URL:
 
 
  export ENDPOINT="{computeURL}"
 
  
 
# List available flavors:
 
# List available flavors:
  
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
curl -s -X GET $ENDPOINT/flavors \
+
~ curl -s -X GET $ENDPOINT/flavors \
-H "X-Auth-Token: $OS_TOKEN" | python -m json.tool
+
  -H "X-Auth-Token: $OS_TOKEN" | python -m json.tool
 +
 
 +
# Choose a flavor from the list and note its id.
 +
export FLAVOR_ID="{flavorId}"
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
!!!Full list of flavors!!!
 
!!!Full list of flavors!!!
 +
 +
# List available images:
 +
 +
<syntaxhighlight lang=bash>
 +
~ 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}"
 +
</syntaxhighlight>

Versija, kas saglabāta 2017. gada 5. jūnijs, plkst. 10.40

Once you have these pieces of information, you can pass them into the SDK by replacing {username}, {password} and {projectID} with your info:

  1. {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}"
  1. Get service endpoints:
curl -s -X GET https://identity.api.cloud.hostnet.lv/v3/endpoints \                        
  -H "X-Auth-Token: $OS_TOKEN" | python -m json.tool

# Set env variable for public compute and image URL:
export ENDPOINT="{computeURL}"
export IMG_ENDPOINT="{imageURL}"
  1. 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!!!

  1. 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}"