// 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 updateExternalPublicationDetails = {
      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: 678
      },
      configurationDetails: {
        dataAsset: {
          modelType: "REST_DATA_ASSET",
          baseUrl: "EXAMPLE-baseUrl-Value",
          manifestFileContent: "EXAMPLE-manifestFileContent-Value",
          defaultConnection: {
            modelType: "REST_NO_AUTH_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: 202,
            objectStatus: 146,
            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: 769,
              externalKey: "EXAMPLE-externalKey-Value",
              isHasContainers: false,
              defaultConnection: "EXAMPLE-defaultConnection-Value",
              objectStatus: 733,
              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 Sep 26 04:20:03 UTC 2032"),
                timeUpdated: new Date("Tue Apr 01 20:15:36 UTC 2042"),
                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_fsstb: "EXAMPLE_VALUE_K0TaBPgdLRobIUB4nwsz"
                },
                registryVersion: 770,
                labels: ["EXAMPLE--Value"],
                isFavorite: false,
                countStatistics: {
                  objectTypeCountList: [
                    {
                      objectType:
                        dataintegration.models.CountStatisticSummary.ObjectType.Connection,
                      objectCount: 959
                    }
                  ]
                }
              }
            },
            connectionProperties: [
              {
                name: "EXAMPLE-name-Value",
                value: "EXAMPLE-value-Value"
              }
            ],
            isDefault: true,
            metadata: {
              createdBy: "EXAMPLE-createdBy-Value",
              createdByName: "EXAMPLE-createdByName-Value",
              updatedBy: "EXAMPLE-updatedBy-Value",
              updatedByName: "EXAMPLE-updatedByName-Value",
              timeCreated: new Date("Sat Jun 16 18:32:51 UTC 2040"),
              timeUpdated: new Date("Sun Oct 16 13:48:10 UTC 2033"),
              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_JQeQE: "EXAMPLE_VALUE_BusCnxTe1IJTLCUOAYmb"
              },
              registryVersion: 736,
              labels: ["EXAMPLE--Value"],
              isFavorite: true,
              countStatistics: {
                objectTypeCountList: [
                  {
                    objectType:
                      dataintegration.models.CountStatisticSummary.ObjectType.UserDefinedFunction,
                    objectCount: 802
                  }
                ]
              }
            }
          },
          key: "EXAMPLE-key-Value",
          modelVersion: "EXAMPLE-modelVersion-Value",
          name: "EXAMPLE-name-Value",
          description: "EXAMPLE-description-Value",
          objectStatus: 776,
          identifier: "EXAMPLE-identifier-Value",
          externalKey: "EXAMPLE-externalKey-Value",
          assetProperties: {
            EXAMPLE_KEY_g5Ag0: "EXAMPLE_VALUE_3PzQm26LOanmfInmRQ0J"
          },
          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: 756,
            typeMappingTo: {
              EXAMPLE_KEY_AZof9: "EXAMPLE_VALUE_fSk8vDuQMBXYM55HFT7o"
            },
            typeMappingFrom: {
              EXAMPLE_KEY_2f8yI: "EXAMPLE_VALUE_6FqMys327doVO2Xe1kb6"
            },
            objectStatus: 136,
            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: 380,
                  configParameterDefinitions: {
                    EXAMPLE_KEY_UU7xL: {
                      parameterType: {
                        modelType: "MAP_TYPE",
                        keyElementType: "EXAMPLE-keyElementType-Value",
                        valueElementType: "EXAMPLE-valueElementType-Value",
                        containsNull: 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: 471,
                        description: "EXAMPLE-description-Value"
                      },
                      parameterName: "EXAMPLE-parameterName-Value",
                      description: "EXAMPLE-description-Value",
                      defaultValue: "EXAMPLE-defaultValue-Value",
                      classFieldName: "EXAMPLE-classFieldName-Value",
                      isStatic: true,
                      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: 970,
                description: "EXAMPLE-description-Value"
              }
            ]
          },
          objectVersion: 74,
          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("Sat Jun 11 16:04:51 UTC 2033"),
            timeUpdated: new Date("Mon Mar 05 02:17:08 UTC 2018"),
            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_ttvN9: "EXAMPLE_VALUE_BqeEnr8VKcla9B825AP5"
            },
            registryVersion: 682,
            labels: ["EXAMPLE--Value"],
            isFavorite: true,
            countStatistics: {
              objectTypeCountList: [
                {
                  objectType:
                    dataintegration.models.CountStatisticSummary.ObjectType.UserDefinedFunction,
                  objectCount: 216
                }
              ]
            }
          },
          keyMap: {
            EXAMPLE_KEY_M1IHx: "EXAMPLE_VALUE_OVcHvxpYNaOf1LrW2vWO"
          }
        },
        connection: {
          modelType: "ORACLE_PEOPLESOFT_CONNECTION",
          username: "EXAMPLE-username-Value",
          password: "EXAMPLE-password-Value",
          passwordSecret: {
            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: 559,
          objectStatus: 189,
          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: 934,
            externalKey: "EXAMPLE-externalKey-Value",
            isHasContainers: true,
            defaultConnection: "EXAMPLE-defaultConnection-Value",
            objectStatus: 504,
            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 Mar 21 08:55:09 UTC 2035"),
              timeUpdated: new Date("Mon Feb 15 10:00:39 UTC 2049"),
              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_q4SxM: "EXAMPLE_VALUE_RemEkJ97eDGz8ArSfoMF"
              },
              registryVersion: 437,
              labels: ["EXAMPLE--Value"],
              isFavorite: false,
              countStatistics: {
                objectTypeCountList: [
                  {
                    objectType:
                      dataintegration.models.CountStatisticSummary.ObjectType.UserDefinedFunction,
                    objectCount: 584
                  }
                ]
              }
            }
          },
          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("Tue Apr 24 12:20:50 UTC 2029"),
            timeUpdated: new Date("Mon Nov 23 09:32:37 UTC 2015"),
            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_IuylQ: "EXAMPLE_VALUE_QNpgLD0WFroyoXvcSmAp"
            },
            registryVersion: 491,
            labels: ["EXAMPLE--Value"],
            isFavorite: false,
            countStatistics: {
              objectTypeCountList: [
                {
                  objectType: dataintegration.models.CountStatisticSummary.ObjectType.Folder,
                  objectCount: 437
                }
              ]
            }
          },
          keyMap: {
            EXAMPLE_KEY_Dx8xo: "EXAMPLE_VALUE_RnTl7w5V6McoH26wKxi6"
          }
        },
        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: 163,
          externalKey: "EXAMPLE-externalKey-Value",
          isHasContainers: false,
          defaultConnection: "EXAMPLE-defaultConnection-Value",
          objectStatus: 675,
          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 Nov 09 08:00:36 UTC 2031"),
            timeUpdated: new Date("Tue Nov 27 04:34:05 UTC 2046"),
            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_jfCvO: "EXAMPLE_VALUE_gNGXYF2GtJWGc03XDcKY"
            },
            registryVersion: 533,
            labels: ["EXAMPLE--Value"],
            isFavorite: false,
            countStatistics: {
              objectTypeCountList: [
                {
                  objectType: dataintegration.models.CountStatisticSummary.ObjectType.DataAsset,
                  objectCount: 335
                }
              ]
            }
          }
        }
      }
    };

    const updateExternalPublicationRequest: dataintegration.requests.UpdateExternalPublicationRequest = {
      workspaceId: "ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value",
      taskKey: "EXAMPLE-taskKey-Value",
      externalPublicationsKey: "EXAMPLE-externalPublicationsKey-Value",
      updateExternalPublicationDetails: updateExternalPublicationDetails,
      opcRequestId: "VNUHTGMJZHY7H0MDYYUQ<unique_ID>",
      ifMatch: "EXAMPLE-ifMatch-Value"
    };

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