添加云服务器网卡NovaAttachInterface
调试
您可以在API Explorer中调试该接口。
请求消息
响应消息
请求示例
- 为指定云服务器添加一张网卡,Network ID为“3cb9bc59-5699-4588-a4b1-b87f96708bc6”。
POST https://{endpoint}/v2.1/{project_id}/servers/{server_id}/os-interface { "interfaceAttachment" : { "fixed_ips" : [ { "ip_address" : "192.168.1.3" } ], "net_id" : "3cb9bc59-5699-4588-a4b1-b87f96708bc6" } }
- 为指定云服务器添加一张网卡,Port ID为“ce531f90-199f-48c0-816c-13e38010b442”。
POST https://{endpoint}/v2.1/{project_id}/servers/{server_id}/os-interface { "interfaceAttachment" : { "fixed_ips" : [ { "ip_address" : "192.168.1.3" } ], "port_id" : "ce531f90-199f-48c0-816c-13e38010b442" } }
响应示例
{ "interfaceAttachment": { "port_state": "DOWN", "fixed_ips": [ { "subnet_id": "d9cfef77-0151-4c2a-9ed5-d951ada8adf3", "ip_address": "10.0.1.11" } ], "port_id": " ce531f90-199f-48c0-816c-13e38010b442", "net_id": "0dc714fa-9022-4a03-bb22-9821a396bb9d", "mac_addr": "fa:16:3e:63:75:b2" } }
返回值
请参考通用请求返回值。