public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.CognitoIdentityProvider.Model.ChangePasswordRequest(); if (cmdletContext.AccessToken != null) { request.AccessToken = cmdletContext.AccessToken; } if (cmdletContext.PreviousPassword != null) { request.PreviousPassword = cmdletContext.PreviousPassword; } if (cmdletContext.ProposedPassword != null) { request.ProposedPassword = cmdletContext.ProposedPassword; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }
public virtual async Task ChangePassword(Model.ChangePasswordRequest command, CancellationToken cancellationToken = default) { Check.NotNull(command, nameof(command)); command.EnsureIsValid(); var changeRequest = new Amazon.CognitoIdentityProvider.Model.ChangePasswordRequest() { AccessToken = command.AccessToken, ProposedPassword = command.ProposedPassword, PreviousPassword = command.PreviousPassword }; try { await base.CreateDefaultRetryAsyncPolicy().ExecuteAsync(async() => await CognitoidentityProvider.ChangePasswordAsync(changeRequest, cancellationToken)); } catch (Exception ex) { throw CatchException(ex); } }
private Amazon.CognitoIdentityProvider.Model.ChangePasswordResponse CallAWSServiceOperation(IAmazonCognitoIdentityProvider client, Amazon.CognitoIdentityProvider.Model.ChangePasswordRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Cognito Identity Provider", "ChangePassword"); try { #if DESKTOP return(client.ChangePassword(request)); #elif CORECLR return(client.ChangePasswordAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }