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

    // Create a request and dependent object(s).
    const createExternalPublicationDetails = {
      applicationId: "ocid1.test.oc1..<unique_ID>EXAMPLE-applicationId-Value",
      applicationCompartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-applicationCompartmentId-Value",
      displayName: "EXAMPLE-displayName-Value",
      description: "EXAMPLE-description-Value",
      resourceConfiguration: {
        sparkVersion: "EXAMPLE-sparkVersion-Value",
        driverShape: "EXAMPLE-driverShape-Value",
        executorShape: "EXAMPLE-executorShape-Value",
        totalExecutors: 385
      },
      configurationDetails: {
        dataAsset: {
          modelType: "LAKE_DATA_ASSET",
          lakeId: "ocid1.test.oc1..<unique_ID>EXAMPLE-lakeId-Value",
          metastoreId: "ocid1.test.oc1..<unique_ID>EXAMPLE-metastoreId-Value",
          lakeProxyEndpoint: "EXAMPLE-lakeProxyEndpoint-Value",
          defaultConnection: {
            modelType: "LAKE_CONNECTION",
            key: "EXAMPLE-key-Value",
            modelVersion: "EXAMPLE-modelVersion-Value",
            parentRef: {
              parent: "EXAMPLE-parent-Value",
              rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
            },
            name: "EXAMPLE-name-Value",
            description: "EXAMPLE-description-Value",
            objectVersion: 561,
            objectStatus: 224,
            identifier: "EXAMPLE-identifier-Value",
            primarySchema: {
              key: "EXAMPLE-key-Value",
              modelType: "EXAMPLE-modelType-Value",
              modelVersion: "EXAMPLE-modelVersion-Value",
              parentRef: {
                parent: "EXAMPLE-parent-Value",
                rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
              },
              name: "EXAMPLE-name-Value",
              resourceName: "EXAMPLE-resourceName-Value",
              description: "EXAMPLE-description-Value",
              objectVersion: 868,
              externalKey: "EXAMPLE-externalKey-Value",
              isHasContainers: false,
              defaultConnection: "EXAMPLE-defaultConnection-Value",
              objectStatus: 270,
              identifier: "EXAMPLE-identifier-Value",
              metadata: {
                createdBy: "EXAMPLE-createdBy-Value",
                createdByName: "EXAMPLE-createdByName-Value",
                updatedBy: "EXAMPLE-updatedBy-Value",
                updatedByName: "EXAMPLE-updatedByName-Value",
                timeCreated: new Date("Sun Aug 27 23:38:40 UTC 2045"),
                timeUpdated: new Date("Sat Mar 24 12:38:31 UTC 2012"),
                aggregatorKey: "EXAMPLE-aggregatorKey-Value",
                aggregator: {
                  type: "EXAMPLE-type-Value",
                  key: "EXAMPLE-key-Value",
                  name: "EXAMPLE-name-Value",
                  identifier: "EXAMPLE-identifier-Value",
                  description: "EXAMPLE-description-Value"
                },
                identifierPath: "EXAMPLE-identifierPath-Value",
                infoFields: {
                  EXAMPLE_KEY_2gLfR: "EXAMPLE_VALUE_Ui5SvOe5DFkfNIG1lhPG"
                },
                registryVersion: 708,
                labels: ["EXAMPLE--Value"],
                isFavorite: false,
                countStatistics: {
                  objectTypeCountList: [
                    {
                      objectType: dataintegration.models.CountStatisticSummary.ObjectType.Folder,
                      objectCount: 888
                    }
                  ]
                }
              }
            },
            connectionProperties: [
              {
                name: "EXAMPLE-name-Value",
                value: "EXAMPLE-value-Value"
              }
            ],
            isDefault: false,
            metadata: {
              createdBy: "EXAMPLE-createdBy-Value",
              createdByName: "EXAMPLE-createdByName-Value",
              updatedBy: "EXAMPLE-updatedBy-Value",
              updatedByName: "EXAMPLE-updatedByName-Value",
              timeCreated: new Date("Mon Aug 02 19:44:01 UTC 2049"),
              timeUpdated: new Date("Wed Jan 09 09:03:01 UTC 2036"),
              aggregatorKey: "EXAMPLE-aggregatorKey-Value",
              aggregator: {
                type: "EXAMPLE-type-Value",
                key: "EXAMPLE-key-Value",
                name: "EXAMPLE-name-Value",
                identifier: "EXAMPLE-identifier-Value",
                description: "EXAMPLE-description-Value"
              },
              identifierPath: "EXAMPLE-identifierPath-Value",
              infoFields: {
                EXAMPLE_KEY_M8HX4: "EXAMPLE_VALUE_JWEzOYn00twQJlj477Rh"
              },
              registryVersion: 868,
              labels: ["EXAMPLE--Value"],
              isFavorite: false,
              countStatistics: {
                objectTypeCountList: [
                  {
                    objectType:
                      dataintegration.models.CountStatisticSummary.ObjectType.FunctionLibrary,
                    objectCount: 567
                  }
                ]
              }
            }
          },
          key: "EXAMPLE-key-Value",
          modelVersion: "EXAMPLE-modelVersion-Value",
          name: "EXAMPLE-name-Value",
          description: "EXAMPLE-description-Value",
          objectStatus: 399,
          identifier: "EXAMPLE-identifier-Value",
          externalKey: "EXAMPLE-externalKey-Value",
          assetProperties: {
            EXAMPLE_KEY_1ogaP: "EXAMPLE_VALUE_ClhRJcskNobq4ut85guE"
          },
          nativeTypeSystem: {
            key: "EXAMPLE-key-Value",
            modelType: "EXAMPLE-modelType-Value",
            modelVersion: "EXAMPLE-modelVersion-Value",
            parentRef: {
              parent: "EXAMPLE-parent-Value",
              rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
            },
            name: "EXAMPLE-name-Value",
            description: "EXAMPLE-description-Value",
            objectVersion: 780,
            typeMappingTo: {
              EXAMPLE_KEY_JpsFo: "EXAMPLE_VALUE_j8o4h0PRKrup8Dm7CdYn"
            },
            typeMappingFrom: {
              EXAMPLE_KEY_B8YlJ: "EXAMPLE_VALUE_eV0mqo9ksYMBO4Aqv1qr"
            },
            objectStatus: 944,
            identifier: "EXAMPLE-identifier-Value",
            types: [
              {
                modelType: "DATA_TYPE",
                dtType: dataintegration.models.DataType.DtType.Structured,
                typeSystemName: "EXAMPLE-typeSystemName-Value",
                configDefinition: {
                  key: "EXAMPLE-key-Value",
                  modelType: "EXAMPLE-modelType-Value",
                  modelVersion: "EXAMPLE-modelVersion-Value",
                  parentRef: {
                    parent: "EXAMPLE-parent-Value",
                    rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                  },
                  name: "EXAMPLE-name-Value",
                  isContained: false,
                  objectStatus: 397,
                  configParameterDefinitions: {
                    EXAMPLE_KEY_QuhrE: {
                      parameterName: "EXAMPLE-parameterName-Value",
                      description: "EXAMPLE-description-Value",
                      defaultValue: "EXAMPLE-defaultValue-Value",
                      classFieldName: "EXAMPLE-classFieldName-Value",
                      isStatic: false,
                      isClassFieldValue: false
                    }
                  }
                },
                key: "EXAMPLE-key-Value",
                modelVersion: "EXAMPLE-modelVersion-Value",
                parentRef: {
                  parent: "EXAMPLE-parent-Value",
                  rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                },
                name: "EXAMPLE-name-Value",
                objectStatus: 534,
                description: "EXAMPLE-description-Value"
              }
            ]
          },
          objectVersion: 816,
          parentRef: {
            parent: "EXAMPLE-parent-Value",
            rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
          },
          metadata: {
            createdBy: "EXAMPLE-createdBy-Value",
            createdByName: "EXAMPLE-createdByName-Value",
            updatedBy: "EXAMPLE-updatedBy-Value",
            updatedByName: "EXAMPLE-updatedByName-Value",
            timeCreated: new Date("Fri Apr 03 19:06:25 UTC 2026"),
            timeUpdated: new Date("Sat Nov 21 22:08:08 UTC 2043"),
            aggregatorKey: "EXAMPLE-aggregatorKey-Value",
            aggregator: {
              type: "EXAMPLE-type-Value",
              key: "EXAMPLE-key-Value",
              name: "EXAMPLE-name-Value",
              identifier: "EXAMPLE-identifier-Value",
              description: "EXAMPLE-description-Value"
            },
            identifierPath: "EXAMPLE-identifierPath-Value",
            infoFields: {
              EXAMPLE_KEY_YJbnt: "EXAMPLE_VALUE_LbDo2avBQYJywkQsti2C"
            },
            registryVersion: 515,
            labels: ["EXAMPLE--Value"],
            isFavorite: false,
            countStatistics: {
              objectTypeCountList: [
                {
                  objectType: dataintegration.models.CountStatisticSummary.ObjectType.Connection,
                  objectCount: 931
                }
              ]
            }
          },
          keyMap: {
            EXAMPLE_KEY_PpzLp: "EXAMPLE_VALUE_LbsRAWO6hzWZCebyBeV5"
          }
        },
        connection: {
          modelType: "AMAZON_S3_CONNECTION",
          accessKey: {
            secretConfig: {
              modelType: "OCI_VAULT_SECRET_CONFIG",
              secretId: "ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"
            },
            value: "EXAMPLE-value-Value"
          },
          secretKey: {
            secretConfig: {
              modelType: "OCI_VAULT_SECRET_CONFIG",
              secretId: "ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"
            },
            value: "EXAMPLE-value-Value"
          },
          key: "EXAMPLE-key-Value",
          modelVersion: "EXAMPLE-modelVersion-Value",
          parentRef: {
            parent: "EXAMPLE-parent-Value",
            rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
          },
          name: "EXAMPLE-name-Value",
          description: "EXAMPLE-description-Value",
          objectVersion: 587,
          objectStatus: 617,
          identifier: "EXAMPLE-identifier-Value",
          primarySchema: {
            key: "EXAMPLE-key-Value",
            modelType: "EXAMPLE-modelType-Value",
            modelVersion: "EXAMPLE-modelVersion-Value",
            parentRef: {
              parent: "EXAMPLE-parent-Value",
              rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
            },
            name: "EXAMPLE-name-Value",
            resourceName: "EXAMPLE-resourceName-Value",
            description: "EXAMPLE-description-Value",
            objectVersion: 134,
            externalKey: "EXAMPLE-externalKey-Value",
            isHasContainers: true,
            defaultConnection: "EXAMPLE-defaultConnection-Value",
            objectStatus: 624,
            identifier: "EXAMPLE-identifier-Value",
            metadata: {
              createdBy: "EXAMPLE-createdBy-Value",
              createdByName: "EXAMPLE-createdByName-Value",
              updatedBy: "EXAMPLE-updatedBy-Value",
              updatedByName: "EXAMPLE-updatedByName-Value",
              timeCreated: new Date("Wed Oct 03 20:05:13 UTC 2018"),
              timeUpdated: new Date("Thu Jan 30 10:21:40 UTC 2025"),
              aggregatorKey: "EXAMPLE-aggregatorKey-Value",
              aggregator: {
                type: "EXAMPLE-type-Value",
                key: "EXAMPLE-key-Value",
                name: "EXAMPLE-name-Value",
                identifier: "EXAMPLE-identifier-Value",
                description: "EXAMPLE-description-Value"
              },
              identifierPath: "EXAMPLE-identifierPath-Value",
              infoFields: {
                EXAMPLE_KEY_ZWr7l: "EXAMPLE_VALUE_MKhiKVPd5soszfkk9ous"
              },
              registryVersion: 690,
              labels: ["EXAMPLE--Value"],
              isFavorite: true,
              countStatistics: {
                objectTypeCountList: [
                  {
                    objectType:
                      dataintegration.models.CountStatisticSummary.ObjectType.FunctionLibrary,
                    objectCount: 658
                  }
                ]
              }
            }
          },
          connectionProperties: [
            {
              name: "EXAMPLE-name-Value",
              value: "EXAMPLE-value-Value"
            }
          ],
          isDefault: false,
          metadata: {
            createdBy: "EXAMPLE-createdBy-Value",
            createdByName: "EXAMPLE-createdByName-Value",
            updatedBy: "EXAMPLE-updatedBy-Value",
            updatedByName: "EXAMPLE-updatedByName-Value",
            timeCreated: new Date("Mon Oct 26 22:44:04 UTC 2015"),
            timeUpdated: new Date("Wed Sep 24 00:36:12 UTC 2003"),
            aggregatorKey: "EXAMPLE-aggregatorKey-Value",
            aggregator: {
              type: "EXAMPLE-type-Value",
              key: "EXAMPLE-key-Value",
              name: "EXAMPLE-name-Value",
              identifier: "EXAMPLE-identifier-Value",
              description: "EXAMPLE-description-Value"
            },
            identifierPath: "EXAMPLE-identifierPath-Value",
            infoFields: {
              EXAMPLE_KEY_08u1f: "EXAMPLE_VALUE_f4GMD6jAkYyI1yRdL0nA"
            },
            registryVersion: 501,
            labels: ["EXAMPLE--Value"],
            isFavorite: false,
            countStatistics: {
              objectTypeCountList: [
                {
                  objectType: dataintegration.models.CountStatisticSummary.ObjectType.Folder,
                  objectCount: 19
                }
              ]
            }
          },
          keyMap: {
            EXAMPLE_KEY_7iCp2: "EXAMPLE_VALUE_NsPeCVBCoXUgSgHq7LWR"
          }
        },
        compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
        schema: {
          key: "EXAMPLE-key-Value",
          modelType: "EXAMPLE-modelType-Value",
          modelVersion: "EXAMPLE-modelVersion-Value",
          parentRef: {
            parent: "EXAMPLE-parent-Value",
            rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
          },
          name: "EXAMPLE-name-Value",
          resourceName: "EXAMPLE-resourceName-Value",
          description: "EXAMPLE-description-Value",
          objectVersion: 545,
          externalKey: "EXAMPLE-externalKey-Value",
          isHasContainers: true,
          defaultConnection: "EXAMPLE-defaultConnection-Value",
          objectStatus: 90,
          identifier: "EXAMPLE-identifier-Value",
          metadata: {
            createdBy: "EXAMPLE-createdBy-Value",
            createdByName: "EXAMPLE-createdByName-Value",
            updatedBy: "EXAMPLE-updatedBy-Value",
            updatedByName: "EXAMPLE-updatedByName-Value",
            timeCreated: new Date("Thu Aug 21 01:54:14 UTC 2031"),
            timeUpdated: new Date("Sun Dec 01 09:15:49 UTC 2024"),
            aggregatorKey: "EXAMPLE-aggregatorKey-Value",
            aggregator: {
              type: "EXAMPLE-type-Value",
              key: "EXAMPLE-key-Value",
              name: "EXAMPLE-name-Value",
              identifier: "EXAMPLE-identifier-Value",
              description: "EXAMPLE-description-Value"
            },
            identifierPath: "EXAMPLE-identifierPath-Value",
            infoFields: {
              EXAMPLE_KEY_DrKaW: "EXAMPLE_VALUE_crj6bvi9ICS5dlyj173Z"
            },
            registryVersion: 491,
            labels: ["EXAMPLE--Value"],
            isFavorite: false,
            countStatistics: {
              objectTypeCountList: [
                {
                  objectType: dataintegration.models.CountStatisticSummary.ObjectType.Project,
                  objectCount: 774
                }
              ]
            }
          }
        }
      }
    };

    const createExternalPublicationRequest: dataintegration.requests.CreateExternalPublicationRequest = {
      workspaceId: "ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value",
      taskKey: "EXAMPLE-taskKey-Value",
      createExternalPublicationDetails: createExternalPublicationDetails,
      opcRequestId: "SCQFGVFXAE4U4FESRDAF<unique_ID>",
      opcRetryToken: "EXAMPLE-opcRetryToken-Value"
    };

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