// 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 dataflow from "oci-dataflow";
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 dataflow.DataFlowClient({ authenticationDetailsProvider: provider });

    // Create a request and dependent object(s).
    const createRunDetails = {
      applicationId: "ocid1.test.oc1..<unique_ID>EXAMPLE-applicationId-Value",
      archiveUri: "EXAMPLE-archiveUri-Value",
      arguments: ["EXAMPLE--Value"],
      compartmentId: "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
      configuration: {
        EXAMPLE_KEY_y5UmE: "EXAMPLE_VALUE_8gAk0sB9b80G2hYSa8OS"
      },
      definedTags: {
        EXAMPLE_KEY_nbswj: {
          EXAMPLE_KEY_W0Bja: "EXAMPLE--Value"
        }
      },
      displayName: "EXAMPLE-displayName-Value",
      driverShape: "EXAMPLE-driverShape-Value",
      execute: "EXAMPLE-execute-Value",
      executorShape: "EXAMPLE-executorShape-Value",
      freeformTags: {
        EXAMPLE_KEY_iPhDZ: "EXAMPLE_VALUE_5VxMriXbllAc1ndQlzia"
      },
      logsBucketUri: "EXAMPLE-logsBucketUri-Value",
      metastoreId: "ocid1.test.oc1..<unique_ID>EXAMPLE-metastoreId-Value",
      numExecutors: 704,
      parameters: [
        {
          name: "EXAMPLE-name-Value",
          value: "EXAMPLE-value-Value"
        }
      ],
      sparkVersion: "EXAMPLE-sparkVersion-Value",
      warehouseBucketUri: "EXAMPLE-warehouseBucketUri-Value"
    };

    const createRunRequest: dataflow.requests.CreateRunRequest = {
      createRunDetails: createRunDetails,
      opcRetryToken: "EXAMPLE-opcRetryToken-Value",
      opcRequestId: "L0BKBBNKK9Q5Z3TT7BBG<unique_ID>"
    };

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