// 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).
package main
import (
"context"
"fmt"
"github.com/oracle/oci-go-sdk/v65/common"
"github.com/oracle/oci-go-sdk/v65/example/helpers"
"github.com/oracle/oci-go-sdk/v65/globallydistributeddatabase"
)
func ExampleCreateShardedDatabase() {
// 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.
client, err := globallydistributeddatabase.NewShardedDatabaseServiceClientWithConfigurationProvider(common.DefaultConfigProvider())
helpers.FatalIfError(err)
// Create a request and dependent object(s).
req := globallydistributeddatabase.CreateShardedDatabaseRequest{CreateShardedDatabaseDetails: globallydistributeddatabase.CreateDedicatedShardedDatabase{DisplayName: common.String("EXAMPLE-displayName-Value"),
ListenerPortTls: common.Int(18646),
CatalogDetails: []globallydistributeddatabase.CreateDedicatedCatalogDetail{globallydistributeddatabase.CreateDedicatedCatalogDetail{EncryptionKeyDetails: &globallydistributeddatabase.DedicatedShardOrCatalogEncryptionKeyDetails{KmsKeyVersionId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyVersionId-Value"),
VaultId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value"),
KmsKeyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value")},
IsAutoScalingEnabled: common.Bool(true),
PeerCloudAutonomousVmClusterId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-peerCloudAutonomousVmClusterId-Value"),
AdminPassword: common.String("EXAMPLE-adminPassword-Value"),
CloudAutonomousVmClusterId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-cloudAutonomousVmClusterId-Value"),
ComputeCount: common.Float32(4387.8813),
DataStorageSizeInGbs: common.Float64(3617.9263)}},
CharacterSet: common.String("EXAMPLE-characterSet-Value"),
Chunks: common.Int(542),
ClusterCertificateCommonName: common.String("EXAMPLE-clusterCertificateCommonName-Value"),
CompartmentId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value"),
DbVersion: common.String("EXAMPLE-dbVersion-Value"),
NcharacterSet: common.String("EXAMPLE-ncharacterSet-Value"),
OnsPortLocal: common.Int(51880),
DbWorkload: globallydistributeddatabase.CreateDedicatedShardedDatabaseDbWorkloadOltp,
DefinedTags: map[string]map[string]interface{}{"EXAMPLE_KEY_qTUUE": map[string]interface{}{"EXAMPLE_KEY_qHAl2": "EXAMPLE--Value"}},
FreeformTags: map[string]string{"EXAMPLE_KEY_zSVSd": "EXAMPLE_VALUE_XwYRxeQdJRb16O7I9ho2"},
ListenerPort: common.Int(62108),
OnsPortRemote: common.Int(62334),
Prefix: common.String("Xcg"),
ShardDetails: []globallydistributeddatabase.CreateDedicatedShardDetail{globallydistributeddatabase.CreateDedicatedShardDetail{CloudAutonomousVmClusterId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-cloudAutonomousVmClusterId-Value"),
ComputeCount: common.Float32(8518.397),
DataStorageSizeInGbs: common.Float64(2460.2217),
EncryptionKeyDetails: &globallydistributeddatabase.DedicatedShardOrCatalogEncryptionKeyDetails{KmsKeyId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"),
KmsKeyVersionId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyVersionId-Value"),
VaultId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value")},
IsAutoScalingEnabled: common.Bool(false),
PeerCloudAutonomousVmClusterId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-peerCloudAutonomousVmClusterId-Value"),
ShardSpace: common.String("EXAMPLE-shardSpace-Value"),
AdminPassword: common.String("EXAMPLE-adminPassword-Value")}},
ShardingMethod: globallydistributeddatabase.CreateDedicatedShardedDatabaseShardingMethodUser},
OpcRequestId: common.String("FCXOONUU2QXDFTOIPPLM<unique_ID>"),
OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value")}
// Send the request using the service client
resp, err := client.CreateShardedDatabase(context.Background(), req)
helpers.FatalIfError(err)
// Retrieve value from the response.
fmt.Println(resp)
}