// This is an automatically generated code sample.
// To make this code sample work in your Oracle Cloud tenancy,
// please replace the values for any parameters whose current values do not fit
// your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
// boolean, number, and enum parameters with values not fitting your use case).
using System;
using System.Threading.Tasks;
using Oci.CimsService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Cims
{
public class ListIncidentsExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var listIncidentsRequest = new Oci.CimsService.Requests.ListIncidentsRequest
{
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
Csi = "EXAMPLE-csi-Value",
Limit = 784,
SortBy = Oci.CimsService.Models.SortBy.Severity,
SortOrder = Oci.CimsService.Models.SortOrder.Desc,
LifecycleState = Oci.CimsService.Models.LifecycleState.Active,
Page = "EXAMPLE-page-Value",
OpcRequestId = "ANMP5SIN6KDFLFKWHQ46<unique_ID>",
Ocid = "EXAMPLE-ocid-Value",
Homeregion = "EXAMPLE-homeregion-Value",
ProblemType = "EXAMPLE-problemType-Value",
Bearertokentype = "EXAMPLE-bearertokentype-Value",
Bearertoken = "EXAMPLE-bearertoken-Value",
Idtoken = "EXAMPLE-idtoken-Value",
Domainid = "EXAMPLE-domainid-Value"
};
// Create a default authentication provider that uses the DEFAULT
// profile in the configuration file.
// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
try
{
// Create a service client and send the request.
using (var client = new IncidentClient(provider, new ClientConfiguration()))
{
var response = await client.ListIncidents(listIncidentsRequest);
// Retrieve value from the response.
var incidentSummaryValueCount = response.Items.Count;
}
}
catch (Exception e)
{
Console.WriteLine($"ListIncidents Failed with {e.Message}");
throw e;
}
}
}
}