關於這項作業
若要從 API 供應環境,請使用以下 REST PUT 指令:供應藍圖。
對要求使用下列 URL 字串:
http://hostname:port/landscaper/rest/blueprint/{blueprintId}/deploy
將藍圖設計器的主機名稱及埠用於
hostname 和
port,並將藍圖的名稱用於
{blueprintId}。
隨 PUT 要求包括下列標頭:
| 標頭 |
範例 |
說明 |
| UCR_SESSION_KEY |
347e9240-dcc9-424e-af31-3614df52b245 |
藉由利用使用者名稱和密碼執行簡式指令所擷取的階段作業金鑰 |
| Accept |
application/json |
指定 application/json 作為指令傳回的資訊類型 |
| Content-Type |
application/json |
指定 application/json 作為傳送給指令的資訊類型 |
| Location |
/landscaper/orion/file/jsmith_002-OrionContent/default/my_blueprint/my_blueprint.yml |
藍圖在藍圖設計伺服器上的位置 |
| X-Region-Name |
MyCloudRegion |
(選用)環境的區域 |
傳遞類似於下列範例的 JSON 文件作為要求內文。此範例對伺服器使用鑑別記號而非使用者名稱及密碼。
{
"environmentName": "myNewEnvironment1",
"configuration": "myConfigFile",
"cloudProjectId":"3d16879f-7b43-4909-9862-12767dad7f04",
"configurationLocation":"/landscaper/orion/file/jsmith_00000000_2-OrionContent/default/configurations/myConfigFile.yml",
"parameters": {
"availability_zone" : "nova",
"flavor" : "m1.tiny",
"key_name" : "myKey",
"ucd_password":"cc99a431-d96c-4154-99d6-1a5532275015",
"ucd_relay_url":"None",
"ucd_server_url":"http://ucd.example.com:9080",
"ucd_user":"PasswordIsAuthToken"
},
"teamMappings":[],
"validate": "true"
}
此 JSON 文件包含下列資訊:
| JSON 內容 |
範例 |
說明 |
| cloudProjectId |
3d16879f-7b43-4909-9862-12767dad7f04 |
雲端專案的 ID;若要取得此 ID,您可以使用 列出雲端專案 指令 |
|
| configuration |
myConfigFile |
(選用)要使用的配置檔的名稱 |
|
| configurationLocation |
/landscaper/orion/file/jsmith_00000000_2-OrionContent/default/configurations/myConfigFile.yml |
伺服器上配置檔的位置 |
|
| environmentName |
myNewEnvironment1 |
新環境的名稱 |
|
| parameters |
{ "availability_zone" : "nova", "flavor" : "m1.tiny", "key_name" :
"myKey", "ucd_password":"cc99a431-d96c-4154-99d6-1a5532275015",
"ucd_relay_url":"None", "ucd_server_url":"http://ucd.example.com:9080",
"ucd_user":"PasswordIsAuthToken" } |
要傳遞給供應處理程序之參數的 JSON 陣列,其中包括您從設計器伺服器使用者介面供應環境時指定的參數。若要取得必要參數的清單,請使用 列出供應藍圖所需的參數 或 列出使用配置檔供應藍圖所需的參數 指令。 |
| teamMappings |
|
要向其新增環境之團隊的陣列 |
| validate |
true |
是否在執行要求之前驗證要求 |
範例
如果您使用 Linux 程式
curl,則指令可能類似於下列範例。此指令必須在單一行上撰寫。
curl -k -u jsmith:passwd
"http://myserver.example.com:8080/landscaper/rest/blueprint/myBlueprint/deploy"
-X PUT
-H "Accept: application/json"
-H "Content-Type: application/json"
-H "UCR_SESSION_KEY: 347e9240-dcc9-424e-af31-3614df52b245"
-H "Location:
/landscaper/orion/file/jsmith_002-OrionContent/default/my_blueprint/my_blueprint.yml"
-H "X-Region-Name: MyCloudRegion"
-d @provisionEnvironment.json
此指令範例使用一個名稱為
newEnvironment.json 的 JSON 檔案。