Пример #1
0
        /// <summary>
        /// Lists the Amazon CloudWatch Events rules in your account. You can either list all
        /// the rules or you can provide a prefix to match to the rule names. If you have more
        /// rules in your account than the given limit, the results will be paginated. In that
        /// case, use the next token returned in the response and repeat ListRules until the NextToken
        /// in the response is returned as null.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the ListRules service method.</param>
        ///
        /// <returns>The response from the ListRules service method, as returned by CloudWatchEvents.</returns>
        /// <exception cref="Amazon.CloudWatchEvents.Model.InternalException">
        /// This exception occurs due to unexpected causes.
        /// </exception>
        public ListRulesResponse ListRules(ListRulesRequest request)
        {
            var marshaller   = new ListRulesRequestMarshaller();
            var unmarshaller = ListRulesResponseUnmarshaller.Instance;

            return(Invoke <ListRulesRequest, ListRulesResponse>(request, marshaller, unmarshaller));
        }
Пример #2
0
        internal virtual ListRulesResponse ListRules(ListRulesRequest request)
        {
            var marshaller   = ListRulesRequestMarshaller.Instance;
            var unmarshaller = ListRulesResponseUnmarshaller.Instance;

            return(Invoke <ListRulesRequest, ListRulesResponse>(request, marshaller, unmarshaller));
        }
        private static void findRule(IoTDAClient client)
        {
            ListRulesRequest req = new ListRulesRequest
            {
                InstanceId = "1a7ffc5c-d89c-44dd-8265-b1653d951ce0"
            };

            try
            {
                var resp = client.ListRules(req);
                Console.WriteLine(resp.HttpStatusCode);
                Console.WriteLine(resp.Count);
                Console.WriteLine(resp.Marker);
                foreach (var rule in resp.Rules)
                {
                    Console.WriteLine(JsonConvert.SerializeObject(rule));
                }
            }
            catch (RequestTimeoutException requestTimeoutException)
            {
                Console.WriteLine(requestTimeoutException.ErrorMessage);
            }
            catch (ServiceResponseException clientRequestException)
            {
                Console.WriteLine(clientRequestException.HttpStatusCode);
                Console.WriteLine(clientRequestException.ErrorCode);
                Console.WriteLine(clientRequestException.ErrorMsg);
            }
            catch (ConnectionException connectionException)
            {
                Console.WriteLine(connectionException.ErrorMessage);
            }
        }
Пример #4
0
        /// <summary>
        /// Lists rules for this compartment.
        ///
        /// </summary>
        /// <param name="request">The request object containing the details to send. Required.</param>
        /// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
        /// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
        /// <returns>A response object containing details about the completed operation</returns>
        /// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/events/ListRules.cs.html">here</a> to see an example of how to use ListRules API.</example>
        public async Task <ListRulesResponse> ListRules(ListRulesRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
        {
            logger.Trace("Called listRules");
            Uri                uri            = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/rules".Trim('/')));
            HttpMethod         method         = new HttpMethod("GET");
            HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);

            requestMessage.Headers.Add("Accept", "application/json");
            GenericRetrier      retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
            HttpResponseMessage responseMessage;

            try
            {
                if (retryingClient != null)
                {
                    responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
                }
                else
                {
                    responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
                }
                this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);

                return(Converter.FromHttpResponseMessage <ListRulesResponse>(responseMessage));
            }
            catch (Exception e)
            {
                logger.Error($"ListRules failed with error: {e.Message}");
                throw;
            }
        }
Пример #5
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListRulesRequest request;

            try
            {
                request = new ListRulesRequest
                {
                    CompartmentId  = CompartmentId,
                    Limit          = Limit,
                    Page           = Page,
                    LifecycleState = LifecycleState,
                    DisplayName    = DisplayName,
                    SortBy         = SortBy,
                    SortOrder      = SortOrder,
                    OpcRequestId   = OpcRequestId
                };
                IEnumerable <ListRulesResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.Items, true);
                }
                if (!ParameterSetName.Equals(AllPageSet) && !ParameterSetName.Equals(LimitSet) && response.OpcNextPage != null)
                {
                    WriteWarning("This operation supports pagination and not all resources were returned. Re-run using the -All option to auto paginate and list all resources.");
                }
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListRulesRequest request;

            try
            {
                request = new ListRulesRequest
                {
                    CompartmentId = CompartmentId,
                    Limit = Limit,
                    Page = Page,
                    LifecycleState = LifecycleState,
                    DisplayName = DisplayName,
                    SortBy = SortBy,
                    SortOrder = SortOrder,
                    OpcRequestId = OpcRequestId
                };
                IEnumerable<ListRulesResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.Items, true);
                }
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Пример #7
0
        /// <summary>
        /// Initiates the asynchronous execution of the ListRules operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ListRules 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 <ListRulesResponse> ListRulesAsync(ListRulesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new ListRulesRequestMarshaller();
            var unmarshaller = ListRulesResponseUnmarshaller.Instance;

            return(InvokeAsync <ListRulesRequest, ListRulesResponse>(request, marshaller,
                                                                     unmarshaller, cancellationToken));
        }
        /// <summary>
        /// Lists the Recycle Bin retention rules in the Region.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the ListRules service method.</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 ListRules service method, as returned by RecycleBin.</returns>
        /// <exception cref="Amazon.RecycleBin.Model.InternalServerException">
        /// The service could not respond to the request due to an internal problem.
        /// </exception>
        /// <exception cref="Amazon.RecycleBin.Model.ValidationException">
        /// One or more of the parameters in the request is not valid.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/rbin-2021-06-15/ListRules">REST API Reference for ListRules Operation</seealso>
        public virtual Task <ListRulesResponse> ListRulesAsync(ListRulesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = ListRulesRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ListRulesResponseUnmarshaller.Instance;

            return(InvokeAsync <ListRulesResponse>(request, options, cancellationToken));
        }
        /// <summary>
        /// Lists the Recycle Bin retention rules in the Region.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the ListRules service method.</param>
        ///
        /// <returns>The response from the ListRules service method, as returned by RecycleBin.</returns>
        /// <exception cref="Amazon.RecycleBin.Model.InternalServerException">
        /// The service could not respond to the request due to an internal problem.
        /// </exception>
        /// <exception cref="Amazon.RecycleBin.Model.ValidationException">
        /// One or more of the parameters in the request is not valid.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/rbin-2021-06-15/ListRules">REST API Reference for ListRules Operation</seealso>
        public virtual ListRulesResponse ListRules(ListRulesRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = ListRulesRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ListRulesResponseUnmarshaller.Instance;

            return(Invoke <ListRulesResponse>(request, options));
        }
