// 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 CreateDeploymentExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var createDeploymentDetails = new Oci.GoldengateService.Models.CreateDeploymentDetails
{
DisplayName = "EXAMPLE-displayName-Value",
LicenseModel = Oci.GoldengateService.Models.LicenseModel.BringYourOwnLicense,
IsByolCpuCoreCountLimitEnabled = false,
ByolCpuCoreCountLimit = 903,
EnvironmentType = Oci.GoldengateService.Models.EnvironmentType.Production,
Description = "EXAMPLE-description-Value",
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
SourceDeploymentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-sourceDeploymentId-Value",
AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
FaultDomain = "EXAMPLE-faultDomain-Value",
Placements = new List<Oci.GoldengateService.Models.DeploymentPlacementDetails>
{
new Oci.GoldengateService.Models.DeploymentPlacementDetails
{
AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
FaultDomain = "EXAMPLE-faultDomain-Value"
}
},
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_R1oJ6",
"EXAMPLE_VALUE_QyhY8ReQyS2IYvHIY2pX"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_LRYoj",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_Oo6tx",
"EXAMPLE--Value"
}
}
}
},
Locks = new List<Oci.GoldengateService.Models.AddResourceLockDetails>
{
new Oci.GoldengateService.Models.AddResourceLockDetails
{
Type = Oci.GoldengateService.Models.AddResourceLockDetails.TypeEnum.Delete,
Message = "EXAMPLE-message-Value"
}
},
DeploymentBackupId = "ocid1.test.oc1..<unique_ID>EXAMPLE-deploymentBackupId-Value",
SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
LoadBalancerSubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-loadBalancerSubnetId-Value",
Fqdn = "EXAMPLE-fqdn-Value",
NsgIds = new List<string>
{
"EXAMPLE--Value"
},
IsPublic = false,
CpuCoreCount = 8,
IsAutoScalingEnabled = false,
DeploymentType = Oci.GoldengateService.Models.DeploymentType.DatabaseDb2Zos,
SubscriptionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value",
ClusterPlacementGroupId = "ocid1.test.oc1..<unique_ID>EXAMPLE-clusterPlacementGroupId-Value",
SecurityAttributes = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_Kryqo",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_AfNuY",
"EXAMPLE--Value"
}
}
}
},
OggData = new Oci.GoldengateService.Models.CreateOggDeploymentDetails
{
DeploymentName = "EXAMPLE-deploymentName-Value",
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",
OggVersion = "EXAMPLE-oggVersion-Value",
GroupToRolesMapping = new Oci.GoldengateService.Models.GroupToRolesMappingDetails
{
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.CreateMaintenanceWindowDetails
{
Day = Oci.GoldengateService.Models.Day.Saturday,
StartHour = 1
},
MaintenanceConfiguration = new Oci.GoldengateService.Models.CreateMaintenanceConfigurationDetails
{
IsInterimReleaseAutoUpgradeEnabled = true,
InterimReleaseUpgradePeriodInDays = 845,
BundleReleaseUpgradePeriodInDays = 591,
MajorReleaseUpgradePeriodInDays = 436,
SecurityPatchUpgradePeriodInDays = 475
},
BackupSchedule = new Oci.GoldengateService.Models.CreateBackupScheduleDetails
{
TimeBackupScheduled = DateTime.Parse("02/06/2044 01:49:22"),
FrequencyBackupScheduled = Oci.GoldengateService.Models.CreateBackupScheduleDetails.FrequencyBackupScheduledEnum.Monthly,
BucketName = "EXAMPLE-bucketName-Value",
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
NamespaceName = "EXAMPLE-namespaceName-Value",
IsMetadataOnly = true
}
};
var createDeploymentRequest = new Oci.GoldengateService.Requests.CreateDeploymentRequest
{
CreateDeploymentDetails = createDeploymentDetails,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcRequestId = "6JHRMQ1C63C3QAU0JRFI<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 GoldenGateClient(provider, new ClientConfiguration()))
{
var response = await client.CreateDeployment(createDeploymentRequest);
// Retrieve value from the response.
var id = response.Deployment.Id;
}
}
catch (Exception e)
{
Console.WriteLine($"CreateDeployment Failed with {e.Message}");
throw e;
}
}
}
}