private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeCertificatesResponse 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("Certificates/Certificate", targetDepth)) { var unmarshaller = CertificateUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.Certificates.Add(item); continue; } if (context.TestExpression("Marker", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Marker = unmarshaller.Unmarshall(context); 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) { DescribeCertificatesResponse response = new DescribeCertificatesResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("DescribeCertificatesResult", 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) { DescribeCertificatesResponse response = new DescribeCertificatesResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("Certificates", targetDepth)) { var unmarshaller = new ListUnmarshaller <Certificate, CertificateUnmarshaller>(CertificateUnmarshaller.Instance); response.Certificates = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Marker", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Marker = unmarshaller.Unmarshall(context); continue; } } return(response); }
public static DescribeCertificatesResponse Unmarshall(UnmarshallerContext _ctx) { DescribeCertificatesResponse describeCertificatesResponse = new DescribeCertificatesResponse(); describeCertificatesResponse.HttpResponse = _ctx.HttpResponse; describeCertificatesResponse.RequestId = _ctx.StringValue("DescribeCertificates.RequestId"); List <DescribeCertificatesResponse.DescribeCertificates_Certificate> describeCertificatesResponse_certificates = new List <DescribeCertificatesResponse.DescribeCertificates_Certificate>(); for (int i = 0; i < _ctx.Length("DescribeCertificates.Certificates.Length"); i++) { DescribeCertificatesResponse.DescribeCertificates_Certificate certificate = new DescribeCertificatesResponse.DescribeCertificates_Certificate(); certificate.CommonName = _ctx.StringValue("DescribeCertificates.Certificates[" + i + "].CommonName"); certificate.IsUsing = _ctx.BooleanValue("DescribeCertificates.Certificates[" + i + "].IsUsing"); certificate.CertificateName = _ctx.StringValue("DescribeCertificates.Certificates[" + i + "].CertificateName"); certificate.CertificateId = _ctx.LongValue("DescribeCertificates.Certificates[" + i + "].CertificateId"); List <string> certificate_sans = new List <string>(); for (int j = 0; j < _ctx.Length("DescribeCertificates.Certificates[" + i + "].Sans.Length"); j++) { certificate_sans.Add(_ctx.StringValue("DescribeCertificates.Certificates[" + i + "].Sans[" + j + "]")); } certificate.Sans = certificate_sans; describeCertificatesResponse_certificates.Add(certificate); } describeCertificatesResponse.Certificates = describeCertificatesResponse_certificates; return(describeCertificatesResponse); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonDatabaseMigrationServiceConfig config = new AmazonDatabaseMigrationServiceConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonDatabaseMigrationServiceClient client = new AmazonDatabaseMigrationServiceClient(creds, config); DescribeCertificatesResponse resp = new DescribeCertificatesResponse(); do { DescribeCertificatesRequest req = new DescribeCertificatesRequest { Marker = resp.Marker , MaxRecords = maxItems }; resp = client.DescribeCertificates(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Certificates) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.Marker)); }