public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.IdentityManagement.Model.GetUserPolicyRequest(); if (cmdletContext.PolicyName != null) { request.PolicyName = cmdletContext.PolicyName; } 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 GetUserPolicy operation. /// <seealso cref="Amazon.IdentityManagement.IAmazonIdentityManagementService"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetUserPolicy 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<GetUserPolicyResponse> GetUserPolicyAsync(GetUserPolicyRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetUserPolicyRequestMarshaller(); var unmarshaller = GetUserPolicyResponseUnmarshaller.Instance; return InvokeAsync<GetUserPolicyRequest,GetUserPolicyResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal GetUserPolicyResponse GetUserPolicy(GetUserPolicyRequest request) { var marshaller = new GetUserPolicyRequestMarshaller(); var unmarshaller = GetUserPolicyResponseUnmarshaller.Instance; return Invoke<GetUserPolicyRequest,GetUserPolicyResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the GetUserPolicy operation. /// <seealso cref="Amazon.IdentityManagement.AmazonIdentityManagementService.GetUserPolicy"/> /// </summary> /// /// <param name="getUserPolicyRequest">Container for the necessary parameters to execute the GetUserPolicy 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> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetUserPolicy /// operation.</returns> public IAsyncResult BeginGetUserPolicy(GetUserPolicyRequest getUserPolicyRequest, AsyncCallback callback, object state) { return invokeGetUserPolicy(getUserPolicyRequest, callback, state, false); }
IAsyncResult invokeGetUserPolicy(GetUserPolicyRequest getUserPolicyRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new GetUserPolicyRequestMarshaller().Marshall(getUserPolicyRequest); var unmarshaller = GetUserPolicyResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// <para>Retrieves the specified policy document for the specified user. The returned policy is URL-encoded according to RFC 3986. For more /// information about RFC 3986, go to http://www.faqs.org/rfcs/rfc3986.html.</para> /// </summary> /// /// <param name="getUserPolicyRequest">Container for the necessary parameters to execute the GetUserPolicy service method on /// AmazonIdentityManagementService.</param> /// /// <returns>The response from the GetUserPolicy service method, as returned by AmazonIdentityManagementService.</returns> /// /// <exception cref="NoSuchEntityException"/> public GetUserPolicyResponse GetUserPolicy(GetUserPolicyRequest getUserPolicyRequest) { IAsyncResult asyncResult = invokeGetUserPolicy(getUserPolicyRequest, null, null, true); return EndGetUserPolicy(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the GetUserPolicy operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetUserPolicy 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 EndGetUserPolicy /// operation.</returns> public IAsyncResult BeginGetUserPolicy(GetUserPolicyRequest request, AsyncCallback callback, object state) { var marshaller = new GetUserPolicyRequestMarshaller(); var unmarshaller = GetUserPolicyResponseUnmarshaller.Instance; return BeginInvoke<GetUserPolicyRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// <para>Retrieves the specified policy document for the specified User. /// The returned policy is URL-encoded according to RFC 3986. For more /// information about RFC 3986, go to /// http://www.faqs.org/rfcs/rfc3986.html.</para> /// </summary> /// /// <param name="getUserPolicyRequest">Container for the necessary /// parameters to execute the GetUserPolicy service method on /// AmazonIdentityManagementService.</param> /// /// <returns>The response from the GetUserPolicy service method, as /// returned by AmazonIdentityManagementService.</returns> /// /// <exception cref="NoSuchEntityException"/> public GetUserPolicyResponse GetUserPolicy(GetUserPolicyRequest getUserPolicyRequest) { IRequest<GetUserPolicyRequest> request = new GetUserPolicyRequestMarshaller().Marshall(getUserPolicyRequest); GetUserPolicyResponse response = Invoke<GetUserPolicyRequest, GetUserPolicyResponse> (request, this.signer, GetUserPolicyResponseUnmarshaller.GetInstance()); return response; }
/// <summary> /// Initiates the asynchronous execution of the GetUserPolicy operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetUserPolicy 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 GetUserPolicyAsync(GetUserPolicyRequest request, AmazonServiceCallback<GetUserPolicyRequest, GetUserPolicyResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new GetUserPolicyRequestMarshaller(); var unmarshaller = GetUserPolicyResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<GetUserPolicyRequest,GetUserPolicyResponse> responseObject = new AmazonServiceResult<GetUserPolicyRequest,GetUserPolicyResponse>((GetUserPolicyRequest)req, (GetUserPolicyResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<GetUserPolicyRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
/// <summary> /// Initiates the asynchronous execution of the GetUserPolicy operation. /// <seealso cref="Amazon.IdentityManagement.IAmazonIdentityManagementService.GetUserPolicy"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetUserPolicy 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<GetUserPolicyResponse> GetUserPolicyAsync(GetUserPolicyRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetUserPolicyRequestMarshaller(); var unmarshaller = GetUserPolicyResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, GetUserPolicyRequest, GetUserPolicyResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para>Retrieves the specified policy document for the specified user. The returned policy is URL-encoded according to RFC 3986. For more /// information about RFC 3986, go to <a href="http://www.faqs.org/rfcs/rfc3986.html">http://www.faqs.org/rfcs/rfc3986.html</a> .</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetUserPolicy service method on /// AmazonIdentityManagementService.</param> /// /// <returns>The response from the GetUserPolicy service method, as returned by AmazonIdentityManagementService.</returns> /// /// <exception cref="T:Amazon.IdentityManagement.Model.NoSuchEntityException" /> public GetUserPolicyResponse GetUserPolicy(GetUserPolicyRequest request) { var task = GetUserPolicyAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// <para>Retrieves the specified policy document for the specified user. The returned policy is URL-encoded according to RFC 3986. For more /// information about RFC 3986, go to <a href="http://www.faqs.org/rfcs/rfc3986.html">http://www.faqs.org/rfcs/rfc3986.html</a> .</para> /// </summary> /// /// <param name="getUserPolicyRequest">Container for the necessary parameters to execute the GetUserPolicy service method on /// AmazonIdentityManagementService.</param> /// /// <returns>The response from the GetUserPolicy service method, as returned by AmazonIdentityManagementService.</returns> /// /// <exception cref="T:Amazon.IdentityManagement.Model.NoSuchEntityException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<GetUserPolicyResponse> GetUserPolicyAsync(GetUserPolicyRequest getUserPolicyRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetUserPolicyRequestMarshaller(); var unmarshaller = GetUserPolicyResponseUnmarshaller.GetInstance(); return Invoke<IRequest, GetUserPolicyRequest, GetUserPolicyResponse>(getUserPolicyRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal GetUserPolicyResponse GetUserPolicy(GetUserPolicyRequest request) { var task = GetUserPolicyAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
IAsyncResult invokeGetUserPolicy(GetUserPolicyRequest request, AsyncCallback callback, object state, bool synchronized) { var marshaller = new GetUserPolicyRequestMarshaller(); var unmarshaller = GetUserPolicyResponseUnmarshaller.Instance; return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer); }
private Amazon.IdentityManagement.Model.GetUserPolicyResponse CallAWSServiceOperation(IAmazonIdentityManagementService client, Amazon.IdentityManagement.Model.GetUserPolicyRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Identity and Access Management", "GetUserPolicy"); try { #if DESKTOP return(client.GetUserPolicy(request)); #elif CORECLR return(client.GetUserPolicyAsync(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; } }