public IRequest Marshall(CreatePrivateVirtualInterfaceRequest createPrivateVirtualInterfaceRequest) { IRequest request = new DefaultRequest(createPrivateVirtualInterfaceRequest, "AmazonDirectConnect"); string target = "OvertureService.CreatePrivateVirtualInterface"; request.Headers["X-Amz-Target"] = target; request.Headers["Content-Type"] = "application/x-amz-json-1.1"; string uriResourcePath = ""; request.ResourcePath = uriResourcePath; using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture)) { JsonWriter writer = new JsonWriter(stringWriter); writer.WriteObjectStart(); if (createPrivateVirtualInterfaceRequest != null && createPrivateVirtualInterfaceRequest.IsSetConnectionId()) { writer.WritePropertyName("connectionId"); writer.Write(createPrivateVirtualInterfaceRequest.ConnectionId); } if (createPrivateVirtualInterfaceRequest != null) { NewPrivateVirtualInterface newPrivateVirtualInterface = createPrivateVirtualInterfaceRequest.NewPrivateVirtualInterface; if (newPrivateVirtualInterface != null) { writer.WritePropertyName("newPrivateVirtualInterface"); writer.WriteObjectStart(); if (newPrivateVirtualInterface != null && newPrivateVirtualInterface.IsSetVirtualInterfaceName()) { writer.WritePropertyName("virtualInterfaceName"); writer.Write(newPrivateVirtualInterface.VirtualInterfaceName); } if (newPrivateVirtualInterface != null && newPrivateVirtualInterface.IsSetVlan()) { writer.WritePropertyName("vlan"); writer.Write(newPrivateVirtualInterface.Vlan); } if (newPrivateVirtualInterface != null && newPrivateVirtualInterface.IsSetAsn()) { writer.WritePropertyName("asn"); writer.Write(newPrivateVirtualInterface.Asn); } if (newPrivateVirtualInterface != null && newPrivateVirtualInterface.IsSetAuthKey()) { writer.WritePropertyName("authKey"); writer.Write(newPrivateVirtualInterface.AuthKey); } if (newPrivateVirtualInterface != null && newPrivateVirtualInterface.IsSetAmazonAddress()) { writer.WritePropertyName("amazonAddress"); writer.Write(newPrivateVirtualInterface.AmazonAddress); } if (newPrivateVirtualInterface != null && newPrivateVirtualInterface.IsSetCustomerAddress()) { writer.WritePropertyName("customerAddress"); writer.Write(newPrivateVirtualInterface.CustomerAddress); } if (newPrivateVirtualInterface != null && newPrivateVirtualInterface.IsSetVirtualGatewayId()) { writer.WritePropertyName("virtualGatewayId"); writer.Write(newPrivateVirtualInterface.VirtualGatewayId); } writer.WriteObjectEnd(); } } writer.WriteObjectEnd(); string snippet = stringWriter.ToString(); request.Content = System.Text.Encoding.UTF8.GetBytes(snippet); } return(request); }
public IRequest Marshall(CreatePrivateVirtualInterfaceRequest createPrivateVirtualInterfaceRequest) { IRequest request = new DefaultRequest(createPrivateVirtualInterfaceRequest, "AmazonDirectConnect"); string target = "OvertureService.CreatePrivateVirtualInterface"; request.Headers["X-Amz-Target"] = target; request.Headers["Content-Type"] = "application/x-amz-json-1.1"; string uriResourcePath = ""; if (uriResourcePath.Contains("?")) { string queryString = uriResourcePath.Substring(uriResourcePath.IndexOf("?") + 1); uriResourcePath = uriResourcePath.Substring(0, uriResourcePath.IndexOf("?")); foreach (string s in queryString.Split('&', ';')) { string[] nameValuePair = s.Split('='); if (nameValuePair.Length == 2 && nameValuePair[1].Length > 0) { request.Parameters.Add(nameValuePair[0], nameValuePair[1]); } else { request.Parameters.Add(nameValuePair[0], null); } } } request.ResourcePath = uriResourcePath; using (StringWriter stringWriter = new StringWriter()) { JsonWriter writer = new JsonWriter(stringWriter); writer.WriteObjectStart(); if (createPrivateVirtualInterfaceRequest != null && createPrivateVirtualInterfaceRequest.IsSetConnectionId()) { writer.WritePropertyName("connectionId"); writer.Write(createPrivateVirtualInterfaceRequest.ConnectionId); } if (createPrivateVirtualInterfaceRequest != null) { NewPrivateVirtualInterface newPrivateVirtualInterface = createPrivateVirtualInterfaceRequest.NewPrivateVirtualInterface; if (newPrivateVirtualInterface != null) { writer.WritePropertyName("newPrivateVirtualInterface"); writer.WriteObjectStart(); if (newPrivateVirtualInterface != null && newPrivateVirtualInterface.IsSetVirtualInterfaceName()) { writer.WritePropertyName("virtualInterfaceName"); writer.Write(newPrivateVirtualInterface.VirtualInterfaceName); } if (newPrivateVirtualInterface != null && newPrivateVirtualInterface.IsSetVlan()) { writer.WritePropertyName("vlan"); writer.Write(newPrivateVirtualInterface.Vlan); } if (newPrivateVirtualInterface != null && newPrivateVirtualInterface.IsSetAsn()) { writer.WritePropertyName("asn"); writer.Write(newPrivateVirtualInterface.Asn); } if (newPrivateVirtualInterface != null && newPrivateVirtualInterface.IsSetAuthKey()) { writer.WritePropertyName("authKey"); writer.Write(newPrivateVirtualInterface.AuthKey); } if (newPrivateVirtualInterface != null && newPrivateVirtualInterface.IsSetAmazonAddress()) { writer.WritePropertyName("amazonAddress"); writer.Write(newPrivateVirtualInterface.AmazonAddress); } if (newPrivateVirtualInterface != null && newPrivateVirtualInterface.IsSetCustomerAddress()) { writer.WritePropertyName("customerAddress"); writer.Write(newPrivateVirtualInterface.CustomerAddress); } if (newPrivateVirtualInterface != null && newPrivateVirtualInterface.IsSetVirtualGatewayId()) { writer.WritePropertyName("virtualGatewayId"); writer.Write(newPrivateVirtualInterface.VirtualGatewayId); } writer.WriteObjectEnd(); } } writer.WriteObjectEnd(); string snippet = stringWriter.ToString(); request.Content = System.Text.Encoding.UTF8.GetBytes(snippet); } return(request); }