我正在尝试使用REST消息在Google Compute Engine上创建实例。
我使用与标准控制台页面上的REST链接完全相同的休息消息。
POST <post url>
{
"name": "instance-1",
"zone": "projects/service-now-16699/zones/us-east1-c",
"machineType": "projects/service-now-16699/zones/us-east1-c/machineTypes/n1-standard-1",
"metadata": {
"items": []
},
"tags": {
"items": [
"http-server",
"https-server"
]
},
"disks": [
{
"type": "PERSISTENT",
"boot": true,
"mode": "READ_WRITE",
"autoDelete": true,
"deviceName": "instance-1",
"initializeParams": {
"sourceImage": "<image-url>",
"diskType": "projects/service-now-16699/zones/us-east1-c/diskTypes/pd-ssd",
"diskSizeGb": "10"
}
}
],
"canIpForward": false,
"networkInterfaces": [
{
"network": "projects/service-now-16699/global/networks/default",
"accessConfigs": [
{
"name": "External NAT",
"type": "ONE_TO_ONE_NAT"
}
]
}
],
"description": "",
"scheduling": {
"preemptible": false,
"onHostMaintenance": "MIGRATE",
"automaticRestart": true
},
"serviceAccounts": [
{
"email": "service-now-16699@appspot.gserviceaccount.com",
"scopes": [
"https://www.googleapis.com/auth/cloud-platform"
]
}
]
}
然而,当我执行时,我收到以下错误:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Required field 'resource.name' not specified"
}
],
"code": 400,
"message": "Required field 'resource.name' not specified"
}
}
我找不到任何对'resource.name&#39;的提及。
有什么建议吗?
谢谢,
SAURABH