public string GetCallerIdentity()
        {
            if (_answer != null)
            {
                return(_answer);
            }

            if (Run)
            {
                var client = new Amazon.SecurityToken.AmazonSecurityTokenServiceClient();
                var task   = client.GetCallerIdentityAsync(new Amazon.SecurityToken.Model.GetCallerIdentityRequest());
                if (task.IsFaulted)
                {
                    Error(task.Exception.Flatten().Message);
                    Error("You must have assumed a role first.");
                    Run = false;
                    return(string.Empty);
                }
                else
                {
                    _answer = _serializer(task.Result);
                    return(_answer);
                }
            }
            else
            {
                Error("Unable to run stsgetcalleridentity.  Missing context and/or serializer.");
                return(string.Empty);
            }
        }
Exemplo n.º 2
0
        public string GetCallerIdentity()
        {
            if (_answer != null)
            {
                return(_answer);
            }

            if (Run)
            {
                var client = new Amazon.SecurityToken.AmazonSecurityTokenServiceClient();
                var task   = client.GetCallerIdentityAsync(new Amazon.SecurityToken.Model.GetCallerIdentityRequest());
                _answer = _serializer(task.Result);
                return(_answer);
            }
            else
            {
                Error("Unable to get caller identity.  Missing context and/or serializer.");
                return(string.Empty);
            }
        }