private static void UnmarshallResult(XmlUnmarshallerContext context, ListDomainNamesResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.ReadAtDepth(originalDepth)) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("DomainNames/entry", targetDepth)) { var unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance); var item = unmarshaller.Unmarshall(context); response.DomainNames.Add(item); continue; } } } return; }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { ListDomainNamesResponse response = new ListDomainNamesResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("ListDomainNamesResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListDomainNamesResponse response = new ListDomainNamesResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("domainNameConfigs", targetDepth)) { var unmarshaller = new ListUnmarshaller <DomainNameConfig, DomainNameConfigUnmarshaller>(DomainNameConfigUnmarshaller.Instance); response.DomainNameConfigs = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("nextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } } return(response); }
public bool IndexExists(string indexName) { var amazonSearchParameters = this.GetAmazonParams(); var region = RegionEndpoint.GetBySystemName(amazonSearchParameters[Region]); using (IAmazonCloudSearch cloudSearchClient = AWSClientFactory.CreateAmazonCloudSearchClient(amazonSearchParameters[AccessKey], amazonSearchParameters[SecretAccessKey], region)) { bool exists = false; try { ListDomainNamesResponse response = cloudSearchClient.ListDomainNames(); exists = response.DomainNames.ContainsKey(indexName); } catch (BaseException ex) { Log.Write(ex.InnerException.Message); } catch (ArgumentNullException ex) { Log.Write(ex.InnerException.Message); } return(exists); } }
private static void UnmarshallResult(XmlUnmarshallerContext context, ListDomainNamesResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("DomainNames/entry", targetDepth)) { KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance()); KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context); response.DomainNames.Add(kvp.Key, kvp.Value); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }