示例#1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.SQS.Model.RemovePermissionRequest();

            if (cmdletContext.Label != null)
            {
                request.Label = cmdletContext.Label;
            }
            if (cmdletContext.QueueUrl != null)
            {
                request.QueueUrl = cmdletContext.QueueUrl;
            }

            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 RemovePermission operation.
        /// <seealso cref="Amazon.SQS.IAmazonSQS"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the RemovePermission operation on AmazonSQSClient.</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 EndRemovePermission
        ///         operation.</returns>
        public IAsyncResult BeginRemovePermission(RemovePermissionRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new RemovePermissionRequestMarshaller();
            var unmarshaller = RemovePermissionResponseUnmarshaller.Instance;

            return BeginInvoke<RemovePermissionRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
示例#3
0
        /// <summary>
        /// Initiates the asynchronous execution of the RemovePermission operation.
        /// <seealso cref="Amazon.SQS.IAmazonSQS.RemovePermission"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the RemovePermission 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<RemovePermissionResponse> RemovePermissionAsync(RemovePermissionRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new RemovePermissionRequestMarshaller();
            var unmarshaller = RemovePermissionResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, RemovePermissionRequest, RemovePermissionResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
 /// <summary>
 /// Revokes any permissions in the queue      policy that matches the specified <code>Label</code>
 /// parameter. Only the owner      of the queue can remove permissions.
 /// </summary>
 /// <param name="queueUrl">The URL of the Amazon SQS queue to take action on.</param>
 /// <param name="label">The identification of the permission to remove. This is the label added with   the <a>AddPermission</a> action.</param>
 /// 
 /// <returns>The response from the RemovePermission service method, as returned by SQS.</returns>
 public RemovePermissionResponse RemovePermission(string queueUrl, string label)
 {
     var request = new RemovePermissionRequest();
     request.QueueUrl = queueUrl;
     request.Label = label;
     return RemovePermission(request);
 }
        /// <summary>
        /// Revokes any permissions in the queue      policy that matches the specified <code>Label</code>
        /// parameter. Only the owner      of the queue can remove permissions.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the RemovePermission service method.</param>
        /// 
        /// <returns>The response from the RemovePermission service method, as returned by SQS.</returns>
        public RemovePermissionResponse RemovePermission(RemovePermissionRequest request)
        {
            var marshaller = new RemovePermissionRequestMarshaller();
            var unmarshaller = RemovePermissionResponseUnmarshaller.Instance;

            return Invoke<RemovePermissionRequest,RemovePermissionResponse>(request, marshaller, unmarshaller);
        }
		internal RemovePermissionResponse RemovePermission(RemovePermissionRequest request)
        {
            var task = RemovePermissionAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
示例#7
0
    public static void SQSRemovePermission()
    {
      #region SQSRemovePermission
      var client = new AmazonSQSClient();

      var request = new RemovePermissionRequest
      {
        Label = "JohnDoeCanAccessQueues",
        QueueUrl = "https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyTestQueue"
      };

      client.RemovePermission(request);
      #endregion
    }
示例#8
0
 IAsyncResult invokeRemovePermission(RemovePermissionRequest removePermissionRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new RemovePermissionRequestMarshaller().Marshall(removePermissionRequest);
     var unmarshaller = RemovePermissionResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
示例#9
0
 /// <summary>
 /// <para>The <c>RemovePermission</c> action revokes any permissions in the queue policy that matches the specified <c>Label</c> parameter. Only
 /// the owner of the queue can remove permissions.</para>
 /// </summary>
 /// 
 /// <param name="removePermissionRequest">Container for the necessary parameters to execute the RemovePermission service method on
 ///          AmazonSQS.</param>
 /// 
 public RemovePermissionResponse RemovePermission(RemovePermissionRequest removePermissionRequest)
 {
     IAsyncResult asyncResult = invokeRemovePermission(removePermissionRequest, null, null, true);
     return EndRemovePermission(asyncResult);
 }
示例#10
0
 public Task<RemovePermissionResponse> RemovePermissionAsync(RemovePermissionRequest request, CancellationToken cancellationToken = new CancellationToken())
 {
     throw new NotImplementedException();
 }
示例#11
0
 /// <summary>
 /// Initiates the asynchronous execution of the RemovePermission operation.
 /// <seealso cref="Amazon.SQS.IAmazonSQS.RemovePermission"/>
 /// </summary>
 /// 
 /// <param name="removePermissionRequest">Container for the necessary parameters to execute the RemovePermission operation on AmazonSQS.</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 BeginRemovePermission(RemovePermissionRequest removePermissionRequest, AsyncCallback callback, object state)
 {
     return invokeRemovePermission(removePermissionRequest, callback, state, false);
 }
示例#12
0
 public RemovePermissionResponse RemovePermission(RemovePermissionRequest request)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Initiates the asynchronous execution of the RemovePermission operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the RemovePermission operation on AmazonSQSClient.</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 RemovePermissionAsync(RemovePermissionRequest request, AmazonServiceCallback<RemovePermissionRequest, RemovePermissionResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new RemovePermissionRequestMarshaller();
     var unmarshaller = RemovePermissionResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<RemovePermissionRequest,RemovePermissionResponse> responseObject 
                     = new AmazonServiceResult<RemovePermissionRequest,RemovePermissionResponse>((RemovePermissionRequest)req, (RemovePermissionResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<RemovePermissionRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
 /// <summary>
 /// Revokes any permissions in the queue policy that matches the specified <code>Label</code>
 /// parameter. Only the owner of the queue can remove permissions.
 /// </summary>
 /// <param name="queueUrl">The URL of the Amazon SQS queue to take action on.</param>
 /// <param name="label">The identification of the permission to remove. This is the label added with the <a>AddPermission</a> action.</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>
 /// 
 /// <returns>The response from the RemovePermission service method, as returned by SQS.</returns>
 public void RemovePermissionAsync(string queueUrl, string label,  AmazonServiceCallback<RemovePermissionRequest, RemovePermissionResponse> callback, AsyncOptions options = null)
 {
     var request = new RemovePermissionRequest();
     request.QueueUrl = queueUrl;
     request.Label = label;
     RemovePermissionAsync(request, callback, options);
 }
示例#15
0
 private Amazon.SQS.Model.RemovePermissionResponse CallAWSServiceOperation(IAmazonSQS client, Amazon.SQS.Model.RemovePermissionRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Queue Service (SQS)", "RemovePermission");
     try
     {
         #if DESKTOP
         return(client.RemovePermission(request));
         #elif CORECLR
         return(client.RemovePermissionAsync(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;
     }
 }
示例#16
0
 /// <summary>
 /// Revokes any permissions in the queue policy that matches the specified <code>Label</code>
 /// parameter. Only the owner of the queue can remove permissions.
 /// </summary>
 /// <param name="queueUrl">The URL of the Amazon SQS queue from which permissions are removed. Queue URLs are case-sensitive.</param>
 /// <param name="label">The identification of the permission to remove. This is the label added using the <code> <a>AddPermission</a> </code> action.</param>
 /// <param name="cancellationToken">
 ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
 /// </param>
 /// 
 /// <returns>The response from the RemovePermission service method, as returned by SQS.</returns>
 public Task<RemovePermissionResponse> RemovePermissionAsync(string queueUrl, string label, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
 {
     var request = new RemovePermissionRequest();
     request.QueueUrl = queueUrl;
     request.Label = label;
     return RemovePermissionAsync(request, cancellationToken);
 }
示例#17
0
        /// <summary>
        /// <para>Revokes any permissions in the queue policy that matches the specified <c>Label</c> parameter. Only the owner of the queue can remove
        /// permissions.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the RemovePermission service method on
        /// AmazonSQS.</param>
		public RemovePermissionResponse RemovePermission(RemovePermissionRequest request)
        {
            var task = RemovePermissionAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
示例#18
0
        /// <summary>
        /// Initiates the asynchronous execution of the RemovePermission operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the RemovePermission 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<RemovePermissionResponse> RemovePermissionAsync(RemovePermissionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new RemovePermissionRequestMarshaller();
            var unmarshaller = RemovePermissionResponseUnmarshaller.Instance;

            return InvokeAsync<RemovePermissionRequest,RemovePermissionResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
示例#19
0
        /// <summary>
        /// <para>The <c>RemovePermission</c> action revokes any permissions in the queue policy that matches the specified <c>Label</c> parameter. Only
        /// the owner of the queue can remove permissions.</para>
        /// </summary>
        /// 
        /// <param name="removePermissionRequest">Container for the necessary parameters to execute the RemovePermission service method on
        /// AmazonSQS.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public Task<RemovePermissionResponse> RemovePermissionAsync(RemovePermissionRequest removePermissionRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new RemovePermissionRequestMarshaller();
            var unmarshaller = RemovePermissionResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, RemovePermissionRequest, RemovePermissionResponse>(removePermissionRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
        IAsyncResult invokeRemovePermission(RemovePermissionRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller = new RemovePermissionRequestMarshaller();
            var unmarshaller = RemovePermissionResponseUnmarshaller.Instance;

            return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer);
        }