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

namespace Oci.Sdk.DotNet.Example.Goldengate
{
    public class UpdateDeploymentExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var updateDeploymentDetails = new Oci.GoldengateService.Models.UpdateDeploymentDetails
			{
				DisplayName = "EXAMPLE-displayName-Value",
				LicenseModel = Oci.GoldengateService.Models.LicenseModel.BringYourOwnLicense,
				EnvironmentType = Oci.GoldengateService.Models.EnvironmentType.Production,
				Description = "EXAMPLE-description-Value",
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_eAwmb", 
						"EXAMPLE_VALUE_TcvHkULsJM1LN0rpxFXq"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_8Yx6C", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_XcHcz", 
								"EXAMPLE--Value"
							}
						}
					}
				},
				NsgIds = new List<string>
				{
					"EXAMPLE--Value"
				},
				SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
				LoadBalancerSubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-loadBalancerSubnetId-Value",
				IsPublic = true,
				Fqdn = "EXAMPLE-fqdn-Value",
				CpuCoreCount = 3,
				IsAutoScalingEnabled = false,
				Placements = new List<Oci.GoldengateService.Models.DeploymentPlacementDetails>
				{
					new Oci.GoldengateService.Models.DeploymentPlacementDetails
					{
						AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
						FaultDomain = "EXAMPLE-faultDomain-Value"
					}
				},
				OggData = new Oci.GoldengateService.Models.UpdateOggDeploymentDetails
				{
					CredentialStore = Oci.GoldengateService.Models.CredentialStore.Iam,
					IdentityDomainId = "ocid1.test.oc1..<unique_ID>EXAMPLE-identityDomainId-Value",
					PasswordSecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-passwordSecretId-Value",
					AdminUsername = "EXAMPLE-adminUsername-Value",
					AdminPassword = "EXAMPLE-adminPassword-Value",
					Certificate = "EXAMPLE-certificate-Value",
					Key = "EXAMPLE-key-Value",
					GroupToRolesMapping = new Oci.GoldengateService.Models.UpdateGroupToRolesMappingDetails
					{
						SecurityGroupId = "ocid1.test.oc1..<unique_ID>EXAMPLE-securityGroupId-Value",
						AdministratorGroupId = "ocid1.test.oc1..<unique_ID>EXAMPLE-administratorGroupId-Value",
						OperatorGroupId = "ocid1.test.oc1..<unique_ID>EXAMPLE-operatorGroupId-Value",
						UserGroupId = "ocid1.test.oc1..<unique_ID>EXAMPLE-userGroupId-Value"
					}
				},
				MaintenanceWindow = new Oci.GoldengateService.Models.UpdateMaintenanceWindowDetails
				{
					Day = Oci.GoldengateService.Models.Day.Monday,
					StartHour = 2
				},
				MaintenanceConfiguration = new Oci.GoldengateService.Models.UpdateMaintenanceConfigurationDetails
				{
					IsInterimReleaseAutoUpgradeEnabled = true,
					InterimReleaseUpgradePeriodInDays = 444,
					BundleReleaseUpgradePeriodInDays = 120,
					MajorReleaseUpgradePeriodInDays = 783,
					SecurityPatchUpgradePeriodInDays = 183
				},
				BackupSchedule = new Oci.GoldengateService.Models.UpdateBackupScheduleDetails
				{
					TimeBackupScheduled = DateTime.Parse("06/18/2019 08:39:20"),
					FrequencyBackupScheduled = Oci.GoldengateService.Models.UpdateBackupScheduleDetails.FrequencyBackupScheduledEnum.Monthly,
					BucketName = "EXAMPLE-bucketName-Value",
					CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
					NamespaceName = "EXAMPLE-namespaceName-Value",
					IsMetadataOnly = true
				}
			};
			var updateDeploymentRequest = new Oci.GoldengateService.Requests.UpdateDeploymentRequest
			{
				DeploymentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-deploymentId-Value",
				UpdateDeploymentDetails = updateDeploymentDetails,
				IfMatch = "EXAMPLE-ifMatch-Value",
				OpcRequestId = "IHJGMHFTUZJAXHX2FJ0O<unique_ID>",
				IsLockOverride = false
			};

            // 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 GoldenGateClient(provider, new ClientConfiguration()))
				{
					var response = await client.UpdateDeployment(updateDeploymentRequest);
					// Retrieve value from the response.
					var versionValue = response.httpResponseMessage.Version;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"UpdateDeployment Failed with {e.Message}");
                throw e;
            }
        }

    }
}

Was this article helpful?