// 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).

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.DataintegrationService;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Dataintegration
{
    public class CreateTaskExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createTaskDetails = new Oci.DataintegrationService.Models.CreateTaskFromOCIDataflowTask
			{
				DataflowApplication = new Oci.DataintegrationService.Models.DataflowApplication
				{
					ApplicationId = "ocid1.test.oc1..<unique_ID>EXAMPLE-applicationId-Value",
					CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
					ConfigValues = new Oci.DataintegrationService.Models.ConfigValues
					{
						ConfigParamValues = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterValue>()
						{
							{
								"EXAMPLE_KEY_77t3U", 
								new Oci.DataintegrationService.Models.ConfigParameterValue
								{
									StringValue = "EXAMPLE-stringValue-Value",
									IntValue = 936,
									ObjectValue = "EXAMPLE-objectValue-Value",
									RefValue = "EXAMPLE-refValue-Value",
									ParameterValue = "EXAMPLE-parameterValue-Value",
									RootObjectValue = "EXAMPLE-rootObjectValue-Value"
								}
							}
						},
						ParentRef = new Oci.DataintegrationService.Models.ParentReference
						{
							Parent = "EXAMPLE-parent-Value",
							RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
						}
					}
				},
				DriverShapeDetails = new Oci.DataintegrationService.Models.ShapeDetails
				{
					ConfigValues = new Oci.DataintegrationService.Models.ConfigValues
					{
						ConfigParamValues = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterValue>()
						{
							{
								"EXAMPLE_KEY_GjSPR", 
								new Oci.DataintegrationService.Models.ConfigParameterValue
								{
									StringValue = "EXAMPLE-stringValue-Value",
									IntValue = 302,
									ObjectValue = "EXAMPLE-objectValue-Value",
									RefValue = "EXAMPLE-refValue-Value",
									ParameterValue = "EXAMPLE-parameterValue-Value",
									RootObjectValue = "EXAMPLE-rootObjectValue-Value"
								}
							}
						},
						ParentRef = new Oci.DataintegrationService.Models.ParentReference
						{
							Parent = "EXAMPLE-parent-Value",
							RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
						}
					}
				},
				ExecutorShapeDetails = new Oci.DataintegrationService.Models.ShapeDetails
				{
					ConfigValues = new Oci.DataintegrationService.Models.ConfigValues
					{
						ConfigParamValues = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterValue>()
						{
							{
								"EXAMPLE_KEY_EGahz", 
								new Oci.DataintegrationService.Models.ConfigParameterValue
								{
									StringValue = "EXAMPLE-stringValue-Value",
									IntValue = 797,
									ObjectValue = "EXAMPLE-objectValue-Value",
									RefValue = "EXAMPLE-refValue-Value",
									ParameterValue = "EXAMPLE-parameterValue-Value",
									RootObjectValue = "EXAMPLE-rootObjectValue-Value"
								}
							}
						},
						ParentRef = new Oci.DataintegrationService.Models.ParentReference
						{
							Parent = "EXAMPLE-parent-Value",
							RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
						}
					}
				},
				Key = "EXAMPLE-key-Value",
				ModelVersion = "EXAMPLE-modelVersion-Value",
				ParentRef = new Oci.DataintegrationService.Models.ParentReference
				{
					Parent = "EXAMPLE-parent-Value",
					RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
				},
				Name = "EXAMPLE-name-Value",
				Description = "EXAMPLE-description-Value",
				ObjectStatus = 513,
				Identifier = "EXAMPLE-identifier-Value",
				InputPorts = new List<Oci.DataintegrationService.Models.InputPort>
				{
					new Oci.DataintegrationService.Models.InputPort
					{
						PortType = Oci.DataintegrationService.Models.InputPort.PortTypeEnum.Data,
						Fields = new List<Oci.DataintegrationService.Models.TypedObject>
						{
							new Oci.DataintegrationService.Models.InputProxyField
							{
								Scope = "EXAMPLE-scope-Value",
								Type = new Oci.DataintegrationService.Models.MapType
								{
									KeyElementType = "EXAMPLE-keyElementType-Value",
									ValueElementType = "EXAMPLE-valueElementType-Value",
									ContainsNull = false,
									Key = "EXAMPLE-key-Value",
									ModelVersion = "EXAMPLE-modelVersion-Value",
									ParentRef = new Oci.DataintegrationService.Models.ParentReference
									{
										Parent = "EXAMPLE-parent-Value",
										RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
									},
									Name = "EXAMPLE-name-Value",
									ObjectStatus = 317,
									Description = "EXAMPLE-description-Value"
								},
								Labels = new List<string>
								{
									"EXAMPLE--Value"
								},
								Key = "EXAMPLE-key-Value",
								ModelVersion = "EXAMPLE-modelVersion-Value",
								ParentRef = new Oci.DataintegrationService.Models.ParentReference
								{
									Parent = "EXAMPLE-parent-Value",
									RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
								},
								ConfigValues = new Oci.DataintegrationService.Models.ConfigValues
								{
									ConfigParamValues = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterValue>()
									{
										{
											"EXAMPLE_KEY_S3vQz", 
											new Oci.DataintegrationService.Models.ConfigParameterValue
											{
												StringValue = "EXAMPLE-stringValue-Value",
												IntValue = 260,
												ObjectValue = "EXAMPLE-objectValue-Value",
												RefValue = "EXAMPLE-refValue-Value",
												ParameterValue = "EXAMPLE-parameterValue-Value",
												RootObjectValue = "EXAMPLE-rootObjectValue-Value"
											}
										}
									},
									ParentRef = new Oci.DataintegrationService.Models.ParentReference
									{
										Parent = "EXAMPLE-parent-Value",
										RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
									}
								},
								ObjectStatus = 674,
								Name = "EXAMPLE-name-Value",
								Description = "EXAMPLE-description-Value"
							}
						},
						Key = "EXAMPLE-key-Value",
						ModelVersion = "EXAMPLE-modelVersion-Value",
						ParentRef = new Oci.DataintegrationService.Models.ParentReference
						{
							Parent = "EXAMPLE-parent-Value",
							RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
						},
						ConfigValues = new Oci.DataintegrationService.Models.ConfigValues
						{
							ConfigParamValues = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterValue>()
							{
								{
									"EXAMPLE_KEY_Y7526", 
									new Oci.DataintegrationService.Models.ConfigParameterValue
									{
										StringValue = "EXAMPLE-stringValue-Value",
										IntValue = 738,
										ObjectValue = "EXAMPLE-objectValue-Value",
										RefValue = "EXAMPLE-refValue-Value",
										ParameterValue = "EXAMPLE-parameterValue-Value",
										RootObjectValue = "EXAMPLE-rootObjectValue-Value"
									}
								}
							},
							ParentRef = new Oci.DataintegrationService.Models.ParentReference
							{
								Parent = "EXAMPLE-parent-Value",
								RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
							}
						},
						ObjectStatus = 537,
						Name = "EXAMPLE-name-Value",
						Description = "EXAMPLE-description-Value"
					}
				},
				OutputPorts = new List<Oci.DataintegrationService.Models.OutputPort>
				{
					new Oci.DataintegrationService.Models.OutputPort
					{
						PortType = Oci.DataintegrationService.Models.OutputPort.PortTypeEnum.Control,
						Fields = new List<Oci.DataintegrationService.Models.TypedObject>
						{
							new Oci.DataintegrationService.Models.DecisionOutputPort
							{
								PortType = Oci.DataintegrationService.Models.DecisionOutputPort.PortTypeEnum.Control,
								DecisionOutputPortType = Oci.DataintegrationService.Models.DecisionOutputPort.DecisionOutputPortTypeEnum.EvalFalse,
								Key = "EXAMPLE-key-Value",
								ModelVersion = "EXAMPLE-modelVersion-Value",
								ParentRef = new Oci.DataintegrationService.Models.ParentReference
								{
									Parent = "EXAMPLE-parent-Value",
									RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
								},
								ConfigValues = new Oci.DataintegrationService.Models.ConfigValues
								{
									ConfigParamValues = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterValue>()
									{
										{
											"EXAMPLE_KEY_ls925", 
											new Oci.DataintegrationService.Models.ConfigParameterValue
											{
												StringValue = "EXAMPLE-stringValue-Value",
												IntValue = 252,
												ObjectValue = "EXAMPLE-objectValue-Value",
												RefValue = "EXAMPLE-refValue-Value",
												ParameterValue = "EXAMPLE-parameterValue-Value",
												RootObjectValue = "EXAMPLE-rootObjectValue-Value"
											}
										}
									},
									ParentRef = new Oci.DataintegrationService.Models.ParentReference
									{
										Parent = "EXAMPLE-parent-Value",
										RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
									}
								},
								ObjectStatus = 840,
								Name = "EXAMPLE-name-Value",
								Description = "EXAMPLE-description-Value"
							}
						},
						Key = "EXAMPLE-key-Value",
						ModelVersion = "EXAMPLE-modelVersion-Value",
						ParentRef = new Oci.DataintegrationService.Models.ParentReference
						{
							Parent = "EXAMPLE-parent-Value",
							RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
						},
						ConfigValues = new Oci.DataintegrationService.Models.ConfigValues
						{
							ConfigParamValues = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterValue>()
							{
								{
									"EXAMPLE_KEY_pBbw5", 
									new Oci.DataintegrationService.Models.ConfigParameterValue
									{
										StringValue = "EXAMPLE-stringValue-Value",
										IntValue = 14,
										ObjectValue = "EXAMPLE-objectValue-Value",
										RefValue = "EXAMPLE-refValue-Value",
										ParameterValue = "EXAMPLE-parameterValue-Value",
										RootObjectValue = "EXAMPLE-rootObjectValue-Value"
									}
								}
							},
							ParentRef = new Oci.DataintegrationService.Models.ParentReference
							{
								Parent = "EXAMPLE-parent-Value",
								RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
							}
						},
						ObjectStatus = 666,
						Name = "EXAMPLE-name-Value",
						Description = "EXAMPLE-description-Value"
					}
				},
				Parameters = new List<Oci.DataintegrationService.Models.Parameter>
				{
					new Oci.DataintegrationService.Models.Parameter
					{
						Type = "EXAMPLE-type-Value",
						DefaultValue = "EXAMPLE-defaultValue-Value",
						RootObjectDefaultValue = "EXAMPLE-rootObjectDefaultValue-Value",
						IsInput = true,
						IsOutput = false,
						OutputAggregationType = Oci.DataintegrationService.Models.Parameter.OutputAggregationTypeEnum.Count,
						TypeName = "EXAMPLE-typeName-Value",
						UsedFor = "EXAMPLE-usedFor-Value",
						Key = "EXAMPLE-key-Value",
						ModelVersion = "EXAMPLE-modelVersion-Value",
						ParentRef = new Oci.DataintegrationService.Models.ParentReference
						{
							Parent = "EXAMPLE-parent-Value",
							RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
						},
						ConfigValues = new Oci.DataintegrationService.Models.ConfigValues
						{
							ConfigParamValues = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterValue>()
							{
								{
									"EXAMPLE_KEY_uNgFh", 
									new Oci.DataintegrationService.Models.ConfigParameterValue
									{
										StringValue = "EXAMPLE-stringValue-Value",
										IntValue = 177,
										ObjectValue = "EXAMPLE-objectValue-Value",
										RefValue = "EXAMPLE-refValue-Value",
										ParameterValue = "EXAMPLE-parameterValue-Value",
										RootObjectValue = "EXAMPLE-rootObjectValue-Value"
									}
								}
							},
							ParentRef = new Oci.DataintegrationService.Models.ParentReference
							{
								Parent = "EXAMPLE-parent-Value",
								RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
							}
						},
						ObjectStatus = 18,
						Name = "EXAMPLE-name-Value",
						Description = "EXAMPLE-description-Value"
					}
				},
				OpConfigValues = new Oci.DataintegrationService.Models.ConfigValues
				{
					ConfigParamValues = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterValue>()
					{
						{
							"EXAMPLE_KEY_kIIzk", 
							new Oci.DataintegrationService.Models.ConfigParameterValue
							{
								StringValue = "EXAMPLE-stringValue-Value",
								IntValue = 975,
								ObjectValue = "EXAMPLE-objectValue-Value",
								RefValue = "EXAMPLE-refValue-Value",
								ParameterValue = "EXAMPLE-parameterValue-Value",
								RootObjectValue = "EXAMPLE-rootObjectValue-Value"
							}
						}
					},
					ParentRef = new Oci.DataintegrationService.Models.ParentReference
					{
						Parent = "EXAMPLE-parent-Value",
						RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
					}
				},
				ConfigProviderDelegate = new Oci.DataintegrationService.Models.CreateConfigProvider
				{
					Bindings = new Dictionary<string, Oci.DataintegrationService.Models.ParameterValue>()
					{
						{
							"EXAMPLE_KEY_QcWp5", 
							new Oci.DataintegrationService.Models.ParameterValue
							{
								SimpleValue = "EXAMPLE-simpleValue-Value",
								RootObjectValue = "EXAMPLE-rootObjectValue-Value"
							}
						}
					}
				},
				IsConcurrentAllowed = false,
				RegistryMetadata = new Oci.DataintegrationService.Models.RegistryMetadata
				{
					AggregatorKey = "EXAMPLE-aggregatorKey-Value",
					Labels = new List<string>
					{
						"EXAMPLE--Value"
					},
					RegistryVersion = 788,
					Key = "EXAMPLE-key-Value",
					IsFavorite = false
				}
			};
			var createTaskRequest = new Oci.DataintegrationService.Requests.CreateTaskRequest
			{
				WorkspaceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value",
				CreateTaskDetails = createTaskDetails,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcRequestId = "NTV9MPVZUZEXN6O3VD86<unique_ID>"
			};

            // 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. 
            var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
            try
            {
                // Create a service client and send the request.
				using (var client = new DataIntegrationClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateTask(createTaskRequest);
					// Retrieve value from the response.
					var keyValue = response.Task.Key;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateTask Failed with {e.Message}");
                throw e;
            }
        }

    }
}

Was this article helpful?