// 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 createDataFlowDetails = {
      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",
      identifier: "EXAMPLE-identifier-Value",
      nodes: [
        {
          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",
          inputLinks: [
            {
              modelType: "INPUT_LINK",
              fromLink: "EXAMPLE-fromLink-Value",
              fieldMap: {
                modelType: "RULE_BASED_FIELD_MAP",
                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_5T17L: {
                      stringValue: "EXAMPLE-stringValue-Value",
                      intValue: 955,
                      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"
                  }
                },
                mapType: dataintegration.models.RuleBasedFieldMap.MapType.Mapbyposition,
                fromPattern: "EXAMPLE-fromPattern-Value",
                toPattern: "EXAMPLE-toPattern-Value",
                isJavaRegexSyntax: false,
                objectStatus: 850,
                fromRuleConfig: {
                  modelType: "RULE_TYPE_CONFIGS",
                  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",
                  scopeReference: {
                    referenceObject: "EXAMPLE-referenceObject-Value",
                    referenceType: dataintegration.models.ScopeReference.ReferenceType.DirectRef,
                    refObjectName: "EXAMPLE-refObjectName-Value"
                  },
                  isOrderByRule: false,
                  projectionRules: [
                    {
                      modelType: "NAME_PATTERN_RULE",
                      isSkipRemainingRulesOnMatch: true,
                      scope: "EXAMPLE-scope-Value",
                      isCascade: true,
                      matchingStrategy:
                        dataintegration.models.NamePatternRule.MatchingStrategy.NameOnly,
                      isCaseSensitive: true,
                      ruleType: dataintegration.models.NamePatternRule.RuleType.Exclude,
                      pattern: "EXAMPLE-pattern-Value",
                      key: "EXAMPLE-key-Value",
                      modelVersion: "EXAMPLE-modelVersion-Value",
                      parentRef: {
                        parent: "EXAMPLE-parent-Value",
                        rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                      },
                      isJavaRegexSyntax: true,
                      configValues: {
                        configParamValues: {
                          EXAMPLE_KEY_JKx2d: {
                            stringValue: "EXAMPLE-stringValue-Value",
                            intValue: 92,
                            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: 38,
                      description: "EXAMPLE-description-Value"
                    }
                  ],
                  configValues: {
                    configParamValues: {
                      EXAMPLE_KEY_G2wxx: {
                        stringValue: "EXAMPLE-stringValue-Value",
                        intValue: 486,
                        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: 201
                },
                toRuleConfig: {
                  modelType: "RULE_TYPE_CONFIGS",
                  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",
                  scopeReference: {
                    referenceObject: "EXAMPLE-referenceObject-Value",
                    referenceType: dataintegration.models.ScopeReference.ReferenceType.DirectRef,
                    refObjectName: "EXAMPLE-refObjectName-Value"
                  },
                  isOrderByRule: true,
                  projectionRules: [
                    {
                      modelType: "GROUPED_NAME_PATTERN_RULE",
                      name: "EXAMPLE-name-Value",
                      isSkipRemainingRulesOnMatch: true,
                      scope: "EXAMPLE-scope-Value",
                      isCascade: false,
                      matchingStrategy:
                        dataintegration.models.GroupedNamePatternRule.MatchingStrategy.TagsOnly,
                      isCaseSensitive: false,
                      ruleType: dataintegration.models.GroupedNamePatternRule.RuleType.Include,
                      pattern: "EXAMPLE-pattern-Value",
                      key: "EXAMPLE-key-Value",
                      modelVersion: "EXAMPLE-modelVersion-Value",
                      parentRef: {
                        parent: "EXAMPLE-parent-Value",
                        rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
                      },
                      isJavaRegexSyntax: false,
                      configValues: {
                        configParamValues: {
                          EXAMPLE_KEY_7Gwrm: {
                            stringValue: "EXAMPLE-stringValue-Value",
                            intValue: 581,
                            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: 547,
                      description: "EXAMPLE-description-Value"
                    }
                  ],
                  configValues: {
                    configParamValues: {
                      EXAMPLE_KEY_cMG7C: {
                        stringValue: "EXAMPLE-stringValue-Value",
                        intValue: 200,
                        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: 676
                },
                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"
              },
              objectStatus: 708,
              description: "EXAMPLE-description-Value",
              port: "EXAMPLE-port-Value"
            }
          ],
          outputLinks: [
            {
              modelType: "OUTPUT_LINK",
              toLinks: ["EXAMPLE--Value"],
              key: "EXAMPLE-key-Value",
              modelVersion: "EXAMPLE-modelVersion-Value",
              parentRef: {
                parent: "EXAMPLE-parent-Value",
                rootDocId: "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
              },
              objectStatus: 494,
              description: "EXAMPLE-description-Value",
              port: "EXAMPLE-port-Value"
            }
          ],
          operator: {
            modelType: "SPLIT_OPERATOR",
            dataRoutingStrategy: dataintegration.models.Split.DataRoutingStrategy.All,
            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: 365,
            inputPorts: [
              {
                modelType: "INPUT_PORT",
                portType: dataintegration.models.InputPort.PortType.Model,
                fields: [
                  {
                    modelType: "FLOW_PORT",
                    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_ZZ95l: {
                          stringValue: "EXAMPLE-stringValue-Value",
                          intValue: 116,
                          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: 741,
                    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_uTQB4: {
                      stringValue: "EXAMPLE-stringValue-Value",
                      intValue: 361,
                      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: 529,
                name: "EXAMPLE-name-Value",
                description: "EXAMPLE-description-Value"
              }
            ],
            outputPorts: [
              {
                modelType: "SHAPE_FIELD",
                type: "EXAMPLE-type-Value",
                labels: ["EXAMPLE--Value"],
                nativeShapeField: {
                  name: "EXAMPLE-name-Value",
                  modelType: "EXAMPLE-modelType-Value",
                  type: "EXAMPLE-type-Value",
                  configValues: {
                    configParamValues: {
                      EXAMPLE_KEY_103ga: {
                        stringValue: "EXAMPLE-stringValue-Value",
                        intValue: 493,
                        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"
                    }
                  },
                  position: 655,
                  defaultValueString: "EXAMPLE-defaultValueString-Value",
                  isMandatory: true
                },
                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_sFMUk: {
                      stringValue: "EXAMPLE-stringValue-Value",
                      intValue: 238,
                      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: 526,
                name: "EXAMPLE-name-Value",
                description: "EXAMPLE-description-Value"
              }
            ],
            objectStatus: 73,
            identifier: "EXAMPLE-identifier-Value",
            parameters: [
              {
                modelType: "PARAMETER",
                type: "EXAMPLE-type-Value",
                defaultValue: "EXAMPLE-defaultValue-Value",
                rootObjectDefaultValue: "EXAMPLE-rootObjectDefaultValue-Value",
                isInput: true,
                isOutput: true,
                outputAggregationType: dataintegration.models.Parameter.OutputAggregationType.Min,
                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_0U3St: {
                      stringValue: "EXAMPLE-stringValue-Value",
                      intValue: 725,
                      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: 127,
                name: "EXAMPLE-name-Value",
                description: "EXAMPLE-description-Value"
              }
            ],
            opConfigValues: {
              configParamValues: {
                EXAMPLE_KEY_MXOlJ: {
                  stringValue: "EXAMPLE-stringValue-Value",
                  intValue: 260,
                  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"
              }
            }
          },
          uiProperties: {
            coordinateX: 4024.9688,
            coordinateY: 8799.476
          },
          objectStatus: 722
        }
      ],
      parameters: [
        {
          modelType: "PARAMETER",
          type: "EXAMPLE-type-Value",
          defaultValue: "EXAMPLE-defaultValue-Value",
          rootObjectDefaultValue: "EXAMPLE-rootObjectDefaultValue-Value",
          isInput: false,
          isOutput: true,
          outputAggregationType: dataintegration.models.Parameter.OutputAggregationType.Min,
          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_q7Bt8: {
                stringValue: "EXAMPLE-stringValue-Value",
                intValue: 406,
                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: 815,
          name: "EXAMPLE-name-Value",
          description: "EXAMPLE-description-Value"
        }
      ],
      description: "EXAMPLE-description-Value",
      flowConfigValues: {
        configParamValues: {
          EXAMPLE_KEY_C9NqT: {
            stringValue: "EXAMPLE-stringValue-Value",
            intValue: 537,
            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: 333,
      registryMetadata: {
        aggregatorKey: "EXAMPLE-aggregatorKey-Value",
        labels: ["EXAMPLE--Value"],
        registryVersion: 73,
        key: "EXAMPLE-key-Value",
        isFavorite: true
      }
    };

    const createDataFlowRequest: dataintegration.requests.CreateDataFlowRequest = {
      workspaceId: "ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value",
      createDataFlowDetails: createDataFlowDetails,
      opcRetryToken: "EXAMPLE-opcRetryToken-Value",
      opcRequestId: "J4QBDMZMXJXGPS8NQTAL<unique_ID>"
    };

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