// 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: 865,
      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_nTJ6t: {
                  stringValue: "EXAMPLE-stringValue-Value",
                  intValue: 4,
                  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: 729,
              configParameterDefinitions: {
                EXAMPLE_KEY_7zOkW: {
                  parameterName: "EXAMPLE-parameterName-Value",
                  description: "EXAMPLE-description-Value",
                  defaultValue: "EXAMPLE-defaultValue-Value",
                  classFieldName: "EXAMPLE-classFieldName-Value",
                  isStatic: false,
                  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: 523,
            description: "EXAMPLE-description-Value"
          },
          arguments: [
            {
              modelType: "MATERIALIZED_DYNAMIC_FIELD",
              scope: "EXAMPLE-scope-Value",
              type: {
                modelType: "MATERIALIZED_COMPOSITE_TYPE",
                elements: ["EXAMPLE--Value"],
                pathNames: ["EXAMPLE--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: 422,
                  configParameterDefinitions: {
                    EXAMPLE_KEY_YcfcS: {
                      parameterType: {
                        modelType: "DYNAMIC_TYPE",
                        typeHandler: {
                          modelType: "FLATTEN_TYPE_HANDLER",
                          key: "EXAMPLE-key-Value",
                          modelVersion: "EXAMPLE-modelVersion-Value",
                          parentRef: {
                            parent: "EXAMPLE-parent-Value",
                            rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                          },
                          scope: "EXAMPLE-scope-Value",
                          flattenDetails: "EXAMPLE-flattenDetails-Value",
                          configValues: {
                            configParamValues: {
                              EXAMPLE_KEY_1QQYN: {
                                stringValue: "EXAMPLE-stringValue-Value",
                                intValue: 653,
                                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: 493
                        },
                        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: 2,
                        description: "EXAMPLE-description-Value"
                      },
                      parameterName: "EXAMPLE-parameterName-Value",
                      description: "EXAMPLE-description-Value",
                      defaultValue: "EXAMPLE-defaultValue-Value",
                      classFieldName: "EXAMPLE-classFieldName-Value",
                      isStatic: false,
                      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: 684,
                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"
              },
              configValues: {
                configParamValues: {
                  EXAMPLE_KEY_ezxIv: {
                    stringValue: "EXAMPLE-stringValue-Value",
                    intValue: 669,
                    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: 548,
              name: "EXAMPLE-name-Value",
              description: "EXAMPLE-description-Value"
            }
          ],
          description: "EXAMPLE-description-Value",
          objectStatus: 223
        }
      ],
      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_4F6It: {
              stringValue: "EXAMPLE-stringValue-Value",
              intValue: 712,
              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: 335
      },
      description: "EXAMPLE-description-Value",
      objectStatus: 885,
      registryMetadata: {
        aggregatorKey: "EXAMPLE-aggregatorKey-Value",
        labels: ["EXAMPLE--Value"],
        registryVersion: 713,
        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: "IDE1EYF3LDWWZS2POYMP<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);
  }
})();