public IRequest Marshall(PollForTaskRequest pollForTaskRequest) { IRequest request = new DefaultRequest(pollForTaskRequest, "AmazonDataPipeline"); string target = "DataPipeline.PollForTask"; 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 (pollForTaskRequest != null && pollForTaskRequest.IsSetWorkerGroup()) { writer.WritePropertyName("workerGroup"); writer.Write(pollForTaskRequest.WorkerGroup); } if (pollForTaskRequest != null && pollForTaskRequest.IsSetHostname()) { writer.WritePropertyName("hostname"); writer.Write(pollForTaskRequest.Hostname); } if (pollForTaskRequest != null) { InstanceIdentity instanceIdentity = pollForTaskRequest.InstanceIdentity; if (instanceIdentity != null) { writer.WritePropertyName("instanceIdentity"); writer.WriteObjectStart(); if (instanceIdentity != null && instanceIdentity.IsSetDocument()) { writer.WritePropertyName("document"); writer.Write(instanceIdentity.Document); } if (instanceIdentity != null && instanceIdentity.IsSetSignature()) { writer.WritePropertyName("signature"); writer.Write(instanceIdentity.Signature); } writer.WriteObjectEnd(); } } writer.WriteObjectEnd(); string snippet = stringWriter.ToString(); request.Content = System.Text.Encoding.UTF8.GetBytes(snippet); } return(request); }
public IRequest Marshall(PollForTaskRequest pollForTaskRequest) { IRequest request = new DefaultRequest(pollForTaskRequest, "AmazonDataPipeline"); string target = "DataPipeline.PollForTask"; request.Headers["X-Amz-Target"] = target; request.Headers["Content-Type"] = "application/x-amz-json-1.1"; string uriResourcePath = ""; if (uriResourcePath.Contains("?")) { int queryPosition = uriResourcePath.IndexOf("?", StringComparison.OrdinalIgnoreCase); string queryString = uriResourcePath.Substring(queryPosition + 1); uriResourcePath = uriResourcePath.Substring(0, queryPosition); 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(System.Globalization.CultureInfo.InvariantCulture)) { JsonWriter writer = new JsonWriter(stringWriter); writer.WriteObjectStart(); if (pollForTaskRequest != null && pollForTaskRequest.IsSetWorkerGroup()) { writer.WritePropertyName("workerGroup"); writer.Write(pollForTaskRequest.WorkerGroup); } if (pollForTaskRequest != null && pollForTaskRequest.IsSetHostname()) { writer.WritePropertyName("hostname"); writer.Write(pollForTaskRequest.Hostname); } if (pollForTaskRequest != null) { InstanceIdentity instanceIdentity = pollForTaskRequest.InstanceIdentity; if (instanceIdentity != null) { writer.WritePropertyName("instanceIdentity"); writer.WriteObjectStart(); if (instanceIdentity != null && instanceIdentity.IsSetDocument()) { writer.WritePropertyName("document"); writer.Write(instanceIdentity.Document); } if (instanceIdentity != null && instanceIdentity.IsSetSignature()) { writer.WritePropertyName("signature"); writer.Write(instanceIdentity.Signature); } writer.WriteObjectEnd(); } } writer.WriteObjectEnd(); string snippet = stringWriter.ToString(); request.Content = System.Text.Encoding.UTF8.GetBytes(snippet); } return(request); }