private static void UnmarshallResult(XmlUnmarshallerContext context, ListSAMLProvidersResponse 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("SAMLProviderList/member", targetDepth)) { response.SAMLProviderList.Add(SAMLProviderListEntryUnmarshaller.GetInstance().Unmarshall(context)); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }
private static void UnmarshallResult(XmlUnmarshallerContext context, ListSAMLProvidersResponse 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("SAMLProviderList/member", targetDepth)) { var unmarshaller = SAMLProviderListEntryUnmarshaller.Instance; var item = unmarshaller.Unmarshall(context); response.SAMLProviderList.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) { ListSAMLProvidersResponse response = new ListSAMLProvidersResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.IsStartElement) { if (context.TestExpression("ListSAMLProvidersResult", 2)) { UnmarshallResult(context, response); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context); } } } return(response); }
private static void ListSamlProviders() { if (String.IsNullOrEmpty(Token)) { stsClient = new AmazonIdentityManagementServiceClient(AccessKeyId, SecretKey, iamconfig); } else { stsClient = new AmazonIdentityManagementServiceClient(AccessKeyId, SecretKey, Token, iamconfig); } ListSAMLProvidersRequest req = new ListSAMLProvidersRequest(); try { ListSAMLProvidersResponse response = stsClient.ListSAMLProviders(req); foreach (SAMLProviderListEntry entry in response.SAMLProviderList) { Console.WriteLine("ARN: {0}, Valid Until: {1}, Create Date: {2}", entry.Arn, entry.ValidUntil, entry.CreateDate); } Console.WriteLine(); } catch (Exception ex) { Console.WriteLine("Error occured while creating user. " + ex.ToString()); } }
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); ListSAMLProvidersResponse resp = new ListSAMLProvidersResponse(); ListSAMLProvidersRequest req = new ListSAMLProvidersRequest { }; resp = client.ListSAMLProviders(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.SAMLProviderList) { AddObject(obj); } }