// 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 createTaskDetails = {
      modelType: "OCI_DATAFLOW_TASK",
      dataflowApplication: {
        applicationId: "ocid1.test.oc1..<unique_ID>EXAMPLE-applicationId-Value",
        compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
        configValues: {
          configParamValues: {
            EXAMPLE_KEY_EKdgz: {
              stringValue: "EXAMPLE-stringValue-Value",
              intValue: 206,
              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"
          }
        }
      },
      driverShapeDetails: {
        configValues: {
          configParamValues: {
            EXAMPLE_KEY_s4G7a: {
              stringValue: "EXAMPLE-stringValue-Value",
              intValue: 952,
              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"
          }
        }
      },
      executorShapeDetails: {
        configValues: {
          configParamValues: {
            EXAMPLE_KEY_4c5tv: {
              stringValue: "EXAMPLE-stringValue-Value",
              intValue: 8,
              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"
          }
        }
      },
      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",
      objectStatus: 854,
      identifier: "EXAMPLE-identifier-Value",
      inputPorts: [
        {
          modelType: "INPUT_PORT",
          portType: dataintegration.models.InputPort.PortType.Control,
          fields: [
            {
              modelType: "PIVOT_FIELD",
              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_OhC19: {
                      stringValue: "EXAMPLE-stringValue-Value",
                      intValue: 846,
                      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: 827
              },
              useType: {
                modelType: "CONFIGURED_TYPE",
                wrappedType: "EXAMPLE-wrappedType-Value",
                configValues: {
                  configParamValues: {
                    EXAMPLE_KEY_axXz4: {
                      stringValue: "EXAMPLE-stringValue-Value",
                      intValue: 527,
                      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: false,
                  objectStatus: 945,
                  configParameterDefinitions: {
                    EXAMPLE_KEY_ssvyD: {
                      parameterType: {
                        modelType: "DERIVED_TYPE",
                        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: 162,
                        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: 233,
                description: "EXAMPLE-description-Value"
              },
              type: {
                modelType: "CONFIGURED_TYPE",
                wrappedType: "EXAMPLE-wrappedType-Value",
                configValues: {
                  configParamValues: {
                    EXAMPLE_KEY_qPBJb: {
                      stringValue: "EXAMPLE-stringValue-Value",
                      intValue: 521,
                      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: false,
                  objectStatus: 314,
                  configParameterDefinitions: {
                    EXAMPLE_KEY_hM9P7: {
                      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: 689,
                description: "EXAMPLE-description-Value"
              },
              columnNamePattern: "EXAMPLE-columnNamePattern-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_Eqb5n: {
                    stringValue: "EXAMPLE-stringValue-Value",
                    intValue: 425,
                    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: 42,
              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"
          },
          configValues: {
            configParamValues: {
              EXAMPLE_KEY_zkhRO: {
                stringValue: "EXAMPLE-stringValue-Value",
                intValue: 897,
                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: 39,
          name: "EXAMPLE-name-Value",
          description: "EXAMPLE-description-Value"
        }
      ],
      outputPorts: [
        {
          modelType: "OUTPUT_PORT",
          portType: dataintegration.models.OutputPort.PortType.Control,
          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_wwTKu: {
                stringValue: "EXAMPLE-stringValue-Value",
                intValue: 256,
                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: 173,
          name: "EXAMPLE-name-Value",
          description: "EXAMPLE-description-Value"
        }
      ],
      parameters: [
        {
          modelType: "PARAMETER",
          type: "EXAMPLE-type-Value",
          defaultValue: "EXAMPLE-defaultValue-Value",
          rootObjectDefaultValue: "EXAMPLE-rootObjectDefaultValue-Value",
          isInput: true,
          isOutput: false,
          outputAggregationType: dataintegration.models.Parameter.OutputAggregationType.Max,
          typeName: "EXAMPLE-typeName-Value",
          usedFor: "EXAMPLE-usedFor-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_9lZyW: {
                stringValue: "EXAMPLE-stringValue-Value",
                intValue: 426,
                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: 545,
          name: "EXAMPLE-name-Value",
          description: "EXAMPLE-description-Value"
        }
      ],
      opConfigValues: {
        configParamValues: {
          EXAMPLE_KEY_oT3eg: {
            stringValue: "EXAMPLE-stringValue-Value",
            intValue: 82,
            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"
        }
      },
      configProviderDelegate: {
        bindings: {
          EXAMPLE_KEY_vTbhe: {
            simpleValue: "EXAMPLE-simpleValue-Value",
            rootObjectValue: "EXAMPLE-rootObjectValue-Value"
          }
        }
      },
      isConcurrentAllowed: true,
      registryMetadata: {
        aggregatorKey: "EXAMPLE-aggregatorKey-Value",
        labels: ["EXAMPLE--Value"],
        registryVersion: 512,
        key: "EXAMPLE-key-Value",
        isFavorite: false
      }
    };

    const createTaskRequest: dataintegration.requests.CreateTaskRequest = {
      workspaceId: "ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value",
      createTaskDetails: createTaskDetails,
      opcRetryToken: "EXAMPLE-opcRetryToken-Value",
      opcRequestId: "RRGPJKDM2DHWN9RYOIRY<unique_ID>"
    };

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