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

import * as cloudguard from "oci-cloudguard";
import common = require("oci-common");

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

const provider: common.ConfigFileAuthenticationDetailsProvider = new common.ConfigFileAuthenticationDetailsProvider();

(async () => {
  try {
    // Create a service client
    const client = new cloudguard.CloudGuardClient({ authenticationDetailsProvider: provider });

    // Create a request and dependent object(s).
    const listProblemsRequest: cloudguard.requests.ListProblemsRequest = {
      compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
      timeLastDetectedGreaterThanOrEqualTo: new Date("Tue Aug 22 22:02:39 UTC 2000"),
      timeLastDetectedLessThanOrEqualTo: new Date("Sat Dec 25 12:20:27 UTC 2049"),
      timeFirstDetectedGreaterThanOrEqualTo: new Date("Fri Jul 12 18:58:37 UTC 2013"),
      timeFirstDetectedLessThanOrEqualTo: new Date("Fri Oct 10 08:24:45 UTC 2031"),
      lifecycleDetail: cloudguard.models.ProblemLifecycleDetail.Resolved,
      lifecycleState: cloudguard.models.ProblemLifecycleState.Active,
      region: "EXAMPLE-region-Value",
      riskLevel: "EXAMPLE-riskLevel-Value",
      resourceType: "EXAMPLE-resourceType-Value",
      city: "EXAMPLE-city-Value",
      state: "EXAMPLE-state-Value",
      country: "EXAMPLE-country-Value",
      label: "EXAMPLE-label-Value",
      detectorRuleIdList: ["EXAMPLE--Value"],
      detectorType: cloudguard.models.DetectorEnum.IaasThreatDetector,
      targetId: "ocid1.test.oc1..<unique_ID>EXAMPLE-targetId-Value",
      problemCategory: cloudguard.models.ProblemCategoryEnum.SecurityZone,
      compartmentIdInSubtree: true,
      accessLevel: cloudguard.requests.ListProblemsRequest.AccessLevel.Restricted,
      resourceId: "ocid1.test.oc1..<unique_ID>EXAMPLE-resourceId-Value",
      limit: 694,
      page: "EXAMPLE-page-Value",
      sortOrder: cloudguard.models.SortOrders.Asc,
      sortBy: cloudguard.requests.ListProblemsRequest.SortBy.TimeLastDetected,
      opcRequestId: "QF0BJPHLFRVWYANIZLRF<unique_ID>"
    };

    // Send request to the Client.
    const listProblemsResponse = await client.listProblems(listProblemsRequest);
  } catch (error) {
    console.log("listProblems Failed with error  " + error);
  }
})();