protected override void ProcessRecord() { base.ProcessRecord(); ListWaasPoliciesRequest request; try { request = new ListWaasPoliciesRequest { CompartmentId = CompartmentId, OpcRequestId = OpcRequestId, Limit = Limit, Page = Page, SortBy = SortBy, SortOrder = SortOrder, Id = Id, DisplayName = DisplayName, LifecycleState = LifecycleState, TimeCreatedGreaterThanOrEqualTo = TimeCreatedGreaterThanOrEqualTo, TimeCreatedLessThan = TimeCreatedLessThan }; IEnumerable <ListWaasPoliciesResponse> responses = GetRequestDelegate().Invoke(request); foreach (var item in responses) { response = item; WriteOutput(response, response.Items, true); } FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
protected override void ProcessRecord() { base.ProcessRecord(); ListWaasPoliciesRequest request; try { request = new ListWaasPoliciesRequest { CompartmentId = CompartmentId, OpcRequestId = OpcRequestId, Limit = Limit, Page = Page, SortBy = SortBy, SortOrder = SortOrder, Id = Id, DisplayName = DisplayName, LifecycleState = LifecycleState, TimeCreatedGreaterThanOrEqualTo = TimeCreatedGreaterThanOrEqualTo, TimeCreatedLessThan = TimeCreatedLessThan }; IEnumerable <ListWaasPoliciesResponse> 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); } }
/// <summary> /// Gets a list of WAAS policies. /// </summary> /// <param name="request"></param> /// <returns></returns> public ListWaasPoliciesResponse ListWaasPolicies(ListWaasPoliciesRequest request) { var uri = new Uri($"{GetEndPoint(WaasServices.WaasPolicies, this.Region)}?{request.GetOptionQuery()}"); var httpRequestHeaderParam = new HttpRequestHeaderParam() { OpcRequestId = request.OpcRequestId }; using (var webResponse = this.RestClient.Get(uri, httpRequestHeaderParam)) using (var stream = webResponse.GetResponseStream()) using (var reader = new StreamReader(stream)) { var response = reader.ReadToEnd(); return(new ListWaasPoliciesResponse() { Items = this.JsonSerializer.Deserialize <List <WaasPolicySummary> >(response), OpcRequestId = webResponse.Headers.Get("opc-request-id"), OpcNextPage = webResponse.Headers.Get("opc-request-id") }); } }