protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListRunsRequest request;

            try
            {
                request = new ListRunsRequest
                {
                    CompartmentId          = CompartmentId,
                    OpcRequestId           = OpcRequestId,
                    ApplicationId          = ApplicationId,
                    OwnerPrincipalId       = OwnerPrincipalId,
                    DisplayNameStartsWith  = DisplayNameStartsWith,
                    LifecycleState         = LifecycleState,
                    TimeCreatedGreaterThan = TimeCreatedGreaterThan,
                    Limit       = Limit,
                    Page        = Page,
                    SortBy      = SortBy,
                    SortOrder   = SortOrder,
                    DisplayName = DisplayName
                };
                IEnumerable <ListRunsResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.Items, true);
                }
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
예제 #2
0
        /// <summary>
        /// Lists all runs of an application in the specified 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>
        public async Task <ListRunsResponse> ListRuns(ListRunsRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
        {
            logger.Trace("Called listRuns");
            Uri                uri            = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/runs".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);
                }
                else
                {
                    responseMessage = await this.restClient.HttpSend(requestMessage);
                }

                return(Converter.FromHttpResponseMessage <ListRunsResponse>(responseMessage));
            }
            catch (Exception e)
            {
                logger.Error($"ListRuns failed with error: {e.Message}");
                throw;
            }
        }
예제 #3
0
 /// <summary>
 /// Creates a new enumerable which will iterate over the responses received from the ListRuns 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 <ListRunsResponse> ListRunsResponseEnumerator(ListRunsRequest request, Common.Retry.RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
 {
     return(new Common.Utils.ResponseEnumerable <ListRunsRequest, ListRunsResponse>(
                response => response.OpcNextPage,
                input =>
     {
         if (!string.IsNullOrEmpty(input))
         {
             request.Page = input;
         }
         return request;
     },
                request => client.ListRuns(request, retryConfiguration, cancellationToken)
                ));
 }
        public static string BuildUrl(this ListRunsRequest req, string version)
        {
            var urlWithParameters = AddDefaultQueryParameters(string.Format("{0}/users/current/runs", version), req.Offset,
                                                              req.Limit, req.SortDir);

            if (req.SortBy.HasValue)
            {
                urlWithParameters = string.Format("{0}&{1}={2}", urlWithParameters, QueryParameters.SortBy, req.SortBy);
            }
            if (!string.IsNullOrEmpty(req.Status))
            {
                urlWithParameters = string.Format("{0}&{1}={2}", urlWithParameters, RunSortByParameters.Status, req.Status);
            }
            return(urlWithParameters);
        }
예제 #5
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListRunsRequest request;

            try
            {
                request = new ListRunsRequest
                {
                    CompartmentId          = CompartmentId,
                    OpcRequestId           = OpcRequestId,
                    ApplicationId          = ApplicationId,
                    OwnerPrincipalId       = OwnerPrincipalId,
                    DisplayNameStartsWith  = DisplayNameStartsWith,
                    LifecycleState         = LifecycleState,
                    TimeCreatedGreaterThan = TimeCreatedGreaterThan,
                    Limit       = Limit,
                    Page        = Page,
                    SortBy      = SortBy,
                    SortOrder   = SortOrder,
                    DisplayName = DisplayName
                };
                IEnumerable <ListRunsResponse> 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);
            }
        }
 public Task<ListRunsResponse> ListRunsAsync(ListRunsRequest request, IRequestOptions options)
 {
     return WebClient.SendAsync<ListRunsResponse>(HttpMethods.GET, request.BuildUrl(ClientSettings.Version), null, options);
 }
 public ListRunsResponse ListRuns(ListRunsRequest request, IRequestOptions options = null)
 {
     return WebClient.Send(request, options);
 }
예제 #8
0
 public ListRunsResponse ListRuns(ListRunsRequest request, IRequestOptions options = null)
 {
     return(WebClient.Send(request, options));
 }
 public ListRunsResponse ListRuns(ListRunsRequest request, IRequestOptions options = null)
 {
     return WebClient.Send<ListRunsResponse>(HttpMethods.GET, request.BuildUrl(ClientSettings.Version), null, options);
 }
예제 #10
0
 public ListRunsResponse ListRuns(ListRunsRequest request, IRequestOptions options)
 {
     return(WebClient.Send <ListRunsResponse>(HttpMethods.GET, request.BuildUrl(ClientSettings.Version), null, options));
 }