// 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).

package main

import (
	"context"
	"fmt"

	"github.com/oracle/oci-go-sdk/v65/cims"
	"github.com/oracle/oci-go-sdk/v65/common"
	"github.com/oracle/oci-go-sdk/v65/example/helpers"
)

func ExampleCreateIncident() {
	// 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.
	client, err := cims.NewIncidentClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

	// Create a request and dependent object(s).

	req := cims.CreateIncidentRequest{CreateIncidentDetails: cims.CreateIncident{Csi: common.String("EXAMPLE-csi-Value"),
		ProblemType: cims.ProblemTypeTech,
		Referrer:    common.String("EXAMPLE-referrer-Value"),
		Ticket: &cims.CreateTicketDetails{Severity: cims.CreateTicketDetailsSeverityHighest,
			Title: common.String("EXAMPLE-title-Value"),
			ContextualData: &cims.ContextualData{ClientId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-clientId-Value"),
				Payload:       common.String("EXAMPLE-payload-Value"),
				SchemaName:    common.String("EXAMPLE-schemaName-Value"),
				SchemaVersion: common.String("EXAMPLE-schemaVersion-Value")},
			Description: common.String("EXAMPLE-description-Value"),
			ResourceList: []cims.CreateResourceDetails{cims.CreateResourceDetails{Region: common.String("EXAMPLE-region-Value"),
				Item: cims.CreateAccountItemDetails{Name: common.String("EXAMPLE-name-Value"),
					SubCategory: &cims.CreateSubCategoryDetails{SubCategoryKey: common.String("EXAMPLE-subCategoryKey-Value")},
					Category:    &cims.CreateCategoryDetails{CategoryKey: common.String("EXAMPLE-categoryKey-Value")},
					IssueType:   &cims.CreateIssueTypeDetails{IssueTypeKey: common.String("EXAMPLE-issueTypeKey-Value")}}}}},
		UserGroupId:   common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-userGroupId-Value"),
		CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
		Contacts: []cims.Contact{cims.Contact{ContactEmail: common.String("EXAMPLE-contactEmail-Value"),
			ContactName:  common.String("EXAMPLE-contactName-Value"),
			ContactPhone: common.String("EXAMPLE-contactPhone-Value"),
			ContactType:  cims.ContactContactTypeManager,
			Email:        common.String("EXAMPLE-email-Value")}}},
		Domainid:        common.String("EXAMPLE-domainid-Value"),
		Homeregion:      common.String("EXAMPLE-homeregion-Value"),
		Idtoken:         common.String("EXAMPLE-idtoken-Value"),
		Ocid:            common.String("EXAMPLE-ocid-Value"),
		OpcRequestId:    common.String("XIHOYMKQHNJSXBEBEAZG<unique_ID>"),
		Bearertoken:     common.String("EXAMPLE-bearertoken-Value"),
		Bearertokentype: common.String("EXAMPLE-bearertokentype-Value")}

	// Send the request using the service client
	resp, err := client.CreateIncident(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}