Пример #10
0
        /// <summary>
        /// Initiates the asynchronous execution of the ListRules operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ListRules operation on AmazonRecycleBinClient.</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 EndListRules
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/rbin-2021-06-15/ListRules">REST API Reference for ListRules Operation</seealso>
        public virtual IAsyncResult BeginListRules(ListRulesRequest request, AsyncCallback callback, object state)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = ListRulesRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ListRulesResponseUnmarshaller.Instance;

            return(BeginInvoke(request, options, callback, state));
        }
Пример #11
0
        /// <summary>
        /// 查询规则列表
        /// </summary>
        public async Task <ListRulesResponse> ListRulesAsync(ListRulesRequest listRulesRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string              urlPath          = HttpUtils.AddUrlPath("/v5/iot/{project_id}/rules", urlParam);
            SdkRequest          request          = HttpUtils.InitSdkRequest(urlPath, listRulesRequest);
            HttpResponseMessage response         = await DoHttpRequestAsync("GET", request);

            return(JsonUtils.DeSerialize <ListRulesResponse>(response));
        }
Пример #12
0
 /// <summary>
 /// Creates a new enumerable which will iterate over the responses received from the ListRules operation. This enumerable
 /// will fetch more data from the server as needed.
 /// </summary>
 /// <param name="request">The request object containing the details to send</param>
 /// <param name="retryConfiguration">The configuration for retrying, may be null</param>
 /// <param name="cancellationToken">The cancellation token object</param>
 /// <returns>The enumerator, which supports a simple iteration over a collection of a specified type</returns>
 public IEnumerable <ListRulesResponse> ListRulesResponseEnumerator(ListRulesRequest request, Common.Retry.RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
 {
     return(new Common.Utils.ResponseEnumerable <ListRulesRequest, ListRulesResponse>(
                response => response.OpcNextPage,
                input =>
     {
         if (!string.IsNullOrEmpty(input))
         {
             request.Page = input;
         }
         return request;
     },
                request => client.ListRules(request, retryConfiguration, cancellationToken)
                ));
 }
        /// <summary>
        /// 获取事件规则列表
        /// </summary>
        /// <param name="req"><see cref="ListRulesRequest"/></param>
        /// <returns><see cref="ListRulesResponse"/></returns>
        public ListRulesResponse ListRulesSync(ListRulesRequest req)
        {
            JsonResponseModel <ListRulesResponse> rsp = null;

            try
            {
                var strResp = this.InternalRequestSync(req, "ListRules");
                rsp = JsonConvert.DeserializeObject <JsonResponseModel <ListRulesResponse> >(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new TencentCloudSDKException(e.Message);
            }
            return(rsp.Response);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListRulesRequest request;

            try
            {
                request = new ListRulesRequest
                {
                    CatalogId           = CatalogId,
                    DataAssetKey        = DataAssetKey,
                    EntityKey           = EntityKey,
                    DisplayName         = DisplayName,
                    DisplayNameContains = DisplayNameContains,
                    RuleType            = RuleType,
                    LifecycleState      = LifecycleState,
                    OriginType          = OriginType,
                    ExternalKey         = ExternalKey,
                    TimeCreated         = TimeCreated,
                    TimeUpdated         = TimeUpdated,
                    CreatedById         = CreatedById,
                    UpdatedById         = UpdatedById,
                    Fields       = Fields,
                    SortBy       = SortBy,
                    SortOrder    = SortOrder,
                    Limit        = Limit,
                    Page         = Page,
                    OpcRequestId = OpcRequestId
                };
                IEnumerable <ListRulesResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.RuleCollection, true);
                }
                if (!ParameterSetName.Equals(AllPageSet) && !ParameterSetName.Equals(LimitSet) && response.OpcNextPage != null)
                {
                    WriteWarning("This operation supports pagination and not all resources were returned. Re-run using the -All option to auto paginate and list all resources.");
                }
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }