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

    // Create a request and dependent object(s).
    const parseConnectionDetails = {
      connectionDetail: {
        key: "EXAMPLE-key-Value",
        description: "EXAMPLE-description-Value",
        displayName: "EXAMPLE-displayName-Value",
        timeCreated: new Date("Sun Nov 29 21:01:58 UTC 2020"),
        timeUpdated: new Date("Mon Feb 20 09:24:28 UTC 2017"),
        createdById: "ocid1.test.oc1..<unique_ID>EXAMPLE-createdById-Value",
        updatedById: "ocid1.test.oc1..<unique_ID>EXAMPLE-updatedById-Value",
        customPropertyMembers: [
          {
            key: "EXAMPLE-key-Value",
            displayName: "EXAMPLE-displayName-Value",
            description: "EXAMPLE-description-Value",
            value: "EXAMPLE-value-Value",
            dataType: datacatalog.models.CustomPropertyDataType.Boolean,
            namespaceName: "EXAMPLE-namespaceName-Value",
            namespaceKey: "EXAMPLE-namespaceKey-Value",
            isMultiValued: true,
            isHidden: true,
            isEditable: true,
            isShownInList: false,
            isEventEnabled: true,
            isListType: false,
            allowedValues: ["EXAMPLE--Value"]
          }
        ],
        properties: {
          EXAMPLE_KEY_lDbGc: {
            EXAMPLE_KEY_vWxi4: "EXAMPLE--Value"
          }
        },
        externalKey: "EXAMPLE-externalKey-Value",
        timeStatusUpdated: new Date("Sun May 18 06:20:31 UTC 2036"),
        lifecycleState: datacatalog.models.LifecycleState.Updating,
        isDefault: false,
        dataAssetKey: "EXAMPLE-dataAssetKey-Value",
        typeKey: "EXAMPLE-typeKey-Value",
        uri: "EXAMPLE-uri-Value"
      },
      connectionPayload: "some Byte data",
      walletSecretId: "ocid1.test.oc1..<unique_ID>EXAMPLE-walletSecretId-Value",
      walletSecretName: "EXAMPLE-walletSecretName-Value"
    };

    const parseConnectionRequest: datacatalog.requests.ParseConnectionRequest = {
      catalogId: "ocid1.test.oc1..<unique_ID>EXAMPLE-catalogId-Value",
      dataAssetKey: "EXAMPLE-dataAssetKey-Value",
      parseConnectionDetails: parseConnectionDetails,
      connectionKey: "EXAMPLE-connectionKey-Value",
      opcRequestId: "ZPYIGK1OZKV7ZXAH5L59<unique_ID>",
      opcRetryToken: "EXAMPLE-opcRetryToken-Value"
    };

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