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

namespace Oci.Sdk.DotNet.Example.Osmanagementhub
{
    public class UpdateScheduledJobExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var updateScheduledJobDetails = new Oci.OsmanagementhubService.Models.UpdateScheduledJobDetails
			{
				DisplayName = "EXAMPLE-displayName-Value",
				Description = "EXAMPLE-description-Value",
				ScheduleType = Oci.OsmanagementhubService.Models.ScheduleTypes.Recurring,
				TimeNextExecution = DateTime.Parse("08/21/2045 10:43:09"),
				RecurringRule = "EXAMPLE-recurringRule-Value",
				Operations = new List<Oci.OsmanagementhubService.Models.ScheduledJobOperation>
				{
					new Oci.OsmanagementhubService.Models.ScheduledJobOperation
					{
						OperationType = Oci.OsmanagementhubService.Models.OperationTypes.UpdatePackages,
						PackageNames = new List<string>
						{
							"EXAMPLE--Value"
						},
						WindowsUpdateNames = new List<string>
						{
							"EXAMPLE--Value"
						},
						ManageModuleStreamsDetails = new Oci.OsmanagementhubService.Models.ManageModuleStreamsInScheduledJobDetails
						{
							Enable = new List<Oci.OsmanagementhubService.Models.ModuleStreamDetails>
							{
								new Oci.OsmanagementhubService.Models.ModuleStreamDetails
								{
									ModuleName = "EXAMPLE-moduleName-Value",
									StreamName = "EXAMPLE-streamName-Value",
									SoftwareSourceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-softwareSourceId-Value"
								}
							},
							Disable = new List<Oci.OsmanagementhubService.Models.ModuleStreamDetails>
							{
								new Oci.OsmanagementhubService.Models.ModuleStreamDetails
								{
									ModuleName = "EXAMPLE-moduleName-Value",
									StreamName = "EXAMPLE-streamName-Value",
									SoftwareSourceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-softwareSourceId-Value"
								}
							},
							Install = new List<Oci.OsmanagementhubService.Models.ModuleStreamProfileDetails>
							{
								new Oci.OsmanagementhubService.Models.ModuleStreamProfileDetails
								{
									ModuleName = "EXAMPLE-moduleName-Value",
									StreamName = "EXAMPLE-streamName-Value",
									ProfileName = "EXAMPLE-profileName-Value",
									SoftwareSourceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-softwareSourceId-Value"
								}
							},
							Remove = new List<Oci.OsmanagementhubService.Models.ModuleStreamProfileDetails>
							{
								new Oci.OsmanagementhubService.Models.ModuleStreamProfileDetails
								{
									ModuleName = "EXAMPLE-moduleName-Value",
									StreamName = "EXAMPLE-streamName-Value",
									ProfileName = "EXAMPLE-profileName-Value",
									SoftwareSourceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-softwareSourceId-Value"
								}
							}
						},
						SwitchModuleStreamsDetails = new Oci.OsmanagementhubService.Models.ModuleStreamDetails
						{
							ModuleName = "EXAMPLE-moduleName-Value",
							StreamName = "EXAMPLE-streamName-Value",
							SoftwareSourceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-softwareSourceId-Value"
						},
						SoftwareSourceIds = new List<string>
						{
							"EXAMPLE--Value"
						},
						RebootTimeoutInMins = 186
					}
				},
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_pEUYy", 
						"EXAMPLE_VALUE_pPLxjEoNQcTBQcNV7qkl"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_copdd", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_1EQCd", 
								"EXAMPLE--Value"
							}
						}
					}
				},
				RetryIntervals = new List<Int32>
				{
					81
				}
			};
			var updateScheduledJobRequest = new Oci.OsmanagementhubService.Requests.UpdateScheduledJobRequest
			{
				ScheduledJobId = "ocid1.test.oc1..<unique_ID>EXAMPLE-scheduledJobId-Value",
				UpdateScheduledJobDetails = updateScheduledJobDetails,
				IfMatch = "EXAMPLE-ifMatch-Value",
				OpcRequestId = "5XJBI7P4YLVOPAJZWFTW<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 ScheduledJobClient(provider, new ClientConfiguration()))
				{
					var response = await client.UpdateScheduledJob(updateScheduledJobRequest);
					// Retrieve value from the response.
					var id = response.ScheduledJob.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"UpdateScheduledJob Failed with {e.Message}");
                throw e;
            }
        }

    }
}

Was this article helpful?