public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.IdentityManagement.Model.UpdateUserRequest(); if (cmdletContext.NewPath != null) { request.NewPath = cmdletContext.NewPath; } if (cmdletContext.NewUserName != null) { request.NewUserName = cmdletContext.NewUserName; } if (cmdletContext.UserName != null) { request.UserName = cmdletContext.UserName; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _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); }
/// <summary> /// Initiates the asynchronous execution of the UpdateUser operation. /// <seealso cref="Amazon.IdentityManagement.IAmazonIdentityManagementService"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateUser operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<UpdateUserResponse> UpdateUserAsync(UpdateUserRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new UpdateUserRequestMarshaller(); var unmarshaller = UpdateUserResponseUnmarshaller.Instance; return InvokeAsync<UpdateUserRequest,UpdateUserResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal UpdateUserResponse UpdateUser(UpdateUserRequest request) { var marshaller = new UpdateUserRequestMarshaller(); var unmarshaller = UpdateUserResponseUnmarshaller.Instance; return Invoke<UpdateUserRequest,UpdateUserResponse>(request, marshaller, unmarshaller); }
IAsyncResult invokeUpdateUser(UpdateUserRequest updateUserRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new UpdateUserRequestMarshaller().Marshall(updateUserRequest); var unmarshaller = UpdateUserResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// <para>Updates the name and/or the path of the specified user.</para> <para><b>IMPORTANT:</b> You should understand the implications of /// changing a user's path or name. For more information, see Renaming Users and Groups in Using AWS Identity and Access Management. </para> /// <para><b>NOTE:</b>To change a user name the requester must have appropriate permissions on both the source object and the target object. /// For example, to change Bob to Robert, the entity making the request must have permission on Bob and Robert, or must have permission on all /// (*). For more information about permissions, see Permissions and Policies. </para> /// </summary> /// /// <param name="updateUserRequest">Container for the necessary parameters to execute the UpdateUser service method on /// AmazonIdentityManagementService.</param> /// /// <exception cref="EntityTemporarilyUnmodifiableException"/> /// <exception cref="NoSuchEntityException"/> /// <exception cref="EntityAlreadyExistsException"/> public UpdateUserResponse UpdateUser(UpdateUserRequest updateUserRequest) { IAsyncResult asyncResult = invokeUpdateUser(updateUserRequest, null, null, true); return EndUpdateUser(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the UpdateUser operation. /// <seealso cref="Amazon.IdentityManagement.AmazonIdentityManagementService.UpdateUser"/> /// </summary> /// /// <param name="updateUserRequest">Container for the necessary parameters to execute the UpdateUser operation on /// AmazonIdentityManagementService.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> public IAsyncResult BeginUpdateUser(UpdateUserRequest updateUserRequest, AsyncCallback callback, object state) { return invokeUpdateUser(updateUserRequest, callback, state, false); }
/// <summary> /// Initiates the asynchronous execution of the UpdateUser operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateUser operation on AmazonIdentityManagementServiceClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUpdateUser /// operation.</returns> public IAsyncResult BeginUpdateUser(UpdateUserRequest request, AsyncCallback callback, object state) { var marshaller = new UpdateUserRequestMarshaller(); var unmarshaller = UpdateUserResponseUnmarshaller.Instance; return BeginInvoke<UpdateUserRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// <para>Updates the name and/or the path of the specified User.</para> /// <para><b>IMPORTANT:</b> You should understand the implications of /// changing a User's path or name. For more information, see Renaming /// Users and Groups in Using AWS Identity and Access Management. </para> /// <para><b>NOTE:</b>To change a User name the requester must have /// appropriate permissions on both the source object and the target /// object. For example, to change Bob to Robert, the entity making the /// request must have permission on Bob and Robert, or must have /// permission on all (*). For more information about permissions, see /// Permissions and Policies. </para> /// </summary> /// /// <param name="updateUserRequest">Container for the necessary parameters /// to execute the UpdateUser service method on /// AmazonIdentityManagementService.</param> /// /// <exception cref="EntityTemporarilyUnmodifiableException"/> /// <exception cref="NoSuchEntityException"/> /// <exception cref="EntityAlreadyExistsException"/> public UpdateUserResponse UpdateUser(UpdateUserRequest updateUserRequest) { IRequest<UpdateUserRequest> request = new UpdateUserRequestMarshaller().Marshall(updateUserRequest); UpdateUserResponse response = Invoke<UpdateUserRequest, UpdateUserResponse> (request, this.signer, UpdateUserResponseUnmarshaller.GetInstance()); return response; }
/// <summary> /// Initiates the asynchronous execution of the UpdateUser operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateUser operation on AmazonIdentityManagementServiceClient.</param> /// <param name="callback">An Action delegate that is invoked when the operation completes.</param> /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> public void UpdateUserAsync(UpdateUserRequest request, AmazonServiceCallback<UpdateUserRequest, UpdateUserResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new UpdateUserRequestMarshaller(); var unmarshaller = UpdateUserResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<UpdateUserRequest,UpdateUserResponse> responseObject = new AmazonServiceResult<UpdateUserRequest,UpdateUserResponse>((UpdateUserRequest)req, (UpdateUserResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<UpdateUserRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
/// <summary> /// Initiates the asynchronous execution of the UpdateUser operation. /// <seealso cref="Amazon.IdentityManagement.IAmazonIdentityManagementService.UpdateUser"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateUser operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public async Task<UpdateUserResponse> UpdateUserAsync(UpdateUserRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new UpdateUserRequestMarshaller(); var unmarshaller = UpdateUserResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, UpdateUserRequest, UpdateUserResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para>Updates the name and/or the path of the specified user.</para> <para><b>IMPORTANT:</b> You should understand the implications of /// changing a user's path or name. For more information, see Renaming Users and Groups in Using AWS Identity and Access Management. </para> /// <para><b>NOTE:</b>To change a user name the requester must have appropriate permissions on both the source object and the target object. For /// example, to change Bob to Robert, the entity making the request must have permission on Bob and Robert, or must have permission on all (*). /// For more information about permissions, see Permissions and Policies. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateUser service method on /// AmazonIdentityManagementService.</param> /// /// <exception cref="T:Amazon.IdentityManagement.Model.EntityTemporarilyUnmodifiableException" /> /// <exception cref="T:Amazon.IdentityManagement.Model.NoSuchEntityException" /> /// <exception cref="T:Amazon.IdentityManagement.Model.LimitExceededException" /> /// <exception cref="T:Amazon.IdentityManagement.Model.EntityAlreadyExistsException" /> public UpdateUserResponse UpdateUser(UpdateUserRequest request) { var task = UpdateUserAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
private async Task UpdateExternalIdentifier( IResourceIdentifier resourceIdentifier, string correlationIdentifier, string value = null) { if (null == resourceIdentifier) { throw new ArgumentNullException(AmazonWebServicesProvider.ArgumentNameResourceIdentifier); } if (string.IsNullOrWhiteSpace(correlationIdentifier)) { throw new ArgumentNullException(AmazonWebServicesProvider.ArgumentNameCorrelationIdentifier); } if (string.IsNullOrWhiteSpace(resourceIdentifier.Identifier)) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidResourceIdentifier); } if (string.IsNullOrWhiteSpace(resourceIdentifier.SchemaIdentifier)) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidResourceIdentifier); } IAmazonIdentityManagementService proxy = null; try { proxy = AWSClientFactory.CreateAmazonIdentityManagementServiceClient(this.credentials); switch (resourceIdentifier.SchemaIdentifier) { case SchemaIdentifiers.Core2EnterpriseUser: Amazon.IdentityManagement.Model.User user = await this.RetrieveUser(resourceIdentifier.Identifier, proxy); if (null == user) { return; } UpdateUserRequest updateUserRequest = new UpdateUserRequest(user.UserName) { NewUserName = value }; await proxy.UpdateUserAsync(updateUserRequest); break; case SchemaIdentifiers.WindowsAzureActiveDirectoryGroup: Group group = await this.RetrieveGroup(resourceIdentifier.Identifier, proxy); if (null == group) { return; } UpdateGroupRequest updateGroupRequest = new UpdateGroupRequest(group.GroupName) { NewGroupName = group.GroupName }; await proxy.UpdateGroupAsync(updateGroupRequest); break; default: throw new NotSupportedException(resourceIdentifier.SchemaIdentifier); } } finally { if (proxy != null) { proxy.Dispose(); proxy = null; } } }
/// <summary> /// <para>Updates the name and/or the path of the specified user.</para> <para><b>IMPORTANT:</b> You should understand the implications of /// changing a user's path or name. For more information, see Renaming Users and Groups in Using AWS Identity and Access Management. </para> /// <para><b>NOTE:</b>To change a user name the requester must have appropriate permissions on both the source object and the target object. For /// example, to change Bob to Robert, the entity making the request must have permission on Bob and Robert, or must have permission on all (*). /// For more information about permissions, see Permissions and Policies. </para> /// </summary> /// /// <param name="updateUserRequest">Container for the necessary parameters to execute the UpdateUser service method on /// AmazonIdentityManagementService.</param> /// /// <exception cref="T:Amazon.IdentityManagement.Model.EntityTemporarilyUnmodifiableException" /> /// <exception cref="T:Amazon.IdentityManagement.Model.NoSuchEntityException" /> /// <exception cref="T:Amazon.IdentityManagement.Model.LimitExceededException" /> /// <exception cref="T:Amazon.IdentityManagement.Model.EntityAlreadyExistsException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<UpdateUserResponse> UpdateUserAsync(UpdateUserRequest updateUserRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new UpdateUserRequestMarshaller(); var unmarshaller = UpdateUserResponseUnmarshaller.GetInstance(); return Invoke<IRequest, UpdateUserRequest, UpdateUserResponse>(updateUserRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal UpdateUserResponse UpdateUser(UpdateUserRequest request) { var task = UpdateUserAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
private Amazon.IdentityManagement.Model.UpdateUserResponse CallAWSServiceOperation(IAmazonIdentityManagementService client, Amazon.IdentityManagement.Model.UpdateUserRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Identity and Access Management", "UpdateUser"); try { #if DESKTOP return(client.UpdateUser(request)); #elif CORECLR return(client.UpdateUserAsync(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; } }
IAsyncResult invokeUpdateUser(UpdateUserRequest request, AsyncCallback callback, object state, bool synchronized) { var marshaller = new UpdateUserRequestMarshaller(); var unmarshaller = UpdateUserResponseUnmarshaller.Instance; return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer); }