public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonIdentityManagementServiceConfig config = new AmazonIdentityManagementServiceConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonIdentityManagementServiceClient client = new AmazonIdentityManagementServiceClient(creds, config); ListSigningCertificatesResponse resp = new ListSigningCertificatesResponse(); do { ListSigningCertificatesRequest req = new ListSigningCertificatesRequest { Marker = resp.Marker , MaxItems = maxItems }; resp = client.ListSigningCertificates(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Certificates) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.Marker)); }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { ListSigningCertificatesResponse response = new ListSigningCertificatesResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("ListSigningCertificatesResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
public static void DeleteCertificatesForUser(AmazonIdentityManagementServiceClient client, string username) { ListSigningCertificatesResponse response = client.ListSigningCertificatesAsync(new ListSigningCertificatesRequest() { UserName = username }).Result; foreach (SigningCertificate cert in response.Certificates) { client.DeleteSigningCertificateAsync(new DeleteSigningCertificateRequest() { UserName = username, CertificateId = cert.CertificateId }).Wait(); } }
private static void UnmarshallResult(XmlUnmarshallerContext context, ListSigningCertificatesResponse 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("Certificates/member", targetDepth)) { response.Certificates.Add(SigningCertificateUnmarshaller.GetInstance().Unmarshall(context)); continue; } if (context.TestExpression("IsTruncated", targetDepth)) { response.IsTruncated = BoolUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("Marker", targetDepth)) { response.Marker = StringUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }
private static void UnmarshallResult(XmlUnmarshallerContext context, ListSigningCertificatesResponse 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/member", targetDepth)) { var unmarshaller = SigningCertificateUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.Certificates.Add(item); continue; } if (context.TestExpression("IsTruncated", targetDepth)) { var unmarshaller = BoolUnmarshaller.Instance; response.IsTruncated = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Marker", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Marker = unmarshaller.Unmarshall(context); continue; } } } return; }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { ListSigningCertificatesResponse response = new ListSigningCertificatesResponse(); while (context.Read()) { if (context.IsStartElement) { if (context.TestExpression("ListSigningCertificatesResult", 2)) { response.ListSigningCertificatesResult = ListSigningCertificatesResultUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context); } } } return(response); }