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

            try
            {
                request = new ListAppCatalogSubscriptionsRequest
                {
                    CompartmentId = CompartmentId,
                    Limit         = Limit,
                    Page          = Page,
                    SortBy        = SortBy,
                    SortOrder     = SortOrder,
                    ListingId     = ListingId
                };
                IEnumerable <ListAppCatalogSubscriptionsResponse> 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
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListAppCatalogSubscriptionsRequest request;

            try
            {
                request = new ListAppCatalogSubscriptionsRequest
                {
                    CompartmentId = CompartmentId,
                    Limit         = Limit,
                    Page          = Page,
                    SortBy        = SortBy,
                    SortOrder     = SortOrder,
                    ListingId     = ListingId
                };
                IEnumerable <ListAppCatalogSubscriptionsResponse> 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);
            }
        }
예제 #3
0
        /// <summary>
        /// Lists subscriptions for a compartment.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ListAppCatalogSubscriptionsResponse ListAppCatalogSubscriptions(ListAppCatalogSubscriptionsRequest request)
        {
            var uri = new Uri($"{GetEndPoint(CoreServices.AppCatalogSubscriptions, this.Region)}?{request.GetOptionQuery()}");

            using (var webResponse = this.RestClient.Get(uri))
                using (var stream = webResponse.GetResponseStream())
                    using (var reader = new StreamReader(stream))
                    {
                        var response = reader.ReadToEnd();

                        return(new ListAppCatalogSubscriptionsResponse()
                        {
                            Items = this.JsonSerializer.Deserialize <List <AppCatalogSubscriptionSummary> >(response),
                            OpcRequestId = webResponse.Headers.Get("opc-request-id"),
                            OpcNextPage = webResponse.Headers.Get("opc-next-page")
                        });
                    }
        }