// 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.MysqlService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Mysql
{
public class UpdateDbSystemExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var updateDbSystemDetails = new Oci.MysqlService.Models.UpdateDbSystemDetails
{
DisplayName = "EXAMPLE-displayName-Value",
Description = "EXAMPLE-description-Value",
SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
NsgIds = new List<string>
{
"EXAMPLE--Value"
},
DatabaseMode = Oci.MysqlService.Models.DbSystem.DatabaseModeEnum.ReadWrite,
AccessMode = Oci.MysqlService.Models.DbSystem.AccessModeEnum.Restricted,
Rest = new Oci.MysqlService.Models.UpdateRestDetails
{
Configuration = Oci.MysqlService.Models.RestConfigurationType.DbsystemOnly,
Port = 15636
},
IsHighlyAvailable = true,
AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
FaultDomain = "EXAMPLE-faultDomain-Value",
ShapeName = "EXAMPLE-shapeName-Value",
MysqlVersion = "EXAMPLE-mysqlVersion-Value",
ConfigurationId = "ocid1.test.oc1..<unique_ID>EXAMPLE-configurationId-Value",
AdminUsername = "EXAMPLE-adminUsername-Value",
AdminPassword = "EXAMPLE-adminPassword-Value",
DataStorageSizeInGBs = 123952,
DataStorage = new Oci.MysqlService.Models.DataStorageDetails
{
IsAutoExpandStorageEnabled = false,
MaxStorageSizeInGBs = 46414
},
HostnameLabel = "EXAMPLE-hostnameLabel-Value",
IpAddress = "EXAMPLE-ipAddress-Value",
Port = 28629,
PortX = 5182,
BackupPolicy = new Oci.MysqlService.Models.UpdateBackupPolicyDetails
{
IsEnabled = false,
SoftDelete = Oci.MysqlService.Models.SoftDelete.Disabled,
CopyPolicies = new List<Oci.MysqlService.Models.CopyPolicy>
{
new Oci.MysqlService.Models.CopyPolicy
{
CopyToRegion = "EXAMPLE-copyToRegion-Value",
BackupCopyRetentionInDays = 4
}
},
WindowStartTime = "EXAMPLE-windowStartTime-Value",
RetentionInDays = 31,
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_PaxGP",
"EXAMPLE_VALUE_PUrpn2qXaAAfNxd6Zlfh"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_jqT9w",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_N38P4",
"EXAMPLE--Value"
}
}
}
},
PitrPolicy = new Oci.MysqlService.Models.PitrPolicy
{
IsEnabled = true
}
},
Maintenance = new Oci.MysqlService.Models.UpdateMaintenanceDetails
{
WindowStartTime = "EXAMPLE-windowStartTime-Value"
},
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_PYatk",
"EXAMPLE_VALUE_Fuk0KtfbLJZTq94yb4cN"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_AHZJ3",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_CT0Zh",
"EXAMPLE--Value"
}
}
}
},
DeletionPolicy = new Oci.MysqlService.Models.UpdateDeletionPolicyDetails
{
AutomaticBackupRetention = Oci.MysqlService.Models.UpdateDeletionPolicyDetails.AutomaticBackupRetentionEnum.Retain,
FinalBackup = Oci.MysqlService.Models.UpdateDeletionPolicyDetails.FinalBackupEnum.SkipFinalBackup,
IsDeleteProtected = false
},
CrashRecovery = Oci.MysqlService.Models.CrashRecoveryStatus.Disabled,
DatabaseManagement = Oci.MysqlService.Models.DatabaseManagementStatus.Disabled,
SecureConnections = new Oci.MysqlService.Models.SecureConnectionDetails
{
CertificateId = "ocid1.test.oc1..<unique_ID>EXAMPLE-certificateId-Value",
CertificateGenerationType = Oci.MysqlService.Models.CertificateGenerationType.System
},
EncryptData = new Oci.MysqlService.Models.EncryptDataDetails
{
KeyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-keyId-Value",
KeyGenerationType = Oci.MysqlService.Models.KeyGenerationType.Byok
},
CustomerContacts = new List<Oci.MysqlService.Models.CustomerContact>
{
new Oci.MysqlService.Models.CustomerContact
{
Email = "EXAMPLE-email-Value"
}
},
ReadEndpoint = new Oci.MysqlService.Models.UpdateReadEndpointDetails
{
IsEnabled = false,
ReadEndpointIpAddress = "EXAMPLE-readEndpointIpAddress-Value",
ReadEndpointHostnameLabel = "EXAMPLE-readEndpointHostnameLabel-Value",
ExcludeIps = new List<string>
{
"EXAMPLE--Value"
}
}
};
var updateDbSystemRequest = new Oci.MysqlService.Requests.UpdateDbSystemRequest
{
DbSystemId = "ocid1.test.oc1..<unique_ID>EXAMPLE-dbSystemId-Value",
UpdateDbSystemDetails = updateDbSystemDetails,
IfMatch = "EXAMPLE-ifMatch-Value",
OpcRequestId = "ZFUW6E46MHLYG2CJOQMZ<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 DbSystemClient(provider, new ClientConfiguration()))
{
var response = await client.UpdateDbSystem(updateDbSystemRequest);
// Retrieve value from the response.
var versionValue = response.httpResponseMessage.Version;
}
}
catch (Exception e)
{
Console.WriteLine($"UpdateDbSystem Failed with {e.Message}");
throw e;
}
}
}
}