// 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("Fri Apr 08 00:17:54 UTC 2044"),
timeLastDetectedLessThanOrEqualTo: new Date("Thu Feb 20 05:57:24 UTC 2003"),
timeFirstDetectedGreaterThanOrEqualTo: new Date("Sat Jan 11 10:43:52 UTC 2020"),
timeFirstDetectedLessThanOrEqualTo: new Date("Thu Jan 30 02:31:44 UTC 2025"),
lifecycleDetail: cloudguard.models.ProblemLifecycleDetail.Deleted,
lifecycleState: cloudguard.models.ProblemLifecycleState.Inactive,
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.Accessible,
resourceId: "ocid1.test.oc1..<unique_ID>EXAMPLE-resourceId-Value",
limit: 345,
page: "EXAMPLE-page-Value",
sortOrder: cloudguard.models.SortOrders.Desc,
sortBy: cloudguard.requests.ListProblemsRequest.SortBy.RiskLevel,
opcRequestId: "7RWUIVJBL4NFSP5O8TRF<unique_ID>",
};
// Send request to the Client.
const listProblemsResponse = await client.listProblems(listProblemsRequest);
}
catch (error) {
console.log("listProblems Failed with error " + error);
}
})();