// 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.Collections.Generic;
using System.Threading.Tasks;
using Oci.CimsService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Cims
{
public class CreateIncidentExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var createIncident = new Oci.CimsService.Models.CreateIncident
{
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
Ticket = new Oci.CimsService.Models.CreateTicketDetails
{
Severity = Oci.CimsService.Models.CreateTicketDetails.SeverityEnum.Highest,
ResourceList = new List<Oci.CimsService.Models.CreateResourceDetails>
{
new Oci.CimsService.Models.CreateResourceDetails
{
Item = new Oci.CimsService.Models.CreateAccountItemDetails
{
Category = new Oci.CimsService.Models.CreateCategoryDetails
{
CategoryKey = "EXAMPLE-categoryKey-Value"
},
SubCategory = new Oci.CimsService.Models.CreateSubCategoryDetails
{
SubCategoryKey = "EXAMPLE-subCategoryKey-Value"
},
IssueType = new Oci.CimsService.Models.CreateIssueTypeDetails
{
IssueTypeKey = "EXAMPLE-issueTypeKey-Value"
},
Name = "EXAMPLE-name-Value"
},
Region = "EXAMPLE-region-Value"
}
},
Title = "EXAMPLE-title-Value",
Description = "EXAMPLE-description-Value",
ContextualData = new Oci.CimsService.Models.ContextualData
{
ClientId = "ocid1.test.oc1..<unique_ID>EXAMPLE-clientId-Value",
SchemaName = "EXAMPLE-schemaName-Value",
SchemaVersion = "EXAMPLE-schemaVersion-Value",
Payload = "EXAMPLE-payload-Value"
}
},
Csi = "EXAMPLE-csi-Value",
UserGroupId = "ocid1.test.oc1..<unique_ID>EXAMPLE-userGroupId-Value",
ProblemType = Oci.CimsService.Models.ProblemType.Account,
Contacts = new List<Oci.CimsService.Models.Contact>
{
new Oci.CimsService.Models.Contact
{
ContactName = "EXAMPLE-contactName-Value",
ContactEmail = "EXAMPLE-contactEmail-Value",
Email = "EXAMPLE-email-Value",
ContactPhone = "EXAMPLE-contactPhone-Value",
ContactType = Oci.CimsService.Models.Contact.ContactTypeEnum.Manager
}
},
Referrer = "EXAMPLE-referrer-Value"
};
var createIncidentRequest = new Oci.CimsService.Requests.CreateIncidentRequest
{
CreateIncidentDetails = createIncident,
OpcRequestId = "52IARIXAI5AINWBWBHFH<unique_ID>",
Ocid = "EXAMPLE-ocid-Value",
Homeregion = "EXAMPLE-homeregion-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.CreateIncident(createIncidentRequest);
// Retrieve value from the response.
var keyValue = response.Incident.Key;
}
}
catch (Exception e)
{
Console.WriteLine($"CreateIncident Failed with {e.Message}");
throw e;
}
}
}
}