public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonElasticMapReduceConfig config = new AmazonElasticMapReduceConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonElasticMapReduceClient client = new AmazonElasticMapReduceClient(creds, config); ListInstancesResponse resp = new ListInstancesResponse(); do { ListInstancesRequest req = new ListInstancesRequest { Marker = resp.Marker }; resp = client.ListInstances(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Instances) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.Marker)); }
private static void listInstance(KafkaClient client) { var req = new ListInstancesRequest { Engine = ListInstancesRequest.EngineEnum.KAFKA, }; try { var resp = client.ListInstances(req); Console.WriteLine(resp.GetHttpBody()); } catch (RequestTimeoutException requestTimeoutException) { Console.WriteLine(requestTimeoutException.ErrorMessage); } catch (ServiceResponseException clientRequestException) { Console.WriteLine(clientRequestException.HttpStatusCode); Console.WriteLine(clientRequestException.ErrorCode); Console.WriteLine(clientRequestException.ErrorMsg); } catch (ConnectionException connectionException) { Console.WriteLine(connectionException.ErrorMessage); } }
protected override void ProcessRecord() { base.ProcessRecord(); ListInstancesRequest request; try { request = new ListInstancesRequest { CompartmentId = CompartmentId, AvailabilityDomain = AvailabilityDomain, DisplayName = DisplayName, Limit = Limit, Page = Page, SortBy = SortBy, SortOrder = SortOrder, LifecycleState = LifecycleState }; IEnumerable <ListInstancesResponse> responses = GetRequestDelegate().Invoke(request); foreach (var item in responses) { response = item; WriteOutput(response, response.Items, true); } FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// Deletes 10 oldest instances if the number of instances is more than 14. /// This is to clean up the stale instances in case of instance cleanup code may not get triggered. /// </summary> private async Task DeleteStaleInstancesAsync() { InstanceAdminClient instanceAdminClient = InstanceAdminClient.Create(); var listInstancesRequest = new ListInstancesRequest { Filter = "name:my-instance-processing-units- OR name:my-instance-multi-region-", ParentAsProjectName = ProjectName.FromProject(ProjectId) }; var instances = instanceAdminClient.ListInstances(listInstancesRequest); if (instances.Count() < 15) { return; } var instancesToDelete = instances .OrderBy(db => long.TryParse( db.InstanceName.InstanceId.Replace("my-instance-processing-units-", "") .Replace("my-instance-multi-region-", ""), out long creationDate) ? creationDate : long.MaxValue) .Take(10); // Delete the instances. foreach (var instance in instancesToDelete) { try { await instanceAdminClient.DeleteInstanceAsync(instance.InstanceName); } catch (Exception) { } } }
/// <inheritdoc/> public async Task <object> GetStatusAsync(INacosRegistration registration) { if (registration == null) { throw new ArgumentNullException(nameof(registration)); } var request = new ListInstancesRequest() { ServiceName = registration.ServiceId, Clusters = registration.ClusterName }; var result = await _nacosClient.ListInstancesAsync(request); //ListInstancesResult result = Task.Run(async () => //{ // return //}).Result; foreach (Host check in result.Hosts) { if (check.Ip.Equals(registration.Host)) { if (check.Healthy == false) { return(OUT_OF_SERVICE); } } } return(UP); }
/// <summary> /// Deletes 10 oldest instances if the number of instances is more than 14. /// This is to clean up the stale instances in case of instance cleanup code may not get triggered. /// </summary> private async Task DeleteStaleInstancesAsync() { InstanceAdminClient instanceAdminClient = InstanceAdminClient.Create(); var listInstancesRequest = new ListInstancesRequest { Filter = "name:my-instance-processing-units- OR name:my-instance-multi-region-", ParentAsProjectName = ProjectName.FromProject(ProjectId) }; var instances = instanceAdminClient.ListInstances(listInstancesRequest); if (instances.Count() < 15) { return; } long fiveHoursAgo = DateTimeOffset.UtcNow.AddHours(-5).ToUnixTimeMilliseconds(); var instancesToDelete = instances .Select(db => (db, CreationUnixTimeMilliseconds(db))) .Where(pair => pair.Item2 < fiveHoursAgo) .Select(pair => pair.db); // Delete the instances. foreach (var instance in instancesToDelete) { try { await instanceAdminClient.DeleteInstanceAsync(instance.InstanceName); } catch (Exception) { } }
/// <summary> /// Initiates the asynchronous execution of the ListInstances operation. /// <seealso cref="Amazon.ElasticMapReduce.IAmazonElasticMapReduce"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListInstances operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task <ListInstancesResponse> ListInstancesAsync(ListInstancesRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ListInstancesRequestMarshaller(); var unmarshaller = ListInstancesResponseUnmarshaller.Instance; return(Invoke <IRequest, ListInstancesRequest, ListInstancesResponse>(request, marshaller, unmarshaller, signer, cancellationToken)); }
public InstancesReader(InputContext context, IRowFactory rowFactory) { _context = context; _rowFactory = rowFactory; _client = new AmazonConnectClient(); CheckFieldTypes(); _request = new ListInstancesRequest(); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonConnectConfig config = new AmazonConnectConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonConnectClient client = new AmazonConnectClient(creds, config); ListInstancesResponse resp = new ListInstancesResponse(); do { ListInstancesRequest req = new ListInstancesRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListInstances(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.InstanceSummaryList) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
public async Task <IList <Instance> > ListZoneInstancesAsync(string projectId = "your-project-id", string zone = "us-central1-a") { // Initialize the client that will be used to send instance-related requests. // You should reuse the same client for multiple requests. InstancesClient client = await InstancesClient.CreateAsync(); InstanceList instanceList; IList <Instance> allInstances = new List <Instance>(); // Make the requests to list all VM instances. ListInstancesRequest request = new ListInstancesRequest { Project = projectId, Zone = zone, }; do { instanceList = await client.ListAsync(request); // The result is an Instance collection. foreach (var instance in instanceList.Items) { Console.WriteLine($"-- Name: {instance.Name}"); allInstances.Add(instance); } // Use the NextPageToken value on the request result to make subsequent requests // until all instances have been listed. request.PageToken = instanceList.NextPageToken; // When all instances are listed the last result NextPageToken is not set. } while (instanceList.HasNextPageToken); return(allInstances); }
internal ListInstancesResponse ListInstances(ListInstancesRequest request) { var marshaller = new ListInstancesRequestMarshaller(); var unmarshaller = ListInstancesResponseUnmarshaller.Instance; return(Invoke <ListInstancesRequest, ListInstancesResponse>(request, marshaller, unmarshaller)); }
/// <summary> /// Initiates the asynchronous execution of the ListInstances operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListInstances operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/servicediscovery-2017-03-14/ListInstances">REST API Reference for ListInstances Operation</seealso> public virtual Task <ListInstancesResponse> ListInstancesAsync(ListInstancesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = ListInstancesRequestMarshaller.Instance; var unmarshaller = ListInstancesResponseUnmarshaller.Instance; return(InvokeAsync <ListInstancesRequest, ListInstancesResponse>(request, marshaller, unmarshaller, cancellationToken)); }
internal virtual ListInstancesResponse ListInstances(ListInstancesRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = ListInstancesRequestMarshaller.Instance; options.ResponseUnmarshaller = ListInstancesResponseUnmarshaller.Instance; return(Invoke <ListInstancesResponse>(request, options)); }
/// <summary> /// Initiates the asynchronous execution of the ListInstances operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListInstances operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/servicediscovery-2017-03-14/ListInstances">REST API Reference for ListInstances Operation</seealso> public virtual Task <ListInstancesResponse> ListInstancesAsync(ListInstancesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = ListInstancesRequestMarshaller.Instance; options.ResponseUnmarshaller = ListInstancesResponseUnmarshaller.Instance; return(InvokeAsync <ListInstancesResponse>(request, options, cancellationToken)); }
/// <summary> /// 查询所有实例列表 /// </summary> public async Task <ListInstancesResponse> ListInstancesAsync(ListInstancesRequest listInstancesRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); string urlPath = HttpUtils.AddUrlPath("/v2/{project_id}/instances", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json", listInstancesRequest); HttpResponseMessage response = await DoHttpRequestAsync("GET", request); return(JsonUtils.DeSerialize <ListInstancesResponse>(response)); }
/// <summary> /// 根据指定条件查询实例列表 /// </summary> public ListInstancesResponse ListInstances(ListInstancesRequest listInstancesRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); string urlPath = HttpUtils.AddUrlPath("/v3/{project_id}/instances", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, listInstancesRequest); SdkResponse response = DoHttpRequest("GET", request); return(JsonUtils.DeSerialize <ListInstancesResponse>(response)); }
public async Task ListInstances_Should_Succeed() { var request = new ListInstancesRequest { ServiceName = "testservice", }; var res = await _namingClient.ListInstancesAsync(request); Assert.NotNull(res); }
private static async Task LoadInstances(Compartment compartment, IComputeClientAsync computeClientAsync) { var listInstancesRequest = new ListInstancesRequest() { CompartmentId = compartment.Id }; var getInstansTask = await computeClientAsync.ListInstances(listInstancesRequest); foreach (var instance in getInstansTask.Items) { Console.WriteLine($"loaded Instance: {instance.DisplayName} - compartment:{compartment.Name}"); } }
/// <summary>Snippet for ListInstances</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void ListInstancesRequestObject() { // Create client BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.Create(); // Initialize request argument(s) ListInstancesRequest request = new ListInstancesRequest { ParentAsProjectName = ProjectName.FromProject("[PROJECT]"), PageToken = "", }; // Make the request ListInstancesResponse response = bigtableInstanceAdminClient.ListInstances(request); }
/// <summary>Snippet for ListInstancesAsync</summary> public async Task ListInstancesRequestObjectAsync() { // Snippet: ListInstancesAsync(ListInstancesRequest, CallSettings) // Create client DataFusionClient dataFusionClient = await DataFusionClient.CreateAsync(); // Initialize request argument(s) ListInstancesRequest request = new ListInstancesRequest { Parent = "", Filter = "", OrderBy = "", }; // Make the request PagedAsyncEnumerable <ListInstancesResponse, Instance> response = dataFusionClient.ListInstancesAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Instance item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((ListInstancesResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Instance item in page) { // Do something with each item Console.WriteLine(item); } }); // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Instance> singlePage = await response.ReadPageAsync(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Instance item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
internal ListInstancesResponse ListInstances(ListInstancesRequest request) { var task = ListInstancesAsync(request); try { return(task.Result); } catch (AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return(null); } }
/// <summary>Snippet for ListInstances</summary> public void ListInstances_RequestObject() { // Snippet: ListInstances(ListInstancesRequest,CallSettings) // Create client BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.Create(); // Initialize request argument(s) ListInstancesRequest request = new ListInstancesRequest { ParentAsProjectName = new ProjectName("[PROJECT]"), }; // Make the request ListInstancesResponse response = bigtableInstanceAdminClient.ListInstances(request); // End snippet }
/// <summary>Snippet for ListInstances</summary> public void ListInstancesRequestObject() { // Snippet: ListInstances(ListInstancesRequest, CallSettings) // Create client DataFusionClient dataFusionClient = DataFusionClient.Create(); // Initialize request argument(s) ListInstancesRequest request = new ListInstancesRequest { ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"), Filter = "", OrderBy = "", }; // Make the request PagedEnumerable <ListInstancesResponse, Instance> response = dataFusionClient.ListInstances(request); // Iterate over all response items, lazily performing RPCs as required foreach (Instance item in response) { // Do something with each item Console.WriteLine(item); } // Or iterate over pages (of server-defined size), performing one RPC per page foreach (ListInstancesResponse page in response.AsRawResponses()) { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Instance item in page) { // Do something with each item Console.WriteLine(item); } } // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Instance> singlePage = response.ReadPage(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Instance item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
/// <summary> /// Lists the instances in the specified compartment and the specified availability domain. /// You can filter the results by specifying an instance name (the list will include all the identically-named /// instances in the compartment). /// </summary> /// <param name="listRequest"></param> /// <returns></returns> public async Task <ListInstancesResponse> ListInstances(ListInstancesRequest listRequest) { var uri = new Uri($"{GetEndPoint(CoreServices.Instance, this.Region)}?{listRequest.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 ListInstancesResponse() { Items = this.JsonSerializer.Deserialize <List <Instance> >(response), OpcRequestId = webResponse.Headers.Get("opc-request-id"), OpcNextPage = webResponse.Headers.Get("opc-next-page") }); } }
/// <summary> /// 查询实例列表 /// </summary> public static void ListInstance(DdsClient client) { ListInstancesRequest req = new ListInstancesRequest { Id = "04ada470884e4c2190face9a624c1608in10" }; try { ListInstancesResponse resp = client.ListInstances(req); Console.WriteLine(resp.TotalCount); foreach (var instance in resp.Instances) { Console.WriteLine(instance.Id); Console.WriteLine(instance.Datastore.Version); foreach (var group in instance.Groups) { Console.WriteLine(group.Id); foreach (var node in group.Nodes) { Console.WriteLine(node.Id); } } } Console.WriteLine("List Instance Success!"); } catch (RequestTimeoutException requestTimeoutException) { Console.WriteLine(requestTimeoutException.ErrorMessage); } catch (ServiceResponseException clientRequestException) { Console.WriteLine(clientRequestException.HttpStatusCode); Console.WriteLine(clientRequestException.ErrorCode); Console.WriteLine(clientRequestException.ErrorMsg); } catch (ConnectionException connectionException) { Console.WriteLine(connectionException.ErrorMessage); } }
public static object ListInstances() { // [START bigtable_create_bigtableInstanceAdminClient] BigtableInstanceAdminClient bigtableInstanceAdminClient = BigtableInstanceAdminClient.Create(); // [END bigtable_create_bigtableInstanceAdminClient] Console.WriteLine($"Listing Instances in the project {projectId}"); // [START bigtable_list_instances] // Lists instances in the project. // Initialize request argument(s). ListInstancesRequest listInstancesRequest = new ListInstancesRequest { ParentAsProjectName = new ProjectName(projectId) }; try { // Make a request. Console.WriteLine("Waiting for operation to complete..."); ListInstancesResponse instances = bigtableInstanceAdminClient.ListInstances(listInstancesRequest); // [END bigtable_list_instances] Console.WriteLine(new string('-', 50)); Console.WriteLine($"{"Instance Count:",-30}{instances.Instances.Count} instances in project {projectId}"); foreach (Instance inst in instances.Instances) { PrintInstanceInfo(inst); } // [START bigtable_list_instances] } catch (Exception ex) { Console.WriteLine($"Exception while requesting information about instances in {projectId} project"); Console.WriteLine(ex.Message); return(-1); } Console.WriteLine(new string('-', 50)); // [END bigtable_list_instances] return(0); }
public async Task <IList <Instance> > ListZoneInstancesAsync( // TODO(developer): Set your own default values for these parameters or pass different values when calling this method. string projectId = "your-project-id", string zone = "us-central1-a") { // Initialize client that will be used to send requests. This client only needs to be created // once, and can be reused for multiple requests. InstancesClient client = await InstancesClient.CreateAsync(); InstanceList instanceList; IList <Instance> allInstances = new List <Instance>(); // Make the request to list all VM instances in the given zone in the specified project. ListInstancesRequest request = new ListInstancesRequest { Project = projectId, Zone = zone, }; do { instanceList = await client.ListAsync(request); // The result is an Instance collection. foreach (var instance in instanceList.Items) { Console.WriteLine($"-- Name: {instance.Name}"); allInstances.Add(instance); } // Use the NextPageToken value on the request result to make subsequent requests // until all instances have been listed. request.PageToken = instanceList.NextPageToken; // When all instances are listed the last result NextPageToken is not set. } while (instanceList.HasNextPageToken); return(allInstances); }
public IList <IServiceInstance> GetInstances(string serviceId) { var request = new ListInstancesRequest() { ServiceName = serviceId }; ListInstancesResult result = Task.Run(async() => { return(await _client.ListInstancesAsync(request)); }).Result; IList <IServiceInstance> instances = new List <IServiceInstance>(); if (result == null && result.Hosts != null) { foreach (var host in result.Hosts) { instances.Add(new NacosServiceInstance(host)); } } return(instances); }
protected override void ProcessRecord() { base.ProcessRecord(); ListInstancesRequest request; try { request = new ListInstancesRequest { CompartmentId = CompartmentId, AvailabilityDomain = AvailabilityDomain, CapacityReservationId = CapacityReservationId, DisplayName = DisplayName, Limit = Limit, Page = Page, SortBy = SortBy, SortOrder = SortOrder, LifecycleState = LifecycleState }; IEnumerable <ListInstancesResponse> 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); } }
public static void MonitoringResourceExample(ClientConfig config) { // create client var identityClient = new IdentityClient(config); var computeClient = new ComputeClient(config); var monitoringClient = new MonitoringClient(config); var listCompartmenRequest = new ListCompartmentRequest() { CompartmentId = identityClient.Config.TenancyId, CompartmentIdInSubtree = true, AccessLevel = ListCompartmentRequest.AccessLevels.ACCESSIBLE, Limit = 10 }; // get compartment var listCompartment = identityClient.ListCompartment(listCompartmenRequest).Items; Console.WriteLine("* List Instance Metrics------------------------"); foreach (var compartment in listCompartment) { if (!compartment.IsAccessible.HasValue || !compartment.IsAccessible.Value) { continue; } var listInstanceRequest = new ListInstancesRequest() { CompartmentId = compartment.Id, Limit = 50, LifecycleState = ListInstancesRequest.LifecycleStates.RUNNING, SortOrder = SortOrder.ASC }; var now = DateTime.UtcNow.AddHours(-2); var endTime = DateTime.UtcNow; // get instance var listInstance = computeClient.ListInstances(listInstanceRequest).Items; foreach (var instance in listInstance) { Console.WriteLine($" |-{instance.DisplayName}------------"); // get all computeagent var listMetricsRequest = new ListMetricsRequest() { CompartmentId = compartment.Id, CompartmentIdInSubtree = compartment.CompartmentId == config.TenancyId, ListMetricsDetails = new ListMetricsDetails() { Namespace = "oci_computeagent", DimensionFilters = new DimensionFilter() { ResourceId = instance.Id } } }; // get Metrics try { var listMetrics = monitoringClient.ListMetrics(listMetricsRequest).Items; foreach (var metrics in listMetrics) { Console.WriteLine($"\t| Mertics: {metrics.Name}"); Console.WriteLine($"\t| NameSpace: {metrics.Namespace}"); // metric dimensions //Console.WriteLine($"\t| {metrics.Dimensions}".Replace("\n", "")); var summarizeMetricsDataRequest = new SummarizeMetricsDataRequest() { CompartmentId = compartment.Id, CompartmentIdInSubtree = compartment.CompartmentId == config.TenancyId, SummarizeMetricsDataDetails = new SummarizeMetricsDataDetails() { Namespace = metrics.Namespace, Query = metrics.Name + "[1h]{resourceId = \"" + instance.Id + "\"}.mean()", StartTime = now.ToString("yyyy-MM-ddThh:MM:ssZ"), EndTime = endTime.ToString("yyyy-MM-ddThh:MM:ssZ") } }; var SummarizeMetricsDatas = monitoringClient.SummarizeMetricsData(summarizeMetricsDataRequest).Items; foreach (var summaryData in SummarizeMetricsDatas) { foreach (var aggregatedDatapoint in summaryData.AggregatedDatapoints) { Console.WriteLine("\t| {"); Console.WriteLine($"\t| \tTimeStamp: {aggregatedDatapoint.Timestamp}"); Console.WriteLine($"\t| \tValue: {aggregatedDatapoint.Value}"); Console.WriteLine("\t| }"); } } } } catch (WebException we) { Console.WriteLine($"notfund:{we.Message}"); } } } Console.WriteLine("* List compartment Alarms------------------------"); foreach (var compartment in listCompartment) { Console.WriteLine(" Alarm status------------------------"); var listAlarmsStatusRequest = new ListAlarmsStatusRequest() { CompartmentId = compartment.Id, Limit = 1000 }; var alarmStatus = monitoringClient.ListAlarmsStatus(listAlarmsStatusRequest); if (alarmStatus.Items.Count > 0) { Console.WriteLine($" |-{compartment.Name}------------"); foreach (var alarm in alarmStatus.Items) { Console.WriteLine($"\tid:{alarm.Id}"); Console.WriteLine($"\tname:{alarm.DisplayName}"); Console.WriteLine($"\tstatus:{alarm.Status}"); Console.WriteLine($"\tseverity:{alarm.Severity}"); } } var listAlarmsRequest = new ListAlarmsRequest() { CompartmentId = compartment.Id, Limit = 10 }; Console.WriteLine(" Alarm logs------------------------"); var listAlarms = monitoringClient.ListAlarms(listAlarmsRequest); if (listAlarms.Items.Count > 0) { Console.WriteLine($" |-{compartment.Name}------------"); foreach (var alarm in listAlarms.Items) { Console.WriteLine($"\tid:{alarm.Id}"); Console.WriteLine($"\tname:{alarm.DisplayName}"); Console.WriteLine($"\tdestinations:{alarm.Destinations}"); Console.WriteLine($"\tenable:{alarm.IsEnabled}"); Console.WriteLine($"\tstate:{alarm.LifecycleState}"); var getAlarmHistoryRequest = new GetAlarmHistoryRequest() { AlarmId = alarm.Id, TimestampGreaterThanOrEqualTo = DateTime.UtcNow.ToString() }; var history = monitoringClient.GetAlarmHistory(getAlarmHistoryRequest); foreach (var his in history.AlarmHistoryCollection.Entries) { Console.WriteLine($"\t\t|-summary:{his.Summary}"); Console.WriteLine($"\t\t| timestamp:{his.Timestamp}"); Console.WriteLine($"\t\t| timestampTriggered:{his.TimestampTriggered}"); } } } // Transactions Per Second (TPS) per-tenancy limit for this operation: 1. System.Threading.Thread.Sleep(1000); } }