// 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 updateUserDefinedFunctionDetails = {
      parentRef: {
        parent: "EXAMPLE-parent-Value",
        rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
      },
      name: "EXAMPLE-name-Value",
      identifier: "EXAMPLE-identifier-Value",
      modelVersion: "EXAMPLE-modelVersion-Value",
      objectVersion: 624,
      signatures: [
        {
          key: "EXAMPLE-key-Value",
          modelType: dataintegration.models.FunctionSignature.ModelType.DisFunctionSignature,
          modelVersion: "EXAMPLE-modelVersion-Value",
          parentRef: {
            parent: "EXAMPLE-parent-Value",
            rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
          },
          name: "EXAMPLE-name-Value",
          retType: {
            modelType: "CONFIGURED_TYPE",
            wrappedType: "EXAMPLE-wrappedType-Value",
            configValues: {
              configParamValues: {
                EXAMPLE_KEY_JMbvR: {
                  stringValue: "EXAMPLE-stringValue-Value",
                  intValue: 384,
                  objectValue: "EXAMPLE-objectValue-Value",
                  refValue: "EXAMPLE-refValue-Value",
                  parameterValue: "EXAMPLE-parameterValue-Value",
                  rootObjectValue: "EXAMPLE-rootObjectValue-Value"
                }
              },
              parentRef: {
                parent: "EXAMPLE-parent-Value",
                rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-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: true,
              objectStatus: 879,
              configParameterDefinitions: {
                EXAMPLE_KEY_HHmjb: {
                  parameterType: {
                    modelType: "COMPOSITE_TYPE",
                    elements: [
                      {
                        modelType: "DECISION_OUTPUT_PORT",
                        portType: dataintegration.models.DecisionOutputPort.PortType.Data,
                        decisionOutputPortType:
                          dataintegration.models.DecisionOutputPort.DecisionOutputPortType
                            .EvalError,
                        key: "EXAMPLE-key-Value",
                        modelVersion: "EXAMPLE-modelVersion-Value",
                        parentRef: {
                          parent: "EXAMPLE-parent-Value",
                          rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                        },
                        configValues: {
                          configParamValues: {
                            EXAMPLE_KEY_4YfHM: {
                              stringValue: "EXAMPLE-stringValue-Value",
                              intValue: 427,
                              objectValue: "EXAMPLE-objectValue-Value",
                              refValue: "EXAMPLE-refValue-Value",
                              parameterValue: "EXAMPLE-parameterValue-Value",
                              rootObjectValue: "EXAMPLE-rootObjectValue-Value"
                            }
                          },
                          parentRef: {
                            parent: "EXAMPLE-parent-Value",
                            rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                          }
                        },
                        objectStatus: 387,
                        name: "EXAMPLE-name-Value",
                        description: "EXAMPLE-description-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",
                    objectStatus: 569,
                    description: "EXAMPLE-description-Value"
                  },
                  parameterName: "EXAMPLE-parameterName-Value",
                  description: "EXAMPLE-description-Value",
                  defaultValue: "EXAMPLE-defaultValue-Value",
                  classFieldName: "EXAMPLE-classFieldName-Value",
                  isStatic: true,
                  isClassFieldValue: true
                }
              }
            },
            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: 809,
            description: "EXAMPLE-description-Value"
          },
          arguments: [
            {
              modelType: "DYNAMIC_INPUT_FIELD",
              type: {
                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: true,
                  objectStatus: 697,
                  configParameterDefinitions: {
                    EXAMPLE_KEY_eVANA: {
                      parameterName: "EXAMPLE-parameterName-Value",
                      description: "EXAMPLE-description-Value",
                      defaultValue: "EXAMPLE-defaultValue-Value",
                      classFieldName: "EXAMPLE-classFieldName-Value",
                      isStatic: true,
                      isClassFieldValue: true
                    }
                  }
                },
                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: 121,
                description: "EXAMPLE-description-Value"
              },
              labels: ["EXAMPLE--Value"],
              key: "EXAMPLE-key-Value",
              modelVersion: "EXAMPLE-modelVersion-Value",
              parentRef: {
                parent: "EXAMPLE-parent-Value",
                rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
              },
              configValues: {
                configParamValues: {
                  EXAMPLE_KEY_h43Oc: {
                    stringValue: "EXAMPLE-stringValue-Value",
                    intValue: 325,
                    objectValue: "EXAMPLE-objectValue-Value",
                    refValue: "EXAMPLE-refValue-Value",
                    parameterValue: "EXAMPLE-parameterValue-Value",
                    rootObjectValue: "EXAMPLE-rootObjectValue-Value"
                  }
                },
                parentRef: {
                  parent: "EXAMPLE-parent-Value",
                  rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                }
              },
              objectStatus: 160,
              name: "EXAMPLE-name-Value",
              description: "EXAMPLE-description-Value"
            }
          ],
          description: "EXAMPLE-description-Value",
          objectStatus: 511
        }
      ],
      expr: {
        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"
        },
        exprString: "EXAMPLE-exprString-Value",
        configValues: {
          configParamValues: {
            EXAMPLE_KEY_bDKIP: {
              stringValue: "EXAMPLE-stringValue-Value",
              intValue: 249,
              objectValue: "EXAMPLE-objectValue-Value",
              refValue: "EXAMPLE-refValue-Value",
              parameterValue: "EXAMPLE-parameterValue-Value",
              rootObjectValue: "EXAMPLE-rootObjectValue-Value"
            }
          },
          parentRef: {
            parent: "EXAMPLE-parent-Value",
            rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
          }
        },
        objectStatus: 25
      },
      description: "EXAMPLE-description-Value",
      objectStatus: 449,
      registryMetadata: {
        aggregatorKey: "EXAMPLE-aggregatorKey-Value",
        labels: ["EXAMPLE--Value"],
        registryVersion: 472,
        key: "EXAMPLE-key-Value",
        isFavorite: true
      }
    };

    const updateUserDefinedFunctionRequest: dataintegration.requests.UpdateUserDefinedFunctionRequest = {
      workspaceId: "ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value",
      userDefinedFunctionKey: "EXAMPLE-userDefinedFunctionKey-Value",
      updateUserDefinedFunctionDetails: updateUserDefinedFunctionDetails,
      opcRequestId: "6DZKNQNPMQX2PHIBX1QG<unique_ID>",
      ifMatch: "EXAMPLE-ifMatch-Value"
    };

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