|
| 1 | +/* |
| 2 | + * NOTE: Generated using OracleSDKGenerator, API Version: 20190331 |
| 3 | + * DO NOT EDIT this file manually. |
| 4 | + * |
| 5 | + * Copyright (c) 2020, Oracle and/or its affiliates. |
| 6 | + * This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. |
| 7 | + */ |
| 8 | + |
| 9 | +using System; |
| 10 | +using System.Collections.Generic; |
| 11 | +using System.Linq; |
| 12 | +using System.Management.Automation; |
| 13 | +using Oci.AnalyticsService.Requests; |
| 14 | +using Oci.AnalyticsService.Responses; |
| 15 | +using Oci.AnalyticsService.Models; |
| 16 | + |
| 17 | +namespace Oci.AnalyticsService.Cmdlets |
| 18 | +{ |
| 19 | + [Cmdlet("Get", "OCIAnalyticsInstancesList")] |
| 20 | + [OutputType(new System.Type[] { typeof(Oci.AnalyticsService.Models.AnalyticsInstanceSummary), typeof(Oci.AnalyticsService.Responses.ListAnalyticsInstancesResponse) })] |
| 21 | + public class GetOCIAnalyticsInstancesList : OCIAnalyticsCmdlet |
| 22 | + { |
| 23 | + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = @"The OCID of the compartment.")] |
| 24 | + public string CompartmentId { get; set; } |
| 25 | + |
| 26 | + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = @"Unique identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.")] |
| 27 | + public string OpcRequestId { get; set; } |
| 28 | + |
| 29 | + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = @"A filter to return only resources that match the given name exactly.")] |
| 30 | + public string Name { get; set; } |
| 31 | + |
| 32 | + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = @"A filter to only return resources matching the capacity type enum. Values are case-insensitive.")] |
| 33 | + public System.Nullable<Oci.AnalyticsService.Models.CapacityType> CapacityType { get; set; } |
| 34 | + |
| 35 | + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = @"A filter to only return resources matching the feature set. Values are case-insensitive.")] |
| 36 | + public System.Nullable<Oci.AnalyticsService.Models.FeatureSet> FeatureSet { get; set; } |
| 37 | + |
| 38 | + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = @"A filter to only return resources matching the lifecycle state. The state value is case-insensitive.")] |
| 39 | + public System.Nullable<Oci.AnalyticsService.Models.AnalyticsInstanceLifecycleState> LifecycleState { get; set; } |
| 40 | + |
| 41 | + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = @"For list pagination. The maximum number of results per page, or items to return in a paginated ""List"" call. For important details about how pagination works, see [List Pagination](https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). |
| 42 | +
|
| 43 | +Example: `50`", ParameterSetName = LimitSet)] |
| 44 | + public System.Nullable<int> Limit { get; set; } |
| 45 | + |
| 46 | + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = @"For list pagination. The value of the `opc-next-page` response header from the previous ""List"" call. For important details about how pagination works, see [List Pagination](https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine).")] |
| 47 | + public string Page { get; set; } |
| 48 | + |
| 49 | + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = @"The field to sort by (one column only). Default sort order is ascending exception of `timeCreated` column (descending).")] |
| 50 | + public System.Nullable<Oci.AnalyticsService.Models.SortBy> SortBy { get; set; } |
| 51 | + |
| 52 | + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = @"The sort order to use, either ascending (`ASC`) or descending (`DESC`).")] |
| 53 | + public System.Nullable<Oci.AnalyticsService.Models.SortOrder> SortOrder { get; set; } |
| 54 | + |
| 55 | + [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = @"Fetches all pages of results.", ParameterSetName = AllPageSet)] |
| 56 | + public SwitchParameter All { get; set; } |
| 57 | + |
| 58 | + protected override void ProcessRecord() |
| 59 | + { |
| 60 | + base.ProcessRecord(); |
| 61 | + ListAnalyticsInstancesRequest request; |
| 62 | + |
| 63 | + try |
| 64 | + { |
| 65 | + request = new ListAnalyticsInstancesRequest |
| 66 | + { |
| 67 | + CompartmentId = CompartmentId, |
| 68 | + OpcRequestId = OpcRequestId, |
| 69 | + Name = Name, |
| 70 | + CapacityType = CapacityType, |
| 71 | + FeatureSet = FeatureSet, |
| 72 | + LifecycleState = LifecycleState, |
| 73 | + Limit = Limit, |
| 74 | + Page = Page, |
| 75 | + SortBy = SortBy, |
| 76 | + SortOrder = SortOrder |
| 77 | + }; |
| 78 | + IEnumerable<ListAnalyticsInstancesResponse> responses = GetRequestDelegate().Invoke(request); |
| 79 | + foreach (var item in responses) |
| 80 | + { |
| 81 | + response = item; |
| 82 | + WriteOutput(response, response.Items, true); |
| 83 | + } |
| 84 | + FinishProcessing(response); |
| 85 | + } |
| 86 | + catch (Exception ex) |
| 87 | + { |
| 88 | + TerminatingErrorDuringExecution(ex); |
| 89 | + } |
| 90 | + } |
| 91 | + |
| 92 | + protected override void StopProcessing() |
| 93 | + { |
| 94 | + base.StopProcessing(); |
| 95 | + TerminatingErrorDuringExecution(new OperationCanceledException("Cmdlet execution interrupted")); |
| 96 | + } |
| 97 | + |
| 98 | + private RequestDelegate GetRequestDelegate() |
| 99 | + { |
| 100 | + IEnumerable<ListAnalyticsInstancesResponse> DefaultRequest(ListAnalyticsInstancesRequest request) => Enumerable.Repeat(client.ListAnalyticsInstances(request).GetAwaiter().GetResult(), 1); |
| 101 | + if (ParameterSetName.Equals(AllPageSet)) |
| 102 | + { |
| 103 | + return req => client.Paginators.ListAnalyticsInstancesResponseEnumerator(req); |
| 104 | + } |
| 105 | + return DefaultRequest; |
| 106 | + } |
| 107 | + |
| 108 | + private ListAnalyticsInstancesResponse response; |
| 109 | + private delegate IEnumerable<ListAnalyticsInstancesResponse> RequestDelegate(ListAnalyticsInstancesRequest request); |
| 110 | + private const string AllPageSet = "AllPages"; |
| 111 | + private const string LimitSet = "Limit"; |
| 112 | + } |
| 113 | +} |
0 commit comments