Exemplo n.º 1
0
        public async Task <IActionResult> SetS3BucketName(AwsViewModel model)
        {
            await _settingsHelper.Write(Settings.S3BucketName, model.SetS3BucketViewModel.BucketName);

            StatusMessage = $"Successful set bucket name to {model.SetS3BucketViewModel.BucketName}";
            return(RedirectToAction(nameof(AwsSettings)));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> SetAwsActiveProfile(AwsViewModel model)
        {
            var profileName = model.ActiveProfileViewModel.ActiveProfileName;
            await _settingsHelper.Write(Settings.AwsActiveProfile, profileName);

            StatusMessage = $"Successful set '{profileName}' as active profile";
            return(RedirectToAction(nameof(AwsSettings)));
        }
Exemplo n.º 3
0
        public IActionResult AddAwsProfile(AwsViewModel model)
        {
            if (!ModelState.IsValid)
            {
                StatusMessage = "Invalid input";
                return(RedirectToAction(nameof(AwsSettings)));
            }

            var options = new CredentialProfileOptions
            {
                AccessKey = model.AddProfileViewModel.AccessKey,
                SecretKey = model.AddProfileViewModel.SecretKey
            };
            var profile = new CredentialProfile(model.AddProfileViewModel.ProfileName, options)
            {
                Region = RegionEndpoint.GetBySystemName(model.AddProfileViewModel.Region)
            };
            var sharedCredentialsFile = new SharedCredentialsFile();

            sharedCredentialsFile.RegisterProfile(profile);

            StatusMessage = $"Successful added profile '{model.AddProfileViewModel.ProfileName}'";
            return(RedirectToAction(nameof(AwsSettings)));
        }