// 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 logging from "oci-logging";
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 logging.LoggingManagementClient({ authenticationDetailsProvider: provider });
// Create a request and dependent object(s).
const createUnifiedAgentConfigurationDetails = {
displayName: "EXAMPLE-displayName-Value",
isEnabled: true,
serviceConfiguration: {
configurationType: "LOGGING", sources: [{
sourceType: "CUSTOM_PLUGIN", customPlugin: "EXAMPLE-customPlugin-Value",
name: "EXAMPLE-name-Value"
}
],
filter: [{
filterType: "GREP_FILTER", allowList: [{
key: "EXAMPLE-key-Value",
pattern: "EXAMPLE-pattern-Value",
}
],
denyList: [{
key: "EXAMPLE-key-Value",
pattern: "EXAMPLE-pattern-Value",
}
],
name: "EXAMPLE-name-Value"
}
],
destination: {
logObjectId: "ocid1.test.oc1..<unique_ID>EXAMPLE-logObjectId-Value",
operationalMetricsConfiguration: {
source: {
type: logging.models.OperationalMetricsSource.Type.UmaMetrics,
metrics: ["EXAMPLE--Value" ],
recordInput: {
namespace: "EXAMPLE-namespace-Value",
resourceGroup: "EXAMPLE-resourceGroup-Value",
}
,
}
,
destination: {
compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
}
,
}
,
}
}
,
definedTags: {
EXAMPLE_KEY_gA2WI :{
EXAMPLE_KEY_P9I4s :"EXAMPLE--Value"
}
},
freeformTags: {
EXAMPLE_KEY_XN3e0 :"EXAMPLE_VALUE_MiEQuyAbmuDh6hozfDt6"
},
compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
description: "EXAMPLE-description-Value",
groupAssociation: {
groupList: ["EXAMPLE--Value" ],
}
,
}
const createUnifiedAgentConfigurationRequest: logging.requests.CreateUnifiedAgentConfigurationRequest = {
createUnifiedAgentConfigurationDetails: createUnifiedAgentConfigurationDetails,
opcRequestId: "B9FODGJEXMNIVLGGL22D<unique_ID>",
opcRetryToken: "EXAMPLE-opcRetryToken-Value",
};
// Send request to the Client.
const createUnifiedAgentConfigurationResponse = await client.createUnifiedAgentConfiguration(createUnifiedAgentConfigurationRequest);
}
catch (error) {
console.log("createUnifiedAgentConfiguration Failed with error " + error);
}
})();