Exemplo n.º 1
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListDbNodesRequest request;

            try
            {
                request = new ListDbNodesRequest
                {
                    CompartmentId  = CompartmentId,
                    DbSystemId     = DbSystemId,
                    VmClusterId    = VmClusterId,
                    Limit          = Limit,
                    Page           = Page,
                    SortBy         = SortBy,
                    SortOrder      = SortOrder,
                    LifecycleState = LifecycleState
                };
                IEnumerable <ListDbNodesResponse> 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);
            }
        }
Exemplo n.º 2
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListDbNodesRequest request;

            try
            {
                request = new ListDbNodesRequest
                {
                    CompartmentId  = CompartmentId,
                    DbSystemId     = DbSystemId,
                    VmClusterId    = VmClusterId,
                    Limit          = Limit,
                    Page           = Page,
                    SortBy         = SortBy,
                    SortOrder      = SortOrder,
                    LifecycleState = LifecycleState
                };
                IEnumerable <ListDbNodesResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.Items, true);
                }
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets a list of database nodes in the specified DB system and compartment. A database node is a server running database software.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <ListDbNodesResponse> ListDbNodes(ListDbNodesRequest request)
        {
            var uri = new Uri($"{GetEndPoint(DatabaseServices.DbNodes, this.Region)}?{request.GetOptionQuery()}");

            using (var webResponse = await this.RestClientAsync.Get(uri))
                using (var stream = webResponse.GetResponseStream())
                    using (var reader = new StreamReader(stream))
                    {
                        var response = await reader.ReadToEndAsync();

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