// 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/databasemanagement"
"github.com/oracle/oci-go-sdk/v65/example/helpers"
)
func ExampleCreateTablespace() {
// 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 := databasemanagement.NewDbManagementClientWithConfigurationProvider(common.DefaultConfigProvider())
helpers.FatalIfError(err)
// Create a request and dependent object(s).
req := databasemanagement.CreateTablespaceRequest{CreateTablespaceDetails: databasemanagement.CreateTablespaceDetails{DatabaseCredential: databasemanagement.DatabasePasswordCredentialDetails{Password: common.String("EXAMPLE-password-Value"),
Role: databasemanagement.DatabasePasswordCredentialDetailsRoleNormal,
Username: common.String("EXAMPLE-username-Value")},
DefaultCompress: databasemanagement.CreateTablespaceDetailsDefaultCompressNoCompress,
IsBigfile: common.Bool(false),
IsMaxSizeUnlimited: common.Bool(true),
IsAutoExtensible: common.Bool(false),
BlockSizeInKilobytes: common.Int(190),
DataFiles: []string{"EXAMPLE--Value"},
ExtentUniformSize: &databasemanagement.TablespaceStorageSize{Size: common.Float32(1185.0131),
Unit: databasemanagement.TablespaceStorageSizeUnitKilobytes},
FileSize: &databasemanagement.TablespaceStorageSize{Unit: databasemanagement.TablespaceStorageSizeUnitGigabytes,
Size: common.Float32(9944.298)},
IsDefault: common.Bool(true),
IsEncrypted: common.Bool(false),
Status: databasemanagement.CreateTablespaceDetailsStatusWrite,
Type: databasemanagement.CreateTablespaceDetailsTypePermanent,
AutoExtendMaxSize: &databasemanagement.TablespaceStorageSize{Size: common.Float32(9850.005),
Unit: databasemanagement.TablespaceStorageSizeUnitGigabytes},
AutoExtendNextSize: &databasemanagement.TablespaceStorageSize{Size: common.Float32(7824.259),
Unit: databasemanagement.TablespaceStorageSizeUnitMegabytes},
ExtentManagement: databasemanagement.CreateTablespaceDetailsExtentManagementAutoallocate,
FileCount: common.Int(308),
SegmentManagement: databasemanagement.CreateTablespaceDetailsSegmentManagementAuto,
CredentialDetails: databasemanagement.TablespaceAdminPasswordCredentialDetails{Username: common.String("EXAMPLE-username-Value"),
Password: common.String("EXAMPLE-password-Value"),
Role: databasemanagement.TablespaceAdminCredentialDetailsRoleNormal},
EncryptionAlgorithm: common.String("EXAMPLE-encryptionAlgorithm-Value"),
IsReusable: common.Bool(true),
Name: common.String("EXAMPLE-name-Value")},
ManagedDatabaseId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-managedDatabaseId-Value"),
OpcRequestId: common.String("ZOQV7FWF4RPOELLXO6DQ<unique_ID>"),
OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value")}
// Send the request using the service client
resp, err := client.CreateTablespace(context.Background(), req)
helpers.FatalIfError(err)
// Retrieve value from the response.
fmt.Println(resp)
}