// 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 loganalytics from "oci-loganalytics";
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 loganalytics.LogAnalyticsClient({ authenticationDetailsProvider: provider });

     // Create a request and dependent object(s).
	const  createLogAnalyticsEntityDetails = {
		name: "EXAMPLE-name-Value",
		compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
		entityTypeName: "EXAMPLE-entityTypeName-Value",
		managementAgentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-managementAgentId-Value",
		cloudResourceId: "ocid1.test.oc1..<unique_ID>EXAMPLE-cloudResourceId-Value",
		timezoneRegion: "EXAMPLE-timezoneRegion-Value",
		hostname: "EXAMPLE-hostname-Value",
		sourceId: "ocid1.test.oc1..<unique_ID>EXAMPLE-sourceId-Value",
		properties: {
			EXAMPLE_KEY_lSRqr :"EXAMPLE_VALUE_WEsx7cugr4Im7jraXjCb"
			},
		freeformTags: {
			EXAMPLE_KEY_011mG :"EXAMPLE_VALUE_aPjzMlQtpJanAOjhlrFz"
			},
		definedTags: {
			EXAMPLE_KEY_za65d :{
				EXAMPLE_KEY_RSqMn :"EXAMPLE--Value"
				}
			},
		timeLastDiscovered: new Date("Thu Jan 18 22:37:46 UTC 2035"),
		metadata: {
			items: [{
					name: "EXAMPLE-name-Value",
					value: "EXAMPLE-value-Value",
					type: "EXAMPLE-type-Value",

					}
					],

			}
,

		}

	const createLogAnalyticsEntityRequest: loganalytics.requests.CreateLogAnalyticsEntityRequest = { 
	namespaceName: "EXAMPLE-namespaceName-Value",
	createLogAnalyticsEntityDetails: createLogAnalyticsEntityDetails,
	opcRetryToken: "EXAMPLE-opcRetryToken-Value",
	opcRequestId: "W0A3MA9QZ0XED7QALJUS<unique_ID>",

		}; 


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