protected override void ProcessRecord()
 {
     AmazonSimpleNotificationService client = base.GetClient();
     Amazon.SimpleNotificationService.Model.ListSubscriptionsRequest request = new Amazon.SimpleNotificationService.Model.ListSubscriptionsRequest();
     request.NextToken = this._NextToken;
     Amazon.SimpleNotificationService.Model.ListSubscriptionsResponse response = client.ListSubscriptions(request);
     base.WriteObject(response.ListSubscriptionsResult, true);
 }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext      = context as CmdletContext;
            var useParameterSelect = this.Select.StartsWith("^");

            // create request and set iteration invariants
            var request = new Amazon.SimpleNotificationService.Model.ListSubscriptionsRequest();


            // Initialize loop variant and commence piping
            var _nextToken             = cmdletContext.NextToken;
            var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.NextToken));

            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            do
            {
                request.NextToken = _nextToken;

                CmdletOutput output;

                try
                {
                    var response = CallAWSServiceOperation(client, request);

                    object pipelineOutput = null;
                    if (!useParameterSelect)
                    {
                        pipelineOutput = cmdletContext.Select(response, this);
                    }
                    output = new CmdletOutput
                    {
                        PipelineOutput  = pipelineOutput,
                        ServiceResponse = response
                    };

                    _nextToken = response.NextToken;
                }
                catch (Exception e)
                {
                    output = new CmdletOutput {
                        ErrorResponse = e
                    };
                }

                ProcessOutput(output);
            } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken));

            if (useParameterSelect)
            {
                WriteObject(cmdletContext.Select(null, this));
            }


            return(null);
        }
        /// <summary>
        /// <para>The <c>ListSubscriptions</c> action returns a list of the requester's subscriptions. Each call returns a limited list of
        /// subscriptions, up to 100. If there are more subscriptions, a <c>NextToken</c> is also returned. Use the <c>NextToken</c> parameter in a new
        /// <c>ListSubscriptions</c> call to get further results.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ListSubscriptions service method on
        /// AmazonSimpleNotificationService.</param>
        /// 
        /// <returns>The response from the ListSubscriptions service method, as returned by AmazonSimpleNotificationService.</returns>
        /// 
        /// <exception cref="T:Amazon.SimpleNotificationService.Model.AuthorizationErrorException" />
        /// <exception cref="T:Amazon.SimpleNotificationService.Model.InternalErrorException" />
        /// <exception cref="T:Amazon.SimpleNotificationService.Model.InvalidParameterException" />
		public ListSubscriptionsResponse ListSubscriptions(ListSubscriptionsRequest request)
        {
            var task = ListSubscriptionsAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
        /// <summary>
        /// Initiates the asynchronous execution of the ListSubscriptions operation.
        /// <seealso cref="Amazon.SimpleNotificationService.IAmazonSimpleNotificationService"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ListSubscriptions 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<ListSubscriptionsResponse> ListSubscriptionsAsync(ListSubscriptionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new ListSubscriptionsRequestMarshaller();
            var unmarshaller = ListSubscriptionsResponseUnmarshaller.Instance;

            return InvokeAsync<ListSubscriptionsRequest,ListSubscriptionsResponse>(request, marshaller,
                unmarshaller, cancellationToken);
        }
 private Amazon.SimpleNotificationService.Model.ListSubscriptionsResponse CallAWSServiceOperation(IAmazonSimpleNotificationService client, Amazon.SimpleNotificationService.Model.ListSubscriptionsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Notification Service (SNS)", "ListSubscriptions");
     try
     {
         #if DESKTOP
         return(client.ListSubscriptions(request));
         #elif CORECLR
         return(client.ListSubscriptionsAsync(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 invokeListSubscriptions(ListSubscriptionsRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller = new ListSubscriptionsRequestMarshaller();
            var unmarshaller = ListSubscriptionsResponseUnmarshaller.Instance;

            return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer);
        }
        /// <summary>
        /// <para>The <c>ListSubscriptions</c> action returns a list of the requester's subscriptions. Each call returns a limited list of
        /// subscriptions, up to 100. If there are more subscriptions, a <c>NextToken</c> is also returned. Use the <c>NextToken</c> parameter in a new
        /// <c>ListSubscriptions</c> call to get further results.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ListSubscriptions service method on
        /// AmazonSimpleNotificationService.</param>
        /// 
        /// <returns>The response from the ListSubscriptions service method, as returned by AmazonSimpleNotificationService.</returns>
        /// 
        /// <exception cref="T:Amazon.SimpleNotificationService.Model.AuthorizationErrorException" />
        /// <exception cref="T:Amazon.SimpleNotificationService.Model.InternalErrorException" />
        /// <exception cref="T:Amazon.SimpleNotificationService.Model.InvalidParameterException" />
		public ListSubscriptionsResponse ListSubscriptions(ListSubscriptionsRequest request)
        {
            var task = ListSubscriptionsAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
        /// <summary>
        /// Returns a list of the requester's subscriptions. Each call returns a limited list
        ///      of subscriptions, up to 100. If there are more subscriptions, a <code>NextToken</code>
        /// is also returned. Use the <code>NextToken</code> parameter in a       new <code>ListSubscriptions</code>
        /// call to get further results.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the ListSubscriptions service method.</param>
        /// 
        /// <returns>The response from the ListSubscriptions service method, as returned by SimpleNotificationService.</returns>
        /// <exception cref="Amazon.SimpleNotificationService.Model.AuthorizationErrorException">
        /// Indicates that the user has been denied access to the requested resource.
        /// </exception>
        /// <exception cref="Amazon.SimpleNotificationService.Model.InternalErrorException">
        /// Indicates an internal service error.
        /// </exception>
        /// <exception cref="Amazon.SimpleNotificationService.Model.InvalidParameterException">
        /// Indicates that a request parameter does not comply with the associated constraints.
        /// </exception>
        public ListSubscriptionsResponse ListSubscriptions(ListSubscriptionsRequest request)
        {
            var marshaller = new ListSubscriptionsRequestMarshaller();
            var unmarshaller = ListSubscriptionsResponseUnmarshaller.Instance;

            return Invoke<ListSubscriptionsRequest,ListSubscriptionsResponse>(request, marshaller, unmarshaller);
        }
        /// <summary>
        /// <para>The <c>ListSubscriptions</c> action returns a list of the requester's subscriptions. Each call returns a limited list of
        /// subscriptions, up to 100. If there are more subscriptions, a <c>NextToken</c> is also returned. Use the <c>NextToken</c> parameter in a new
        /// <c>ListSubscriptions</c> call to get further results.</para>
        /// </summary>
        /// 
        /// <param name="listSubscriptionsRequest">Container for the necessary parameters to execute the ListSubscriptions service method on
        /// AmazonSimpleNotificationService.</param>
        /// 
        /// <returns>The response from the ListSubscriptions service method, as returned by AmazonSimpleNotificationService.</returns>
        /// 
        /// <exception cref="T:Amazon.SimpleNotificationService.Model.AuthorizationErrorException" />
        /// <exception cref="T:Amazon.SimpleNotificationService.Model.InternalErrorException" />
        /// <exception cref="T:Amazon.SimpleNotificationService.Model.InvalidParameterException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public async Task<ListSubscriptionsResponse> ListSubscriptionsAsync(ListSubscriptionsRequest listSubscriptionsRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new ListSubscriptionsRequestMarshaller();
            var unmarshaller = ListSubscriptionsResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, ListSubscriptionsRequest, ListSubscriptionsResponse>(listSubscriptionsRequest, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
 /// <summary>
 /// Returns a list of the requester's subscriptions. Each call returns a limited list
 ///      of subscriptions, up to 100. If there are more subscriptions, a <code>NextToken</code>
 /// is also returned. Use the <code>NextToken</code> parameter in a       new <code>ListSubscriptions</code>
 /// call to get further results.
 /// </summary>
 /// <param name="nextToken">Token returned by the previous <code>ListSubscriptions</code> request.</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 ListSubscriptions service method, as returned by SimpleNotificationService.</returns>
 /// <exception cref="Amazon.SimpleNotificationService.Model.AuthorizationErrorException">
 /// Indicates that the user has been denied access to the requested resource.
 /// </exception>
 /// <exception cref="Amazon.SimpleNotificationService.Model.InternalErrorException">
 /// Indicates an internal service error.
 /// </exception>
 /// <exception cref="Amazon.SimpleNotificationService.Model.InvalidParameterException">
 /// Indicates that a request parameter does not comply with the associated constraints.
 /// </exception>
 public Task<ListSubscriptionsResponse> ListSubscriptionsAsync(string nextToken, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
 {
     var request = new ListSubscriptionsRequest();
     request.NextToken = nextToken;
     return ListSubscriptionsAsync(request, cancellationToken);
 }
 /// <summary>
 /// Paginator for ListSubscriptions operation
 ///</summary>
 public IListSubscriptionsPaginator ListSubscriptions(ListSubscriptionsRequest request)
 {
     return(new ListSubscriptionsPaginator(this.client, request));
 }
 /// <summary>
 /// Initiates the asynchronous execution of the ListSubscriptions operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the ListSubscriptions operation on AmazonSimpleNotificationServiceClient.</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 ListSubscriptionsAsync(ListSubscriptionsRequest request, AmazonServiceCallback<ListSubscriptionsRequest, ListSubscriptionsResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new ListSubscriptionsRequestMarshaller();
     var unmarshaller = ListSubscriptionsResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<ListSubscriptionsRequest,ListSubscriptionsResponse> responseObject 
                     = new AmazonServiceResult<ListSubscriptionsRequest,ListSubscriptionsResponse>((ListSubscriptionsRequest)req, (ListSubscriptionsResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<ListSubscriptionsRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
 /// <summary>
 /// Returns a list of the requester's subscriptions. Each call returns a limited list
 /// of subscriptions, up to 100. If there are more subscriptions, a <code>NextToken</code>
 /// is also returned. Use the <code>NextToken</code> parameter in a new <code>ListSubscriptions</code>
 /// call to get further results.
 /// </summary>
 /// <param name="nextToken">Token returned by the previous <code>ListSubscriptions</code> request.</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>
 /// 
 /// <returns>The response from the ListSubscriptions service method, as returned by SimpleNotificationService.</returns>
 /// <exception cref="Amazon.SimpleNotificationService.Model.AuthorizationErrorException">
 /// Indicates that the user has been denied access to the requested resource.
 /// </exception>
 /// <exception cref="Amazon.SimpleNotificationService.Model.InternalErrorException">
 /// Indicates an internal service error.
 /// </exception>
 /// <exception cref="Amazon.SimpleNotificationService.Model.InvalidParameterException">
 /// Indicates that a request parameter does not comply with the associated constraints.
 /// </exception>
 public void ListSubscriptionsAsync(string nextToken,  AmazonServiceCallback<ListSubscriptionsRequest, ListSubscriptionsResponse> callback, AsyncOptions options = null)
 {
     var request = new ListSubscriptionsRequest();
     request.NextToken = nextToken;
     ListSubscriptionsAsync(request, callback, options);
 }
Beispiel #14
0
    public static void SNSListSubscriptions()
    {
      #region SNSListSubscriptions
      var snsClient = new AmazonSimpleNotificationServiceClient();
      var request = new ListSubscriptionsRequest();
      var response = new ListSubscriptionsResponse();

      do
      {
        response = snsClient.ListSubscriptions(request);

        foreach (var sub in response.Subscriptions)
        {
          Console.WriteLine("Subscription: {0}", sub.SubscriptionArn);
        }

        request.NextToken = response.NextToken;

      } while (!string.IsNullOrEmpty(response.NextToken));
      #endregion

      Console.ReadLine();
    }
 internal ListSubscriptionsPaginator(IAmazonSimpleNotificationService client, ListSubscriptionsRequest request)
 {
     this._client  = client;
     this._request = request;
 }
 /// <summary>
 /// Returns a list of the requester's subscriptions. Each call returns a limited list
 ///      of subscriptions, up to 100. If there are more subscriptions, a <code>NextToken</code>
 /// is also returned. Use the <code>NextToken</code> parameter in a       new <code>ListSubscriptions</code>
 /// call to get further results.
 /// </summary>
 /// <param name="nextToken">Token returned by the previous <code>ListSubscriptions</code> request.</param>
 /// 
 /// <returns>The response from the ListSubscriptions service method, as returned by SimpleNotificationService.</returns>
 /// <exception cref="Amazon.SimpleNotificationService.Model.AuthorizationErrorException">
 /// Indicates that the user has been denied access to the requested resource.
 /// </exception>
 /// <exception cref="Amazon.SimpleNotificationService.Model.InternalErrorException">
 /// Indicates an internal service error.
 /// </exception>
 /// <exception cref="Amazon.SimpleNotificationService.Model.InvalidParameterException">
 /// Indicates that a request parameter does not comply with the associated constraints.
 /// </exception>
 public ListSubscriptionsResponse ListSubscriptions(string nextToken)
 {
     var request = new ListSubscriptionsRequest();
     request.NextToken = nextToken;
     return ListSubscriptions(request);
 }
 /// <summary>
 /// <para>The <c>ListSubscriptions</c> action returns a list of the requester's subscriptions. Each call returns a limited list of
 /// subscriptions, up to 100. If there are more subscriptions, a <c>NextToken</c> is also returned. Use the <c>NextToken</c> parameter in a new
 /// <c>ListSubscriptions</c> call to get further results.</para>
 /// </summary>
 /// 
 /// <param name="listSubscriptionsRequest">Container for the necessary parameters to execute the ListSubscriptions service method on
 ///          AmazonSimpleNotificationService.</param>
 /// 
 /// <returns>The response from the ListSubscriptions service method, as returned by AmazonSimpleNotificationService.</returns>
 /// 
 /// <exception cref="AuthorizationErrorException"/>
 /// <exception cref="InternalErrorException"/>
 /// <exception cref="InvalidParameterException"/>
 public ListSubscriptionsResponse ListSubscriptions(ListSubscriptionsRequest listSubscriptionsRequest)
 {
     IAsyncResult asyncResult = invokeListSubscriptions(listSubscriptionsRequest, null, null, true);
     return EndListSubscriptions(asyncResult);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the ListSubscriptions operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ListSubscriptions operation on AmazonSimpleNotificationServiceClient.</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 EndListSubscriptions
        ///         operation.</returns>
        public IAsyncResult BeginListSubscriptions(ListSubscriptionsRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new ListSubscriptionsRequestMarshaller();
            var unmarshaller = ListSubscriptionsResponseUnmarshaller.Instance;

            return BeginInvoke<ListSubscriptionsRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
 /// <summary>
 /// Initiates the asynchronous execution of the ListSubscriptions operation.
 /// <seealso cref="Amazon.SimpleNotificationService.IAmazonSimpleNotificationService.ListSubscriptions"/>
 /// </summary>
 /// 
 /// <param name="listSubscriptionsRequest">Container for the necessary parameters to execute the ListSubscriptions operation on
 ///          AmazonSimpleNotificationService.</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 EndListSubscriptions
 ///         operation.</returns>
 public IAsyncResult BeginListSubscriptions(ListSubscriptionsRequest listSubscriptionsRequest, AsyncCallback callback, object state)
 {
     return invokeListSubscriptions(listSubscriptionsRequest, callback, state, false);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the ListSubscriptions operation.
        /// <seealso cref="Amazon.SimpleNotificationService.IAmazonSimpleNotificationService.ListSubscriptions"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ListSubscriptions 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<ListSubscriptionsResponse> ListSubscriptionsAsync(ListSubscriptionsRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new ListSubscriptionsRequestMarshaller();
            var unmarshaller = ListSubscriptionsResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, ListSubscriptionsRequest, ListSubscriptionsResponse>(request, marshaller, unmarshaller, signer, cancellationToken);
        }
 IAsyncResult invokeListSubscriptions(ListSubscriptionsRequest listSubscriptionsRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new ListSubscriptionsRequestMarshaller().Marshall(listSubscriptionsRequest);
     var unmarshaller = ListSubscriptionsResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }