public async Task <IActionResult> Get(string key, string secret)
        {
            if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(secret))
            {
                return(BadRequest("Bad Request"));
            }
            var user = new AwsUser
            {
                AccessKeySecret = key,
                AccesskeyId     = secret
            };

            var instances = await _service.ListInstances(user);

            return(Ok(instances));
        }
        public async Task <IActionResult> StopInstance(string key, string secret, string instanceId)
        {
            if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(secret) || string.IsNullOrEmpty(instanceId))
            {
                return(BadRequest("Bad Request"));
            }
            var user = new AwsUser
            {
                AccessKeySecret = secret,
                AccesskeyId     = key
            };

            var instanceExits = await _service.ListInstances(user);

            if (instanceExits.All(x => x.InstanceId != instanceId))
            {
                return(BadRequest("Bad Request"));
            }

            var instanceStatus = await _service.StopInstance(user, instanceId);

            return(Ok("stopping instance"));
        }
 public static bool IsAdmin(this AwsUser user)
 {
     return(user.SignInUserSession.IdToken.Payload.Groups.Contains("Admin"));
 }