Esempio n. 1
0
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            UpdateSAMLProviderResponse response = new UpdateSAMLProviderResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("UpdateSAMLProviderResult", 2))
                    {
                        UnmarshallResult(context, response);
                        continue;
                    }

                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context);
                    }
                }
            }

            return(response);
        }
        private static void UnmarshallResult(XmlUnmarshallerContext context, UpdateSAMLProviderResponse 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("SAMLProviderArn", targetDepth))
                    {
                        response.SAMLProviderArn = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return;
                }
            }



            return;
        }
Esempio n. 3
0
        public UpdateSAMLProviderResponse updateSAMLProvider(string accountId)
        {
            AmazonIdentityManagementServiceClient client = new AmazonIdentityManagementServiceClient();;

            if (accountId != "177654365656")
            {
                var credentials = AssumeIdentity.AssumeRole(accountId).Credentials;

                string accessKey    = credentials.AccessKeyId;
                string secretkey    = credentials.SecretAccessKey;
                string sessionToken = credentials.SessionToken;

                client = new AmazonIdentityManagementServiceClient(accessKey, secretkey, sessionToken);
            }

            UpdateSAMLProviderRequest request = new UpdateSAMLProviderRequest()
            {
                SAMLMetadataDocument = MetadataXML(),
                SAMLProviderArn      = string.Format("arn:aws:iam::{0}:saml-provider/ADFS", accountId)
            };

            UpdateSAMLProviderResponse response = client.UpdateSAMLProviderAsync(request).Result;

            return(response);
        }