// 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.DatascienceService;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Datascience
{
    public class CreateScheduleExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createScheduleDetails = new Oci.DatascienceService.Models.CreateScheduleDetails
			{
				DisplayName = "EXAMPLE-displayName-Value",
				Description = "EXAMPLE-description-Value",
				ProjectId = "ocid1.test.oc1..<unique_ID>EXAMPLE-projectId-Value",
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				Trigger = new Oci.DatascienceService.Models.ScheduleIntervalTrigger
				{
					Frequency = Oci.DatascienceService.Models.ScheduleIntervalTrigger.FrequencyEnum.Daily,
					Interval = 712,
					InitialJitterInMinutes = 539,
					IsRandomStartTime = true,
					TimeStart = DateTime.Parse("02/16/2030 23:13:41"),
					TimeEnd = DateTime.Parse("02/17/2017 22:16:43")
				},
				Action = new Oci.DatascienceService.Models.ScheduleHttpAction
				{
					ActionDetails = new Oci.DatascienceService.Models.InvokeMlApplicationProviderTriggerScheduleActionDetails
					{
						MlApplicationInstanceViewId = "ocid1.test.oc1..<unique_ID>EXAMPLE-mlApplicationInstanceViewId-Value",
						TriggerMlApplicationInstanceViewFlowDetails = new Oci.DatascienceService.Models.TriggerMlApplicationInstanceViewFlowDetails
						{
							TriggerName = "EXAMPLE-triggerName-Value",
							Parameters = new List<Oci.DatascienceService.Models.TriggerParameter>
							{
								new Oci.DatascienceService.Models.TriggerParameter
								{
									Name = "EXAMPLE-name-Value",
									Value = "EXAMPLE-value-Value"
								}
							}
						}
					}
				},
				LogDetails = new Oci.DatascienceService.Models.ScheduleLogDetails
				{
					LogGroupId = "ocid1.test.oc1..<unique_ID>EXAMPLE-logGroupId-Value",
					LogId = "ocid1.test.oc1..<unique_ID>EXAMPLE-logId-Value"
				},
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_2c7lN", 
						"EXAMPLE_VALUE_7PkOsYoqruj03deh7rk6"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_oPYKi", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_unLtw", 
								"EXAMPLE--Value"
							}
						}
					}
				}
			};
			var createScheduleRequest = new Oci.DatascienceService.Requests.CreateScheduleRequest
			{
				CreateScheduleDetails = createScheduleDetails,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcRequestId = "OCJT9UKDN5FGP1OFNFMB<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 DataScienceClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateSchedule(createScheduleRequest);
					// Retrieve value from the response.
					var id = response.Schedule.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateSchedule Failed with {e.Message}");
                throw e;
            }
        }

    }
}