Beispiel #1
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonManagedBlockchainConfig config = new AmazonManagedBlockchainConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonManagedBlockchainClient client = new AmazonManagedBlockchainClient(creds, config);

            ListNodesResponse resp = new ListNodesResponse();

            do
            {
                ListNodesRequest req = new ListNodesRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxResults = maxItems
                };

                resp = client.ListNodes(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.Nodes)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
Beispiel #2
0
        /// <summary>
        /// Returns a list of the broker nodes in the cluster.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the ListNodes service method.</param>
        ///
        /// <returns>The response from the ListNodes service method, as returned by Kafka.</returns>
        /// <exception cref="Amazon.Kafka.Model.BadRequestException">
        /// Returns information about an error.
        /// </exception>
        /// <exception cref="Amazon.Kafka.Model.ForbiddenException">
        /// Returns information about an error.
        /// </exception>
        /// <exception cref="Amazon.Kafka.Model.InternalServerErrorException">
        /// Returns information about an error.
        /// </exception>
        /// <exception cref="Amazon.Kafka.Model.NotFoundException">
        /// Returns information about an error.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/kafka-2018-11-14/ListNodes">REST API Reference for ListNodes Operation</seealso>
        public virtual ListNodesResponse ListNodes(ListNodesRequest request)
        {
            var marshaller   = ListNodesRequestMarshaller.Instance;
            var unmarshaller = ListNodesResponseUnmarshaller.Instance;

            return(Invoke <ListNodesRequest, ListNodesResponse>(request, marshaller, unmarshaller));
        }
Beispiel #3
0
        /// <summary>
        /// Initiates the asynchronous execution of the ListNodes operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ListNodes operation on AmazonKafkaClient.</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 EndListNodes
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/kafka-2018-11-14/ListNodes">REST API Reference for ListNodes Operation</seealso>
        public virtual IAsyncResult BeginListNodes(ListNodesRequest request, AsyncCallback callback, object state)
        {
            var marshaller   = ListNodesRequestMarshaller.Instance;
            var unmarshaller = ListNodesResponseUnmarshaller.Instance;

            return(BeginInvoke <ListNodesRequest>(request, marshaller, unmarshaller,
                                                  callback, state));
        }
Beispiel #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the ListNodes operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ListNodes 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>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/kafka-2018-11-14/ListNodes">REST API Reference for ListNodes Operation</seealso>
        public virtual Task <ListNodesResponse> ListNodesAsync(ListNodesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = ListNodesRequestMarshaller.Instance;
            var unmarshaller = ListNodesResponseUnmarshaller.Instance;

            return(InvokeAsync <ListNodesRequest, ListNodesResponse>(request, marshaller,
                                                                     unmarshaller, cancellationToken));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the ListNodes operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ListNodes 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>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/kafka-2018-11-14/ListNodes">REST API Reference for ListNodes Operation</seealso>
        public virtual Task <ListNodesResponse> ListNodesAsync(ListNodesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = ListNodesRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ListNodesResponseUnmarshaller.Instance;

            return(InvokeAsync <ListNodesResponse>(request, options, cancellationToken));
        }
        internal virtual ListNodesResponse ListNodes(ListNodesRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = ListNodesRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ListNodesResponseUnmarshaller.Instance;

            return(Invoke <ListNodesResponse>(request, options));
        }
Beispiel #7
0
        /// <summary>
        /// Initiates the asynchronous execution of the ListNodes operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ListNodes operation on AmazonKafkaClient.</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 EndListNodes
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/kafka-2018-11-14/ListNodes">REST API Reference for ListNodes Operation</seealso>
        public virtual IAsyncResult BeginListNodes(ListNodesRequest request, AsyncCallback callback, object state)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = ListNodesRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ListNodesResponseUnmarshaller.Instance;

            return(BeginInvoke(request, options, callback, state));
        }
        /// <summary>
        /// 获取集群下所有节点
        /// </summary>
        public async Task <ListNodesResponse> ListNodesAsync(ListNodesRequest listNodesRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();

            urlParam.Add("cluster_id", listNodesRequest.ClusterId.ToString());
            string              urlPath  = HttpUtils.AddUrlPath("/api/v3/projects/{project_id}/clusters/{cluster_id}/nodes", urlParam);
            SdkRequest          request  = HttpUtils.InitSdkRequest(urlPath, "application/json", listNodesRequest);
            HttpResponseMessage response = await DoHttpRequestAsync("GET", request);

            return(JsonUtils.DeSerialize <ListNodesResponse>(response));
        }
Beispiel #9
0
        /// <summary>
        /// Lists all the nodes in the specified tree.
        /// </summary>
        /// <param name="parentTree">The tree from which to list nodes.</param>
        /// <returns>Does not return anything.</returns>
        private async Task ListAllNodes(Tree parentTree)
        {
            if (parentTree != null)
            {
                var listAllNodesRequest = new ListNodesRequest
                {
                    ForestId = parentTree.ForestId,
                    TreeId   = parentTree.Id,
                };

                Console.WriteLine("Listing all nodes:");

                await this.orgClient.ListAllNodesAsync(listAllNodesRequest, this.PrintNodes).ConfigureAwait(false);

                Console.WriteLine();
            }
        }