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

            try
            {
                request = new ListVcnsRequest
                {
                    CompartmentId  = CompartmentId,
                    Limit          = Limit,
                    Page           = Page,
                    DisplayName    = DisplayName,
                    SortBy         = SortBy,
                    SortOrder      = SortOrder,
                    LifecycleState = LifecycleState
                };
                IEnumerable <ListVcnsResponse> 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);
            }
        }
예제 #2
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ListVcnsRequest request;

            try
            {
                request = new ListVcnsRequest
                {
                    CompartmentId  = CompartmentId,
                    Limit          = Limit,
                    Page           = Page,
                    DisplayName    = DisplayName,
                    SortBy         = SortBy,
                    SortOrder      = SortOrder,
                    LifecycleState = LifecycleState
                };
                IEnumerable <ListVcnsResponse> responses = GetRequestDelegate().Invoke(request);
                foreach (var item in responses)
                {
                    response = item;
                    WriteOutput(response, response.Items, true);
                }
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
예제 #3
0
        /**
         * Gets VCN info of a single uniquely named VCN in the specified compartment.
         *
         * @param vcnClient      the service client to use to query the VCN.
         * @param compartmentId  of the VCN.
         * @param vcnDisplayName of the VCN.
         * @return               the VCN.
         */
        private static async Task <Vcn> GetUniqueVcnByName(VirtualNetworkClient vcnClient, string compartmentId)
        {
            // Find the Vcn in a specific compartment
            var listVcnsRequest = new ListVcnsRequest
            {
                CompartmentId = compartmentId,
                DisplayName   = VcnName
            };
            var listVcnsResponse = await vcnClient.ListVcns(listVcnsRequest);

            if (listVcnsResponse.Items.Count != 1)
            {
                logger.Error($"Could not find unique VCN with name: {VcnName} in compartment: {compartmentId}");
                return(null);
            }

            return(listVcnsResponse.Items[0]);
        }