Skip to content

Commit

Permalink
Added - Support for autonomous database-dedicated
Browse files Browse the repository at this point in the history
  • Loading branch information
krinapat authored and ravinitp committed Aug 16, 2024
1 parent f7128fc commit 00f727f
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -671,10 +671,11 @@ func (s *DisasterRecoveryDrPlanResourceCrud) mapToUpdateDrPlanGroupDetails(field
result.Id = &tmp
}

/*if isPauseEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_pause_enabled")); ok {
tmp := isPauseEnabled.(bool)
result.IsPauseEnabled = &tmp
}*/
/*
if isPauseEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_pause_enabled")); ok {
tmp := isPauseEnabled.(bool)
result.IsPauseEnabled = &tmp
}*/

if steps, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "steps")); ok {
interfaces := steps.([]interface{})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ func DisasterRecoveryDrProtectionGroupResource() *schema.Resource {
Required: true,
DiffSuppressFunc: tfresource.EqualIgnoreCaseSuppressDiff,
ValidateFunc: validation.StringInSlice([]string{
"AUTONOMOUS_CONTAINER_DATABASE",
"AUTONOMOUS_DATABASE",
"COMPUTE_INSTANCE",
"COMPUTE_INSTANCE_MOVABLE",
Expand All @@ -146,6 +147,11 @@ func DisasterRecoveryDrProtectionGroupResource() *schema.Resource {
},

// Optional
"autonomous_database_standby_type_for_dr_drills": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"backend_set_mappings": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -236,6 +242,11 @@ func DisasterRecoveryDrProtectionGroupResource() *schema.Resource {
},
},
},
"connection_string_type": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"bucket": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -1427,8 +1438,26 @@ func (s *DisasterRecoveryDrProtectionGroupResourceCrud) mapToCreateDrProtectionG
memberType = "" // default value
}
switch strings.ToLower(memberType) {
case strings.ToLower("AUTONOMOUS_CONTAINER_DATABASE"):
details := oci_disaster_recovery.UpdateDrProtectionGroupMemberAutonomousContainerDatabaseDetails{}
if connectionStringType, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "connection_string_type")); ok {
details.ConnectionStringType = oci_disaster_recovery.AutonomousContainerDatabaseSnapshotStandbyConnectionStringTypeEnum(connectionStringType.(string))
}
if memberId, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "member_id")); ok {
tmp := memberId.(string)
details.MemberId = &tmp
}
baseObject = details
case strings.ToLower("AUTONOMOUS_DATABASE"):
details := oci_disaster_recovery.CreateDrProtectionGroupMemberAutonomousDatabaseDetails{}
details := oci_disaster_recovery.UpdateDrProtectionGroupMemberAutonomousDatabaseDetails{}
if autonomousDatabaseStandbyTypeForDrDrills, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "autonomous_database_standby_type_for_dr_drills")); ok {
details.AutonomousDatabaseStandbyTypeForDrDrills = oci_disaster_recovery.AutonomousDatabaseStandbyTypeForDrDrillsEnum(autonomousDatabaseStandbyTypeForDrDrills.(string))
}
if passwordVaultSecretId, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "password_vault_secret_id")); ok {
tmp := passwordVaultSecretId.(string)
details.PasswordVaultSecretId = &tmp
}
details = oci_disaster_recovery.UpdateDrProtectionGroupMemberAutonomousDatabaseDetails{}
if memberId, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "member_id")); ok {
tmp := memberId.(string)
details.MemberId = &tmp
Expand Down Expand Up @@ -1698,8 +1727,35 @@ func (s *DisasterRecoveryDrProtectionGroupResourceCrud) mapToUpdateDrProtectionG
memberType = "" // default value
}
switch strings.ToLower(memberType) {
case strings.ToLower("AUTONOMOUS_CONTAINER_DATABASE"):
details := oci_disaster_recovery.UpdateDrProtectionGroupMemberAutonomousContainerDatabaseDetails{}
if connectionStringType, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "connection_string_type")); ok {
tmp := connectionStringType.(string)
if tmp != "" {
details.ConnectionStringType = oci_disaster_recovery.AutonomousContainerDatabaseSnapshotStandbyConnectionStringTypeEnum(tmp)
}
}
if memberId, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "member_id")); ok {
tmp := memberId.(string)
if tmp != "" {
details.MemberId = &tmp
}
}
baseObject = details
case strings.ToLower("AUTONOMOUS_DATABASE"):
details := oci_disaster_recovery.UpdateDrProtectionGroupMemberAutonomousDatabaseDetails{}
if autonomousDatabaseStandbyTypeForDrDrills, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "autonomous_database_standby_type_for_dr_drills")); ok {
tmp := autonomousDatabaseStandbyTypeForDrDrills.(string)
if tmp != "" {
details.AutonomousDatabaseStandbyTypeForDrDrills = oci_disaster_recovery.AutonomousDatabaseStandbyTypeForDrDrillsEnum(tmp)
}
}
if passwordVaultSecretId, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "password_vault_secret_id")); ok {
tmp := passwordVaultSecretId.(string)
if tmp != "" {
details.PasswordVaultSecretId = &tmp
}
}
if memberId, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "member_id")); ok {
tmp := memberId.(string)
if tmp != "" {
Expand Down Expand Up @@ -2003,9 +2059,24 @@ func (s *DisasterRecoveryDrProtectionGroupResourceCrud) mapToUpdateDrProtectionG
func DrProtectionGroupMemberToMap(obj oci_disaster_recovery.DrProtectionGroupMember) map[string]interface{} {
result := map[string]interface{}{}
switch v := (obj).(type) {
case oci_disaster_recovery.UpdateDrProtectionGroupMemberAutonomousContainerDatabaseDetails:
result["member_type"] = "AUTONOMOUS_CONTAINER_DATABASE"

result["connection_string_type"] = string(v.ConnectionStringType)

if v.MemberId != nil {
result["member_id"] = string(*v.MemberId)
}
case oci_disaster_recovery.UpdateDrProtectionGroupMemberAutonomousDatabaseDetails:
case oci_disaster_recovery.DrProtectionGroupMemberAutonomousDatabase:
result["member_type"] = "AUTONOMOUS_DATABASE"

result["autonomous_database_standby_type_for_dr_drills"] = string(v.AutonomousDatabaseStandbyTypeForDrDrills)

if v.PasswordVaultSecretId != nil {
result["password_vault_secret_id"] = string(*v.PasswordVaultSecretId)
}

if v.MemberId != nil {
result["member_id"] = string(*v.MemberId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ The following attributes are exported:
* `namespace` - The namespace in object storage (Note - this is usually the tenancy name). Example: `myocitenancy`
* `object` - The object name inside the object storage bucket. Example: `switchover_plan_executions`
* `members` - A list of DR protection group members.
* `autonomous_database_standby_type_for_dr_drills` - This specifies the mechanism used to create a temporary Autonomous Database instance for DR Drills. See https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/autonomous-clone-about.html for information about these clone types. See https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/autonomous-data-guard-snapshot-standby.html for information about snapshot standby.
* `backend_set_mappings` - A list of backend set mappings that are used to transfer or update backends during DR.
* `destination_backend_set_name` - The name of the destination backend set. Example: `My_Destination_Backend_Set`
* `is_backend_set_for_non_movable` - This flag specifies if this backend set is used for traffic for non-movable compute instances. Backend sets that point to non-movable instances are only enabled or disabled during DR. For non-movable instances this flag should be set to 'true'. Backend sets that point to movable instances are emptied and their contents are transferred to the destination region network load balancer. For movable instances this flag should be set to 'false'. Example: `true`
Expand All @@ -55,6 +56,7 @@ The following attributes are exported:
* `mount_details` - The details for mounting or unmounting the file system on a block volume.
* `mount_point` - The physical mount point used for mounting and unmounting the file system on a block volume. Example: `/mnt/yourmountpoint`
* `bucket` - The bucket name inside the object storage namespace. Example: `bucket_name`
* `connection_string_type` - The type of connection strings used to connect to an Autonomous Container Database snapshot standby created during a DR Drill operation. See https://docs.oracle.com/en/cloud/paas/autonomous-database/dedicated/adbcl/index.html for information about these service types.
* `destination_availability_domain` - The availability domain of the destination mount target. Example: `BBTh:region-AD`
* `destination_capacity_reservation_id` - The OCID of a capacity reservation in the destination region which will be used to launch the compute instance. Example: `ocid1.capacityreservation.oc1..uniqueID`
* `destination_compartment_id` - The OCID of a compartment in the destination region in which the compute instance should be launched. Example: `ocid1.compartment.oc1..uniqueID`
Expand All @@ -78,7 +80,7 @@ The following attributes are exported:
* `member_id` - The OCID of the member. Example: `ocid1.instance.oc1..uniqueID`
* `member_type` - The type of the member.
* `namespace` - The namespace in object storage (Note - this is usually the tenancy name). Example: `myocitenancy`
* `password_vault_secret_id` - The OCID of the vault secret where the database SYSDBA password is stored. This password is used for performing database DR operations. Example: `ocid1.vaultsecret.oc1..uniqueID`
* `password_vault_secret_id` - The OCID of the vault secret where the database SYSDBA password is stored. This password is required and used for performing database DR Drill operations when using full clone. Example: `ocid1.vaultsecret.oc1..uniqueID`
* `vnic_mapping` - A list of compute instance VNIC mappings.
* `destination_nsg_id_list` - A list of OCIDs of network security groups (NSG) in the destination region which should be assigned to the source VNIC. Example: `[ ocid1.networksecuritygroup.oc1..uniqueID1, ocid1.networksecuritygroup.oc1..uniqueID2 ]`
* `destination_subnet_id` - The OCID of the destination subnet to which the source VNIC should connect. Example: `ocid1.subnet.oc1..uniqueID`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ The following attributes are exported:
* `namespace` - The namespace in object storage (Note - this is usually the tenancy name). Example: `myocitenancy`
* `object` - The object name inside the object storage bucket. Example: `switchover_plan_executions`
* `members` - A list of DR protection group members.
* `autonomous_database_standby_type_for_dr_drills` - This specifies the mechanism used to create a temporary Autonomous Database instance for DR Drills. See https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/autonomous-clone-about.html for information about these clone types. See https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/autonomous-data-guard-snapshot-standby.html for information about snapshot standby.
* `backend_set_mappings` - A list of backend set mappings that are used to transfer or update backends during DR.
* `destination_backend_set_name` - The name of the destination backend set. Example: `My_Destination_Backend_Set`
* `is_backend_set_for_non_movable` - This flag specifies if this backend set is used for traffic for non-movable compute instances. Backend sets that point to non-movable instances are only enabled or disabled during DR. For non-movable instances this flag should be set to 'true'. Backend sets that point to movable instances are emptied and their contents are transferred to the destination region network load balancer. For movable instances this flag should be set to 'false'. Example: `true`
Expand All @@ -72,6 +73,7 @@ The following attributes are exported:
* `block_volume_id` - The OCID of the block volume. Example: `ocid1.volume.oc1..uniqueID`
* `mount_details` - The details for mounting or unmounting the file system on a block volume.
* `mount_point` - The physical mount point used for mounting and unmounting the file system on a block volume. Example: `/mnt/yourmountpoint`
* `connection_string_type` - The type of connection strings used to connect to an Autonomous Container Database snapshot standby created during a DR Drill operation. See https://docs.oracle.com/en/cloud/paas/autonomous-database/dedicated/adbcl/index.html for information about these service types.
* `bucket` - The bucket name inside the object storage namespace. Example: `bucket_name`
* `destination_availability_domain` - The availability domain of the destination mount target. Example: `BBTh:region-AD`
* `destination_capacity_reservation_id` - The OCID of a capacity reservation in the destination region which will be used to launch the compute instance. Example: `ocid1.capacityreservation.oc1..uniqueID`
Expand All @@ -96,7 +98,7 @@ The following attributes are exported:
* `member_id` - The OCID of the member. Example: `ocid1.instance.oc1..uniqueID`
* `member_type` - The type of the member.
* `namespace` - The namespace in object storage (Note - this is usually the tenancy name). Example: `myocitenancy`
* `password_vault_secret_id` - The OCID of the vault secret where the database SYSDBA password is stored. This password is used for performing database DR operations. Example: `ocid1.vaultsecret.oc1..uniqueID`
* `password_vault_secret_id` - The OCID of the vault secret where the database SYSDBA password is stored. This password is required and used for performing database DR Drill operations when using full clone. Example: `ocid1.vaultsecret.oc1..uniqueID`
* `vnic_mapping` - A list of compute instance VNIC mappings.
* `destination_nsg_id_list` - A list of OCIDs of network security groups (NSG) in the destination region which should be assigned to the source VNIC. Example: `[ ocid1.networksecuritygroup.oc1..uniqueID1, ocid1.networksecuritygroup.oc1..uniqueID2 ]`
* `destination_subnet_id` - The OCID of the destination subnet to which the source VNIC should connect. Example: `ocid1.subnet.oc1..uniqueID`
Expand Down
Loading

0 comments on commit 00f727f

Please sign in to comment.