Create (POST) a VirtualNetworkAdapter [SPFSDK][VMMREF]
Applies To: Windows Azure Pack
Creates an VirtualNetworkAdapter entity by using the HTTP POST operation.
Here is a list of examples related to this collection operation.
- Example: Create a new virtual network adapter
Request
For more information about the placeholders used in the URI, see URL placeholders.
Method |
Request URI |
HTTP Version |
---|---|---|
POST |
https://{server}:{auth-port}/{subscription-id}/services/systemcenter/vmm/VirtualNetworkAdapters |
HTTP/1.1 |
Request URI Parameters
This operation does not have any request URI parameters.
Request Headers
This operation does not use any non-standard request headers.
For more information about the common request headers used by this operation, see Common HTTP request information.
Request Body
The request body should contain a single (depending on the request headers) XML or JSON encoded VirtualNetworkAdapter [SPFSDK][VMMREF] entity that you want to create. Here is the request body of a single entity.
For more information about how to get started with using the code examples provided in this programming guide, see.
{
"odata.type":"VMM.VirtualNetworkAdapter",
"Accessibility":null,
"AddedTime":null,
"ChildObjectIDs@odata.type":"Collection(Edm.Guid)",
"ChildObjectIDs":[
],
"Description":null,
"Enabled":null,
"EnableMACAddressSpoofing":null,
"EthernetAddress":null,
"EthernetAddressType":null,
"ID":"00000000-0000-0000-0000-000000000000",
"IPv4Addresses@odata.type":"Collection(Edm.String)",
"IPv4Addresses":[
],
"IPv4AddressType":null,
"IPv6Addresses@odata.type":"Collection(Edm.String)",
"IPv6Addresses":[
],
"IPv6AddressType":null,
"IsSynthetic":null,
"Location":null,
"MACAddress":null,
"MACAddressesSpoofingEnabled":null,
"MACAddressesSpoolingEnabled":null,
"MACAddressSpoofingEnabled":null,
"MACAddressType":null,
"ModifiedTime":null,
"Name":null,
"ParentId":null,
"PhysicalAddress":null,
"PhysicalAddressType":null,
"RequiredBandwidth":null,
"SlotId":null,
"StampId":"56ebc6dc-f63c-46e2-8438-2967e0ad83bc",
"Tag":null,
"TemplateId":null,
"VirtualNetworkAdapterType":null,
"VLanEnabled":null,
"VLanId":null,
"VMId":"ee9fb3ed-c2f1-4ed5-9597-0a30c69d17f8",
"VMNetworkId":null,
"VMNetworkName":null,
"VMNetworkOptimizationEnabled":null,
"VMSubnetId":null,
"VmwAdapterIndex":null,
"VMwarePortGroup":null
}
Response
Response Codes
This operation does not return any non-standard OData response codes. If successful, it will return code 201 Created.
Response Headers
This operation does not use any non-standard response headers.
For more information about the common response headers used by this operation, see Common HTTP response information
Response Body
The response body will contain a single (depending on the request headers) XML or JSON encoded VirtualNetworkAdapter [SPFSDK][VMMREF] entity as it exists on the server.
{
"odata.metadata":"https://contoso.com:30005/86e93b7f-25e3-4c44-8ca1-3ebdbd2dfc06/services/systemcenter/vmm/$metadata#VirtualNetworkAdapters/@Element",
"ID":"3f0a0b57-1e3a-4700-8ddd-e6bf60771ed4",
"Name":"Tenent Test Virtual Machine 1",
"VMwarePortGroup":null,
"EthernetAddressType":"Dynamic",
"PhysicalAddressType":"Dynamic",
"EthernetAddress":null,
"PhysicalAddress":null,
"VirtualNetworkAdapterType":"Emulated",
"Location":null,
"Tag":null,
"Description":"",
"VMNetworkId":null,
"VMNetworkName":null,
"VMSubnetId":null,
"TemplateId":null,
"VMId":null,
"StampId":"56ebc6dc-f63c-46e2-8438-2967e0ad83bc",
"MACAddressesSpoofingEnabled":false,
"SlotId":0,
"VLanEnabled":false,
"VLanId":0,
"VMNetworkOptimizationEnabled":false,
"VmwAdapterIndex":null,
"Accessibility":"Public",
"AddedTime":"2014-05-12T15:38:18.5867007-07:00",
"ChildObjectIDs":[
],
"Enabled":true,
"IPv4AddressType":"Dynamic",
"IPv6AddressType":"Dynamic",
"IPv4Addresses":[
],
"IPv6Addresses":[
],
"MACAddress":null,
"MACAddressesSpoolingEnabled":null,
"MACAddressSpoofingEnabled":false,
"EnableMACAddressSpoofing":null,
"MACAddressType":"Dynamic",
"ModifiedTime":"2014-05-12T15:38:18.5867007-07:00",
"ParentId":null,
"RequiredBandwidth":"0",
"IsSynthetic":null
}
Example: Create a new virtual network adapter
This example creates a new virtual network adapter on an existing virtual machine.
For more information about how to get started with using the code examples provided in this programming guide, see Programming in Visual Studio with Service Provider Foundation Services.
Guid stampId = new Guid("56ebc6dc-f63c-46e2-8438-2967e0ad83bc");
Guid virtualMachineId = new Guid("ee9fb3ed-c2f1-4ed5-9597-0a30c69d17f8");
SpfVMM.VirtualNetworkAdapter adapter = new SpfVMM.VirtualNetworkAdapter();
adapter.StampId = stampId;
adapter.VMId = virtualMachineId;
vmmService.AddToVirtualNetworkAdapters(adapter);
vmmService.SaveChanges();
HTTP Request
POST https://contoso.com:30005/86e93b7f-25e3-4c44-8ca1-3ebdbd2dfc06/services/systemcenter/vmm/VirtualNetworkAdapters HTTP/1.1
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
DataServiceUrlConventions: KeyAsSegment
User-Agent: Microsoft ADO.NET Data Services
Authorization: Bearer {ENCODED AUTHENTICATION TOKEN}
x-ms-principal-id: tenant@fabrikam.com
Host: contoso.com:30005
Content-Length: 1144
Expect: 100-continue
Connection: Keep-Alive
{"odata.type":"VMM.VirtualNetworkAdapter","Accessibility":null,"AddedTime":null,"ChildObjectIDs@odata.type":"Collection(Edm.Guid)","ChildObjectIDs":[],"Description":null,"Enabled":null,"EnableMACAddressSpoofing":null,"EthernetAddress":null,"EthernetAddressType":null,"ID":"00000000-0000-0000-0000-000000000000","IPv4Addresses@odata.type":"Collection(Edm.String)","IPv4Addresses":[],"IPv4AddressType":null,"IPv6Addresses@odata.type":"Collection(Edm.String)","IPv6Addresses":[],"IPv6AddressType":null,"IsSynthetic":null,"Location":null,"MACAddress":null,"MACAddressesSpoofingEnabled":null,"MACAddressesSpoolingEnabled":null,"MACAddressSpoofingEnabled":null,"MACAddressType":null,"ModifiedTime":null,"Name":null,"ParentId":null,"PhysicalAddress":null,"PhysicalAddressType":null,"RequiredBandwidth":null,"SlotId":null,"StampId":"56ebc6dc-f63c-46e2-8438-2967e0ad83bc","Tag":null,"TemplateId":null,"VirtualNetworkAdapterType":null,"VLanEnabled":null,"VLanId":null,"VMId":"ee9fb3ed-c2f1-4ed5-9597-0a30c69d17f8","VMNetworkId":null,"VMNetworkName":null,"VMNetworkOptimizationEnabled":null,"VMSubnetId":null,"VmwAdapterIndex":null,"VMwarePortGroup":null}
HTTP Response
HTTP/1.1 201 Created
Cache-Control: no-cache
Content-Length: 1189
Content-Type: application/json; odata=minimalmetadata; streaming=true; charset=utf-8
Location: https://contoso.com:30005/86e93b7f-25e3-4c44-8ca1-3ebdbd2dfc06/services/systemcenter/vmm/VirtualNetworkAdapters(ID=guid'3f0a0b57-1e3a-4700-8ddd-e6bf60771ed4',StampId=guid'56ebc6dc-f63c-46e2-8438-2967e0ad83bc')
Server: Microsoft-IIS/8.5
x-ms-request-id: cafed8fe-9a11-49c7-bfc5-843f5c24dcf8
X-Content-Type-Options: nosniff
request-id: 5fbd8ef2-63e6-0000-eb3a-bf5fe663cf01
DataServiceVersion: 3.0;
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By: ASP.NET
Date: Mon, 12 May 2014 22:38:20 GMT
{"odata.metadata":"https://contoso.com:30005/86e93b7f-25e3-4c44-8ca1-3ebdbd2dfc06/services/systemcenter/vmm/$metadata#VirtualNetworkAdapters/@Element","ID":"3f0a0b57-1e3a-4700-8ddd-e6bf60771ed4","Name":"Tenent Test Virtual Machine 1","VMwarePortGroup":null,"EthernetAddressType":"Dynamic","PhysicalAddressType":"Dynamic","EthernetAddress":null,"PhysicalAddress":null,"VirtualNetworkAdapterType":"Emulated","Location":null,"Tag":null,"Description":"","VMNetworkId":null,"VMNetworkName":null,"VMSubnetId":null,"TemplateId":null,"VMId":null,"StampId":"56ebc6dc-f63c-46e2-8438-2967e0ad83bc","MACAddressesSpoofingEnabled":false,"SlotId":0,"VLanEnabled":false,"VLanId":0,"VMNetworkOptimizationEnabled":false,"VmwAdapterIndex":null,"Accessibility":"Public","AddedTime":"2014-05-12T15:38:18.5867007-07:00","ChildObjectIDs":[],"Enabled":true,"IPv4AddressType":"Dynamic","IPv6AddressType":"Dynamic","IPv4Addresses":[],"IPv6Addresses":[],"MACAddress":null,"MACAddressesSpoolingEnabled":null,"MACAddressSpoofingEnabled":false,"EnableMACAddressSpoofing":null,"MACAddressType":"Dynamic","ModifiedTime":"2014-05-12T15:38:18.5867007-07:00","ParentId":null,"RequiredBandwidth":"0","IsSynthetic":null}
See Also
VirtualNetworkAdapters Collection [SPFSDK][VMMREF]
VirtualNetworkAdapter [SPFSDK][VMMREF]
Read (GET) a VirtualNetworkAdapter [SPFSDK][VMMREF]
Update (PUT) a VirtualNetworkAdapter [SPFSDK][VMMREF]
Delete (DELETE) a VirtualNetworkAdapter [SPFSDK][VMMREF]