diff --git a/.changelog/2807.txt b/.changelog/2807.txt
new file mode 100644
index 0000000000..ae286af59d
--- /dev/null
+++ b/.changelog/2807.txt
@@ -0,0 +1,7 @@
+```release-note:new-resource
+tencentcloud_postgresql_account
+```
+
+```release-note:new-data-source
+tencentcloud_postgresql_account_privileges
+```
diff --git a/go.mod b/go.mod
index ccdfcd33b5..8f032dfb3a 100644
--- a/go.mod
+++ b/go.mod
@@ -46,7 +46,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.984
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.544
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.970
- github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.993
+ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.995
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.960
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.762
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.692
@@ -70,7 +70,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor v1.0.844
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mps v1.0.853
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization v1.0.991
- github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres v1.0.873
+ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres v1.0.995
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/privatedns v1.0.859
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts v1.0.762
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis v1.0.657
diff --git a/go.sum b/go.sum
index 622e572379..3eb6713e64 100644
--- a/go.sum
+++ b/go.sum
@@ -933,6 +933,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.993 h1:+iJM
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.993/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993 h1:WlPgXldQCxt7qi5Xrc6j6zTrsXWzN5BcOGs7Irq7fwQ=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/controlcenter v1.0.993/go.mod h1:Z9U8zNtyuyKhjS0698wqsrG/kLx1TQ5CEixXBwVe7xY=
+github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.995 h1:I1l5kl6rdQYDLEk8DqWjZgwMh0+nYnqbwq7KS4bqi/s=
+github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.995/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860 h1:F3esKBIT3HW9+7Gt8cVgf8X06VdGIczpgLBUECzSEzU=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/csip v1.0.860/go.mod h1:NZo1WplQcC314kMlCRUoy8NQju2BnolIJj7NAWgsuhY=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.960 h1:Tpz3KVUfaJ7b98wQDYZSbmoKIn0hlH0oHPOzWMzE5Q8=
@@ -991,6 +993,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization v1.0.991 h
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization v1.0.991/go.mod h1:1QZV9ZlcmYEVz/kA5jj8jHDjQsEKbT13WJBywZzaX2U=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres v1.0.873 h1:kqNFHpILFWPbOUAUrH1i6+IfkLWWEAZLYfj9RZ0WM+0=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres v1.0.873/go.mod h1:Mjkr/911Pw0VopTfXt5zt46TnV3IrX01mvjZ66RsRRg=
+github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres v1.0.995 h1:chLBYIeKYtDy2kB/IO4uFMLZzlYn/rDoBi7K34HWJu0=
+github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres v1.0.995/go.mod h1:Qv44A5kdz3uX4TYhXz4WacYVSZ0BQL9aYtTdJEwDCQw=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/privatedns v1.0.859 h1:VrE3qzwzWB5mV/ejTJuwZbqZ/CNYLoc8X+uFbWEEOnY=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/privatedns v1.0.859/go.mod h1:FeOl14rPWpNEu6r4bPEsTNHIB9qaRTg0dRhxhRwQ5Hw=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts v1.0.762 h1:rZDKucVVtTnmnbZFDyh6t47dHswkb2oSuOxOHTTkygA=
diff --git a/tencentcloud/provider.go b/tencentcloud/provider.go
index e3d34a4986..0c7485ef7f 100644
--- a/tencentcloud/provider.go
+++ b/tencentcloud/provider.go
@@ -680,6 +680,7 @@ func Provider() *schema.Provider {
"tencentcloud_postgresql_regions": postgresql.DataSourceTencentCloudPostgresqlRegions(),
"tencentcloud_postgresql_db_instance_versions": postgresql.DataSourceTencentCloudPostgresqlDbInstanceVersions(),
"tencentcloud_postgresql_zones": postgresql.DataSourceTencentCloudPostgresqlZones(),
+ "tencentcloud_postgresql_account_privileges": postgresql.DataSourceTencentCloudPostgresqlAccountPrivileges(),
"tencentcloud_sqlserver_zone_config": sqlserver.DataSourceTencentCloudSqlserverZoneConfig(),
"tencentcloud_sqlserver_instances": sqlserver.DataSourceTencentCloudSqlserverInstances(),
"tencentcloud_sqlserver_backups": sqlserver.DataSourceTencentCloudSqlserverBackups(),
@@ -1488,6 +1489,8 @@ func Provider() *schema.Provider {
"tencentcloud_postgresql_modify_account_remark_operation": postgresql.ResourceTencentCloudPostgresqlModifyAccountRemarkOperation(),
"tencentcloud_postgresql_modify_switch_time_period_operation": postgresql.ResourceTencentCloudPostgresqlModifySwitchTimePeriodOperation(),
"tencentcloud_postgresql_instance_ha_config": postgresql.ResourceTencentCloudPostgresqlInstanceHAConfig(),
+ "tencentcloud_postgresql_account": postgresql.ResourceTencentCloudPostgresqlAccount(),
+ "tencentcloud_postgresql_account_privileges_operation": postgresql.ResourceTencentCloudPostgresqlAccountPrivilegesOperation(),
"tencentcloud_sqlserver_instance": sqlserver.ResourceTencentCloudSqlserverInstance(),
"tencentcloud_sqlserver_db": sqlserver.ResourceTencentCloudSqlserverDB(),
"tencentcloud_sqlserver_account": sqlserver.ResourceTencentCloudSqlserverAccount(),
diff --git a/tencentcloud/provider.md b/tencentcloud/provider.md
index b7bafde2c5..8ae77bc74e 100644
--- a/tencentcloud/provider.md
+++ b/tencentcloud/provider.md
@@ -872,6 +872,7 @@ TencentDB for PostgreSQL(PostgreSQL)
tencentcloud_postgresql_regions
tencentcloud_postgresql_db_instance_versions
tencentcloud_postgresql_zones
+ tencentcloud_postgresql_account_privileges
Resource
tencentcloud_postgresql_instance
@@ -892,6 +893,7 @@ TencentDB for PostgreSQL(PostgreSQL)
tencentcloud_postgresql_modify_switch_time_period_operation
tencentcloud_postgresql_base_backup
tencentcloud_postgresql_instance_ha_config
+ tencentcloud_postgresql_account
TencentDB for Redis(crs)
Data Source
diff --git a/tencentcloud/services/postgresql/data_source_tc_postgresql_account_privileges.go b/tencentcloud/services/postgresql/data_source_tc_postgresql_account_privileges.go
new file mode 100644
index 0000000000..3656e14519
--- /dev/null
+++ b/tencentcloud/services/postgresql/data_source_tc_postgresql_account_privileges.go
@@ -0,0 +1,239 @@
+package postgresql
+
+import (
+ "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
+ "log"
+ "strings"
+
+ tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common"
+
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ postgresql "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312"
+)
+
+func DataSourceTencentCloudPostgresqlAccountPrivileges() *schema.Resource {
+ return &schema.Resource{
+ Read: dataSourceTencentCloudPostgresqlAccountPrivilegesRead,
+ Schema: map[string]*schema.Schema{
+ "db_instance_id": {
+ Required: true,
+ Type: schema.TypeString,
+ Description: "Instance ID.",
+ },
+ "user_name": {
+ Required: true,
+ Type: schema.TypeString,
+ Description: "Instance username.",
+ },
+ "database_object_set": {
+ Required: true,
+ Type: schema.TypeList,
+ Description: "Instance database object info.",
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "object_type": {
+ Type: schema.TypeString,
+ Required: true,
+ Description: "Supported database object types: account, database, schema, sequence, procedure, type, function, table, view, matview, column. Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ "object_name": {
+ Type: schema.TypeString,
+ Required: true,
+ Description: "Database object Name.Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ "database_name": {
+ Type: schema.TypeString,
+ Optional: true,
+ Description: "Database name to which the database object belongs. This parameter is mandatory when ObjectType is not database.Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ "schema_name": {
+ Type: schema.TypeString,
+ Optional: true,
+ Description: "Schema name to which the database object belongs. This parameter is mandatory when ObjectType is not database or schema.Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ "table_name": {
+ Type: schema.TypeString,
+ Optional: true,
+ Description: "Table name to which the database object belongs. This parameter is mandatory when ObjectType is column.Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ },
+ },
+ },
+ // computed
+ "privilege_set": {
+ Computed: true,
+ Type: schema.TypeList,
+ Description: "Privilege list.",
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "object": {
+ Type: schema.TypeList,
+ Computed: true,
+ Description: "Database object.If ObjectType is database, DatabaseName/SchemaName/TableName can be null.If ObjectType is schema, SchemaName/TableName can be null.If ObjectType is table, TableName can be null.If ObjectType is column, DatabaseName/SchemaName/TableName can't be null.In all other cases, DatabaseName/SchemaName/TableName can be null. Note: This field may return null, indicating that no valid value can be obtained.",
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "object_type": {
+ Type: schema.TypeString,
+ Computed: true,
+ Description: "Supported database object types: account, database, schema, sequence, procedure, type, function, table, view, matview, column. Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ "object_name": {
+ Type: schema.TypeString,
+ Computed: true,
+ Description: "Database object Name. Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ "database_name": {
+ Type: schema.TypeString,
+ Computed: true,
+ Description: "Database name to which the database object belongs. This parameter is mandatory when ObjectType is not database. Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ "schema_name": {
+ Type: schema.TypeString,
+ Computed: true,
+ Description: "Schema name to which the database object belongs. This parameter is mandatory when ObjectType is not database or schema. Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ "table_name": {
+ Type: schema.TypeString,
+ Computed: true,
+ Description: "Table name to which the database object belongs. This parameter is mandatory when ObjectType is column. Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ },
+ },
+ },
+ "privilege_set": {
+ Type: schema.TypeSet,
+ Elem: &schema.Schema{Type: schema.TypeString},
+ Computed: true,
+ Description: "Privileges the specific account has on database object. Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ },
+ },
+ },
+ "result_output_file": {
+ Type: schema.TypeString,
+ Optional: true,
+ Description: "Used to save results.",
+ },
+ },
+ }
+}
+
+func dataSourceTencentCloudPostgresqlAccountPrivilegesRead(d *schema.ResourceData, meta interface{}) error {
+ defer tccommon.LogElapsed("data_source.tencentcloud_postgresql_account_privileges.read")()
+ defer tccommon.InconsistentCheck(d, meta)()
+
+ var (
+ logId = tccommon.GetLogId(tccommon.ContextNil)
+ request = postgresql.NewDescribeAccountPrivilegesRequest()
+ privilegeSet []*postgresql.DatabasePrivilege
+ dBInstanceId string
+ userName string
+ )
+
+ if v, ok := d.GetOk("db_instance_id"); ok {
+ request.DBInstanceId = &dBInstanceId
+ dBInstanceId = v.(string)
+ }
+
+ if v, ok := d.GetOk("user_name"); ok {
+ request.UserName = &userName
+ userName = v.(string)
+ }
+
+ if v, ok := d.GetOk("database_object_set"); ok {
+ for _, item := range v.([]interface{}) {
+ objectMap := item.(map[string]interface{})
+ databaseObject := postgresql.DatabaseObject{}
+ if v, ok := objectMap["object_type"]; ok {
+ databaseObject.ObjectType = helper.String(v.(string))
+ }
+
+ if v, ok := objectMap["object_name"]; ok {
+ databaseObject.ObjectName = helper.String(v.(string))
+ }
+
+ if v, ok := objectMap["database_name"]; ok {
+ databaseObject.DatabaseName = helper.String(v.(string))
+ }
+
+ if v, ok := objectMap["schema_name"]; ok {
+ databaseObject.SchemaName = helper.String(v.(string))
+ }
+
+ if v, ok := objectMap["table_name"]; ok {
+ databaseObject.TableName = helper.String(v.(string))
+ }
+
+ request.DatabaseObjectSet = append(request.DatabaseObjectSet, &databaseObject)
+ }
+ }
+
+ err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
+ result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UsePostgresqlClient().DescribeAccountPrivileges(request)
+ if e != nil {
+ return tccommon.RetryError(e)
+ } else {
+ log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
+ }
+
+ privilegeSet = result.Response.PrivilegeSet
+ return nil
+ })
+
+ if err != nil {
+ return err
+ }
+
+ tmpList := make([]map[string]interface{}, 0, len(privilegeSet))
+ for _, item := range privilegeSet {
+ databasePrivilegeMap := map[string]interface{}{}
+ if item.Object != nil {
+ objectMap := map[string]interface{}{}
+ if item.Object.ObjectType != nil {
+ objectMap["object_type"] = item.Object.ObjectType
+ }
+
+ if item.Object.ObjectName != nil {
+ objectMap["object_name"] = item.Object.ObjectName
+ }
+
+ if item.Object.DatabaseName != nil {
+ objectMap["database_name"] = item.Object.DatabaseName
+ }
+
+ if item.Object.SchemaName != nil {
+ objectMap["schema_name"] = item.Object.SchemaName
+ }
+
+ if item.Object.TableName != nil {
+ objectMap["table_name"] = item.Object.TableName
+ }
+
+ databasePrivilegeMap["object"] = []interface{}{objectMap}
+ }
+
+ if item.PrivilegeSet != nil {
+ privilegeList := make([]string, 0, len(item.PrivilegeSet))
+ for _, privilege := range item.PrivilegeSet {
+ privilegeList = append(privilegeList, *privilege)
+ }
+
+ databasePrivilegeMap["privilege_set"] = privilegeList
+ }
+
+ tmpList = append(tmpList, databasePrivilegeMap)
+ }
+
+ _ = d.Set("privilege_set", tmpList)
+
+ d.SetId(strings.Join([]string{dBInstanceId, userName}, tccommon.FILED_SP))
+ output, ok := d.GetOk("result_output_file")
+ if ok && output.(string) != "" {
+ if e := tccommon.WriteToFile(output.(string), tmpList); e != nil {
+ return e
+ }
+ }
+
+ return nil
+}
diff --git a/tencentcloud/services/postgresql/data_source_tc_postgresql_account_privileges.md b/tencentcloud/services/postgresql/data_source_tc_postgresql_account_privileges.md
new file mode 100644
index 0000000000..5b0e81bcc6
--- /dev/null
+++ b/tencentcloud/services/postgresql/data_source_tc_postgresql_account_privileges.md
@@ -0,0 +1,14 @@
+Use this data source to query detailed information of postgresql account privileges
+
+Example Usage
+
+```hcl
+data "tencentcloud_postgresql_account_privileges" "example" {
+ db_instance_id = "postgres-3hk6b6tj"
+ user_name = "tf_example"
+ database_object_set {
+ object_name = "postgres"
+ object_type = "database"
+ }
+}
+```
diff --git a/tencentcloud/services/postgresql/data_source_tc_postgresql_account_privileges_test.go b/tencentcloud/services/postgresql/data_source_tc_postgresql_account_privileges_test.go
new file mode 100644
index 0000000000..2fbf307edd
--- /dev/null
+++ b/tencentcloud/services/postgresql/data_source_tc_postgresql_account_privileges_test.go
@@ -0,0 +1,42 @@
+package postgresql_test
+
+import (
+ "testing"
+
+ tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
+
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
+)
+
+// go test -i; go test -test.run TestAccTencentCloudPostgresqlAccountPrivilegesDataSource_basic -v
+func TestAccTencentCloudPostgresqlAccountPrivilegesDataSource_basic(t *testing.T) {
+ // t.Parallel()
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() {
+ tcacctest.AccPreCheck(t)
+ },
+ Providers: tcacctest.AccProviders,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccPostgresqlAccountPrivilegesDataSource,
+ Check: resource.ComposeTestCheckFunc(
+ tcacctest.AccCheckTencentCloudDataSourceID("data.tencentcloud_postgresql_account_privileges.example"),
+ resource.TestCheckResourceAttrSet("data.tencentcloud_postgresql_account_privileges.example", "db_instance_id"),
+ resource.TestCheckResourceAttrSet("data.tencentcloud_postgresql_account_privileges.example", "user_name"),
+ resource.TestCheckResourceAttrSet("data.tencentcloud_postgresql_account_privileges.example", "database_object_set.#"),
+ ),
+ },
+ },
+ })
+}
+
+const testAccPostgresqlAccountPrivilegesDataSource = `
+data "tencentcloud_postgresql_account_privileges" "example" {
+ db_instance_id = "postgres-3hk6b6tj"
+ user_name = "tf_example"
+ database_object_set {
+ object_name = "postgres"
+ object_type = "database"
+ }
+}
+`
diff --git a/tencentcloud/services/postgresql/resource_tc_postgresql_account.go b/tencentcloud/services/postgresql/resource_tc_postgresql_account.go
new file mode 100644
index 0000000000..1b121abd04
--- /dev/null
+++ b/tencentcloud/services/postgresql/resource_tc_postgresql_account.go
@@ -0,0 +1,331 @@
+package postgresql
+
+import (
+ "context"
+ "fmt"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ postgresql "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312"
+ tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common"
+ "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
+ "log"
+ "strings"
+)
+
+func ResourceTencentCloudPostgresqlAccount() *schema.Resource {
+ return &schema.Resource{
+ Create: resourceTencentCloudPostgresqlAccountCreate,
+ Read: resourceTencentCloudPostgresqlAccountRead,
+ Update: resourceTencentCloudPostgresqlAccountUpdate,
+ Delete: resourceTencentCloudPostgresqlAccountDelete,
+ Importer: &schema.ResourceImporter{
+ State: schema.ImportStatePassthrough,
+ },
+ Schema: map[string]*schema.Schema{
+ "db_instance_id": {
+ Required: true,
+ ForceNew: true,
+ Type: schema.TypeString,
+ Description: "Instance ID in the format of postgres-4wdeb0zv.",
+ },
+ "user_name": {
+ Required: true,
+ ForceNew: true,
+ Type: schema.TypeString,
+ Description: "Instance username, which can contain 1-16 letters, digits, and underscore (_); can't be postgres; can't start with numbers, pg_, and tencentdb_.",
+ },
+ "password": {
+ Required: true,
+ Type: schema.TypeString,
+ Sensitive: true,
+ Description: "Password, which can contain 8-32 letters, digits, and symbols (()`~!@#$%^&*-+=_|{}[]:;'<>,.?/); can't start with slash /.",
+ },
+ "type": {
+ Required: true,
+ ForceNew: true,
+ Type: schema.TypeString,
+ ValidateFunc: tccommon.ValidateAllowedStringValue([]string{"normal", "tencentDBSuper"}),
+ Description: "The type of user. Valid values: 1. normal: regular user; 2. tencentDBSuper: user with the pg_tencentdb_superuser role.",
+ },
+ "remark": {
+ Optional: true,
+ Type: schema.TypeString,
+ Description: "Remarks correspond to user `UserName`, which can contain 0-60 letters, digits, symbols (-_), and Chinese characters.",
+ },
+ "lock_status": {
+ Optional: true,
+ Computed: true,
+ Type: schema.TypeBool,
+ Description: "whether lock account. true: locked; false: unlock.",
+ },
+ },
+ }
+}
+
+func resourceTencentCloudPostgresqlAccountCreate(d *schema.ResourceData, meta interface{}) error {
+ defer tccommon.LogElapsed("resource.tencentcloud_postgresql_account.create")()
+ defer tccommon.InconsistentCheck(d, meta)()
+
+ var (
+ logId = tccommon.GetLogId(tccommon.ContextNil)
+ request = postgresql.NewCreateAccountRequest()
+ dBInstanceId string
+ userName string
+ )
+
+ if v, ok := d.GetOk("db_instance_id"); ok {
+ dBInstanceId = v.(string)
+ request.DBInstanceId = helper.String(v.(string))
+ }
+
+ if v, ok := d.GetOk("user_name"); ok {
+ userName = v.(string)
+ request.UserName = helper.String(v.(string))
+ }
+
+ if v, ok := d.GetOk("password"); ok {
+ request.Password = helper.String(v.(string))
+ }
+
+ if v, ok := d.GetOk("type"); ok {
+ request.Type = helper.String(v.(string))
+ }
+
+ if v, ok := d.GetOk("remark"); ok {
+ request.Remark = helper.String(v.(string))
+ }
+
+ err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
+ result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UsePostgresqlClient().CreateAccount(request)
+ if e != nil {
+ return tccommon.RetryError(e)
+ } else {
+ log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
+ }
+
+ return nil
+ })
+
+ if err != nil {
+ log.Printf("[CRITAL]%s create postgres account failed, reason:%+v", logId, err)
+ return err
+ }
+
+ d.SetId(strings.Join([]string{dBInstanceId, userName}, tccommon.FILED_SP))
+
+ // lock
+ if v, ok := d.GetOkExists("lock_status"); ok {
+ lockStatus := v.(bool)
+ if lockStatus {
+ lockRequest := postgresql.NewLockAccountRequest()
+ lockRequest.DBInstanceId = &dBInstanceId
+ lockRequest.UserName = &userName
+ err = resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
+ result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UsePostgresqlClient().LockAccount(lockRequest)
+ if e != nil {
+ return tccommon.RetryError(e)
+ } else {
+ log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, lockRequest.GetAction(), lockRequest.ToJsonString(), result.ToJsonString())
+ }
+
+ return nil
+ })
+
+ if err != nil {
+ log.Printf("[CRITAL]%s lock postgres account failed, reason:%+v", logId, err)
+ return err
+ }
+ }
+ }
+
+ return resourceTencentCloudPostgresqlAccountRead(d, meta)
+}
+
+func resourceTencentCloudPostgresqlAccountRead(d *schema.ResourceData, meta interface{}) error {
+ defer tccommon.LogElapsed("resource.tencentcloud_postgresql_account.read")()
+ defer tccommon.InconsistentCheck(d, meta)()
+
+ var (
+ logId = tccommon.GetLogId(tccommon.ContextNil)
+ ctx = context.WithValue(context.TODO(), tccommon.LogIdKey, logId)
+ service = PostgresqlService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()}
+ )
+
+ idSplit := strings.Split(d.Id(), tccommon.FILED_SP)
+ if len(idSplit) != 2 {
+ return fmt.Errorf("id is broken,%s", d.Id())
+ }
+
+ dBInstanceId := idSplit[0]
+ userName := idSplit[1]
+
+ account, err := service.DescribePostgresqlAccountById(ctx, dBInstanceId, userName)
+ if err != nil {
+ return err
+ }
+
+ if account == nil {
+ d.SetId("")
+ log.Printf("[WARN]%s resource `PostgresAccount` [%s] not found, please check if it has been deleted.\n", logId, d.Id())
+ return nil
+ }
+
+ if account.DBInstanceId != nil {
+ _ = d.Set("db_instance_id", account.DBInstanceId)
+ }
+
+ if account.UserName != nil {
+ _ = d.Set("user_name", account.UserName)
+ }
+
+ if account.UserType != nil {
+ _ = d.Set("type", account.UserType)
+ }
+
+ if account.Remark != nil {
+ _ = d.Set("remark", account.Remark)
+ }
+
+ if account.Status != nil {
+ if *account.Status == 5 {
+ _ = d.Set("lock_status", true)
+ } else {
+ _ = d.Set("lock_status", false)
+ }
+ }
+
+ return nil
+}
+
+func resourceTencentCloudPostgresqlAccountUpdate(d *schema.ResourceData, meta interface{}) error {
+ defer tccommon.LogElapsed("resource.tencentcloud_postgresql_account.update")()
+ defer tccommon.InconsistentCheck(d, meta)()
+
+ var (
+ logId = tccommon.GetLogId(tccommon.ContextNil)
+ pwdRequest = postgresql.NewResetAccountPasswordRequest()
+ remarkRequest = postgresql.NewModifyAccountRemarkRequest()
+ )
+
+ idSplit := strings.Split(d.Id(), tccommon.FILED_SP)
+ if len(idSplit) != 2 {
+ return fmt.Errorf("id is broken,%s", d.Id())
+ }
+
+ dBInstanceId := idSplit[0]
+ userName := idSplit[1]
+
+ if d.HasChange("password") {
+ pwdRequest.DBInstanceId = &dBInstanceId
+ pwdRequest.UserName = &userName
+ pwdRequest.Password = helper.String(d.Get("password").(string))
+ err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
+ result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UsePostgresqlClient().ResetAccountPassword(pwdRequest)
+ if e != nil {
+ return tccommon.RetryError(e)
+ } else {
+ log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, pwdRequest.GetAction(), pwdRequest.ToJsonString(), result.ToJsonString())
+ }
+
+ return nil
+ })
+
+ if err != nil {
+ log.Printf("[CRITAL]%s update postgres account password failed, reason:%+v", logId, err)
+ return err
+ }
+ }
+
+ if d.HasChange("remark") {
+ remarkRequest.DBInstanceId = &dBInstanceId
+ remarkRequest.UserName = &userName
+ remarkRequest.Remark = helper.String(d.Get("remark").(string))
+ err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
+ result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UsePostgresqlClient().ModifyAccountRemark(remarkRequest)
+ if e != nil {
+ return tccommon.RetryError(e)
+ } else {
+ log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, remarkRequest.GetAction(), remarkRequest.ToJsonString(), result.ToJsonString())
+ }
+
+ return nil
+ })
+
+ if err != nil {
+ log.Printf("[CRITAL]%s update postgres account remark failed, reason:%+v", logId, err)
+ return err
+ }
+ }
+
+ if d.HasChange("lock_status") {
+ if v, ok := d.GetOkExists("lock_status"); ok {
+ lockStatus := v.(bool)
+ if lockStatus {
+ lockRequest := postgresql.NewLockAccountRequest()
+ lockRequest.DBInstanceId = &dBInstanceId
+ lockRequest.UserName = &userName
+ err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
+ result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UsePostgresqlClient().LockAccount(lockRequest)
+ if e != nil {
+ return tccommon.RetryError(e)
+ } else {
+ log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, lockRequest.GetAction(), lockRequest.ToJsonString(), result.ToJsonString())
+ }
+
+ return nil
+ })
+
+ if err != nil {
+ log.Printf("[CRITAL]%s lock postgres account failed, reason:%+v", logId, err)
+ return err
+ }
+ } else {
+ unlockRequest := postgresql.NewUnlockAccountRequest()
+ unlockRequest.DBInstanceId = &dBInstanceId
+ unlockRequest.UserName = &userName
+ err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
+ result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UsePostgresqlClient().UnlockAccount(unlockRequest)
+ if e != nil {
+ return tccommon.RetryError(e)
+ } else {
+ log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, unlockRequest.GetAction(), unlockRequest.ToJsonString(), result.ToJsonString())
+ }
+
+ return nil
+ })
+
+ if err != nil {
+ log.Printf("[CRITAL]%s unlock postgres account failed, reason:%+v", logId, err)
+ return err
+ }
+ }
+ }
+ }
+
+ return resourceTencentCloudPostgresqlAccountRead(d, meta)
+}
+
+func resourceTencentCloudPostgresqlAccountDelete(d *schema.ResourceData, meta interface{}) error {
+ defer tccommon.LogElapsed("resource.tencentcloud_postgresql_account.delete")()
+ defer tccommon.InconsistentCheck(d, meta)()
+
+ var (
+ logId = tccommon.GetLogId(tccommon.ContextNil)
+ ctx = context.WithValue(context.TODO(), tccommon.LogIdKey, logId)
+ service = PostgresqlService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()}
+ )
+
+ idSplit := strings.Split(d.Id(), tccommon.FILED_SP)
+ if len(idSplit) != 2 {
+ return fmt.Errorf("id is broken,%s", d.Id())
+ }
+
+ dBInstanceId := idSplit[0]
+ userName := idSplit[1]
+
+ if err := service.DeletePostgresqlAccountById(ctx, dBInstanceId, userName); err != nil {
+ return err
+ }
+
+ return nil
+}
diff --git a/tencentcloud/services/postgresql/resource_tc_postgresql_account.md b/tencentcloud/services/postgresql/resource_tc_postgresql_account.md
new file mode 100644
index 0000000000..eed80fb6dd
--- /dev/null
+++ b/tencentcloud/services/postgresql/resource_tc_postgresql_account.md
@@ -0,0 +1,64 @@
+Provides a resource to create a postgresql account
+
+Example Usage
+
+```hcl
+variable "availability_zone" {
+ default = "ap-guangzhou-3"
+}
+
+# create vpc
+resource "tencentcloud_vpc" "vpc" {
+ name = "vpc"
+ cidr_block = "10.0.0.0/16"
+}
+
+# create vpc subnet
+resource "tencentcloud_subnet" "subnet" {
+ availability_zone = var.availability_zone
+ name = "subnet"
+ vpc_id = tencentcloud_vpc.vpc.id
+ cidr_block = "10.0.20.0/28"
+ is_multicast = false
+}
+
+# create postgresql
+resource "tencentcloud_postgresql_instance" "example" {
+ name = "example"
+ availability_zone = var.availability_zone
+ charge_type = "POSTPAID_BY_HOUR"
+ vpc_id = tencentcloud_vpc.vpc.id
+ subnet_id = tencentcloud_subnet.subnet.id
+ db_major_version = "10"
+ engine_version = "10.23"
+ root_user = "root123"
+ root_password = "Root123$"
+ charset = "UTF8"
+ project_id = 0
+ cpu = 1
+ memory = 2
+ storage = 10
+
+ tags = {
+ test = "tf"
+ }
+}
+
+# create account
+resource "tencentcloud_postgresql_account" "example" {
+ db_instance_id = tencentcloud_postgresql_instance.example.id
+ user_name = "tf_example"
+ password = "Password@123"
+ type = "normal"
+ remark = "remark"
+ lock_status = false
+}
+```
+
+Import
+
+postgres account can be imported using the id, e.g.
+
+```
+terraform import tencentcloud_postgresql_account.example postgres-3hk6b6tj#tf_example
+```
diff --git a/tencentcloud/services/postgresql/resource_tc_postgresql_account_privileges_operation.go b/tencentcloud/services/postgresql/resource_tc_postgresql_account_privileges_operation.go
new file mode 100644
index 0000000000..d1f9839e64
--- /dev/null
+++ b/tencentcloud/services/postgresql/resource_tc_postgresql_account_privileges_operation.go
@@ -0,0 +1,224 @@
+package postgresql
+
+import (
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ postgresql "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312"
+ tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common"
+ "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper"
+ "log"
+ "strings"
+)
+
+func ResourceTencentCloudPostgresqlAccountPrivilegesOperation() *schema.Resource {
+ return &schema.Resource{
+ Create: resourceTencentCloudPostgresqlAccountPrivilegesOperationCreate,
+ Read: resourceTencentCloudPostgresqlAccountPrivilegesOperationRead,
+ Update: resourceTencentCloudPostgresqlAccountPrivilegesOperationUpdate,
+ Delete: resourceTencentCloudPostgresqlAccountPrivilegesOperationDelete,
+
+ Schema: map[string]*schema.Schema{
+ "db_instance_id": {
+ Required: true,
+ ForceNew: true,
+ Type: schema.TypeString,
+ Description: "Instance ID in the format of postgres-4wdeb0zv.",
+ },
+ "user_name": {
+ Required: true,
+ ForceNew: true,
+ Type: schema.TypeString,
+ Description: "Instance username.",
+ },
+ "modify_privilege_set": {
+ Required: true,
+ Type: schema.TypeList,
+ Description: "Privileges to modify. Batch modification supported, up to 50 entries at a time.",
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "database_privilege": {
+ Type: schema.TypeList,
+ MaxItems: 1,
+ Optional: true,
+ Description: "Database objects and the user permissions on these objects. Note: This field may return null, indicating that no valid value can be obtained.",
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "object": {
+ Type: schema.TypeList,
+ MaxItems: 1,
+ Optional: true,
+ Description: "Database object.If ObjectType is database, DatabaseName/SchemaName/TableName can be null.If ObjectType is schema, SchemaName/TableName can be null.If ObjectType is table, TableName can be null.If ObjectType is column, DatabaseName/SchemaName/TableName can't be null.In all other cases, DatabaseName/SchemaName/TableName can be null. Note: This field may return null, indicating that no valid value can be obtained.",
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "object_type": {
+ Type: schema.TypeString,
+ Required: true,
+ Description: "Supported database object types: account, database, schema, sequence, procedure, type, function, table, view, matview, column. Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ "object_name": {
+ Type: schema.TypeString,
+ Required: true,
+ Description: "Database object Name. Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ "database_name": {
+ Type: schema.TypeString,
+ Optional: true,
+ Description: "Database name to which the database object belongs. This parameter is mandatory when ObjectType is not database. Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ "schema_name": {
+ Type: schema.TypeString,
+ Optional: true,
+ Description: "Schema name to which the database object belongs. This parameter is mandatory when ObjectType is not database or schema. Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ "table_name": {
+ Type: schema.TypeString,
+ Optional: true,
+ Description: "Table name to which the database object belongs. This parameter is mandatory when ObjectType is column. Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ },
+ },
+ },
+ "privilege_set": {
+ Type: schema.TypeSet,
+ Elem: &schema.Schema{Type: schema.TypeString},
+ Optional: true,
+ Description: "Privileges the specific account has on database object. Note: This field may return null, indicating that no valid value can be obtained.",
+ },
+ },
+ },
+ },
+ "modify_type": {
+ Type: schema.TypeString,
+ Optional: true,
+ Description: "Supported modification method: grantObject, revokeObject, alterRole. grantObject represents granting permissions on object, revokeObject represents revoking permissions on object, and alterRole represents modifying the account type.",
+ },
+ "is_cascade": {
+ Type: schema.TypeBool,
+ Optional: true,
+ Description: "Required only when ModifyType is revokeObject. When the parameter is true, revoking permissions will cascade. The default value is false.",
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func resourceTencentCloudPostgresqlAccountPrivilegesOperationCreate(d *schema.ResourceData, meta interface{}) error {
+ defer tccommon.LogElapsed("resource.tencentcloud_postgresql_account_privileges_operation.create")()
+ defer tccommon.InconsistentCheck(d, meta)()
+
+ var (
+ logId = tccommon.GetLogId(tccommon.ContextNil)
+ request = postgresql.NewModifyAccountPrivilegesRequest()
+ dBInstanceId string
+ userName string
+ )
+
+ if v, ok := d.GetOk("db_instance_id"); ok {
+ request.DBInstanceId = &dBInstanceId
+ dBInstanceId = v.(string)
+ }
+
+ if v, ok := d.GetOk("user_name"); ok {
+ request.UserName = &userName
+ userName = v.(string)
+ }
+
+ if v, ok := d.GetOk("modify_privilege_set"); ok {
+ for _, item := range v.([]interface{}) {
+ dMap := item.(map[string]interface{})
+ modifyPrivilege := postgresql.ModifyPrivilege{}
+ if databasePrivilegeMap, ok := helper.InterfaceToMap(dMap, "database_privilege"); ok {
+ databasePrivilege := postgresql.DatabasePrivilege{}
+ if objectMap, ok := helper.InterfaceToMap(databasePrivilegeMap, "object"); ok {
+ databaseObject := postgresql.DatabaseObject{}
+ if v, ok := objectMap["object_type"]; ok {
+ databaseObject.ObjectType = helper.String(v.(string))
+ }
+
+ if v, ok := objectMap["object_name"]; ok {
+ databaseObject.ObjectName = helper.String(v.(string))
+ }
+
+ if v, ok := objectMap["database_name"]; ok {
+ databaseObject.DatabaseName = helper.String(v.(string))
+ }
+
+ if v, ok := objectMap["schema_name"]; ok {
+ databaseObject.SchemaName = helper.String(v.(string))
+ }
+
+ if v, ok := objectMap["table_name"]; ok {
+ databaseObject.TableName = helper.String(v.(string))
+ }
+
+ databasePrivilege.Object = &databaseObject
+ }
+
+ if v, ok := databasePrivilegeMap["privilege_set"]; ok {
+ privilegeSetSet := v.(*schema.Set).List()
+ for i := range privilegeSetSet {
+ if privilegeSetSet[i] != nil {
+ privilegeSet := privilegeSetSet[i].(string)
+ databasePrivilege.PrivilegeSet = append(databasePrivilege.PrivilegeSet, &privilegeSet)
+ }
+ }
+ }
+
+ modifyPrivilege.DatabasePrivilege = &databasePrivilege
+ }
+
+ if v, ok := dMap["modify_type"]; ok {
+ modifyPrivilege.ModifyType = helper.String(v.(string))
+ }
+
+ if v, ok := dMap["is_cascade"]; ok {
+ modifyPrivilege.IsCascade = helper.Bool(v.(bool))
+ }
+
+ request.ModifyPrivilegeSet = append(request.ModifyPrivilegeSet, &modifyPrivilege)
+ }
+ }
+
+ err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
+ result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UsePostgresqlClient().ModifyAccountPrivileges(request)
+ if e != nil {
+ return tccommon.RetryError(e)
+ } else {
+ log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString())
+ }
+
+ return nil
+ })
+
+ if err != nil {
+ log.Printf("[CRITAL]%s update postgres accountPrivileges failed, reason:%+v", logId, err)
+ return err
+ }
+
+ d.SetId(strings.Join([]string{dBInstanceId, userName}, tccommon.FILED_SP))
+
+ return resourceTencentCloudPostgresqlAccountPrivilegesOperationUpdate(d, meta)
+}
+
+func resourceTencentCloudPostgresqlAccountPrivilegesOperationRead(d *schema.ResourceData, meta interface{}) error {
+ defer tccommon.LogElapsed("resource.tencentcloud_postgresql_account_privileges_operation.read")()
+ defer tccommon.InconsistentCheck(d, meta)()
+
+ return nil
+}
+
+func resourceTencentCloudPostgresqlAccountPrivilegesOperationUpdate(d *schema.ResourceData, meta interface{}) error {
+ defer tccommon.LogElapsed("resource.tencentcloud_postgresql_account_privileges_operation.update")()
+ defer tccommon.InconsistentCheck(d, meta)()
+
+ return resourceTencentCloudPostgresqlAccountPrivilegesOperationRead(d, meta)
+}
+
+func resourceTencentCloudPostgresqlAccountPrivilegesOperationDelete(d *schema.ResourceData, meta interface{}) error {
+ defer tccommon.LogElapsed("resource.tencentcloud_postgresql_account_privileges_operation.delete")()
+ defer tccommon.InconsistentCheck(d, meta)()
+
+ return nil
+}
diff --git a/tencentcloud/services/postgresql/resource_tc_postgresql_account_privileges_operation_test.go b/tencentcloud/services/postgresql/resource_tc_postgresql_account_privileges_operation_test.go
new file mode 100644
index 0000000000..d707f990f4
--- /dev/null
+++ b/tencentcloud/services/postgresql/resource_tc_postgresql_account_privileges_operation_test.go
@@ -0,0 +1,100 @@
+package postgresql_test
+
+import (
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
+ tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
+ "testing"
+)
+
+// go test -i; go test -test.run TestAccTencentCloudPostgresqlAccountPrivilegesOperationResource_basic -v
+func TestAccTencentCloudPostgresqlAccountPrivilegesOperationResource_basic(t *testing.T) {
+ t.Parallel()
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() {
+ tcacctest.AccPreCheck(t)
+ },
+ Providers: tcacctest.AccProviders,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccPostgresAccountPrivileges,
+ Check: resource.ComposeTestCheckFunc(
+ resource.TestCheckResourceAttrSet("tencentcloud_postgresql_account_privileges_operation.example", "id"),
+ resource.TestCheckResourceAttrSet("tencentcloud_postgresql_account_privileges_operation.example", "db_instance_id"),
+ resource.TestCheckResourceAttrSet("tencentcloud_postgresql_account_privileges_operation.example", "user_name"),
+ ),
+ },
+ },
+ })
+}
+
+const testAccPostgresAccountPrivileges = `
+variable "availability_zone" {
+ default = "ap-guangzhou-3"
+}
+
+# create vpc
+resource "tencentcloud_vpc" "vpc" {
+ name = "vpc"
+ cidr_block = "10.0.0.0/16"
+}
+
+# create vpc subnet
+resource "tencentcloud_subnet" "subnet" {
+ availability_zone = var.availability_zone
+ name = "subnet"
+ vpc_id = tencentcloud_vpc.vpc.id
+ cidr_block = "10.0.20.0/28"
+ is_multicast = false
+}
+
+# create postgresql
+resource "tencentcloud_postgresql_instance" "example" {
+ name = "example"
+ availability_zone = var.availability_zone
+ charge_type = "POSTPAID_BY_HOUR"
+ vpc_id = tencentcloud_vpc.vpc.id
+ subnet_id = tencentcloud_subnet.subnet.id
+ db_major_version = "10"
+ engine_version = "10.23"
+ root_user = "root123"
+ root_password = "Root123$"
+ charset = "UTF8"
+ project_id = 0
+ cpu = 1
+ memory = 2
+ storage = 10
+
+ tags = {
+ test = "tf"
+ }
+}
+
+# create account
+resource "tencentcloud_postgresql_account" "example" {
+ db_instance_id = tencentcloud_postgresql_instance.example.id
+ user_name = "tf_example"
+ password = "Password@123"
+ type = "normal"
+ remark = "remark"
+ lock_status = false
+}
+
+# create account privileges
+resource "tencentcloud_postgresql_account_privileges_operation" "example" {
+ db_instance_id = tencentcloud_postgresql_instance.example.id
+ user_name = tencentcloud_postgresql_account.example.user_name
+ modify_privilege_set {
+ database_privilege {
+ object {
+ object_name = "postgres"
+ object_type = "database"
+ }
+
+ privilege_set = ["CONNECT", "TEMPORARY", "CREATE"]
+ }
+
+ modify_type = "grantObject"
+ is_cascade = false
+ }
+}
+`
diff --git a/tencentcloud/services/postgresql/resource_tc_postgresql_account_test.go b/tencentcloud/services/postgresql/resource_tc_postgresql_account_test.go
new file mode 100644
index 0000000000..569900ff94
--- /dev/null
+++ b/tencentcloud/services/postgresql/resource_tc_postgresql_account_test.go
@@ -0,0 +1,148 @@
+package postgresql_test
+
+import (
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
+ tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest"
+ "testing"
+)
+
+// go test -i; go test -test.run TestAccTencentCloudPostgresqlAccountResource_basic -v
+func TestAccTencentCloudPostgresqlAccountResource_basic(t *testing.T) {
+ t.Parallel()
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() {
+ tcacctest.AccPreCheck(t)
+ },
+ Providers: tcacctest.AccProviders,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccPostgresAccount,
+ Check: resource.ComposeTestCheckFunc(
+ resource.TestCheckResourceAttrSet("tencentcloud_postgres_account.example", "id"),
+ resource.TestCheckResourceAttrSet("tencentcloud_postgres_account.example", "db_instance_id"),
+ resource.TestCheckResourceAttrSet("tencentcloud_postgres_account.example", "user_name"),
+ resource.TestCheckResourceAttrSet("tencentcloud_postgres_account.example", "password"),
+ resource.TestCheckResourceAttrSet("tencentcloud_postgres_account.example", "type"),
+ resource.TestCheckResourceAttrSet("tencentcloud_postgres_account.example", "remark"),
+ resource.TestCheckResourceAttrSet("tencentcloud_postgres_account.example", "lock_status"),
+ ),
+ },
+ {
+ Config: testAccPostgresAccountUpdate,
+ Check: resource.ComposeTestCheckFunc(
+ resource.TestCheckResourceAttrSet("tencentcloud_postgres_account.example", "id"),
+ resource.TestCheckResourceAttrSet("tencentcloud_postgres_account.example", "db_instance_id"),
+ resource.TestCheckResourceAttrSet("tencentcloud_postgres_account.example", "user_name"),
+ resource.TestCheckResourceAttrSet("tencentcloud_postgres_account.example", "password"),
+ resource.TestCheckResourceAttrSet("tencentcloud_postgres_account.example", "type"),
+ resource.TestCheckResourceAttrSet("tencentcloud_postgres_account.example", "remark"),
+ resource.TestCheckResourceAttrSet("tencentcloud_postgres_account.example", "lock_status"),
+ ),
+ },
+ {
+ ResourceName: "tencentcloud_postgres_account.example",
+ ImportState: true,
+ ImportStateVerify: true,
+ ImportStateVerifyIgnore: []string{"password"},
+ },
+ },
+ })
+}
+
+const testAccPostgresAccount = `
+variable "availability_zone" {
+ default = "ap-guangzhou-3"
+}
+
+resource "tencentcloud_vpc" "vpc" {
+ name = "vpc"
+ cidr_block = "10.0.0.0/16"
+}
+
+resource "tencentcloud_subnet" "subnet" {
+ availability_zone = var.availability_zone
+ name = "subnet"
+ vpc_id = tencentcloud_vpc.vpc.id
+ cidr_block = "10.0.20.0/28"
+ is_multicast = false
+}
+
+resource "tencentcloud_postgresql_instance" "example" {
+ name = "example"
+ availability_zone = var.availability_zone
+ charge_type = "POSTPAID_BY_HOUR"
+ vpc_id = tencentcloud_vpc.vpc.id
+ subnet_id = tencentcloud_subnet.subnet.id
+ db_major_version = "10"
+ engine_version = "10.23"
+ root_user = "root123"
+ root_password = "Root123$"
+ charset = "UTF8"
+ project_id = 0
+ cpu = 1
+ memory = 2
+ storage = 10
+
+ tags = {
+ test = "tf"
+ }
+}
+
+resource "tencentcloud_postgresql_account" "example" {
+ db_instance_id = tencentcloud_postgresql_instance.example.id
+ user_name = "tf_example"
+ password = "Password@123"
+ type = "normal"
+ remark = "remark"
+ lock_status = false
+}
+`
+
+const testAccPostgresAccountUpdate = `
+variable "availability_zone" {
+ default = "ap-guangzhou-3"
+}
+
+resource "tencentcloud_vpc" "vpc" {
+ name = "vpc"
+ cidr_block = "10.0.0.0/16"
+}
+
+resource "tencentcloud_subnet" "subnet" {
+ availability_zone = var.availability_zone
+ name = "subnet"
+ vpc_id = tencentcloud_vpc.vpc.id
+ cidr_block = "10.0.20.0/28"
+ is_multicast = false
+}
+
+resource "tencentcloud_postgresql_instance" "example" {
+ name = "example"
+ availability_zone = var.availability_zone
+ charge_type = "POSTPAID_BY_HOUR"
+ vpc_id = tencentcloud_vpc.vpc.id
+ subnet_id = tencentcloud_subnet.subnet.id
+ db_major_version = "10"
+ engine_version = "10.23"
+ root_user = "root123"
+ root_password = "Root123$"
+ charset = "UTF8"
+ project_id = 0
+ cpu = 1
+ memory = 2
+ storage = 10
+
+ tags = {
+ test = "tf"
+ }
+}
+
+resource "tencentcloud_postgresql_account" "example" {
+ db_instance_id = tencentcloud_postgresql_instance.example.id
+ user_name = "tf_example"
+ password = "Password@456"
+ type = "normal"
+ remark = "remark_update"
+ lock_status = true
+}
+`
diff --git a/tencentcloud/services/postgresql/service_tencentcloud_postgresql.go b/tencentcloud/services/postgresql/service_tencentcloud_postgresql.go
index c0adcbc20f..b45b99b8e1 100644
--- a/tencentcloud/services/postgresql/service_tencentcloud_postgresql.go
+++ b/tencentcloud/services/postgresql/service_tencentcloud_postgresql.go
@@ -2058,3 +2058,95 @@ func (me *PostgresqlService) DeletePostgresqlBaseBackupById(ctx context.Context,
return
}
+
+func (me *PostgresqlService) DescribePostgresqlAccountById(ctx context.Context, dBInstanceId string, userName string) (account *postgresql.AccountInfo, errRet error) {
+ logId := tccommon.GetLogId(ctx)
+
+ request := postgresql.NewDescribeAccountsRequest()
+ request.DBInstanceId = &dBInstanceId
+
+ defer func() {
+ if errRet != nil {
+ log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error())
+ }
+ }()
+
+ ratelimit.Check(request.GetAction())
+
+ response, err := me.client.UsePostgresqlClient().DescribeAccounts(request)
+ if err != nil {
+ errRet = err
+ return
+ }
+
+ log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())
+
+ if response == nil || len(response.Response.Details) < 1 {
+ return
+ }
+
+ for _, item := range response.Response.Details {
+ if *item.UserName == userName {
+ account = item
+ }
+ }
+
+ return
+}
+
+func (me *PostgresqlService) DeletePostgresqlAccountById(ctx context.Context, dBInstanceId string, userName string) (errRet error) {
+ logId := tccommon.GetLogId(ctx)
+
+ request := postgresql.NewDeleteAccountRequest()
+ request.DBInstanceId = &dBInstanceId
+ request.UserName = &userName
+
+ defer func() {
+ if errRet != nil {
+ log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error())
+ }
+ }()
+
+ ratelimit.Check(request.GetAction())
+
+ response, err := me.client.UsePostgresqlClient().DeleteAccount(request)
+ if err != nil {
+ errRet = err
+ return
+ }
+
+ log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())
+
+ return
+}
+
+func (me *PostgresqlService) DescribePostgresAccountPrivilegesById(ctx context.Context, dBInstanceId string, userName string) (accountPrivileges []*postgresql.DatabasePrivilege, errRet error) {
+ logId := tccommon.GetLogId(ctx)
+
+ request := postgresql.NewDescribeAccountPrivilegesRequest()
+ request.DBInstanceId = &dBInstanceId
+ request.UserName = &userName
+
+ defer func() {
+ if errRet != nil {
+ log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error())
+ }
+ }()
+
+ ratelimit.Check(request.GetAction())
+
+ response, err := me.client.UsePostgresqlClient().DescribeAccountPrivileges(request)
+ if err != nil {
+ errRet = err
+ return
+ }
+
+ log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())
+
+ if response == nil || len(response.Response.PrivilegeSet) < 1 {
+ return
+ }
+
+ accountPrivileges = response.Response.PrivilegeSet
+ return
+}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go
index 1ec564c553..99b5226dba 100644
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go
+++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go
@@ -265,7 +265,7 @@ func CompleteCommonParams(request Request, region string, requestClient string)
params["Action"] = request.GetAction()
params["Timestamp"] = strconv.FormatInt(time.Now().Unix(), 10)
params["Nonce"] = strconv.Itoa(rand.Int())
- params["RequestClient"] = "SDK_GO_1.0.993"
+ params["RequestClient"] = "SDK_GO_1.0.995"
if requestClient != "" {
params["RequestClient"] += ": " + requestClient
}
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312/client.go
index b918b5e081..7e558e636d 100644
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312/client.go
+++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312/client.go
@@ -437,6 +437,85 @@ func (c *Client) CloseServerlessDBExtranetAccessWithContext(ctx context.Context,
return
}
+func NewCreateAccountRequest() (request *CreateAccountRequest) {
+ request = &CreateAccountRequest{
+ BaseRequest: &tchttp.BaseRequest{},
+ }
+
+ request.Init().WithApiInfo("postgres", APIVersion, "CreateAccount")
+
+
+ return
+}
+
+func NewCreateAccountResponse() (response *CreateAccountResponse) {
+ response = &CreateAccountResponse{
+ BaseResponse: &tchttp.BaseResponse{},
+ }
+ return
+
+}
+
+// CreateAccount
+// 此接口用于创建数据账号,返回的Oid为账号唯一标识。与数据库系统表pg_roles中记录的oid一致。
+//
+// 可能返回的错误码:
+// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
+// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
+// INVALIDPARAMETERVALUE_DECRYPTPASSWORDFAILED = "InvalidParameterValue.DecryptPasswordFailed"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
+// INVALIDPARAMETERVALUE_INVALIDDATABASENAMEFORMATERROR = "InvalidParameterValue.InvalidDatabaseNameFormatError"
+// INVALIDPARAMETERVALUE_INVALIDPASSWORDLENGTHERROR = "InvalidParameterValue.InvalidPasswordLengthError"
+// INVALIDPARAMETERVALUE_INVALIDPASSWORDVALUEERROR = "InvalidParameterValue.InvalidPasswordValueError"
+// INVALIDPARAMETERVALUE_PARAMETERCHARACTERERROR = "InvalidParameterValue.ParameterCharacterError"
+// INVALIDPARAMETERVALUE_PARAMETERLENGTHLIMITERROR = "InvalidParameterValue.ParameterLengthLimitError"
+// OPERATIONDENIED_INSTANCEACCESSDENIEDERROR = "OperationDenied.InstanceAccessDeniedError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITERROR = "OperationDenied.InstanceStatusLimitError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITOPERROR = "OperationDenied.InstanceStatusLimitOpError"
+// OPERATIONDENIED_KERNELVERSIONERROR = "OperationDenied.KernelVersionError"
+func (c *Client) CreateAccount(request *CreateAccountRequest) (response *CreateAccountResponse, err error) {
+ return c.CreateAccountWithContext(context.Background(), request)
+}
+
+// CreateAccount
+// 此接口用于创建数据账号,返回的Oid为账号唯一标识。与数据库系统表pg_roles中记录的oid一致。
+//
+// 可能返回的错误码:
+// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
+// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
+// INVALIDPARAMETERVALUE_DECRYPTPASSWORDFAILED = "InvalidParameterValue.DecryptPasswordFailed"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
+// INVALIDPARAMETERVALUE_INVALIDDATABASENAMEFORMATERROR = "InvalidParameterValue.InvalidDatabaseNameFormatError"
+// INVALIDPARAMETERVALUE_INVALIDPASSWORDLENGTHERROR = "InvalidParameterValue.InvalidPasswordLengthError"
+// INVALIDPARAMETERVALUE_INVALIDPASSWORDVALUEERROR = "InvalidParameterValue.InvalidPasswordValueError"
+// INVALIDPARAMETERVALUE_PARAMETERCHARACTERERROR = "InvalidParameterValue.ParameterCharacterError"
+// INVALIDPARAMETERVALUE_PARAMETERLENGTHLIMITERROR = "InvalidParameterValue.ParameterLengthLimitError"
+// OPERATIONDENIED_INSTANCEACCESSDENIEDERROR = "OperationDenied.InstanceAccessDeniedError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITERROR = "OperationDenied.InstanceStatusLimitError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITOPERROR = "OperationDenied.InstanceStatusLimitOpError"
+// OPERATIONDENIED_KERNELVERSIONERROR = "OperationDenied.KernelVersionError"
+func (c *Client) CreateAccountWithContext(ctx context.Context, request *CreateAccountRequest) (response *CreateAccountResponse, err error) {
+ if request == nil {
+ request = NewCreateAccountRequest()
+ }
+
+ if c.GetCredential() == nil {
+ return nil, errors.New("CreateAccount require credential")
+ }
+
+ request.SetContext(ctx)
+
+ response = NewCreateAccountResponse()
+ err = c.Send(request, response)
+ return
+}
+
func NewCreateBaseBackupRequest() (request *CreateBaseBackupRequest) {
request = &CreateBaseBackupRequest{
BaseRequest: &tchttp.BaseRequest{},
@@ -798,9 +877,9 @@ func NewCreateInstancesResponse() (response *CreateInstancesResponse) {
// CreateInstances
// 本接口 (CreateInstances) 用于创建一个或者多个PostgreSQL实例,通过此接口创建的实例无需进行初始化,可直接使用。
//
-//
实例创建成功后将自动开机启动,实例状态变为“运行中”。
+// 实例创建成功后将自动开机启动,实例状态变为“运行中”。
//
-// 预付费实例的购买会预先扣除本次实例购买所需金额,按小时后付费实例购买会预先冻结本次实例购买一小时内所需金额,在调用本接口前请确保账户余额充足。
+// 预付费实例的购买会预先扣除本次实例购买所需金额,按小时后付费实例购买会预先冻结本次实例购买一小时内所需金额,在调用本接口前请确保账户余额充足。
//
// 可能返回的错误码:
// AUTHFAILURE_UNAUTHORIZEDOPERATION = "AuthFailure.UnauthorizedOperation"
@@ -833,6 +912,7 @@ func NewCreateInstancesResponse() (response *CreateInstancesResponse) {
// INTERNALERROR_DFWERROR = "InternalError.DfwError"
// INTERNALERROR_FLOWERROR = "InternalError.FlowError"
// INTERNALERROR_INTERNALHTTPSERVERERROR = "InternalError.InternalHttpServerError"
+// INTERNALERROR_JSONPARSEERROR = "InternalError.JsonParseError"
// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError"
// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError"
// INTERNALERROR_VPCERROR = "InternalError.VpcError"
@@ -844,6 +924,7 @@ func NewCreateInstancesResponse() (response *CreateInstancesResponse) {
// INVALIDPARAMETERVALUE_BADSPEC = "InvalidParameterValue.BadSpec"
// INVALIDPARAMETERVALUE_CHARSETNOTFOUNDERROR = "InvalidParameterValue.CharsetNotFoundError"
// INVALIDPARAMETERVALUE_DATACONVERTERROR = "InvalidParameterValue.DataConvertError"
+// INVALIDPARAMETERVALUE_DECRYPTPASSWORDFAILED = "InvalidParameterValue.DecryptPasswordFailed"
// INVALIDPARAMETERVALUE_ILLEGALINSTANCECHARGETYPE = "InvalidParameterValue.IllegalInstanceChargeType"
// INVALIDPARAMETERVALUE_ILLEGALPROJECTID = "InvalidParameterValue.IllegalProjectId"
// INVALIDPARAMETERVALUE_ILLEGALREGION = "InvalidParameterValue.IllegalRegion"
@@ -852,6 +933,8 @@ func NewCreateInstancesResponse() (response *CreateInstancesResponse) {
// INVALIDPARAMETERVALUE_INVALIDACCOUNTERROR = "InvalidParameterValue.InvalidAccountError"
// INVALIDPARAMETERVALUE_INVALIDACCOUNTFORMAT = "InvalidParameterValue.InvalidAccountFormat"
// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAME = "InvalidParameterValue.InvalidAccountName"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
// INVALIDPARAMETERVALUE_INVALIDCHARSET = "InvalidParameterValue.InvalidCharset"
// INVALIDPARAMETERVALUE_INVALIDINSTANCENUM = "InvalidParameterValue.InvalidInstanceNum"
// INVALIDPARAMETERVALUE_INVALIDORDERNUM = "InvalidParameterValue.InvalidOrderNum"
@@ -886,9 +969,9 @@ func (c *Client) CreateInstances(request *CreateInstancesRequest) (response *Cre
// CreateInstances
// 本接口 (CreateInstances) 用于创建一个或者多个PostgreSQL实例,通过此接口创建的实例无需进行初始化,可直接使用。
//
-// 实例创建成功后将自动开机启动,实例状态变为“运行中”。
+// 实例创建成功后将自动开机启动,实例状态变为“运行中”。
//
-// 预付费实例的购买会预先扣除本次实例购买所需金额,按小时后付费实例购买会预先冻结本次实例购买一小时内所需金额,在调用本接口前请确保账户余额充足。
+// 预付费实例的购买会预先扣除本次实例购买所需金额,按小时后付费实例购买会预先冻结本次实例购买一小时内所需金额,在调用本接口前请确保账户余额充足。
//
// 可能返回的错误码:
// AUTHFAILURE_UNAUTHORIZEDOPERATION = "AuthFailure.UnauthorizedOperation"
@@ -921,6 +1004,7 @@ func (c *Client) CreateInstances(request *CreateInstancesRequest) (response *Cre
// INTERNALERROR_DFWERROR = "InternalError.DfwError"
// INTERNALERROR_FLOWERROR = "InternalError.FlowError"
// INTERNALERROR_INTERNALHTTPSERVERERROR = "InternalError.InternalHttpServerError"
+// INTERNALERROR_JSONPARSEERROR = "InternalError.JsonParseError"
// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError"
// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError"
// INTERNALERROR_VPCERROR = "InternalError.VpcError"
@@ -932,6 +1016,7 @@ func (c *Client) CreateInstances(request *CreateInstancesRequest) (response *Cre
// INVALIDPARAMETERVALUE_BADSPEC = "InvalidParameterValue.BadSpec"
// INVALIDPARAMETERVALUE_CHARSETNOTFOUNDERROR = "InvalidParameterValue.CharsetNotFoundError"
// INVALIDPARAMETERVALUE_DATACONVERTERROR = "InvalidParameterValue.DataConvertError"
+// INVALIDPARAMETERVALUE_DECRYPTPASSWORDFAILED = "InvalidParameterValue.DecryptPasswordFailed"
// INVALIDPARAMETERVALUE_ILLEGALINSTANCECHARGETYPE = "InvalidParameterValue.IllegalInstanceChargeType"
// INVALIDPARAMETERVALUE_ILLEGALPROJECTID = "InvalidParameterValue.IllegalProjectId"
// INVALIDPARAMETERVALUE_ILLEGALREGION = "InvalidParameterValue.IllegalRegion"
@@ -940,6 +1025,8 @@ func (c *Client) CreateInstances(request *CreateInstancesRequest) (response *Cre
// INVALIDPARAMETERVALUE_INVALIDACCOUNTERROR = "InvalidParameterValue.InvalidAccountError"
// INVALIDPARAMETERVALUE_INVALIDACCOUNTFORMAT = "InvalidParameterValue.InvalidAccountFormat"
// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAME = "InvalidParameterValue.InvalidAccountName"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
// INVALIDPARAMETERVALUE_INVALIDCHARSET = "InvalidParameterValue.InvalidCharset"
// INVALIDPARAMETERVALUE_INVALIDINSTANCENUM = "InvalidParameterValue.InvalidInstanceNum"
// INVALIDPARAMETERVALUE_INVALIDORDERNUM = "InvalidParameterValue.InvalidOrderNum"
@@ -1544,6 +1631,71 @@ func (c *Client) CreateServerlessDBInstanceWithContext(ctx context.Context, requ
return
}
+func NewDeleteAccountRequest() (request *DeleteAccountRequest) {
+ request = &DeleteAccountRequest{
+ BaseRequest: &tchttp.BaseRequest{},
+ }
+
+ request.Init().WithApiInfo("postgres", APIVersion, "DeleteAccount")
+
+
+ return
+}
+
+func NewDeleteAccountResponse() (response *DeleteAccountResponse) {
+ response = &DeleteAccountResponse{
+ BaseResponse: &tchttp.BaseResponse{},
+ }
+ return
+
+}
+
+// DeleteAccount
+// 此接口用于删除数据库账号,需要同时输入Oid与UserName,避免误删。
+//
+// 可能返回的错误码:
+// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
+// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
+// OPERATIONDENIED_INSTANCEACCESSDENIEDERROR = "OperationDenied.InstanceAccessDeniedError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITOPERROR = "OperationDenied.InstanceStatusLimitOpError"
+// RESOURCENOTFOUND_INSTANCENOTFOUNDERROR = "ResourceNotFound.InstanceNotFoundError"
+func (c *Client) DeleteAccount(request *DeleteAccountRequest) (response *DeleteAccountResponse, err error) {
+ return c.DeleteAccountWithContext(context.Background(), request)
+}
+
+// DeleteAccount
+// 此接口用于删除数据库账号,需要同时输入Oid与UserName,避免误删。
+//
+// 可能返回的错误码:
+// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
+// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
+// OPERATIONDENIED_INSTANCEACCESSDENIEDERROR = "OperationDenied.InstanceAccessDeniedError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITOPERROR = "OperationDenied.InstanceStatusLimitOpError"
+// RESOURCENOTFOUND_INSTANCENOTFOUNDERROR = "ResourceNotFound.InstanceNotFoundError"
+func (c *Client) DeleteAccountWithContext(ctx context.Context, request *DeleteAccountRequest) (response *DeleteAccountResponse, err error) {
+ if request == nil {
+ request = NewDeleteAccountRequest()
+ }
+
+ if c.GetCredential() == nil {
+ return nil, errors.New("DeleteAccount require credential")
+ }
+
+ request.SetContext(ctx)
+
+ response = NewDeleteAccountResponse()
+ err = c.Send(request, response)
+ return
+}
+
func NewDeleteBaseBackupRequest() (request *DeleteBaseBackupRequest) {
request = &DeleteBaseBackupRequest{
BaseRequest: &tchttp.BaseRequest{},
@@ -2035,6 +2187,73 @@ func (c *Client) DeleteServerlessDBInstanceWithContext(ctx context.Context, requ
return
}
+func NewDescribeAccountPrivilegesRequest() (request *DescribeAccountPrivilegesRequest) {
+ request = &DescribeAccountPrivilegesRequest{
+ BaseRequest: &tchttp.BaseRequest{},
+ }
+
+ request.Init().WithApiInfo("postgres", APIVersion, "DescribeAccountPrivileges")
+
+
+ return
+}
+
+func NewDescribeAccountPrivilegesResponse() (response *DescribeAccountPrivilegesResponse) {
+ response = &DescribeAccountPrivilegesResponse{
+ BaseResponse: &tchttp.BaseResponse{},
+ }
+ return
+
+}
+
+// DescribeAccountPrivileges
+// 查询数据库账号对某数据库对象拥有的权限列表。
+//
+// 可能返回的错误码:
+// DBERROR = "DBError"
+// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
+// INTERNALERROR_DBERROR = "InternalError.DBError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
+// INVALIDPARAMETERVALUE_INVALIDDATABASEOBJECTNAME = "InvalidParameterValue.InvalidDatabaseObjectName"
+// OPERATIONDENIED_INSTANCEACCESSDENIEDERROR = "OperationDenied.InstanceAccessDeniedError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITOPERROR = "OperationDenied.InstanceStatusLimitOpError"
+// RESOURCENOTFOUND_INSTANCENOTFOUNDERROR = "ResourceNotFound.InstanceNotFoundError"
+func (c *Client) DescribeAccountPrivileges(request *DescribeAccountPrivilegesRequest) (response *DescribeAccountPrivilegesResponse, err error) {
+ return c.DescribeAccountPrivilegesWithContext(context.Background(), request)
+}
+
+// DescribeAccountPrivileges
+// 查询数据库账号对某数据库对象拥有的权限列表。
+//
+// 可能返回的错误码:
+// DBERROR = "DBError"
+// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
+// INTERNALERROR_DBERROR = "InternalError.DBError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
+// INVALIDPARAMETERVALUE_INVALIDDATABASEOBJECTNAME = "InvalidParameterValue.InvalidDatabaseObjectName"
+// OPERATIONDENIED_INSTANCEACCESSDENIEDERROR = "OperationDenied.InstanceAccessDeniedError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITOPERROR = "OperationDenied.InstanceStatusLimitOpError"
+// RESOURCENOTFOUND_INSTANCENOTFOUNDERROR = "ResourceNotFound.InstanceNotFoundError"
+func (c *Client) DescribeAccountPrivilegesWithContext(ctx context.Context, request *DescribeAccountPrivilegesRequest) (response *DescribeAccountPrivilegesResponse, err error) {
+ if request == nil {
+ request = NewDescribeAccountPrivilegesRequest()
+ }
+
+ if c.GetCredential() == nil {
+ return nil, errors.New("DescribeAccountPrivileges require credential")
+ }
+
+ request.SetContext(ctx)
+
+ response = NewDescribeAccountPrivilegesResponse()
+ err = c.Send(request, response)
+ return
+}
+
func NewDescribeAccountsRequest() (request *DescribeAccountsRequest) {
request = &DescribeAccountsRequest{
BaseRequest: &tchttp.BaseRequest{},
@@ -2059,12 +2278,16 @@ func NewDescribeAccountsResponse() (response *DescribeAccountsResponse) {
//
// 可能返回的错误码:
// AUTHFAILURE_UNAUTHORIZEDOPERATION = "AuthFailure.UnauthorizedOperation"
+// DBERROR = "DBError"
// FAILEDOPERATION_CAMSIGANDAUTHERROR = "FailedOperation.CamSigAndAuthError"
// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
// FAILEDOPERATION_DATABASEAFFECTEDERROR = "FailedOperation.DatabaseAffectedError"
// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
+// INTERNALERROR_DBERROR = "InternalError.DBError"
// INTERNALERROR_INTERNALHTTPSERVERERROR = "InternalError.InternalHttpServerError"
// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
// INVALIDPARAMETERVALUE_ACCOUNTNOTEXIST = "InvalidParameterValue.AccountNotExist"
// INVALIDPARAMETERVALUE_INSTANCENOTEXIST = "InvalidParameterValue.InstanceNotExist"
// INVALIDPARAMETERVALUE_INVALIDPARAMETERVALUEERROR = "InvalidParameterValue.InvalidParameterValueError"
@@ -2080,12 +2303,16 @@ func (c *Client) DescribeAccounts(request *DescribeAccountsRequest) (response *D
//
// 可能返回的错误码:
// AUTHFAILURE_UNAUTHORIZEDOPERATION = "AuthFailure.UnauthorizedOperation"
+// DBERROR = "DBError"
// FAILEDOPERATION_CAMSIGANDAUTHERROR = "FailedOperation.CamSigAndAuthError"
// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
// FAILEDOPERATION_DATABASEAFFECTEDERROR = "FailedOperation.DatabaseAffectedError"
// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
+// INTERNALERROR_DBERROR = "InternalError.DBError"
// INTERNALERROR_INTERNALHTTPSERVERERROR = "InternalError.InternalHttpServerError"
// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
// INVALIDPARAMETERVALUE_ACCOUNTNOTEXIST = "InvalidParameterValue.AccountNotExist"
// INVALIDPARAMETERVALUE_INSTANCENOTEXIST = "InvalidParameterValue.InstanceNotExist"
// INVALIDPARAMETERVALUE_INVALIDPARAMETERVALUEERROR = "InvalidParameterValue.InvalidParameterValueError"
@@ -3435,6 +3662,63 @@ func (c *Client) DescribeDBXlogsWithContext(ctx context.Context, request *Descri
return
}
+func NewDescribeDatabaseObjectsRequest() (request *DescribeDatabaseObjectsRequest) {
+ request = &DescribeDatabaseObjectsRequest{
+ BaseRequest: &tchttp.BaseRequest{},
+ }
+
+ request.Init().WithApiInfo("postgres", APIVersion, "DescribeDatabaseObjects")
+
+
+ return
+}
+
+func NewDescribeDatabaseObjectsResponse() (response *DescribeDatabaseObjectsResponse) {
+ response = &DescribeDatabaseObjectsResponse{
+ BaseResponse: &tchttp.BaseResponse{},
+ }
+ return
+
+}
+
+// DescribeDatabaseObjects
+// 本接口用于查询数据库对象列表。例如查询test数据库下的模式列表。
+//
+// 可能返回的错误码:
+// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
+// OPERATIONDENIED_INSTANCEACCESSDENIEDERROR = "OperationDenied.InstanceAccessDeniedError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITOPERROR = "OperationDenied.InstanceStatusLimitOpError"
+// RESOURCENOTFOUND_INSTANCENOTFOUNDERROR = "ResourceNotFound.InstanceNotFoundError"
+func (c *Client) DescribeDatabaseObjects(request *DescribeDatabaseObjectsRequest) (response *DescribeDatabaseObjectsResponse, err error) {
+ return c.DescribeDatabaseObjectsWithContext(context.Background(), request)
+}
+
+// DescribeDatabaseObjects
+// 本接口用于查询数据库对象列表。例如查询test数据库下的模式列表。
+//
+// 可能返回的错误码:
+// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
+// OPERATIONDENIED_INSTANCEACCESSDENIEDERROR = "OperationDenied.InstanceAccessDeniedError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITOPERROR = "OperationDenied.InstanceStatusLimitOpError"
+// RESOURCENOTFOUND_INSTANCENOTFOUNDERROR = "ResourceNotFound.InstanceNotFoundError"
+func (c *Client) DescribeDatabaseObjectsWithContext(ctx context.Context, request *DescribeDatabaseObjectsRequest) (response *DescribeDatabaseObjectsResponse, err error) {
+ if request == nil {
+ request = NewDescribeDatabaseObjectsRequest()
+ }
+
+ if c.GetCredential() == nil {
+ return nil, errors.New("DescribeDatabaseObjects require credential")
+ }
+
+ request.SetContext(ctx)
+
+ response = NewDescribeDatabaseObjectsResponse()
+ err = c.Send(request, response)
+ return
+}
+
func NewDescribeDatabasesRequest() (request *DescribeDatabasesRequest) {
request = &DescribeDatabasesRequest{
BaseRequest: &tchttp.BaseRequest{},
@@ -3459,17 +3743,20 @@ func NewDescribeDatabasesResponse() (response *DescribeDatabasesResponse) {
//
// 可能返回的错误码:
// AUTHFAILURE_UNAUTHORIZEDOPERATION = "AuthFailure.UnauthorizedOperation"
+// DBERROR = "DBError"
// FAILEDOPERATION_CAMSIGANDAUTHERROR = "FailedOperation.CamSigAndAuthError"
// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
// FAILEDOPERATION_LIMITOPERATION = "FailedOperation.LimitOperation"
// FAILEDOPERATION_OSSACCESSERROR = "FailedOperation.OssAccessError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
// INTERNALERROR_DBERROR = "InternalError.DBError"
// INTERNALERROR_INSTANCEDATAERROR = "InternalError.InstanceDataError"
// INTERNALERROR_INTERNALHTTPSERVERERROR = "InternalError.InternalHttpServerError"
// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError"
// INVALIDINSTANCESTATUS = "InvalidInstanceStatus"
// INVALIDPARAMETER = "InvalidParameter"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
// INVALIDPARAMETERVALUE_ACCOUNTNOTEXISTERROR = "InvalidParameterValue.AccountNotExistError"
// INVALIDPARAMETERVALUE_ILLEGALREGION = "InvalidParameterValue.IllegalRegion"
// INVALIDPARAMETERVALUE_INSTANCENOTEXIST = "InvalidParameterValue.InstanceNotExist"
@@ -3489,17 +3776,20 @@ func (c *Client) DescribeDatabases(request *DescribeDatabasesRequest) (response
//
// 可能返回的错误码:
// AUTHFAILURE_UNAUTHORIZEDOPERATION = "AuthFailure.UnauthorizedOperation"
+// DBERROR = "DBError"
// FAILEDOPERATION_CAMSIGANDAUTHERROR = "FailedOperation.CamSigAndAuthError"
// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
// FAILEDOPERATION_LIMITOPERATION = "FailedOperation.LimitOperation"
// FAILEDOPERATION_OSSACCESSERROR = "FailedOperation.OssAccessError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
// INTERNALERROR_DBERROR = "InternalError.DBError"
// INTERNALERROR_INSTANCEDATAERROR = "InternalError.InstanceDataError"
// INTERNALERROR_INTERNALHTTPSERVERERROR = "InternalError.InternalHttpServerError"
// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError"
// INVALIDINSTANCESTATUS = "InvalidInstanceStatus"
// INVALIDPARAMETER = "InvalidParameter"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
// INVALIDPARAMETERVALUE_ACCOUNTNOTEXISTERROR = "InvalidParameterValue.AccountNotExistError"
// INVALIDPARAMETERVALUE_ILLEGALREGION = "InvalidParameterValue.IllegalRegion"
// INVALIDPARAMETERVALUE_INSTANCENOTEXIST = "InvalidParameterValue.InstanceNotExist"
@@ -4746,9 +5036,12 @@ func NewInitDBInstancesResponse() (response *InitDBInstancesResponse) {
// INVALIDPARAMETER = "InvalidParameter"
// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
// INVALIDPARAMETERVALUE_CHARSETNOTFOUNDERROR = "InvalidParameterValue.CharsetNotFoundError"
+// INVALIDPARAMETERVALUE_DECRYPTPASSWORDFAILED = "InvalidParameterValue.DecryptPasswordFailed"
// INVALIDPARAMETERVALUE_INSTANCENOTEXIST = "InvalidParameterValue.InstanceNotExist"
// INVALIDPARAMETERVALUE_INVALIDACCOUNTERROR = "InvalidParameterValue.InvalidAccountError"
// INVALIDPARAMETERVALUE_INVALIDACCOUNTFORMAT = "InvalidParameterValue.InvalidAccountFormat"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
// INVALIDPARAMETERVALUE_INVALIDCHARSET = "InvalidParameterValue.InvalidCharset"
// INVALIDPARAMETERVALUE_INVALIDPARAMETERVALUEERROR = "InvalidParameterValue.InvalidParameterValueError"
// INVALIDPARAMETERVALUE_INVALIDPASSWORDFORMAT = "InvalidParameterValue.InvalidPasswordFormat"
@@ -4781,9 +5074,12 @@ func (c *Client) InitDBInstances(request *InitDBInstancesRequest) (response *Ini
// INVALIDPARAMETER = "InvalidParameter"
// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
// INVALIDPARAMETERVALUE_CHARSETNOTFOUNDERROR = "InvalidParameterValue.CharsetNotFoundError"
+// INVALIDPARAMETERVALUE_DECRYPTPASSWORDFAILED = "InvalidParameterValue.DecryptPasswordFailed"
// INVALIDPARAMETERVALUE_INSTANCENOTEXIST = "InvalidParameterValue.InstanceNotExist"
// INVALIDPARAMETERVALUE_INVALIDACCOUNTERROR = "InvalidParameterValue.InvalidAccountError"
// INVALIDPARAMETERVALUE_INVALIDACCOUNTFORMAT = "InvalidParameterValue.InvalidAccountFormat"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
// INVALIDPARAMETERVALUE_INVALIDCHARSET = "InvalidParameterValue.InvalidCharset"
// INVALIDPARAMETERVALUE_INVALIDPARAMETERVALUEERROR = "InvalidParameterValue.InvalidParameterValueError"
// INVALIDPARAMETERVALUE_INVALIDPASSWORDFORMAT = "InvalidParameterValue.InvalidPasswordFormat"
@@ -5211,6 +5507,150 @@ func (c *Client) IsolateDBInstancesWithContext(ctx context.Context, request *Iso
return
}
+func NewLockAccountRequest() (request *LockAccountRequest) {
+ request = &LockAccountRequest{
+ BaseRequest: &tchttp.BaseRequest{},
+ }
+
+ request.Init().WithApiInfo("postgres", APIVersion, "LockAccount")
+
+
+ return
+}
+
+func NewLockAccountResponse() (response *LockAccountResponse) {
+ response = &LockAccountResponse{
+ BaseResponse: &tchttp.BaseResponse{},
+ }
+ return
+
+}
+
+// LockAccount
+// 此接口用于锁定数据库账号,锁定后账号当前连接会断开,并且无法建立新连接。
+//
+// 可能返回的错误码:
+// DBERROR = "DBError"
+// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
+// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
+// INTERNALERROR_DBERROR = "InternalError.DBError"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
+// OPERATIONDENIED_INSTANCEACCESSDENIEDERROR = "OperationDenied.InstanceAccessDeniedError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITOPERROR = "OperationDenied.InstanceStatusLimitOpError"
+// RESOURCENOTFOUND_INSTANCENOTFOUNDERROR = "ResourceNotFound.InstanceNotFoundError"
+func (c *Client) LockAccount(request *LockAccountRequest) (response *LockAccountResponse, err error) {
+ return c.LockAccountWithContext(context.Background(), request)
+}
+
+// LockAccount
+// 此接口用于锁定数据库账号,锁定后账号当前连接会断开,并且无法建立新连接。
+//
+// 可能返回的错误码:
+// DBERROR = "DBError"
+// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
+// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
+// INTERNALERROR_DBERROR = "InternalError.DBError"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
+// OPERATIONDENIED_INSTANCEACCESSDENIEDERROR = "OperationDenied.InstanceAccessDeniedError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITOPERROR = "OperationDenied.InstanceStatusLimitOpError"
+// RESOURCENOTFOUND_INSTANCENOTFOUNDERROR = "ResourceNotFound.InstanceNotFoundError"
+func (c *Client) LockAccountWithContext(ctx context.Context, request *LockAccountRequest) (response *LockAccountResponse, err error) {
+ if request == nil {
+ request = NewLockAccountRequest()
+ }
+
+ if c.GetCredential() == nil {
+ return nil, errors.New("LockAccount require credential")
+ }
+
+ request.SetContext(ctx)
+
+ response = NewLockAccountResponse()
+ err = c.Send(request, response)
+ return
+}
+
+func NewModifyAccountPrivilegesRequest() (request *ModifyAccountPrivilegesRequest) {
+ request = &ModifyAccountPrivilegesRequest{
+ BaseRequest: &tchttp.BaseRequest{},
+ }
+
+ request.Init().WithApiInfo("postgres", APIVersion, "ModifyAccountPrivileges")
+
+
+ return
+}
+
+func NewModifyAccountPrivilegesResponse() (response *ModifyAccountPrivilegesResponse) {
+ response = &ModifyAccountPrivilegesResponse{
+ BaseResponse: &tchttp.BaseResponse{},
+ }
+ return
+
+}
+
+// ModifyAccountPrivileges
+// 修改某账号对某数据库对象的权限、修改账号类型。
+//
+// 可能返回的错误码:
+// DBERROR = "DBError"
+// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
+// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
+// INTERNALERROR_DBERROR = "InternalError.DBError"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
+// INVALIDPARAMETERVALUE_INVALIDDATABASEOBJECTNAME = "InvalidParameterValue.InvalidDatabaseObjectName"
+// INVALIDPARAMETERVALUE_PARAMETEROUTOFRANGE = "InvalidParameterValue.ParameterOutOfRange"
+// OPERATIONDENIED_INSTANCEACCESSDENIEDERROR = "OperationDenied.InstanceAccessDeniedError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITOPERROR = "OperationDenied.InstanceStatusLimitOpError"
+// OPERATIONDENIED_KERNELVERSIONERROR = "OperationDenied.KernelVersionError"
+// RESOURCENOTFOUND_INSTANCENOTFOUNDERROR = "ResourceNotFound.InstanceNotFoundError"
+func (c *Client) ModifyAccountPrivileges(request *ModifyAccountPrivilegesRequest) (response *ModifyAccountPrivilegesResponse, err error) {
+ return c.ModifyAccountPrivilegesWithContext(context.Background(), request)
+}
+
+// ModifyAccountPrivileges
+// 修改某账号对某数据库对象的权限、修改账号类型。
+//
+// 可能返回的错误码:
+// DBERROR = "DBError"
+// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
+// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
+// INTERNALERROR_DBERROR = "InternalError.DBError"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
+// INVALIDPARAMETERVALUE_INVALIDDATABASEOBJECTNAME = "InvalidParameterValue.InvalidDatabaseObjectName"
+// INVALIDPARAMETERVALUE_PARAMETEROUTOFRANGE = "InvalidParameterValue.ParameterOutOfRange"
+// OPERATIONDENIED_INSTANCEACCESSDENIEDERROR = "OperationDenied.InstanceAccessDeniedError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITOPERROR = "OperationDenied.InstanceStatusLimitOpError"
+// OPERATIONDENIED_KERNELVERSIONERROR = "OperationDenied.KernelVersionError"
+// RESOURCENOTFOUND_INSTANCENOTFOUNDERROR = "ResourceNotFound.InstanceNotFoundError"
+func (c *Client) ModifyAccountPrivilegesWithContext(ctx context.Context, request *ModifyAccountPrivilegesRequest) (response *ModifyAccountPrivilegesResponse, err error) {
+ if request == nil {
+ request = NewModifyAccountPrivilegesRequest()
+ }
+
+ if c.GetCredential() == nil {
+ return nil, errors.New("ModifyAccountPrivileges require credential")
+ }
+
+ request.SetContext(ctx)
+
+ response = NewModifyAccountPrivilegesResponse()
+ err = c.Send(request, response)
+ return
+}
+
func NewModifyAccountRemarkRequest() (request *ModifyAccountRemarkRequest) {
request = &ModifyAccountRemarkRequest{
BaseRequest: &tchttp.BaseRequest{},
@@ -5239,9 +5679,12 @@ func NewModifyAccountRemarkResponse() (response *ModifyAccountRemarkResponse) {
// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
// INTERNALERROR_INTERNALHTTPSERVERERROR = "InternalError.InternalHttpServerError"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
// INVALIDPARAMETERVALUE_ACCOUNTNOTEXISTERROR = "InvalidParameterValue.AccountNotExistError"
// INVALIDPARAMETERVALUE_INSTANCENOTEXIST = "InvalidParameterValue.InstanceNotExist"
// INVALIDPARAMETERVALUE_INVALIDACCOUNTFORMAT = "InvalidParameterValue.InvalidAccountFormat"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
// INVALIDPARAMETERVALUE_INVALIDPARAMETERVALUEERROR = "InvalidParameterValue.InvalidParameterValueError"
// INVALIDPARAMETERVALUE_PARAMETERCHARACTERERROR = "InvalidParameterValue.ParameterCharacterError"
// INVALIDPARAMETERVALUE_PARAMETERHANDLEERROR = "InvalidParameterValue.ParameterHandleError"
@@ -5261,9 +5704,12 @@ func (c *Client) ModifyAccountRemark(request *ModifyAccountRemarkRequest) (respo
// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
// INTERNALERROR_INTERNALHTTPSERVERERROR = "InternalError.InternalHttpServerError"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
// INVALIDPARAMETERVALUE_ACCOUNTNOTEXISTERROR = "InvalidParameterValue.AccountNotExistError"
// INVALIDPARAMETERVALUE_INSTANCENOTEXIST = "InvalidParameterValue.InstanceNotExist"
// INVALIDPARAMETERVALUE_INVALIDACCOUNTFORMAT = "InvalidParameterValue.InvalidAccountFormat"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
// INVALIDPARAMETERVALUE_INVALIDPARAMETERVALUEERROR = "InvalidParameterValue.InvalidParameterValueError"
// INVALIDPARAMETERVALUE_PARAMETERCHARACTERERROR = "InvalidParameterValue.ParameterCharacterError"
// INVALIDPARAMETERVALUE_PARAMETERHANDLEERROR = "InvalidParameterValue.ParameterHandleError"
@@ -6855,13 +7301,18 @@ func NewResetAccountPasswordResponse() (response *ResetAccountPasswordResponse)
// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
// FAILEDOPERATION_OSSACCESSERROR = "FailedOperation.OssAccessError"
// FAILEDOPERATION_OSSOPERATIONFAILED = "FailedOperation.OssOperationFailed"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
// INTERNALERROR_DBERROR = "InternalError.DBError"
// INTERNALERROR_INTERNALHTTPSERVERERROR = "InternalError.InternalHttpServerError"
// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError"
// INVALIDACCOUNTPASSWORD = "InvalidAccountPassword"
// INVALIDPARAMETER = "InvalidParameter"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
// INVALIDPARAMETERVALUE_ACCOUNTNOTEXISTERROR = "InvalidParameterValue.AccountNotExistError"
+// INVALIDPARAMETERVALUE_DECRYPTPASSWORDFAILED = "InvalidParameterValue.DecryptPasswordFailed"
// INVALIDPARAMETERVALUE_INSTANCENOTEXIST = "InvalidParameterValue.InstanceNotExist"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
// INVALIDPARAMETERVALUE_INVALIDPARAMETERVALUEERROR = "InvalidParameterValue.InvalidParameterValueError"
// INVALIDPARAMETERVALUE_INVALIDPASSWORDFORMAT = "InvalidParameterValue.InvalidPasswordFormat"
// INVALIDPARAMETERVALUE_INVALIDPASSWORDLENGTHERROR = "InvalidParameterValue.InvalidPasswordLengthError"
@@ -6883,13 +7334,18 @@ func (c *Client) ResetAccountPassword(request *ResetAccountPasswordRequest) (res
// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
// FAILEDOPERATION_OSSACCESSERROR = "FailedOperation.OssAccessError"
// FAILEDOPERATION_OSSOPERATIONFAILED = "FailedOperation.OssOperationFailed"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
// INTERNALERROR_DBERROR = "InternalError.DBError"
// INTERNALERROR_INTERNALHTTPSERVERERROR = "InternalError.InternalHttpServerError"
// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError"
// INVALIDACCOUNTPASSWORD = "InvalidAccountPassword"
// INVALIDPARAMETER = "InvalidParameter"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
// INVALIDPARAMETERVALUE_ACCOUNTNOTEXISTERROR = "InvalidParameterValue.AccountNotExistError"
+// INVALIDPARAMETERVALUE_DECRYPTPASSWORDFAILED = "InvalidParameterValue.DecryptPasswordFailed"
// INVALIDPARAMETERVALUE_INSTANCENOTEXIST = "InvalidParameterValue.InstanceNotExist"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
// INVALIDPARAMETERVALUE_INVALIDPARAMETERVALUEERROR = "InvalidParameterValue.InvalidParameterValueError"
// INVALIDPARAMETERVALUE_INVALIDPASSWORDFORMAT = "InvalidParameterValue.InvalidPasswordFormat"
// INVALIDPARAMETERVALUE_INVALIDPASSWORDLENGTHERROR = "InvalidParameterValue.InvalidPasswordLengthError"
@@ -6996,6 +7452,69 @@ func (c *Client) RestartDBInstanceWithContext(ctx context.Context, request *Rest
return
}
+func NewRestoreDBInstanceObjectsRequest() (request *RestoreDBInstanceObjectsRequest) {
+ request = &RestoreDBInstanceObjectsRequest{
+ BaseRequest: &tchttp.BaseRequest{},
+ }
+
+ request.Init().WithApiInfo("postgres", APIVersion, "RestoreDBInstanceObjects")
+
+
+ return
+}
+
+func NewRestoreDBInstanceObjectsResponse() (response *RestoreDBInstanceObjectsResponse) {
+ response = &RestoreDBInstanceObjectsResponse{
+ BaseResponse: &tchttp.BaseResponse{},
+ }
+ return
+
+}
+
+// RestoreDBInstanceObjects
+// 根据备份集或恢复目标时间,在原实例上恢复数据库相关对象,例如数据库、表。
+//
+// 可能返回的错误码:
+// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
+// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_FLOWCREATEERROR = "FailedOperation.FlowCreateError"
+// INVALIDPARAMETERVALUE_PARAMETERHANDLEERROR = "InvalidParameterValue.ParameterHandleError"
+// OPERATIONDENIED_INSTANCEACCESSDENIEDERROR = "OperationDenied.InstanceAccessDeniedError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITERROR = "OperationDenied.InstanceStatusLimitError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITOPERROR = "OperationDenied.InstanceStatusLimitOpError"
+// RESOURCENOTFOUND_INSTANCENOTFOUNDERROR = "ResourceNotFound.InstanceNotFoundError"
+func (c *Client) RestoreDBInstanceObjects(request *RestoreDBInstanceObjectsRequest) (response *RestoreDBInstanceObjectsResponse, err error) {
+ return c.RestoreDBInstanceObjectsWithContext(context.Background(), request)
+}
+
+// RestoreDBInstanceObjects
+// 根据备份集或恢复目标时间,在原实例上恢复数据库相关对象,例如数据库、表。
+//
+// 可能返回的错误码:
+// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
+// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_FLOWCREATEERROR = "FailedOperation.FlowCreateError"
+// INVALIDPARAMETERVALUE_PARAMETERHANDLEERROR = "InvalidParameterValue.ParameterHandleError"
+// OPERATIONDENIED_INSTANCEACCESSDENIEDERROR = "OperationDenied.InstanceAccessDeniedError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITERROR = "OperationDenied.InstanceStatusLimitError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITOPERROR = "OperationDenied.InstanceStatusLimitOpError"
+// RESOURCENOTFOUND_INSTANCENOTFOUNDERROR = "ResourceNotFound.InstanceNotFoundError"
+func (c *Client) RestoreDBInstanceObjectsWithContext(ctx context.Context, request *RestoreDBInstanceObjectsRequest) (response *RestoreDBInstanceObjectsResponse, err error) {
+ if request == nil {
+ request = NewRestoreDBInstanceObjectsRequest()
+ }
+
+ if c.GetCredential() == nil {
+ return nil, errors.New("RestoreDBInstanceObjects require credential")
+ }
+
+ request.SetContext(ctx)
+
+ response = NewRestoreDBInstanceObjectsResponse()
+ err = c.Send(request, response)
+ return
+}
+
func NewSetAutoRenewFlagRequest() (request *SetAutoRenewFlagRequest) {
request = &SetAutoRenewFlagRequest{
BaseRequest: &tchttp.BaseRequest{},
@@ -7158,6 +7677,79 @@ func (c *Client) SwitchDBInstancePrimaryWithContext(ctx context.Context, request
return
}
+func NewUnlockAccountRequest() (request *UnlockAccountRequest) {
+ request = &UnlockAccountRequest{
+ BaseRequest: &tchttp.BaseRequest{},
+ }
+
+ request.Init().WithApiInfo("postgres", APIVersion, "UnlockAccount")
+
+
+ return
+}
+
+func NewUnlockAccountResponse() (response *UnlockAccountResponse) {
+ response = &UnlockAccountResponse{
+ BaseResponse: &tchttp.BaseResponse{},
+ }
+ return
+
+}
+
+// UnlockAccount
+// 解除数据库账号的锁定,解锁后账号可以登陆数据库。
+//
+// 可能返回的错误码:
+// DBERROR = "DBError"
+// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
+// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
+// INTERNALERROR_DBERROR = "InternalError.DBError"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
+// INVALIDPARAMETERVALUE_INVALIDDATABASEOBJECTNAME = "InvalidParameterValue.InvalidDatabaseObjectName"
+// INVALIDPARAMETERVALUE_PARAMETERLENGTHLIMITERROR = "InvalidParameterValue.ParameterLengthLimitError"
+// OPERATIONDENIED_INSTANCEACCESSDENIEDERROR = "OperationDenied.InstanceAccessDeniedError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITOPERROR = "OperationDenied.InstanceStatusLimitOpError"
+// RESOURCENOTFOUND_INSTANCENOTFOUNDERROR = "ResourceNotFound.InstanceNotFoundError"
+func (c *Client) UnlockAccount(request *UnlockAccountRequest) (response *UnlockAccountResponse, err error) {
+ return c.UnlockAccountWithContext(context.Background(), request)
+}
+
+// UnlockAccount
+// 解除数据库账号的锁定,解锁后账号可以登陆数据库。
+//
+// 可能返回的错误码:
+// DBERROR = "DBError"
+// FAILEDOPERATION_DATABASEACCESSERROR = "FailedOperation.DatabaseAccessError"
+// FAILEDOPERATION_FAILEDOPERATIONERROR = "FailedOperation.FailedOperationError"
+// FAILEDOPERATION_PRECHECKERROR = "FailedOperation.PreCheckError"
+// INTERNALERROR_DBERROR = "InternalError.DBError"
+// INVALIDPARAMETER_PARAMETERCHECKERROR = "InvalidParameter.ParameterCheckError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+// INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
+// INVALIDPARAMETERVALUE_INVALIDDATABASEOBJECTNAME = "InvalidParameterValue.InvalidDatabaseObjectName"
+// INVALIDPARAMETERVALUE_PARAMETERLENGTHLIMITERROR = "InvalidParameterValue.ParameterLengthLimitError"
+// OPERATIONDENIED_INSTANCEACCESSDENIEDERROR = "OperationDenied.InstanceAccessDeniedError"
+// OPERATIONDENIED_INSTANCESTATUSLIMITOPERROR = "OperationDenied.InstanceStatusLimitOpError"
+// RESOURCENOTFOUND_INSTANCENOTFOUNDERROR = "ResourceNotFound.InstanceNotFoundError"
+func (c *Client) UnlockAccountWithContext(ctx context.Context, request *UnlockAccountRequest) (response *UnlockAccountResponse, err error) {
+ if request == nil {
+ request = NewUnlockAccountRequest()
+ }
+
+ if c.GetCredential() == nil {
+ return nil, errors.New("UnlockAccount require credential")
+ }
+
+ request.SetContext(ctx)
+
+ response = NewUnlockAccountResponse()
+ err = c.Send(request, response)
+ return
+}
+
func NewUpgradeDBInstanceRequest() (request *UpgradeDBInstanceRequest) {
request = &UpgradeDBInstanceRequest{
BaseRequest: &tchttp.BaseRequest{},
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312/errors.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312/errors.go
index 50ff298cb3..9e9d849a3a 100644
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312/errors.go
+++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312/errors.go
@@ -260,6 +260,9 @@ const (
// 请求执行异常。
INTERNALERROR_INTERNALHTTPSERVERERROR = "InternalError.InternalHttpServerError"
+ // Json数据解析失败,请联系客服进行处理。
+ INTERNALERROR_JSONPARSEERROR = "InternalError.JsonParseError"
+
// 后台数据解析失败,请联系客服进行处理。
INTERNALERROR_MARSHALERROR = "InternalError.MarshalError"
@@ -323,6 +326,9 @@ const (
// 数据格式转换失败,请联系客服处理。
INVALIDPARAMETERVALUE_DATACONVERTERROR = "InvalidParameterValue.DataConvertError"
+ // 解密密码失败,请确认密码加密是否正确。
+ INVALIDPARAMETERVALUE_DECRYPTPASSWORDFAILED = "InvalidParameterValue.DecryptPasswordFailed"
+
// 不支持的计费类型。
INVALIDPARAMETERVALUE_ILLEGALCHARGETYPE = "InvalidParameterValue.IllegalChargeType"
@@ -356,9 +362,21 @@ const (
// 当前账号名称不允许是保留字符。
INVALIDPARAMETERVALUE_INVALIDACCOUNTNAME = "InvalidParameterValue.InvalidAccountName"
+ // 账号设置无效,请遵循账号命名规则:账号名需要1-16个字符,只能由字母、数字或下划线组成;不能为postgres;不能由数字、pg_及tencentdb_开头;所有规则均不区分大小写。
+ INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEERROR = "InvalidParameterValue.InvalidAccountNameError"
+
+ // 账号无效,请遵循账号命名规则:由字母(a-z, A-Z)、数字(0-9)、下划线(_)组成,以字母或(_)开头,最多63个字符。不能使用系统保留关键字,不能为postgres,且不能由pg_或tencentdb_开头。
+ INVALIDPARAMETERVALUE_INVALIDACCOUNTNAMEFORMATERROR = "InvalidParameterValue.InvalidAccountNameFormatError"
+
// 数据库字符集错误,当前只支持UTF8、LATIN1。
INVALIDPARAMETERVALUE_INVALIDCHARSET = "InvalidParameterValue.InvalidCharset"
+ // 数据库名称无效,请遵循命名规则:由字母(a-z, A-Z)、数字(0-9)、下划线(_)组成,以字母或(_)开头,最多63个字符。不能使用系统保留关键字。
+ INVALIDPARAMETERVALUE_INVALIDDATABASENAMEFORMATERROR = "InvalidParameterValue.InvalidDatabaseNameFormatError"
+
+ // 当前仅支持操作名称为英文、下划线、数字及特殊符号[]组成的数据库对象,函数及存储过程额外支持三个特殊符号(,)
+ INVALIDPARAMETERVALUE_INVALIDDATABASEOBJECTNAME = "InvalidParameterValue.InvalidDatabaseObjectName"
+
// 购买实例数超过限制。
INVALIDPARAMETERVALUE_INVALIDINSTANCENUM = "InvalidParameterValue.InvalidInstanceNum"
@@ -467,6 +485,9 @@ const (
// 实例类型错误
OPERATIONDENIED_INSTANCETYPEDENIED = "OperationDenied.InstanceTypeDenied"
+ // 内核版本过低,导致实例无法创建tencentDBSuper账号。如果您想使用此功能,请升级内核版本。
+ OPERATIONDENIED_KERNELVERSIONERROR = "OperationDenied.KernelVersionError"
+
// Serverless不支持当前可用区。
OPERATIONDENIED_NOTSUPPORTZONEERROR = "OperationDenied.NotSupportZoneError"
diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312/models.go
index ac13c85d02..5552109e18 100644
--- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312/models.go
+++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312/models.go
@@ -24,20 +24,23 @@ type AccountInfo struct {
// 实例ID,形如postgres-lnp6j617
DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
- // 帐号
+ // 账号
UserName *string `json:"UserName,omitnil,omitempty" name:"UserName"`
- // 帐号备注
+ // 账号备注
Remark *string `json:"Remark,omitnil,omitempty" name:"Remark"`
- // 帐号状态。 1-创建中,2-正常,3-修改中,4-密码重置中,-1-删除中
+ // 账号状态。 1-创建中,2-正常,3-修改中,4-密码重置中,5-锁定中,-1-删除中
Status *int64 `json:"Status,omitnil,omitempty" name:"Status"`
- // 帐号创建时间
+ // 账号创建时间
CreateTime *string `json:"CreateTime,omitnil,omitempty" name:"CreateTime"`
- // 帐号最后一次更新时间
+ // 账号最后一次更新时间
UpdateTime *string `json:"UpdateTime,omitnil,omitempty" name:"UpdateTime"`
+
+ // 账号类型
+ UserType *string `json:"UserType,omitnil,omitempty" name:"UserType"`
}
// Predefined struct for user
@@ -269,13 +272,16 @@ type CloneDBInstanceRequestParams struct {
Storage *int64 `json:"Storage,omitnil,omitempty" name:"Storage"`
// 购买时长,单位:月。
- // 预付费:支持1,2,3,4,5,6,7,8,9,10,11,12,24,36
- // 后付费:只支持1
+ //
+ // - 预付费:支持1,2,3,4,5,6,7,8,9,10,11,12,24,36
+ // - 后付费:只支持1
Period *int64 `json:"Period,omitnil,omitempty" name:"Period"`
// 续费标记:
- // 0:手动续费
- // 1:自动续费
+ //
+ // - 0:手动续费
+ // - 1:自动续费
+ //
// 默认值:0
AutoRenewFlag *int64 `json:"AutoRenewFlag,omitnil,omitempty" name:"AutoRenewFlag"`
@@ -289,8 +295,10 @@ type CloneDBInstanceRequestParams struct {
Name *string `json:"Name,omitnil,omitempty" name:"Name"`
// 实例计费类型,目前支持:
- // PREPAID:预付费,即包年包月
- // POSTPAID_BY_HOUR:后付费,即按量计费
+ //
+ // - PREPAID:预付费,即包年包月
+ // - POSTPAID_BY_HOUR:后付费,即按量计费
+ //
// 默认值:PREPAID
InstanceChargeType *string `json:"InstanceChargeType,omitnil,omitempty" name:"InstanceChargeType"`
@@ -308,8 +316,10 @@ type CloneDBInstanceRequestParams struct {
DBNodeSet []*DBNode `json:"DBNodeSet,omitnil,omitempty" name:"DBNodeSet"`
// 是否自动使用代金券:
- // 0:否
- // 1:是
+ //
+ // - 0:否
+ // - 1:是
+ //
// 默认值:0
AutoVoucher *int64 `json:"AutoVoucher,omitnil,omitempty" name:"AutoVoucher"`
@@ -326,8 +336,8 @@ type CloneDBInstanceRequestParams struct {
RecoveryTargetTime *string `json:"RecoveryTargetTime,omitnil,omitempty" name:"RecoveryTargetTime"`
// 主从同步方式,支持:
- // Semi-sync:半同步
- // Async:异步
+ // Semi-sync:半同步
+ // Async:异步
// 主实例默认值:Semi-sync
// 只读实例默认值:Async
SyncMode *string `json:"SyncMode,omitnil,omitempty" name:"SyncMode"`
@@ -346,13 +356,16 @@ type CloneDBInstanceRequest struct {
Storage *int64 `json:"Storage,omitnil,omitempty" name:"Storage"`
// 购买时长,单位:月。
- // 预付费:支持1,2,3,4,5,6,7,8,9,10,11,12,24,36
- // 后付费:只支持1
+ //
+ // - 预付费:支持1,2,3,4,5,6,7,8,9,10,11,12,24,36
+ // - 后付费:只支持1
Period *int64 `json:"Period,omitnil,omitempty" name:"Period"`
// 续费标记:
- // 0:手动续费
- // 1:自动续费
+ //
+ // - 0:手动续费
+ // - 1:自动续费
+ //
// 默认值:0
AutoRenewFlag *int64 `json:"AutoRenewFlag,omitnil,omitempty" name:"AutoRenewFlag"`
@@ -366,8 +379,10 @@ type CloneDBInstanceRequest struct {
Name *string `json:"Name,omitnil,omitempty" name:"Name"`
// 实例计费类型,目前支持:
- // PREPAID:预付费,即包年包月
- // POSTPAID_BY_HOUR:后付费,即按量计费
+ //
+ // - PREPAID:预付费,即包年包月
+ // - POSTPAID_BY_HOUR:后付费,即按量计费
+ //
// 默认值:PREPAID
InstanceChargeType *string `json:"InstanceChargeType,omitnil,omitempty" name:"InstanceChargeType"`
@@ -385,8 +400,10 @@ type CloneDBInstanceRequest struct {
DBNodeSet []*DBNode `json:"DBNodeSet,omitnil,omitempty" name:"DBNodeSet"`
// 是否自动使用代金券:
- // 0:否
- // 1:是
+ //
+ // - 0:否
+ // - 1:是
+ //
// 默认值:0
AutoVoucher *int64 `json:"AutoVoucher,omitnil,omitempty" name:"AutoVoucher"`
@@ -403,8 +420,8 @@ type CloneDBInstanceRequest struct {
RecoveryTargetTime *string `json:"RecoveryTargetTime,omitnil,omitempty" name:"RecoveryTargetTime"`
// 主从同步方式,支持:
- // Semi-sync:半同步
- // Async:异步
+ // Semi-sync:半同步
+ // Async:异步
// 主实例默认值:Semi-sync
// 只读实例默认值:Async
SyncMode *string `json:"SyncMode,omitnil,omitempty" name:"SyncMode"`
@@ -606,6 +623,88 @@ func (r *CloseServerlessDBExtranetAccessResponse) FromJsonString(s string) error
return json.Unmarshal([]byte(s), &r)
}
+// Predefined struct for user
+type CreateAccountRequestParams struct {
+ // 实例ID。
+ DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 创建的账号名称。
+ UserName *string `json:"UserName,omitnil,omitempty" name:"UserName"`
+
+ // 账号对应的密码。
+ Password *string `json:"Password,omitnil,omitempty" name:"Password"`
+
+ // 账号类型。当前支持normal、tencentDBSuper两个输入。normal指代普通用户,tencentDBSuper为拥有pg_tencentdb_superuser角色的账号。
+ Type *string `json:"Type,omitnil,omitempty" name:"Type"`
+
+ // 账号备注。
+ Remark *string `json:"Remark,omitnil,omitempty" name:"Remark"`
+}
+
+type CreateAccountRequest struct {
+ *tchttp.BaseRequest
+
+ // 实例ID。
+ DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 创建的账号名称。
+ UserName *string `json:"UserName,omitnil,omitempty" name:"UserName"`
+
+ // 账号对应的密码。
+ Password *string `json:"Password,omitnil,omitempty" name:"Password"`
+
+ // 账号类型。当前支持normal、tencentDBSuper两个输入。normal指代普通用户,tencentDBSuper为拥有pg_tencentdb_superuser角色的账号。
+ Type *string `json:"Type,omitnil,omitempty" name:"Type"`
+
+ // 账号备注。
+ Remark *string `json:"Remark,omitnil,omitempty" name:"Remark"`
+}
+
+func (r *CreateAccountRequest) ToJsonString() string {
+ b, _ := json.Marshal(r)
+ return string(b)
+}
+
+// FromJsonString It is highly **NOT** recommended to use this function
+// because it has no param check, nor strict type check
+func (r *CreateAccountRequest) FromJsonString(s string) error {
+ f := make(map[string]interface{})
+ if err := json.Unmarshal([]byte(s), &f); err != nil {
+ return err
+ }
+ delete(f, "DBInstanceId")
+ delete(f, "UserName")
+ delete(f, "Password")
+ delete(f, "Type")
+ delete(f, "Remark")
+ if len(f) > 0 {
+ return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateAccountRequest has unknown keys!", "")
+ }
+ return json.Unmarshal([]byte(s), &r)
+}
+
+// Predefined struct for user
+type CreateAccountResponseParams struct {
+ // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
+ RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
+}
+
+type CreateAccountResponse struct {
+ *tchttp.BaseResponse
+ Response *CreateAccountResponseParams `json:"Response"`
+}
+
+func (r *CreateAccountResponse) ToJsonString() string {
+ b, _ := json.Marshal(r)
+ return string(b)
+}
+
+// FromJsonString It is highly **NOT** recommended to use this function
+// because it has no param check, nor strict type check
+func (r *CreateAccountResponse) FromJsonString(s string) error {
+ return json.Unmarshal([]byte(s), &r)
+}
+
// Predefined struct for user
type CreateBaseBackupRequestParams struct {
// 实例ID。
@@ -967,28 +1066,28 @@ type CreateInstancesRequestParams struct {
InstanceCount *uint64 `json:"InstanceCount,omitnil,omitempty" name:"InstanceCount"`
// 购买时长,单位:月。
- // 预付费:支持1,2,3,4,5,6,7,8,9,10,11,12,24,36
- // 后付费:只支持1
+ // 预付费:支持1,2,3,4,5,6,7,8,9,10,11,12,24,36
+ // 后付费:只支持1
Period *uint64 `json:"Period,omitnil,omitempty" name:"Period"`
// 实例字符集,目前只支持:
- // UTF8
- // LATIN1
+ // UTF8
+ // LATIN1
Charset *string `json:"Charset,omitnil,omitempty" name:"Charset"`
// 实例根账号用户名,具体规范如下:
- // 用户名需要1-16个字符,只能由字母、数字或下划线组成
- // 不能为postgres
- // 不能由数字和pg_开头
- // 所有规则均不区分大小写
+ // 用户名需要1-16个字符,只能由字母、数字或下划线组成
+ // 不能为postgres
+ // 不能由数字和pg_开头
+ // 所有规则均不区分大小写
AdminName *string `json:"AdminName,omitnil,omitempty" name:"AdminName"`
// 实例根账号用户名对应的密码,长度8 ~ 32位,推荐使用12位以上的密码;不能以" / "开头;
// 必须包含以下四项,字符种类:
- // 小写字母: [a ~ z]
- // 大写字母:[A ~ Z]
- // 数字:0 - 9
- // 特殊字符:()`~!@#$%^&*-+=_|{}[]:;'<>,.?/
+ // 小写字母: [a ~ z]
+ // 大写字母:[A ~ Z]
+ // 数字:0 - 9
+ // 特殊字符:()`~!@#$%^&*-+=_|{}[]:;'<>,.?/
AdminPassword *string `json:"AdminPassword,omitnil,omitempty" name:"AdminPassword"`
// PostgreSQL大版本号(该参数当前必传),版本信息可从[DescribeDBVersions](https://cloud.tencent.com/document/api/409/89018)获取。目前支持10,11,12,13,14,15这几个大版本,详情见[内核版本概述](https://cloud.tencent.com/document/product/409/67018)。
@@ -1004,8 +1103,8 @@ type CreateInstancesRequestParams struct {
DBKernelVersion *string `json:"DBKernelVersion,omitnil,omitempty" name:"DBKernelVersion"`
// 实例计费类型,目前支持:
- // PREPAID:预付费,即包年包月
- // POSTPAID_BY_HOUR:后付费,即按量计费
+ // PREPAID:预付费,即包年包月
+ // POSTPAID_BY_HOUR:后付费,即按量计费
// 默认值:PREPAID
InstanceChargeType *string `json:"InstanceChargeType,omitnil,omitempty" name:"InstanceChargeType"`
@@ -1020,14 +1119,14 @@ type CreateInstancesRequestParams struct {
DBNodeSet []*DBNode `json:"DBNodeSet,omitnil,omitempty" name:"DBNodeSet"`
// 续费标记:
- // 0:手动续费
- // 1:自动续费
+ // 0:手动续费
+ // 1:自动续费
// 默认值:0
AutoRenewFlag *int64 `json:"AutoRenewFlag,omitnil,omitempty" name:"AutoRenewFlag"`
// 是否自动使用代金券:
- // 0:否
- // 1:是
+ // 0:否
+ // 1:是
// 默认值:0
AutoVoucher *uint64 `json:"AutoVoucher,omitnil,omitempty" name:"AutoVoucher"`
@@ -1050,8 +1149,8 @@ type CreateInstancesRequestParams struct {
SecurityGroupIds []*string `json:"SecurityGroupIds,omitnil,omitempty" name:"SecurityGroupIds"`
// 是否需要支持数据透明加密:
- // 0:否
- // 1:是
+ // 0:否
+ // 1:是
// 默认值:0
// 参考[数据透明加密概述](https://cloud.tencent.com/document/product/409/71748)
NeedSupportTDE *uint64 `json:"NeedSupportTDE,omitnil,omitempty" name:"NeedSupportTDE"`
@@ -1065,8 +1164,8 @@ type CreateInstancesRequestParams struct {
KMSRegion *string `json:"KMSRegion,omitnil,omitempty" name:"KMSRegion"`
// 数据库引擎,支持:
- // postgresql:云数据库PostgreSQL
- // mssql_compatible:MSSQL兼容-云数据库PostgreSQL
+ // postgresql:云数据库PostgreSQL
+ // mssql_compatible:MSSQL兼容-云数据库PostgreSQL
// 默认值:postgresql
DBEngine *string `json:"DBEngine,omitnil,omitempty" name:"DBEngine"`
@@ -1074,22 +1173,22 @@ type CreateInstancesRequestParams struct {
// {"$key1":"$value1", "$key2":"$value2"}
// 各引擎支持如下:
// mssql_compatible引擎:
- // migrationMode:数据库模式,可选参数,可取值:single-db(单数据库模式),multi-db(多数据库模式)。默认为single-db。
+ // migrationMode:数据库模式,可选参数,可取值:single-db(单数据库模式),multi-db(多数据库模式)。默认为single-db。
// defaultLocale:排序区域规则,可选参数,在初始化后不可修改,默认为en_US,可选值如下:
- // "af_ZA", "sq_AL", "ar_DZ", "ar_BH", "ar_EG", "ar_IQ", "ar_JO", "ar_KW", "ar_LB", "ar_LY", "ar_MA", "ar_OM", "ar_QA", "ar_SA", "ar_SY", "ar_TN", "ar_AE", "ar_YE", "hy_AM", "az_Cyrl_AZ", "az_Latn_AZ", "eu_ES", "be_BY", "bg_BG", "ca_ES", "zh_HK", "zh_MO", "zh_CN", "zh_SG", "zh_TW", "hr_HR", "cs_CZ", "da_DK", "nl_BE", "nl_NL", "en_AU", "en_BZ", "en_CA", "en_IE", "en_JM", "en_NZ", "en_PH", "en_ZA", "en_TT", "en_GB", "en_US", "en_ZW", "et_EE", "fo_FO", "fa_IR", "fi_FI", "fr_BE", "fr_CA", "fr_FR", "fr_LU", "fr_MC", "fr_CH", "mk_MK", "ka_GE", "de_AT", "de_DE", "de_LI", "de_LU", "de_CH", "el_GR", "gu_IN", "he_IL", "hi_IN", "hu_HU", "is_IS", "id_ID", "it_IT", "it_CH", "ja_JP", "kn_IN", "kok_IN", "ko_KR", "ky_KG", "lv_LV", "lt_LT", "ms_BN", "ms_MY", "mr_IN", "mn_MN", "nb_NO", "nn_NO", "pl_PL", "pt_BR", "pt_PT", "pa_IN", "ro_RO", "ru_RU", "sa_IN", "sr_Cyrl_RS", "sr_Latn_RS", "sk_SK", "sl_SI", "es_AR", "es_BO", "es_CL", "es_CO", "es_CR", "es_DO", "es_EC", "es_SV", "es_GT", "es_HN", "es_MX", "es_NI", "es_PA", "es_PY","es_PE", "es_PR", "es_ES", "es_TRADITIONAL", "es_UY", "es_VE", "sw_KE", "sv_FI", "sv_SE", "tt_RU", "te_IN", "th_TH", "tr_TR", "uk_UA", "ur_IN", "ur_PK", "uz_Cyrl_UZ", "uz_Latn_UZ", "vi_VN"。
- // serverCollationName:排序规则名称,可选参数,在初始化后不可修改,默认为sql_latin1_general_cp1_ci_as,可选值如下:"bbf_unicode_general_ci_as", "bbf_unicode_cp1_ci_as", "bbf_unicode_CP1250_ci_as", "bbf_unicode_CP1251_ci_as", "bbf_unicode_cp1253_ci_as", "bbf_unicode_cp1254_ci_as", "bbf_unicode_cp1255_ci_as", "bbf_unicode_cp1256_ci_as", "bbf_unicode_cp1257_ci_as", "bbf_unicode_cp1258_ci_as", "bbf_unicode_cp874_ci_as", "sql_latin1_general_cp1250_ci_as", "sql_latin1_general_cp1251_ci_as", "sql_latin1_general_cp1_ci_as", "sql_latin1_general_cp1253_ci_as", "sql_latin1_general_cp1254_ci_as", "sql_latin1_general_cp1255_ci_as","sql_latin1_general_cp1256_ci_as", "sql_latin1_general_cp1257_ci_as", "sql_latin1_general_cp1258_ci_as", "chinese_prc_ci_as", "cyrillic_general_ci_as", "finnish_swedish_ci_as", "french_ci_as", "japanese_ci_as", "korean_wansung_ci_as", "latin1_general_ci_as", "modern_spanish_ci_as", "polish_ci_as", "thai_ci_as", "traditional_spanish_ci_as", "turkish_ci_as", "ukrainian_ci_as", "vietnamese_ci_as"。
+ // "af_ZA", "sq_AL", "ar_DZ", "ar_BH", "ar_EG", "ar_IQ", "ar_JO", "ar_KW", "ar_LB", "ar_LY", "ar_MA", "ar_OM", "ar_QA", "ar_SA", "ar_SY", "ar_TN", "ar_AE", "ar_YE", "hy_AM", "az_Cyrl_AZ", "az_Latn_AZ", "eu_ES", "be_BY", "bg_BG", "ca_ES", "zh_HK", "zh_MO", "zh_CN", "zh_SG", "zh_TW", "hr_HR", "cs_CZ", "da_DK", "nl_BE", "nl_NL", "en_AU", "en_BZ", "en_CA", "en_IE", "en_JM", "en_NZ", "en_PH", "en_ZA", "en_TT", "en_GB", "en_US", "en_ZW", "et_EE", "fo_FO", "fa_IR", "fi_FI", "fr_BE", "fr_CA", "fr_FR", "fr_LU", "fr_MC", "fr_CH", "mk_MK", "ka_GE", "de_AT", "de_DE", "de_LI", "de_LU", "de_CH", "el_GR", "gu_IN", "he_IL", "hi_IN", "hu_HU", "is_IS", "id_ID", "it_IT", "it_CH", "ja_JP", "kn_IN", "kok_IN", "ko_KR", "ky_KG", "lv_LV", "lt_LT", "ms_BN", "ms_MY", "mr_IN", "mn_MN", "nb_NO", "nn_NO", "pl_PL", "pt_BR", "pt_PT", "pa_IN", "ro_RO", "ru_RU", "sa_IN", "sr_Cyrl_RS", "sr_Latn_RS", "sk_SK", "sl_SI", "es_AR", "es_BO", "es_CL", "es_CO", "es_CR", "es_DO", "es_EC", "es_SV", "es_GT", "es_HN", "es_MX", "es_NI", "es_PA", "es_PY","es_PE", "es_PR", "es_ES", "es_TRADITIONAL", "es_UY", "es_VE", "sw_KE", "sv_FI", "sv_SE", "tt_RU", "te_IN", "th_TH", "tr_TR", "uk_UA", "ur_IN", "ur_PK", "uz_Cyrl_UZ", "uz_Latn_UZ", "vi_VN"。
+ // serverCollationName:排序规则名称,可选参数,在初始化后不可修改,默认为sql_latin1_general_cp1_ci_as,可选值如下:"bbf_unicode_general_ci_as", "bbf_unicode_cp1_ci_as", "bbf_unicode_CP1250_ci_as", "bbf_unicode_CP1251_ci_as", "bbf_unicode_cp1253_ci_as", "bbf_unicode_cp1254_ci_as", "bbf_unicode_cp1255_ci_as", "bbf_unicode_cp1256_ci_as", "bbf_unicode_cp1257_ci_as", "bbf_unicode_cp1258_ci_as", "bbf_unicode_cp874_ci_as", "sql_latin1_general_cp1250_ci_as", "sql_latin1_general_cp1251_ci_as", "sql_latin1_general_cp1_ci_as", "sql_latin1_general_cp1253_ci_as", "sql_latin1_general_cp1254_ci_as", "sql_latin1_general_cp1255_ci_as","sql_latin1_general_cp1256_ci_as", "sql_latin1_general_cp1257_ci_as", "sql_latin1_general_cp1258_ci_as", "chinese_prc_ci_as", "cyrillic_general_ci_as", "finnish_swedish_ci_as", "french_ci_as", "japanese_ci_as", "korean_wansung_ci_as", "latin1_general_ci_as", "modern_spanish_ci_as", "polish_ci_as", "thai_ci_as", "traditional_spanish_ci_as", "turkish_ci_as", "ukrainian_ci_as", "vietnamese_ci_as"。
DBEngineConfig *string `json:"DBEngineConfig,omitnil,omitempty" name:"DBEngineConfig"`
// 主从同步方式,支持:
- // Semi-sync:半同步
- // Async:异步
+ // Semi-sync:半同步
+ // Async:异步
// 主实例默认值:Semi-sync
// 只读实例默认值:Async
SyncMode *string `json:"SyncMode,omitnil,omitempty" name:"SyncMode"`
// 是否需要支持Ipv6:
- // 0:否
- // 1:是
+ // 0:否
+ // 1:是
// 默认值:0
NeedSupportIpv6 *uint64 `json:"NeedSupportIpv6,omitnil,omitempty" name:"NeedSupportIpv6"`
}
@@ -1111,28 +1210,28 @@ type CreateInstancesRequest struct {
InstanceCount *uint64 `json:"InstanceCount,omitnil,omitempty" name:"InstanceCount"`
// 购买时长,单位:月。
- // 预付费:支持1,2,3,4,5,6,7,8,9,10,11,12,24,36
- // 后付费:只支持1
+ // 预付费:支持1,2,3,4,5,6,7,8,9,10,11,12,24,36
+ // 后付费:只支持1
Period *uint64 `json:"Period,omitnil,omitempty" name:"Period"`
// 实例字符集,目前只支持:
- // UTF8
- // LATIN1
+ // UTF8
+ // LATIN1
Charset *string `json:"Charset,omitnil,omitempty" name:"Charset"`
// 实例根账号用户名,具体规范如下:
- // 用户名需要1-16个字符,只能由字母、数字或下划线组成
- // 不能为postgres
- // 不能由数字和pg_开头
- // 所有规则均不区分大小写
+ // 用户名需要1-16个字符,只能由字母、数字或下划线组成
+ // 不能为postgres
+ // 不能由数字和pg_开头
+ // 所有规则均不区分大小写
AdminName *string `json:"AdminName,omitnil,omitempty" name:"AdminName"`
// 实例根账号用户名对应的密码,长度8 ~ 32位,推荐使用12位以上的密码;不能以" / "开头;
// 必须包含以下四项,字符种类:
- // 小写字母: [a ~ z]
- // 大写字母:[A ~ Z]
- // 数字:0 - 9
- // 特殊字符:()`~!@#$%^&*-+=_|{}[]:;'<>,.?/
+ // 小写字母: [a ~ z]
+ // 大写字母:[A ~ Z]
+ // 数字:0 - 9
+ // 特殊字符:()`~!@#$%^&*-+=_|{}[]:;'<>,.?/
AdminPassword *string `json:"AdminPassword,omitnil,omitempty" name:"AdminPassword"`
// PostgreSQL大版本号(该参数当前必传),版本信息可从[DescribeDBVersions](https://cloud.tencent.com/document/api/409/89018)获取。目前支持10,11,12,13,14,15这几个大版本,详情见[内核版本概述](https://cloud.tencent.com/document/product/409/67018)。
@@ -1148,8 +1247,8 @@ type CreateInstancesRequest struct {
DBKernelVersion *string `json:"DBKernelVersion,omitnil,omitempty" name:"DBKernelVersion"`
// 实例计费类型,目前支持:
- // PREPAID:预付费,即包年包月
- // POSTPAID_BY_HOUR:后付费,即按量计费
+ // PREPAID:预付费,即包年包月
+ // POSTPAID_BY_HOUR:后付费,即按量计费
// 默认值:PREPAID
InstanceChargeType *string `json:"InstanceChargeType,omitnil,omitempty" name:"InstanceChargeType"`
@@ -1164,14 +1263,14 @@ type CreateInstancesRequest struct {
DBNodeSet []*DBNode `json:"DBNodeSet,omitnil,omitempty" name:"DBNodeSet"`
// 续费标记:
- // 0:手动续费
- // 1:自动续费
+ // 0:手动续费
+ // 1:自动续费
// 默认值:0
AutoRenewFlag *int64 `json:"AutoRenewFlag,omitnil,omitempty" name:"AutoRenewFlag"`
// 是否自动使用代金券:
- // 0:否
- // 1:是
+ // 0:否
+ // 1:是
// 默认值:0
AutoVoucher *uint64 `json:"AutoVoucher,omitnil,omitempty" name:"AutoVoucher"`
@@ -1194,8 +1293,8 @@ type CreateInstancesRequest struct {
SecurityGroupIds []*string `json:"SecurityGroupIds,omitnil,omitempty" name:"SecurityGroupIds"`
// 是否需要支持数据透明加密:
- // 0:否
- // 1:是
+ // 0:否
+ // 1:是
// 默认值:0
// 参考[数据透明加密概述](https://cloud.tencent.com/document/product/409/71748)
NeedSupportTDE *uint64 `json:"NeedSupportTDE,omitnil,omitempty" name:"NeedSupportTDE"`
@@ -1209,8 +1308,8 @@ type CreateInstancesRequest struct {
KMSRegion *string `json:"KMSRegion,omitnil,omitempty" name:"KMSRegion"`
// 数据库引擎,支持:
- // postgresql:云数据库PostgreSQL
- // mssql_compatible:MSSQL兼容-云数据库PostgreSQL
+ // postgresql:云数据库PostgreSQL
+ // mssql_compatible:MSSQL兼容-云数据库PostgreSQL
// 默认值:postgresql
DBEngine *string `json:"DBEngine,omitnil,omitempty" name:"DBEngine"`
@@ -1218,22 +1317,22 @@ type CreateInstancesRequest struct {
// {"$key1":"$value1", "$key2":"$value2"}
// 各引擎支持如下:
// mssql_compatible引擎:
- // migrationMode:数据库模式,可选参数,可取值:single-db(单数据库模式),multi-db(多数据库模式)。默认为single-db。
+ // migrationMode:数据库模式,可选参数,可取值:single-db(单数据库模式),multi-db(多数据库模式)。默认为single-db。
// defaultLocale:排序区域规则,可选参数,在初始化后不可修改,默认为en_US,可选值如下:
- // "af_ZA", "sq_AL", "ar_DZ", "ar_BH", "ar_EG", "ar_IQ", "ar_JO", "ar_KW", "ar_LB", "ar_LY", "ar_MA", "ar_OM", "ar_QA", "ar_SA", "ar_SY", "ar_TN", "ar_AE", "ar_YE", "hy_AM", "az_Cyrl_AZ", "az_Latn_AZ", "eu_ES", "be_BY", "bg_BG", "ca_ES", "zh_HK", "zh_MO", "zh_CN", "zh_SG", "zh_TW", "hr_HR", "cs_CZ", "da_DK", "nl_BE", "nl_NL", "en_AU", "en_BZ", "en_CA", "en_IE", "en_JM", "en_NZ", "en_PH", "en_ZA", "en_TT", "en_GB", "en_US", "en_ZW", "et_EE", "fo_FO", "fa_IR", "fi_FI", "fr_BE", "fr_CA", "fr_FR", "fr_LU", "fr_MC", "fr_CH", "mk_MK", "ka_GE", "de_AT", "de_DE", "de_LI", "de_LU", "de_CH", "el_GR", "gu_IN", "he_IL", "hi_IN", "hu_HU", "is_IS", "id_ID", "it_IT", "it_CH", "ja_JP", "kn_IN", "kok_IN", "ko_KR", "ky_KG", "lv_LV", "lt_LT", "ms_BN", "ms_MY", "mr_IN", "mn_MN", "nb_NO", "nn_NO", "pl_PL", "pt_BR", "pt_PT", "pa_IN", "ro_RO", "ru_RU", "sa_IN", "sr_Cyrl_RS", "sr_Latn_RS", "sk_SK", "sl_SI", "es_AR", "es_BO", "es_CL", "es_CO", "es_CR", "es_DO", "es_EC", "es_SV", "es_GT", "es_HN", "es_MX", "es_NI", "es_PA", "es_PY","es_PE", "es_PR", "es_ES", "es_TRADITIONAL", "es_UY", "es_VE", "sw_KE", "sv_FI", "sv_SE", "tt_RU", "te_IN", "th_TH", "tr_TR", "uk_UA", "ur_IN", "ur_PK", "uz_Cyrl_UZ", "uz_Latn_UZ", "vi_VN"。
- // serverCollationName:排序规则名称,可选参数,在初始化后不可修改,默认为sql_latin1_general_cp1_ci_as,可选值如下:"bbf_unicode_general_ci_as", "bbf_unicode_cp1_ci_as", "bbf_unicode_CP1250_ci_as", "bbf_unicode_CP1251_ci_as", "bbf_unicode_cp1253_ci_as", "bbf_unicode_cp1254_ci_as", "bbf_unicode_cp1255_ci_as", "bbf_unicode_cp1256_ci_as", "bbf_unicode_cp1257_ci_as", "bbf_unicode_cp1258_ci_as", "bbf_unicode_cp874_ci_as", "sql_latin1_general_cp1250_ci_as", "sql_latin1_general_cp1251_ci_as", "sql_latin1_general_cp1_ci_as", "sql_latin1_general_cp1253_ci_as", "sql_latin1_general_cp1254_ci_as", "sql_latin1_general_cp1255_ci_as","sql_latin1_general_cp1256_ci_as", "sql_latin1_general_cp1257_ci_as", "sql_latin1_general_cp1258_ci_as", "chinese_prc_ci_as", "cyrillic_general_ci_as", "finnish_swedish_ci_as", "french_ci_as", "japanese_ci_as", "korean_wansung_ci_as", "latin1_general_ci_as", "modern_spanish_ci_as", "polish_ci_as", "thai_ci_as", "traditional_spanish_ci_as", "turkish_ci_as", "ukrainian_ci_as", "vietnamese_ci_as"。
+ // "af_ZA", "sq_AL", "ar_DZ", "ar_BH", "ar_EG", "ar_IQ", "ar_JO", "ar_KW", "ar_LB", "ar_LY", "ar_MA", "ar_OM", "ar_QA", "ar_SA", "ar_SY", "ar_TN", "ar_AE", "ar_YE", "hy_AM", "az_Cyrl_AZ", "az_Latn_AZ", "eu_ES", "be_BY", "bg_BG", "ca_ES", "zh_HK", "zh_MO", "zh_CN", "zh_SG", "zh_TW", "hr_HR", "cs_CZ", "da_DK", "nl_BE", "nl_NL", "en_AU", "en_BZ", "en_CA", "en_IE", "en_JM", "en_NZ", "en_PH", "en_ZA", "en_TT", "en_GB", "en_US", "en_ZW", "et_EE", "fo_FO", "fa_IR", "fi_FI", "fr_BE", "fr_CA", "fr_FR", "fr_LU", "fr_MC", "fr_CH", "mk_MK", "ka_GE", "de_AT", "de_DE", "de_LI", "de_LU", "de_CH", "el_GR", "gu_IN", "he_IL", "hi_IN", "hu_HU", "is_IS", "id_ID", "it_IT", "it_CH", "ja_JP", "kn_IN", "kok_IN", "ko_KR", "ky_KG", "lv_LV", "lt_LT", "ms_BN", "ms_MY", "mr_IN", "mn_MN", "nb_NO", "nn_NO", "pl_PL", "pt_BR", "pt_PT", "pa_IN", "ro_RO", "ru_RU", "sa_IN", "sr_Cyrl_RS", "sr_Latn_RS", "sk_SK", "sl_SI", "es_AR", "es_BO", "es_CL", "es_CO", "es_CR", "es_DO", "es_EC", "es_SV", "es_GT", "es_HN", "es_MX", "es_NI", "es_PA", "es_PY","es_PE", "es_PR", "es_ES", "es_TRADITIONAL", "es_UY", "es_VE", "sw_KE", "sv_FI", "sv_SE", "tt_RU", "te_IN", "th_TH", "tr_TR", "uk_UA", "ur_IN", "ur_PK", "uz_Cyrl_UZ", "uz_Latn_UZ", "vi_VN"。
+ // serverCollationName:排序规则名称,可选参数,在初始化后不可修改,默认为sql_latin1_general_cp1_ci_as,可选值如下:"bbf_unicode_general_ci_as", "bbf_unicode_cp1_ci_as", "bbf_unicode_CP1250_ci_as", "bbf_unicode_CP1251_ci_as", "bbf_unicode_cp1253_ci_as", "bbf_unicode_cp1254_ci_as", "bbf_unicode_cp1255_ci_as", "bbf_unicode_cp1256_ci_as", "bbf_unicode_cp1257_ci_as", "bbf_unicode_cp1258_ci_as", "bbf_unicode_cp874_ci_as", "sql_latin1_general_cp1250_ci_as", "sql_latin1_general_cp1251_ci_as", "sql_latin1_general_cp1_ci_as", "sql_latin1_general_cp1253_ci_as", "sql_latin1_general_cp1254_ci_as", "sql_latin1_general_cp1255_ci_as","sql_latin1_general_cp1256_ci_as", "sql_latin1_general_cp1257_ci_as", "sql_latin1_general_cp1258_ci_as", "chinese_prc_ci_as", "cyrillic_general_ci_as", "finnish_swedish_ci_as", "french_ci_as", "japanese_ci_as", "korean_wansung_ci_as", "latin1_general_ci_as", "modern_spanish_ci_as", "polish_ci_as", "thai_ci_as", "traditional_spanish_ci_as", "turkish_ci_as", "ukrainian_ci_as", "vietnamese_ci_as"。
DBEngineConfig *string `json:"DBEngineConfig,omitnil,omitempty" name:"DBEngineConfig"`
// 主从同步方式,支持:
- // Semi-sync:半同步
- // Async:异步
+ // Semi-sync:半同步
+ // Async:异步
// 主实例默认值:Semi-sync
// 只读实例默认值:Async
SyncMode *string `json:"SyncMode,omitnil,omitempty" name:"SyncMode"`
// 是否需要支持Ipv6:
- // 0:否
- // 1:是
+ // 0:否
+ // 1:是
// 默认值:0
NeedSupportIpv6 *uint64 `json:"NeedSupportIpv6,omitnil,omitempty" name:"NeedSupportIpv6"`
}
@@ -1990,10 +2089,10 @@ type DBInstance struct {
// 实例所属可用区, 如:ap-guangzhou-3,对应ZoneSet的Zone字段。
Zone *string `json:"Zone,omitnil,omitempty" name:"Zone"`
- // 私有网络ID,形如vpc-xxxxxxxx。有效的VpcId可通过登录控制台查询;也可以调用接口 [DescribeVpcEx](https://cloud.tencent.com/document/api/215/1372) ,从接口返回中的unVpcId字段获取。
+ // 私有网络ID,形如vpc-e6w23k31。有效的VpcId可通过登录控制台查询;也可以调用接口 [DescribeVpcs](https://cloud.tencent.com/document/api/215/15778) ,从接口返回中的unVpcId字段获取。
VpcId *string `json:"VpcId,omitnil,omitempty" name:"VpcId"`
- // 私有网络子网ID,形如subnet-xxxxxxxx。有效的私有网络子网ID可通过登录控制台查询;也可以调用接口 [DescribeSubnets ](https://cloud.tencent.com/document/api/215/15784),从接口返回中的unSubnetId字段获取。
+ // 私有网络子网ID,形如subnet-51lcif9y。有效的私有网络子网ID可通过登录控制台查询;也可以调用接口 [DescribeSubnets ](https://cloud.tencent.com/document/api/215/15784),从接口返回中的unSubnetId字段获取。
SubnetId *string `json:"SubnetId,omitnil,omitempty" name:"SubnetId"`
// 实例ID。
@@ -2002,7 +2101,7 @@ type DBInstance struct {
// 实例名称。
DBInstanceName *string `json:"DBInstanceName,omitnil,omitempty" name:"DBInstanceName"`
- // 实例状态,分别为:applying(申请中)、init(待初始化)、initing(初始化中)、running(运行中)、limited run(受限运行)、isolating(隔离中)、isolated(已隔离)、recycling(回收中)、recycled(已回收)、job running(任务执行中)、offline(下线)、migrating(迁移中)、expanding(扩容中)、waitSwitch(等待切换)、switching(切换中)、readonly(只读)、restarting(重启中)、network changing(网络变更中)、upgrading(内核版本升级中)、audit-switching(审计状态变更中)、primary-switching(主备切换中)
+ // 实例状态,分别为:applying(申请中)、init(待初始化)、initing(初始化中)、running(运行中)、limited run(受限运行)、isolating(隔离中)、isolated(已隔离)、disisolating(解隔离中)、recycling(回收中)、recycled(已回收)、job running(任务执行中)、offline(下线)、migrating(迁移中)、expanding(扩容中)、waitSwitch(等待切换)、switching(切换中)、readonly(只读)、restarting(重启中)、network changing(网络变更中)、upgrading(内核版本升级中)、audit-switching(审计状态变更中)、primary-switching(主备切换中)
DBInstanceStatus *string `json:"DBInstanceStatus,omitnil,omitempty" name:"DBInstanceStatus"`
// 实例分配的内存大小,单位:GB
@@ -2029,18 +2128,18 @@ type DBInstance struct {
DBKernelVersion *string `json:"DBKernelVersion,omitnil,omitempty" name:"DBKernelVersion"`
// 实例类型,类型有:
- // primary:主实例
- // readonly:只读实例
- // guard:灾备实例
- // temp:临时实例
+ // primary:主实例
+ // readonly:只读实例
+ // guard:灾备实例
+ // temp:临时实例
DBInstanceType *string `json:"DBInstanceType,omitnil,omitempty" name:"DBInstanceType"`
// 实例版本,目前只支持standard(双机高可用版, 一主一从)。
DBInstanceVersion *string `json:"DBInstanceVersion,omitnil,omitempty" name:"DBInstanceVersion"`
// 实例字符集,目前只支持:
- // UTF8
- // LATIN1
+ // UTF8
+ // LATIN1
DBCharset *string `json:"DBCharset,omitnil,omitempty" name:"DBCharset"`
// 实例创建时间。
@@ -2056,13 +2155,13 @@ type DBInstance struct {
IsolatedTime *string `json:"IsolatedTime,omitnil,omitempty" name:"IsolatedTime"`
// 计费模式:
- // prepaid:包年包月,预付费
- // postpaid:按量计费,后付费
+ // prepaid:包年包月,预付费
+ // postpaid:按量计费,后付费
PayType *string `json:"PayType,omitnil,omitempty" name:"PayType"`
// 是否自动续费:
- // 0:手动续费
- // 1:自动续费
+ // 0:手动续费
+ // 1:自动续费
// 默认值:0
AutoRenew *uint64 `json:"AutoRenew,omitnil,omitempty" name:"AutoRenew"`
@@ -2106,16 +2205,16 @@ type DBInstance struct {
DBNodeSet []*DBNode `json:"DBNodeSet,omitnil,omitempty" name:"DBNodeSet"`
// 实例是否支持TDE数据加密:
- // 0:不支持
- // 1:支持
+ // 0:不支持
+ // 1:支持
// 默认值:0
// TDE数据加密可参考[数据透明加密概述](https://cloud.tencent.com/document/product/409/71748)
// 注意:此字段可能返回 null,表示取不到有效值。
IsSupportTDE *int64 `json:"IsSupportTDE,omitnil,omitempty" name:"IsSupportTDE"`
// 数据库引擎,支持:
- // postgresql:云数据库PostgreSQL
- // mssql_compatible:MSSQL兼容-云数据库PostgreSQL
+ // postgresql:云数据库PostgreSQL
+ // mssql_compatible:MSSQL兼容-云数据库PostgreSQL
// 默认值:postgresql
// 注意:此字段可能返回 null,表示取不到有效值。
DBEngine *string `json:"DBEngine,omitnil,omitempty" name:"DBEngine"`
@@ -2124,10 +2223,10 @@ type DBInstance struct {
// {"$key1":"$value1", "$key2":"$value2"}
// 各引擎支持如下:
// mssql_compatible引擎:
- // migrationMode:数据库模式,可选参数,可取值:single-db(单数据库模式),multi-db(多数据库模式)。默认为single-db。
+ // migrationMode:数据库模式,可选参数,可取值:single-db(单数据库模式),multi-db(多数据库模式)。默认为single-db。
// defaultLocale:排序区域规则,可选参数,在初始化后不可修改,默认为en_US,可选值如下:
- // "af_ZA", "sq_AL", "ar_DZ", "ar_BH", "ar_EG", "ar_IQ", "ar_JO", "ar_KW", "ar_LB", "ar_LY", "ar_MA", "ar_OM", "ar_QA", "ar_SA", "ar_SY", "ar_TN", "ar_AE", "ar_YE", "hy_AM", "az_Cyrl_AZ", "az_Latn_AZ", "eu_ES", "be_BY", "bg_BG", "ca_ES", "zh_HK", "zh_MO", "zh_CN", "zh_SG", "zh_TW", "hr_HR", "cs_CZ", "da_DK", "nl_BE", "nl_NL", "en_AU", "en_BZ", "en_CA", "en_IE", "en_JM", "en_NZ", "en_PH", "en_ZA", "en_TT", "en_GB", "en_US", "en_ZW", "et_EE", "fo_FO", "fa_IR", "fi_FI", "fr_BE", "fr_CA", "fr_FR", "fr_LU", "fr_MC", "fr_CH", "mk_MK", "ka_GE", "de_AT", "de_DE", "de_LI", "de_LU", "de_CH", "el_GR", "gu_IN", "he_IL", "hi_IN", "hu_HU", "is_IS", "id_ID", "it_IT", "it_CH", "ja_JP", "kn_IN", "kok_IN", "ko_KR", "ky_KG", "lv_LV", "lt_LT", "ms_BN", "ms_MY", "mr_IN", "mn_MN", "nb_NO", "nn_NO", "pl_PL", "pt_BR", "pt_PT", "pa_IN", "ro_RO", "ru_RU", "sa_IN", "sr_Cyrl_RS", "sr_Latn_RS", "sk_SK", "sl_SI", "es_AR", "es_BO", "es_CL", "es_CO", "es_CR", "es_DO", "es_EC", "es_SV", "es_GT", "es_HN", "es_MX", "es_NI", "es_PA", "es_PY","es_PE", "es_PR", "es_ES", "es_TRADITIONAL", "es_UY", "es_VE", "sw_KE", "sv_FI", "sv_SE", "tt_RU", "te_IN", "th_TH", "tr_TR", "uk_UA", "ur_IN", "ur_PK", "uz_Cyrl_UZ", "uz_Latn_UZ", "vi_VN"。
- // serverCollationName:排序规则名称,可选参数,在初始化后不可修改,默认为sql_latin1_general_cp1_ci_as,可选值如下:"bbf_unicode_general_ci_as", "bbf_unicode_cp1_ci_as", "bbf_unicode_CP1250_ci_as", "bbf_unicode_CP1251_ci_as", "bbf_unicode_cp1253_ci_as", "bbf_unicode_cp1254_ci_as", "bbf_unicode_cp1255_ci_as", "bbf_unicode_cp1256_ci_as", "bbf_unicode_cp1257_ci_as", "bbf_unicode_cp1258_ci_as", "bbf_unicode_cp874_ci_as", "sql_latin1_general_cp1250_ci_as", "sql_latin1_general_cp1251_ci_as", "sql_latin1_general_cp1_ci_as", "sql_latin1_general_cp1253_ci_as", "sql_latin1_general_cp1254_ci_as", "sql_latin1_general_cp1255_ci_as","sql_latin1_general_cp1256_ci_as", "sql_latin1_general_cp1257_ci_as", "sql_latin1_general_cp1258_ci_as", "chinese_prc_ci_as", "cyrillic_general_ci_as", "finnish_swedish_ci_as", "french_ci_as", "japanese_ci_as", "korean_wansung_ci_as", "latin1_general_ci_as", "modern_spanish_ci_as", "polish_ci_as", "thai_ci_as", "traditional_spanish_ci_as", "turkish_ci_as", "ukrainian_ci_as", "vietnamese_ci_as"。
+ // "af_ZA", "sq_AL", "ar_DZ", "ar_BH", "ar_EG", "ar_IQ", "ar_JO", "ar_KW", "ar_LB", "ar_LY", "ar_MA", "ar_OM", "ar_QA", "ar_SA", "ar_SY", "ar_TN", "ar_AE", "ar_YE", "hy_AM", "az_Cyrl_AZ", "az_Latn_AZ", "eu_ES", "be_BY", "bg_BG", "ca_ES", "zh_HK", "zh_MO", "zh_CN", "zh_SG", "zh_TW", "hr_HR", "cs_CZ", "da_DK", "nl_BE", "nl_NL", "en_AU", "en_BZ", "en_CA", "en_IE", "en_JM", "en_NZ", "en_PH", "en_ZA", "en_TT", "en_GB", "en_US", "en_ZW", "et_EE", "fo_FO", "fa_IR", "fi_FI", "fr_BE", "fr_CA", "fr_FR", "fr_LU", "fr_MC", "fr_CH", "mk_MK", "ka_GE", "de_AT", "de_DE", "de_LI", "de_LU", "de_CH", "el_GR", "gu_IN", "he_IL", "hi_IN", "hu_HU", "is_IS", "id_ID", "it_IT", "it_CH", "ja_JP", "kn_IN", "kok_IN", "ko_KR", "ky_KG", "lv_LV", "lt_LT", "ms_BN", "ms_MY", "mr_IN", "mn_MN", "nb_NO", "nn_NO", "pl_PL", "pt_BR", "pt_PT", "pa_IN", "ro_RO", "ru_RU", "sa_IN", "sr_Cyrl_RS", "sr_Latn_RS", "sk_SK", "sl_SI", "es_AR", "es_BO", "es_CL", "es_CO", "es_CR", "es_DO", "es_EC", "es_SV", "es_GT", "es_HN", "es_MX", "es_NI", "es_PA", "es_PY","es_PE", "es_PR", "es_ES", "es_TRADITIONAL", "es_UY", "es_VE", "sw_KE", "sv_FI", "sv_SE", "tt_RU", "te_IN", "th_TH", "tr_TR", "uk_UA", "ur_IN", "ur_PK", "uz_Cyrl_UZ", "uz_Latn_UZ", "vi_VN"。
+ // serverCollationName:排序规则名称,可选参数,在初始化后不可修改,默认为sql_latin1_general_cp1_ci_as,可选值如下:"bbf_unicode_general_ci_as", "bbf_unicode_cp1_ci_as", "bbf_unicode_CP1250_ci_as", "bbf_unicode_CP1251_ci_as", "bbf_unicode_cp1253_ci_as", "bbf_unicode_cp1254_ci_as", "bbf_unicode_cp1255_ci_as", "bbf_unicode_cp1256_ci_as", "bbf_unicode_cp1257_ci_as", "bbf_unicode_cp1258_ci_as", "bbf_unicode_cp874_ci_as", "sql_latin1_general_cp1250_ci_as", "sql_latin1_general_cp1251_ci_as", "sql_latin1_general_cp1_ci_as", "sql_latin1_general_cp1253_ci_as", "sql_latin1_general_cp1254_ci_as", "sql_latin1_general_cp1255_ci_as","sql_latin1_general_cp1256_ci_as", "sql_latin1_general_cp1257_ci_as", "sql_latin1_general_cp1258_ci_as", "chinese_prc_ci_as", "cyrillic_general_ci_as", "finnish_swedish_ci_as", "french_ci_as", "japanese_ci_as", "korean_wansung_ci_as", "latin1_general_ci_as", "modern_spanish_ci_as", "polish_ci_as", "thai_ci_as", "traditional_spanish_ci_as", "turkish_ci_as", "ukrainian_ci_as", "vietnamese_ci_as"。
// 注意:此字段可能返回 null,表示取不到有效值。
DBEngineConfig *string `json:"DBEngineConfig,omitnil,omitempty" name:"DBEngineConfig"`
@@ -2136,8 +2235,8 @@ type DBInstance struct {
NetworkAccessList []*NetworkAccess `json:"NetworkAccessList,omitnil,omitempty" name:"NetworkAccessList"`
// 实例是否支持Ipv6:
- // 0:否
- // 1:是
+ // 0:否
+ // 1:是
// 默认值:0
SupportIpv6 *uint64 `json:"SupportIpv6,omitnil,omitempty" name:"SupportIpv6"`
}
@@ -2181,6 +2280,99 @@ type DBNode struct {
Zone *string `json:"Zone,omitnil,omitempty" name:"Zone"`
}
+type DatabaseObject struct {
+ // 支持使用的数据库对象类型有:account,database,schema,sequence,procedure,type,function,table,view,matview,column。
+ // 注意:此字段可能返回 null,表示取不到有效值。
+ ObjectType *string `json:"ObjectType,omitnil,omitempty" name:"ObjectType"`
+
+ // 所描述的数据库对象名称
+ // 注意:此字段可能返回 null,表示取不到有效值。
+ ObjectName *string `json:"ObjectName,omitnil,omitempty" name:"ObjectName"`
+
+ // 所要描述的数据库对象,所属的数据库名称。当描述对象类型不为database时,此参数必选。
+ // 注意:此字段可能返回 null,表示取不到有效值。
+ DatabaseName *string `json:"DatabaseName,omitnil,omitempty" name:"DatabaseName"`
+
+ // 所要描述的数据库对象,所属的模式名称。当描述对象不为database、schema时,此参数必选。
+ // 注意:此字段可能返回 null,表示取不到有效值。
+ SchemaName *string `json:"SchemaName,omitnil,omitempty" name:"SchemaName"`
+
+ // 所要描述的数据库对象,所属的表名称。当描述的对象类型为column时,此参数必填。
+ // 注意:此字段可能返回 null,表示取不到有效值。
+ TableName *string `json:"TableName,omitnil,omitempty" name:"TableName"`
+}
+
+type DatabasePrivilege struct {
+ // 数据库对象,当ObjectType为database时,DataseName/SchemaName/TableName可为空;当ObjectType为schema时,SchemaName/TableName可为空;当ObjectType为column时,TableName不可为空,其余情况均可为空。
+ // 注意:此字段可能返回 null,表示取不到有效值。
+ Object *DatabaseObject `json:"Object,omitnil,omitempty" name:"Object"`
+
+ // 指定账号对数据库对象拥有的权限列表
+ // 注意:此字段可能返回 null,表示取不到有效值。
+ PrivilegeSet []*string `json:"PrivilegeSet,omitnil,omitempty" name:"PrivilegeSet"`
+}
+
+// Predefined struct for user
+type DeleteAccountRequestParams struct {
+ // 实例ID。
+ DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 删除的账号名称。
+ UserName *string `json:"UserName,omitnil,omitempty" name:"UserName"`
+}
+
+type DeleteAccountRequest struct {
+ *tchttp.BaseRequest
+
+ // 实例ID。
+ DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 删除的账号名称。
+ UserName *string `json:"UserName,omitnil,omitempty" name:"UserName"`
+}
+
+func (r *DeleteAccountRequest) ToJsonString() string {
+ b, _ := json.Marshal(r)
+ return string(b)
+}
+
+// FromJsonString It is highly **NOT** recommended to use this function
+// because it has no param check, nor strict type check
+func (r *DeleteAccountRequest) FromJsonString(s string) error {
+ f := make(map[string]interface{})
+ if err := json.Unmarshal([]byte(s), &f); err != nil {
+ return err
+ }
+ delete(f, "DBInstanceId")
+ delete(f, "UserName")
+ if len(f) > 0 {
+ return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeleteAccountRequest has unknown keys!", "")
+ }
+ return json.Unmarshal([]byte(s), &r)
+}
+
+// Predefined struct for user
+type DeleteAccountResponseParams struct {
+ // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
+ RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
+}
+
+type DeleteAccountResponse struct {
+ *tchttp.BaseResponse
+ Response *DeleteAccountResponseParams `json:"Response"`
+}
+
+func (r *DeleteAccountResponse) ToJsonString() string {
+ b, _ := json.Marshal(r)
+ return string(b)
+}
+
+// FromJsonString It is highly **NOT** recommended to use this function
+// because it has no param check, nor strict type check
+func (r *DeleteAccountResponse) FromJsonString(s string) error {
+ return json.Unmarshal([]byte(s), &r)
+}
+
// Predefined struct for user
type DeleteBaseBackupRequestParams struct {
// 实例ID。
@@ -2634,18 +2826,89 @@ func (r *DeleteServerlessDBInstanceResponse) FromJsonString(s string) error {
return json.Unmarshal([]byte(s), &r)
}
+// Predefined struct for user
+type DescribeAccountPrivilegesRequestParams struct {
+ // 实例ID。
+ DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 查询此账号对某数据库对象所拥有的权限信息。
+ UserName *string `json:"UserName,omitnil,omitempty" name:"UserName"`
+
+ // 要查询的数据库对象信息
+ DatabaseObjectSet []*DatabaseObject `json:"DatabaseObjectSet,omitnil,omitempty" name:"DatabaseObjectSet"`
+}
+
+type DescribeAccountPrivilegesRequest struct {
+ *tchttp.BaseRequest
+
+ // 实例ID。
+ DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 查询此账号对某数据库对象所拥有的权限信息。
+ UserName *string `json:"UserName,omitnil,omitempty" name:"UserName"`
+
+ // 要查询的数据库对象信息
+ DatabaseObjectSet []*DatabaseObject `json:"DatabaseObjectSet,omitnil,omitempty" name:"DatabaseObjectSet"`
+}
+
+func (r *DescribeAccountPrivilegesRequest) ToJsonString() string {
+ b, _ := json.Marshal(r)
+ return string(b)
+}
+
+// FromJsonString It is highly **NOT** recommended to use this function
+// because it has no param check, nor strict type check
+func (r *DescribeAccountPrivilegesRequest) FromJsonString(s string) error {
+ f := make(map[string]interface{})
+ if err := json.Unmarshal([]byte(s), &f); err != nil {
+ return err
+ }
+ delete(f, "DBInstanceId")
+ delete(f, "UserName")
+ delete(f, "DatabaseObjectSet")
+ if len(f) > 0 {
+ return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeAccountPrivilegesRequest has unknown keys!", "")
+ }
+ return json.Unmarshal([]byte(s), &r)
+}
+
+// Predefined struct for user
+type DescribeAccountPrivilegesResponseParams struct {
+ // 用户拥有数据库user_database的CREATE、CONNECT、TEMPORARY权限
+ PrivilegeSet []*DatabasePrivilege `json:"PrivilegeSet,omitnil,omitempty" name:"PrivilegeSet"`
+
+ // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
+ RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
+}
+
+type DescribeAccountPrivilegesResponse struct {
+ *tchttp.BaseResponse
+ Response *DescribeAccountPrivilegesResponseParams `json:"Response"`
+}
+
+func (r *DescribeAccountPrivilegesResponse) ToJsonString() string {
+ b, _ := json.Marshal(r)
+ return string(b)
+}
+
+// FromJsonString It is highly **NOT** recommended to use this function
+// because it has no param check, nor strict type check
+func (r *DescribeAccountPrivilegesResponse) FromJsonString(s string) error {
+ return json.Unmarshal([]byte(s), &r)
+}
+
// Predefined struct for user
type DescribeAccountsRequestParams struct {
// 实例ID,形如postgres-6fego161
DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
- // 分页返回,每页最大返回数目,默认10,取值范围为1-100
+ // 分页返回,每页最大返回数目,默认20,取值范围为1-100
Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"`
// 数据偏移量,从0开始。
Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"`
- // 返回数据按照创建时间或者用户名排序。取值只能为createTime或者name。createTime-按照创建时间排序;name-按照用户名排序
+ // 返回数据按照创建时间或者用户名排序。取值支持createTime、name、updateTime。createTime-按照创建时间排序;name-按照用户名排序; updateTime-按照更新时间排序。
OrderBy *string `json:"OrderBy,omitnil,omitempty" name:"OrderBy"`
// 返回结果是升序还是降序。取值只能为desc或者asc。desc-降序;asc-升序
@@ -2658,13 +2921,13 @@ type DescribeAccountsRequest struct {
// 实例ID,形如postgres-6fego161
DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
- // 分页返回,每页最大返回数目,默认10,取值范围为1-100
+ // 分页返回,每页最大返回数目,默认20,取值范围为1-100
Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"`
// 数据偏移量,从0开始。
Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"`
- // 返回数据按照创建时间或者用户名排序。取值只能为createTime或者name。createTime-按照创建时间排序;name-按照用户名排序
+ // 返回数据按照创建时间或者用户名排序。取值支持createTime、name、updateTime。createTime-按照创建时间排序;name-按照用户名排序; updateTime-按照更新时间排序。
OrderBy *string `json:"OrderBy,omitnil,omitempty" name:"OrderBy"`
// 返回结果是升序还是降序。取值只能为desc或者asc。desc-降序;asc-升序
@@ -2699,7 +2962,7 @@ type DescribeAccountsResponseParams struct {
// 本次调用接口共返回了多少条数据。
TotalCount *int64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"`
- // 账号列表详细信息。
+ // 账号列表详细信息。当CreateTime项为0000-00-00 00:00:00时,意味着对应账号是直连数据库创建的,并非通过CreateAccount接口创建。
Details []*AccountInfo `json:"Details,omitnil,omitempty" name:"Details"`
// 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
@@ -3899,8 +4162,10 @@ type DescribeDBInstancesRequestParams struct {
// db-instance-id:按照实例ID过滤,类型为string
// db-instance-name:按照实例名过滤,类型为string
// db-project-id:按照项目ID过滤,类型为integer
- // db-pay-mode:按照付费模式过滤,类型为string
+ // db-pay-mode:按照实例付费模式过滤,类型为string
// db-tag-key:按照标签键过滤,类型为string
+ // db-private-ip: 按照实例私有网络IP过滤,类型为string
+ // db-public-address: 按照实例外网地址过滤,类型为string
Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"`
// 每页显示数量,取值范围为1-100,默认为返回10条。
@@ -3923,8 +4188,10 @@ type DescribeDBInstancesRequest struct {
// db-instance-id:按照实例ID过滤,类型为string
// db-instance-name:按照实例名过滤,类型为string
// db-project-id:按照项目ID过滤,类型为integer
- // db-pay-mode:按照付费模式过滤,类型为string
+ // db-pay-mode:按照实例付费模式过滤,类型为string
// db-tag-key:按照标签键过滤,类型为string
+ // db-private-ip: 按照实例私有网络IP过滤,类型为string
+ // db-public-address: 按照实例外网地址过滤,类型为string
Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"`
// 每页显示数量,取值范围为1-100,默认为返回10条。
@@ -4219,26 +4486,130 @@ type DescribeDBXlogsResponseParams struct {
// 表示此次返回结果有多少条数据。
TotalCount *int64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"`
- // Xlog列表
- XlogList []*Xlog `json:"XlogList,omitnil,omitempty" name:"XlogList"`
+ // Xlog列表
+ XlogList []*Xlog `json:"XlogList,omitnil,omitempty" name:"XlogList"`
+
+ // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
+ RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
+}
+
+type DescribeDBXlogsResponse struct {
+ *tchttp.BaseResponse
+ Response *DescribeDBXlogsResponseParams `json:"Response"`
+}
+
+func (r *DescribeDBXlogsResponse) ToJsonString() string {
+ b, _ := json.Marshal(r)
+ return string(b)
+}
+
+// FromJsonString It is highly **NOT** recommended to use this function
+// because it has no param check, nor strict type check
+func (r *DescribeDBXlogsResponse) FromJsonString(s string) error {
+ return json.Unmarshal([]byte(s), &r)
+}
+
+// Predefined struct for user
+type DescribeDatabaseObjectsRequestParams struct {
+ // 实例ID。
+ DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 查询的对象类型。支持查询的数据对象有:database,schema,sequence,procedure,type,function,table,view,matview,column。
+ ObjectType *string `json:"ObjectType,omitnil,omitempty" name:"ObjectType"`
+
+ // 单次显示数量,默认20。可选范围为[0,100]。
+ Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"`
+
+ // 数据偏移量,从0开始。
+ Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"`
+
+ // 查询对象所属的数据库。当查询对象类型不为database时,此参数必填。
+ DatabaseName *string `json:"DatabaseName,omitnil,omitempty" name:"DatabaseName"`
+
+ // 查询对象所属的模式。当查询对象类型不为database、schema时,此参数必填。
+ SchemaName *string `json:"SchemaName,omitnil,omitempty" name:"SchemaName"`
+
+ // 查询对象所属的表。当查询对象类型为column时,此参数必填。
+ TableName *string `json:"TableName,omitnil,omitempty" name:"TableName"`
+}
+
+type DescribeDatabaseObjectsRequest struct {
+ *tchttp.BaseRequest
+
+ // 实例ID。
+ DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 查询的对象类型。支持查询的数据对象有:database,schema,sequence,procedure,type,function,table,view,matview,column。
+ ObjectType *string `json:"ObjectType,omitnil,omitempty" name:"ObjectType"`
+
+ // 单次显示数量,默认20。可选范围为[0,100]。
+ Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"`
+
+ // 数据偏移量,从0开始。
+ Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"`
+
+ // 查询对象所属的数据库。当查询对象类型不为database时,此参数必填。
+ DatabaseName *string `json:"DatabaseName,omitnil,omitempty" name:"DatabaseName"`
+
+ // 查询对象所属的模式。当查询对象类型不为database、schema时,此参数必填。
+ SchemaName *string `json:"SchemaName,omitnil,omitempty" name:"SchemaName"`
+
+ // 查询对象所属的表。当查询对象类型为column时,此参数必填。
+ TableName *string `json:"TableName,omitnil,omitempty" name:"TableName"`
+}
+
+func (r *DescribeDatabaseObjectsRequest) ToJsonString() string {
+ b, _ := json.Marshal(r)
+ return string(b)
+}
+
+// FromJsonString It is highly **NOT** recommended to use this function
+// because it has no param check, nor strict type check
+func (r *DescribeDatabaseObjectsRequest) FromJsonString(s string) error {
+ f := make(map[string]interface{})
+ if err := json.Unmarshal([]byte(s), &f); err != nil {
+ return err
+ }
+ delete(f, "DBInstanceId")
+ delete(f, "ObjectType")
+ delete(f, "Limit")
+ delete(f, "Offset")
+ delete(f, "DatabaseName")
+ delete(f, "SchemaName")
+ delete(f, "TableName")
+ if len(f) > 0 {
+ return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeDatabaseObjectsRequest has unknown keys!", "")
+ }
+ return json.Unmarshal([]byte(s), &r)
+}
+
+// Predefined struct for user
+type DescribeDatabaseObjectsResponseParams struct {
+ // 查询对象列表。
+ // 注意:此字段可能返回 null,表示取不到有效值。
+ ObjectSet []*string `json:"ObjectSet,omitnil,omitempty" name:"ObjectSet"`
+
+ // 查询对象总数量
+ // 注意:此字段可能返回 null,表示取不到有效值。
+ TotalCount *uint64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"`
// 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
}
-type DescribeDBXlogsResponse struct {
+type DescribeDatabaseObjectsResponse struct {
*tchttp.BaseResponse
- Response *DescribeDBXlogsResponseParams `json:"Response"`
+ Response *DescribeDatabaseObjectsResponseParams `json:"Response"`
}
-func (r *DescribeDBXlogsResponse) ToJsonString() string {
+func (r *DescribeDatabaseObjectsResponse) ToJsonString() string {
b, _ := json.Marshal(r)
return string(b)
}
// FromJsonString It is highly **NOT** recommended to use this function
// because it has no param check, nor strict type check
-func (r *DescribeDBXlogsResponse) FromJsonString(s string) error {
+func (r *DescribeDatabaseObjectsResponse) FromJsonString(s string) error {
return json.Unmarshal([]byte(s), &r)
}
@@ -4246,6 +4617,15 @@ func (r *DescribeDBXlogsResponse) FromJsonString(s string) error {
type DescribeDatabasesRequestParams struct {
// 实例ID
DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 按照一个或者多个过滤条件进行查询,目前支持的过滤条件有:database-name:按照数据库名称过滤,类型为string。此处使用模糊匹配搜索符合条件的数据库。
+ Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"`
+
+ // 数据偏移量,从0开始。
+ Offset *uint64 `json:"Offset,omitnil,omitempty" name:"Offset"`
+
+ // 单次显示数量
+ Limit *uint64 `json:"Limit,omitnil,omitempty" name:"Limit"`
}
type DescribeDatabasesRequest struct {
@@ -4253,6 +4633,15 @@ type DescribeDatabasesRequest struct {
// 实例ID
DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 按照一个或者多个过滤条件进行查询,目前支持的过滤条件有:database-name:按照数据库名称过滤,类型为string。此处使用模糊匹配搜索符合条件的数据库。
+ Filters []*Filter `json:"Filters,omitnil,omitempty" name:"Filters"`
+
+ // 数据偏移量,从0开始。
+ Offset *uint64 `json:"Offset,omitnil,omitempty" name:"Offset"`
+
+ // 单次显示数量
+ Limit *uint64 `json:"Limit,omitnil,omitempty" name:"Limit"`
}
func (r *DescribeDatabasesRequest) ToJsonString() string {
@@ -4268,6 +4657,9 @@ func (r *DescribeDatabasesRequest) FromJsonString(s string) error {
return err
}
delete(f, "DBInstanceId")
+ delete(f, "Filters")
+ delete(f, "Offset")
+ delete(f, "Limit")
if len(f) > 0 {
return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeDatabasesRequest has unknown keys!", "")
}
@@ -4279,6 +4671,9 @@ type DescribeDatabasesResponseParams struct {
// 数据库信息
Items []*string `json:"Items,omitnil,omitempty" name:"Items"`
+ // 数据库总数
+ TotalCount *uint64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"`
+
// 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
}
@@ -5041,7 +5436,13 @@ func (r *DescribeRegionsResponse) FromJsonString(s string) error {
// Predefined struct for user
type DescribeServerlessDBInstancesRequestParams struct {
- // 查询条件
+ // 查询条件。按照一个或者多个过滤条件进行查询,目前支持的过滤条件类型(name字段指定)有:
+ //
+ // - db-instance-id:按照实例ID过滤,类型为string
+ // - db-instance-name:按照实例名过滤,类型为string
+ // - db-tag-key:按照实例的tag过滤,类型为string
+ //
+ // value字段指定该类型过滤条件下具体要过滤的实例ID/实例名/实例tag-key。
Filter []*Filter `json:"Filter,omitnil,omitempty" name:"Filter"`
// 查询个数
@@ -5060,7 +5461,13 @@ type DescribeServerlessDBInstancesRequestParams struct {
type DescribeServerlessDBInstancesRequest struct {
*tchttp.BaseRequest
- // 查询条件
+ // 查询条件。按照一个或者多个过滤条件进行查询,目前支持的过滤条件类型(name字段指定)有:
+ //
+ // - db-instance-id:按照实例ID过滤,类型为string
+ // - db-instance-name:按照实例名过滤,类型为string
+ // - db-tag-key:按照实例的tag过滤,类型为string
+ //
+ // value字段指定该类型过滤条件下具体要过滤的实例ID/实例名/实例tag-key。
Filter []*Filter `json:"Filter,omitnil,omitempty" name:"Filter"`
// 查询个数
@@ -5133,25 +5540,25 @@ type DescribeSlowQueryAnalysisRequestParams struct {
// 实例ID。
DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
- // 查询起始时间戳,格式 “YYYY-MM-DD HH:mm:ss” ,日志保留时间默认为7天,起始时间不能超出保留时间范围。
+ // 查询起始时间,形如2018-01-01 00:00:00。日志保留时间默认为7天,起始时间不能超出保留时间范围。
StartTime *string `json:"StartTime,omitnil,omitempty" name:"StartTime"`
- // 查询结束时间戳,格式 “YYYY-MM-DD HH:mm:ss”。
+ // 查询结束时间,形如2018-01-01 00:00:00。
EndTime *string `json:"EndTime,omitnil,omitempty" name:"EndTime"`
- // 根据数据库名进行筛选,可以为空。
+ // 数据库名字。
DatabaseName *string `json:"DatabaseName,omitnil,omitempty" name:"DatabaseName"`
- // 排序维度。 可选参数,取值范围[CallNum,CostTime,AvgCostTime]。默认CallNum。
+ // 排序字段,取值范围[CallNum,CostTime,AvgCostTime]。默认值为CallNum。
OrderBy *string `json:"OrderBy,omitnil,omitempty" name:"OrderBy"`
- // 排序类型。升序asc、降序desc。默认desc。
+ // 排序方式,包括升序:asc 降序:desc。默认值为desc。
OrderByType *string `json:"OrderByType,omitnil,omitempty" name:"OrderByType"`
- // 分页大小。取值范围[1,100]。默认50。
+ // 每页显示数量,取值范围为1-100。默认值为50。
Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"`
- // 分页偏移。取值范围[0,INF)。默认0。
+ // 数据偏移量,从0开始。默认值为0。
Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"`
}
@@ -5161,25 +5568,25 @@ type DescribeSlowQueryAnalysisRequest struct {
// 实例ID。
DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
- // 查询起始时间戳,格式 “YYYY-MM-DD HH:mm:ss” ,日志保留时间默认为7天,起始时间不能超出保留时间范围。
+ // 查询起始时间,形如2018-01-01 00:00:00。日志保留时间默认为7天,起始时间不能超出保留时间范围。
StartTime *string `json:"StartTime,omitnil,omitempty" name:"StartTime"`
- // 查询结束时间戳,格式 “YYYY-MM-DD HH:mm:ss”。
+ // 查询结束时间,形如2018-01-01 00:00:00。
EndTime *string `json:"EndTime,omitnil,omitempty" name:"EndTime"`
- // 根据数据库名进行筛选,可以为空。
+ // 数据库名字。
DatabaseName *string `json:"DatabaseName,omitnil,omitempty" name:"DatabaseName"`
- // 排序维度。 可选参数,取值范围[CallNum,CostTime,AvgCostTime]。默认CallNum。
+ // 排序字段,取值范围[CallNum,CostTime,AvgCostTime]。默认值为CallNum。
OrderBy *string `json:"OrderBy,omitnil,omitempty" name:"OrderBy"`
- // 排序类型。升序asc、降序desc。默认desc。
+ // 排序方式,包括升序:asc 降序:desc。默认值为desc。
OrderByType *string `json:"OrderByType,omitnil,omitempty" name:"OrderByType"`
- // 分页大小。取值范围[1,100]。默认50。
+ // 每页显示数量,取值范围为1-100。默认值为50。
Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"`
- // 分页偏移。取值范围[0,INF)。默认0。
+ // 数据偏移量,从0开始。默认值为0。
Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"`
}
@@ -5211,10 +5618,10 @@ func (r *DescribeSlowQueryAnalysisRequest) FromJsonString(s string) error {
// Predefined struct for user
type DescribeSlowQueryAnalysisResponseParams struct {
- // 查询总条数。
+ // 查询到的总条数,最大值为10000条。
TotalCount *int64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"`
- // 慢SQL统计分析接口返回详情。
+ // 查询到的慢SQL统计分析详细信息集合。
Detail *Detail `json:"Detail,omitnil,omitempty" name:"Detail"`
// 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
@@ -5242,25 +5649,25 @@ type DescribeSlowQueryListRequestParams struct {
// 实例ID。
DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
- // 查询起始时间戳,格式 “YYYY-MM-DD HH:mm:ss” ,日志保留时间默认为7天,起始时间不能超出保留时间范围。
+ // 查询起始时间,形如2018-01-01 00:00:00。日志保留时间默认为7天,起始时间不能超出保留时间范围。
StartTime *string `json:"StartTime,omitnil,omitempty" name:"StartTime"`
- // 查询结束时间戳,格式 “YYYY-MM-DD HH:mm:ss”。
+ // 查询结束时间,形如2018-01-01 00:00:00。
EndTime *string `json:"EndTime,omitnil,omitempty" name:"EndTime"`
- // 根据数据库名进行筛选,可以为空。
+ // 数据库名字。
DatabaseName *string `json:"DatabaseName,omitnil,omitempty" name:"DatabaseName"`
- // 排序类型。升序asc、降序desc。默认为desc。
+ // 排序方式,包括升序:asc 降序:desc。默认值为desc。
OrderByType *string `json:"OrderByType,omitnil,omitempty" name:"OrderByType"`
- // 排序维度。 可选参数,取值范围[SessionStartTime,Duration],默认为SessionStartTime。
+ // 排序字段,取值范围[SessionStartTime,Duration]。默认值为SessionStartTime。
OrderBy *string `json:"OrderBy,omitnil,omitempty" name:"OrderBy"`
- // 分页大小。取值范围[1,100],默认为20。
+ // 每页显示数量,取值范围为1-100。默认值为50。
Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"`
- // 分页偏移。取值范围[0,INF),默认为0。
+ // 数据偏移量,从0开始。默认值为0。
Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"`
}
@@ -5270,25 +5677,25 @@ type DescribeSlowQueryListRequest struct {
// 实例ID。
DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
- // 查询起始时间戳,格式 “YYYY-MM-DD HH:mm:ss” ,日志保留时间默认为7天,起始时间不能超出保留时间范围。
+ // 查询起始时间,形如2018-01-01 00:00:00。日志保留时间默认为7天,起始时间不能超出保留时间范围。
StartTime *string `json:"StartTime,omitnil,omitempty" name:"StartTime"`
- // 查询结束时间戳,格式 “YYYY-MM-DD HH:mm:ss”。
+ // 查询结束时间,形如2018-01-01 00:00:00。
EndTime *string `json:"EndTime,omitnil,omitempty" name:"EndTime"`
- // 根据数据库名进行筛选,可以为空。
+ // 数据库名字。
DatabaseName *string `json:"DatabaseName,omitnil,omitempty" name:"DatabaseName"`
- // 排序类型。升序asc、降序desc。默认为desc。
+ // 排序方式,包括升序:asc 降序:desc。默认值为desc。
OrderByType *string `json:"OrderByType,omitnil,omitempty" name:"OrderByType"`
- // 排序维度。 可选参数,取值范围[SessionStartTime,Duration],默认为SessionStartTime。
+ // 排序字段,取值范围[SessionStartTime,Duration]。默认值为SessionStartTime。
OrderBy *string `json:"OrderBy,omitnil,omitempty" name:"OrderBy"`
- // 分页大小。取值范围[1,100],默认为20。
+ // 每页显示数量,取值范围为1-100。默认值为50。
Limit *int64 `json:"Limit,omitnil,omitempty" name:"Limit"`
- // 分页偏移。取值范围[0,INF),默认为0。
+ // 数据偏移量,从0开始。默认值为0。
Offset *int64 `json:"Offset,omitnil,omitempty" name:"Offset"`
}
@@ -5320,14 +5727,14 @@ func (r *DescribeSlowQueryListRequest) FromJsonString(s string) error {
// Predefined struct for user
type DescribeSlowQueryListResponseParams struct {
- // 选定时间范围内慢SQL总条数。
+ // 查询到的慢日志数量,最大值为10000条。
TotalCount *int64 `json:"TotalCount,omitnil,omitempty" name:"TotalCount"`
- // 指定时间范围内,慢SQL耗时分段分析。
+ // 查询到的慢日志耗时分段分析结果。
// 注意:此字段可能返回 null,表示取不到有效值。
DurationAnalysis []*DurationAnalysis `json:"DurationAnalysis,omitnil,omitempty" name:"DurationAnalysis"`
- // 指定时间范围内 慢SQL流水。
+ // 查询到的慢日志详细信息集合。
// 注意:此字段可能返回 null,表示取不到有效值。
RawSlowQueryList []*RawSlowQuery `json:"RawSlowQueryList,omitnil,omitempty" name:"RawSlowQueryList"`
@@ -6083,6 +6490,67 @@ func (r *IsolateDBInstancesResponse) FromJsonString(s string) error {
return json.Unmarshal([]byte(s), &r)
}
+// Predefined struct for user
+type LockAccountRequestParams struct {
+ // 实例ID。
+ DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 账号名称。
+ UserName *string `json:"UserName,omitnil,omitempty" name:"UserName"`
+}
+
+type LockAccountRequest struct {
+ *tchttp.BaseRequest
+
+ // 实例ID。
+ DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 账号名称。
+ UserName *string `json:"UserName,omitnil,omitempty" name:"UserName"`
+}
+
+func (r *LockAccountRequest) ToJsonString() string {
+ b, _ := json.Marshal(r)
+ return string(b)
+}
+
+// FromJsonString It is highly **NOT** recommended to use this function
+// because it has no param check, nor strict type check
+func (r *LockAccountRequest) FromJsonString(s string) error {
+ f := make(map[string]interface{})
+ if err := json.Unmarshal([]byte(s), &f); err != nil {
+ return err
+ }
+ delete(f, "DBInstanceId")
+ delete(f, "UserName")
+ if len(f) > 0 {
+ return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "LockAccountRequest has unknown keys!", "")
+ }
+ return json.Unmarshal([]byte(s), &r)
+}
+
+// Predefined struct for user
+type LockAccountResponseParams struct {
+ // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
+ RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
+}
+
+type LockAccountResponse struct {
+ *tchttp.BaseResponse
+ Response *LockAccountResponseParams `json:"Response"`
+}
+
+func (r *LockAccountResponse) ToJsonString() string {
+ b, _ := json.Marshal(r)
+ return string(b)
+}
+
+// FromJsonString It is highly **NOT** recommended to use this function
+// because it has no param check, nor strict type check
+func (r *LockAccountResponse) FromJsonString(s string) error {
+ return json.Unmarshal([]byte(s), &r)
+}
+
type LogBackup struct {
// 实例ID。
DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
@@ -6115,6 +6583,74 @@ type LogBackup struct {
ExpireTime *string `json:"ExpireTime,omitnil,omitempty" name:"ExpireTime"`
}
+// Predefined struct for user
+type ModifyAccountPrivilegesRequestParams struct {
+ // 实例ID。
+ DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 修改此账号对某数据库对象的权限。
+ UserName *string `json:"UserName,omitnil,omitempty" name:"UserName"`
+
+ // 修改的权限信息,支持批量修改,一次最高修改50条。
+ ModifyPrivilegeSet []*ModifyPrivilege `json:"ModifyPrivilegeSet,omitnil,omitempty" name:"ModifyPrivilegeSet"`
+}
+
+type ModifyAccountPrivilegesRequest struct {
+ *tchttp.BaseRequest
+
+ // 实例ID。
+ DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 修改此账号对某数据库对象的权限。
+ UserName *string `json:"UserName,omitnil,omitempty" name:"UserName"`
+
+ // 修改的权限信息,支持批量修改,一次最高修改50条。
+ ModifyPrivilegeSet []*ModifyPrivilege `json:"ModifyPrivilegeSet,omitnil,omitempty" name:"ModifyPrivilegeSet"`
+}
+
+func (r *ModifyAccountPrivilegesRequest) ToJsonString() string {
+ b, _ := json.Marshal(r)
+ return string(b)
+}
+
+// FromJsonString It is highly **NOT** recommended to use this function
+// because it has no param check, nor strict type check
+func (r *ModifyAccountPrivilegesRequest) FromJsonString(s string) error {
+ f := make(map[string]interface{})
+ if err := json.Unmarshal([]byte(s), &f); err != nil {
+ return err
+ }
+ delete(f, "DBInstanceId")
+ delete(f, "UserName")
+ delete(f, "ModifyPrivilegeSet")
+ if len(f) > 0 {
+ return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyAccountPrivilegesRequest has unknown keys!", "")
+ }
+ return json.Unmarshal([]byte(s), &r)
+}
+
+// Predefined struct for user
+type ModifyAccountPrivilegesResponseParams struct {
+ // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
+ RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
+}
+
+type ModifyAccountPrivilegesResponse struct {
+ *tchttp.BaseResponse
+ Response *ModifyAccountPrivilegesResponseParams `json:"Response"`
+}
+
+func (r *ModifyAccountPrivilegesResponse) ToJsonString() string {
+ b, _ := json.Marshal(r)
+ return string(b)
+}
+
+// FromJsonString It is highly **NOT** recommended to use this function
+// because it has no param check, nor strict type check
+func (r *ModifyAccountPrivilegesResponse) FromJsonString(s string) error {
+ return json.Unmarshal([]byte(s), &r)
+}
+
// Predefined struct for user
type ModifyAccountRemarkRequestParams struct {
// 实例ID,形如postgres-4wdeb0zv
@@ -6539,9 +7075,9 @@ type ModifyDBInstanceDeploymentRequestParams struct {
DBNodeSet []*DBNode `json:"DBNodeSet,omitnil,omitempty" name:"DBNodeSet"`
// 指定实例配置完成变更后的切换时间。
- // 0:立即切换
- // 1:指定时间切换
- // 2:维护时间窗口内切换
+ // 0:立即切换
+ // 1:指定时间切换
+ // 2:维护时间窗口内切换
// 默认值:0
SwitchTag *int64 `json:"SwitchTag,omitnil,omitempty" name:"SwitchTag"`
@@ -6563,9 +7099,9 @@ type ModifyDBInstanceDeploymentRequest struct {
DBNodeSet []*DBNode `json:"DBNodeSet,omitnil,omitempty" name:"DBNodeSet"`
// 指定实例配置完成变更后的切换时间。
- // 0:立即切换
- // 1:指定时间切换
- // 2:维护时间窗口内切换
+ // 0:立即切换
+ // 1:指定时间切换
+ // 2:维护时间窗口内切换
// 默认值:0
SwitchTag *int64 `json:"SwitchTag,omitnil,omitempty" name:"SwitchTag"`
@@ -6797,20 +7333,20 @@ func (r *ModifyDBInstanceNameResponse) FromJsonString(s string) error {
// Predefined struct for user
type ModifyDBInstanceParametersRequestParams struct {
- // 实例ID
+ // 实例ID。
DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
- // 待修改参数及期望值
+ // 待修改参数及期望值。
ParamList []*ParamEntry `json:"ParamList,omitnil,omitempty" name:"ParamList"`
}
type ModifyDBInstanceParametersRequest struct {
*tchttp.BaseRequest
- // 实例ID
+ // 实例ID。
DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
- // 待修改参数及期望值
+ // 待修改参数及期望值。
ParamList []*ParamEntry `json:"ParamList,omitnil,omitempty" name:"ParamList"`
}
@@ -7280,6 +7816,20 @@ func (r *ModifyParameterTemplateResponse) FromJsonString(s string) error {
return json.Unmarshal([]byte(s), &r)
}
+type ModifyPrivilege struct {
+ // 要修改的数据库对象及权限列表
+ // 注意:此字段可能返回 null,表示取不到有效值。
+ DatabasePrivilege *DatabasePrivilege `json:"DatabasePrivilege,omitnil,omitempty" name:"DatabasePrivilege"`
+
+ // 修改的方式,当前仅支持grantObject、revokeObject、alterRole。grantObject代表授权、revokeObject代表收回权、alterRole代表修改账号类型。
+ // 注意:此字段可能返回 null,表示取不到有效值。
+ ModifyType *string `json:"ModifyType,omitnil,omitempty" name:"ModifyType"`
+
+ // 当ModifyType为revokeObject才需要此参数,参数为true时,撤销权限会级联撤销。默认为false。
+ // 注意:此字段可能返回 null,表示取不到有效值。
+ IsCascade *bool `json:"IsCascade,omitnil,omitempty" name:"IsCascade"`
+}
+
// Predefined struct for user
type ModifyReadOnlyGroupConfigRequestParams struct {
// 只读组ID
@@ -8279,6 +8829,81 @@ func (r *RestartDBInstanceResponse) FromJsonString(s string) error {
return json.Unmarshal([]byte(s), &r)
}
+// Predefined struct for user
+type RestoreDBInstanceObjectsRequestParams struct {
+ // 实例ID。
+ DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 需要恢复的对象列表。假设需要恢复的对象名为test,则恢复后的名称为test_bak_${LinuxTime}。${LinuxTime}无法指定,由系统根据任务发起的linux时间设定。
+ RestoreObjects []*string `json:"RestoreObjects,omitnil,omitempty" name:"RestoreObjects"`
+
+ // 恢复所用备份集。BackupSetId与RestoreTargetTime有且只能传一个。
+ BackupSetId *string `json:"BackupSetId,omitnil,omitempty" name:"BackupSetId"`
+
+ // 恢复目标时间,北京时间。BackupSetId与RestoreTargetTime有且只能传一个。
+ RestoreTargetTime *string `json:"RestoreTargetTime,omitnil,omitempty" name:"RestoreTargetTime"`
+}
+
+type RestoreDBInstanceObjectsRequest struct {
+ *tchttp.BaseRequest
+
+ // 实例ID。
+ DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 需要恢复的对象列表。假设需要恢复的对象名为test,则恢复后的名称为test_bak_${LinuxTime}。${LinuxTime}无法指定,由系统根据任务发起的linux时间设定。
+ RestoreObjects []*string `json:"RestoreObjects,omitnil,omitempty" name:"RestoreObjects"`
+
+ // 恢复所用备份集。BackupSetId与RestoreTargetTime有且只能传一个。
+ BackupSetId *string `json:"BackupSetId,omitnil,omitempty" name:"BackupSetId"`
+
+ // 恢复目标时间,北京时间。BackupSetId与RestoreTargetTime有且只能传一个。
+ RestoreTargetTime *string `json:"RestoreTargetTime,omitnil,omitempty" name:"RestoreTargetTime"`
+}
+
+func (r *RestoreDBInstanceObjectsRequest) ToJsonString() string {
+ b, _ := json.Marshal(r)
+ return string(b)
+}
+
+// FromJsonString It is highly **NOT** recommended to use this function
+// because it has no param check, nor strict type check
+func (r *RestoreDBInstanceObjectsRequest) FromJsonString(s string) error {
+ f := make(map[string]interface{})
+ if err := json.Unmarshal([]byte(s), &f); err != nil {
+ return err
+ }
+ delete(f, "DBInstanceId")
+ delete(f, "RestoreObjects")
+ delete(f, "BackupSetId")
+ delete(f, "RestoreTargetTime")
+ if len(f) > 0 {
+ return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "RestoreDBInstanceObjectsRequest has unknown keys!", "")
+ }
+ return json.Unmarshal([]byte(s), &r)
+}
+
+// Predefined struct for user
+type RestoreDBInstanceObjectsResponseParams struct {
+ // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
+ RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
+}
+
+type RestoreDBInstanceObjectsResponse struct {
+ *tchttp.BaseResponse
+ Response *RestoreDBInstanceObjectsResponseParams `json:"Response"`
+}
+
+func (r *RestoreDBInstanceObjectsResponse) ToJsonString() string {
+ b, _ := json.Marshal(r)
+ return string(b)
+}
+
+// FromJsonString It is highly **NOT** recommended to use this function
+// because it has no param check, nor strict type check
+func (r *RestoreDBInstanceObjectsResponse) FromJsonString(s string) error {
+ return json.Unmarshal([]byte(s), &r)
+}
+
type SecurityGroup struct {
// 项目Id
ProjectId *int64 `json:"ProjectId,omitnil,omitempty" name:"ProjectId"`
@@ -8642,6 +9267,67 @@ type Tag struct {
TagValue *string `json:"TagValue,omitnil,omitempty" name:"TagValue"`
}
+// Predefined struct for user
+type UnlockAccountRequestParams struct {
+ // 实例ID。
+ DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 账号名称。
+ UserName *string `json:"UserName,omitnil,omitempty" name:"UserName"`
+}
+
+type UnlockAccountRequest struct {
+ *tchttp.BaseRequest
+
+ // 实例ID。
+ DBInstanceId *string `json:"DBInstanceId,omitnil,omitempty" name:"DBInstanceId"`
+
+ // 账号名称。
+ UserName *string `json:"UserName,omitnil,omitempty" name:"UserName"`
+}
+
+func (r *UnlockAccountRequest) ToJsonString() string {
+ b, _ := json.Marshal(r)
+ return string(b)
+}
+
+// FromJsonString It is highly **NOT** recommended to use this function
+// because it has no param check, nor strict type check
+func (r *UnlockAccountRequest) FromJsonString(s string) error {
+ f := make(map[string]interface{})
+ if err := json.Unmarshal([]byte(s), &f); err != nil {
+ return err
+ }
+ delete(f, "DBInstanceId")
+ delete(f, "UserName")
+ if len(f) > 0 {
+ return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "UnlockAccountRequest has unknown keys!", "")
+ }
+ return json.Unmarshal([]byte(s), &r)
+}
+
+// Predefined struct for user
+type UnlockAccountResponseParams struct {
+ // 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。
+ RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
+}
+
+type UnlockAccountResponse struct {
+ *tchttp.BaseResponse
+ Response *UnlockAccountResponseParams `json:"Response"`
+}
+
+func (r *UnlockAccountResponse) ToJsonString() string {
+ b, _ := json.Marshal(r)
+ return string(b)
+}
+
+// FromJsonString It is highly **NOT** recommended to use this function
+// because it has no param check, nor strict type check
+func (r *UnlockAccountResponse) FromJsonString(s string) error {
+ return json.Unmarshal([]byte(s), &r)
+}
+
// Predefined struct for user
type UpgradeDBInstanceKernelVersionRequestParams struct {
// 实例ID。
@@ -9023,7 +9709,7 @@ type Version struct {
// DEPRECATED:已弃用。
Status *string `json:"Status,omitnil,omitempty" name:"Status"`
- // 该数据库版本(DBKernelVersion)可以升级到的版本号列表。
+ // 该数据库版本(DBKernelVersion)可以升级到的版本号列表。其中包含可升级的小版本号和可升级的大版本号(完整内核版本格式示例:v15.1_v1.6)。
AvailableUpgradeTarget []*string `json:"AvailableUpgradeTarget,omitnil,omitempty" name:"AvailableUpgradeTarget"`
}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 6b9215db46..46d8669b54 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1163,7 +1163,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit/v20190319
# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.970
## explicit; go 1.14
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls/v20201016
-# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.993
+# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.995
## explicit; go 1.11
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors
@@ -1252,7 +1252,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/oceanus/v20190422
# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization v1.0.991
## explicit; go 1.14
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization/v20210331
-# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres v1.0.873
+# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres v1.0.995
## explicit; go 1.14
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres/v20170312
# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/privatedns v1.0.859
diff --git a/website/docs/d/postgresql_account_privileges.html.markdown b/website/docs/d/postgresql_account_privileges.html.markdown
new file mode 100644
index 0000000000..17254a0d6c
--- /dev/null
+++ b/website/docs/d/postgresql_account_privileges.html.markdown
@@ -0,0 +1,57 @@
+---
+subcategory: "TencentDB for PostgreSQL(PostgreSQL)"
+layout: "tencentcloud"
+page_title: "TencentCloud: tencentcloud_postgresql_account_privileges"
+sidebar_current: "docs-tencentcloud-datasource-postgresql_account_privileges"
+description: |-
+ Use this data source to query detailed information of postgresql account privileges
+---
+
+# tencentcloud_postgresql_account_privileges
+
+Use this data source to query detailed information of postgresql account privileges
+
+## Example Usage
+
+```hcl
+data "tencentcloud_postgresql_account_privileges" "example" {
+ db_instance_id = "postgres-3hk6b6tj"
+ user_name = "tf_example"
+ database_object_set {
+ object_name = "postgres"
+ object_type = "database"
+ }
+}
+```
+
+## Argument Reference
+
+The following arguments are supported:
+
+* `database_object_set` - (Required, List) Instance database object info.
+* `db_instance_id` - (Required, String) Instance ID.
+* `user_name` - (Required, String) Instance username.
+* `result_output_file` - (Optional, String) Used to save results.
+
+The `database_object_set` object supports the following:
+
+* `object_name` - (Required, String) Database object Name.Note: This field may return null, indicating that no valid value can be obtained.
+* `object_type` - (Required, String) Supported database object types: account, database, schema, sequence, procedure, type, function, table, view, matview, column. Note: This field may return null, indicating that no valid value can be obtained.
+* `database_name` - (Optional, String) Database name to which the database object belongs. This parameter is mandatory when ObjectType is not database.Note: This field may return null, indicating that no valid value can be obtained.
+* `schema_name` - (Optional, String) Schema name to which the database object belongs. This parameter is mandatory when ObjectType is not database or schema.Note: This field may return null, indicating that no valid value can be obtained.
+* `table_name` - (Optional, String) Table name to which the database object belongs. This parameter is mandatory when ObjectType is column.Note: This field may return null, indicating that no valid value can be obtained.
+
+## Attributes Reference
+
+In addition to all arguments above, the following attributes are exported:
+
+* `privilege_set` - Privilege list.
+ * `object` - Database object.If ObjectType is database, DatabaseName/SchemaName/TableName can be null.If ObjectType is schema, SchemaName/TableName can be null.If ObjectType is table, TableName can be null.If ObjectType is column, DatabaseName/SchemaName/TableName can't be null.In all other cases, DatabaseName/SchemaName/TableName can be null. Note: This field may return null, indicating that no valid value can be obtained.
+ * `database_name` - Database name to which the database object belongs. This parameter is mandatory when ObjectType is not database. Note: This field may return null, indicating that no valid value can be obtained.
+ * `object_name` - Database object Name. Note: This field may return null, indicating that no valid value can be obtained.
+ * `object_type` - Supported database object types: account, database, schema, sequence, procedure, type, function, table, view, matview, column. Note: This field may return null, indicating that no valid value can be obtained.
+ * `schema_name` - Schema name to which the database object belongs. This parameter is mandatory when ObjectType is not database or schema. Note: This field may return null, indicating that no valid value can be obtained.
+ * `table_name` - Table name to which the database object belongs. This parameter is mandatory when ObjectType is column. Note: This field may return null, indicating that no valid value can be obtained.
+ * `privilege_set` - Privileges the specific account has on database object. Note: This field may return null, indicating that no valid value can be obtained.
+
+
diff --git a/website/docs/r/postgresql_account.html.markdown b/website/docs/r/postgresql_account.html.markdown
new file mode 100644
index 0000000000..5ab952d393
--- /dev/null
+++ b/website/docs/r/postgresql_account.html.markdown
@@ -0,0 +1,95 @@
+---
+subcategory: "TencentDB for PostgreSQL(PostgreSQL)"
+layout: "tencentcloud"
+page_title: "TencentCloud: tencentcloud_postgresql_account"
+sidebar_current: "docs-tencentcloud-resource-postgresql_account"
+description: |-
+ Provides a resource to create a postgresql account
+---
+
+# tencentcloud_postgresql_account
+
+Provides a resource to create a postgresql account
+
+## Example Usage
+
+```hcl
+variable "availability_zone" {
+ default = "ap-guangzhou-3"
+}
+
+# create vpc
+resource "tencentcloud_vpc" "vpc" {
+ name = "vpc"
+ cidr_block = "10.0.0.0/16"
+}
+
+# create vpc subnet
+resource "tencentcloud_subnet" "subnet" {
+ availability_zone = var.availability_zone
+ name = "subnet"
+ vpc_id = tencentcloud_vpc.vpc.id
+ cidr_block = "10.0.20.0/28"
+ is_multicast = false
+}
+
+# create postgresql
+resource "tencentcloud_postgresql_instance" "example" {
+ name = "example"
+ availability_zone = var.availability_zone
+ charge_type = "POSTPAID_BY_HOUR"
+ vpc_id = tencentcloud_vpc.vpc.id
+ subnet_id = tencentcloud_subnet.subnet.id
+ db_major_version = "10"
+ engine_version = "10.23"
+ root_user = "root123"
+ root_password = "Root123$"
+ charset = "UTF8"
+ project_id = 0
+ cpu = 1
+ memory = 2
+ storage = 10
+
+ tags = {
+ test = "tf"
+ }
+}
+
+# create account
+resource "tencentcloud_postgresql_account" "example" {
+ db_instance_id = tencentcloud_postgresql_instance.example.id
+ user_name = "tf_example"
+ password = "Password@123"
+ type = "normal"
+ remark = "remark"
+ lock_status = false
+}
+```
+
+## Argument Reference
+
+The following arguments are supported:
+
+* `db_instance_id` - (Required, String, ForceNew) Instance ID in the format of postgres-4wdeb0zv.
+* `password` - (Required, String) Password, which can contain 8-32 letters, digits, and symbols (()`~!@#$%^&amp;*-+=_|{}[]:;&#39;&lt;&gt;,.?/); can&#39;t start with slash /.
+* `type` - (Required, String, ForceNew) The type of user. Valid values: 1. normal: regular user; 2. tencentDBSuper: user with the pg_tencentdb_superuser role.
+* `user_name` - (Required, String, ForceNew) Instance username, which can contain 1-16 letters, digits, and underscore (_); can&#39;t be postgres; can&#39;t start with numbers, pg_, and tencentdb_.
+* `lock_status` - (Optional, Bool) whether lock account. true: locked; false: unlock.
+* `remark` - (Optional, String) Remarks correspond to user `UserName`, which can contain 0-60 letters, digits, symbols (-_), and Chinese characters.
+
+## Attributes Reference
+
+In addition to all arguments above, the following attributes are exported:
+
+* `id` - ID of the resource.
+
+
+
+## Import
+
+postgres account can be imported using the id, e.g.
+
+```
+terraform import tencentcloud_postgresql_account.example postgres-3hk6b6tj#tf_example
+```
+
diff --git a/website/docs/r/postgresql_account_privileges_operation.html.markdown b/website/docs/r/postgresql_account_privileges_operation.html.markdown
new file mode 100644
index 0000000000..7f40d2fdf5
--- /dev/null
+++ b/website/docs/r/postgresql_account_privileges_operation.html.markdown
@@ -0,0 +1,122 @@
+---
+subcategory: "TencentDB for PostgreSQL(PostgreSQL)"
+layout: "tencentcloud"
+page_title: "TencentCloud: tencentcloud_postgresql_account_privileges_operation"
+sidebar_current: "docs-tencentcloud-resource-postgresql_account_privileges_operation"
+description: |-
+ Provides a resource to create postgresql account privileges
+---
+
+# tencentcloud_postgresql_account_privileges_operation
+
+Provides a resource to create postgresql account privileges
+
+## Example Usage
+
+```hcl
+variable "availability_zone" {
+ default = "ap-guangzhou-3"
+}
+
+# create vpc
+resource "tencentcloud_vpc" "vpc" {
+ name = "vpc"
+ cidr_block = "10.0.0.0/16"
+}
+
+# create vpc subnet
+resource "tencentcloud_subnet" "subnet" {
+ availability_zone = var.availability_zone
+ name = "subnet"
+ vpc_id = tencentcloud_vpc.vpc.id
+ cidr_block = "10.0.20.0/28"
+ is_multicast = false
+}
+
+# create postgresql
+resource "tencentcloud_postgresql_instance" "example" {
+ name = "example"
+ availability_zone = var.availability_zone
+ charge_type = "POSTPAID_BY_HOUR"
+ vpc_id = tencentcloud_vpc.vpc.id
+ subnet_id = tencentcloud_subnet.subnet.id
+ db_major_version = "10"
+ engine_version = "10.23"
+ root_user = "root123"
+ root_password = "Root123$"
+ charset = "UTF8"
+ project_id = 0
+ cpu = 1
+ memory = 2
+ storage = 10
+
+ tags = {
+ test = "tf"
+ }
+}
+
+# create account
+resource "tencentcloud_postgresql_account" "example" {
+ db_instance_id = tencentcloud_postgresql_instance.example.id
+ user_name = "tf_example"
+ password = "Password@123"
+ type = "normal"
+ remark = "remark"
+ lock_status = false
+}
+
+# create account privileges
+resource "tencentcloud_postgresql_account_privileges_operation" "example" {
+ db_instance_id = tencentcloud_postgresql_instance.example.id
+ user_name = tencentcloud_postgresql_account.example.user_name
+ modify_privilege_set {
+ database_privilege {
+ object {
+ object_name = "postgres"
+ object_type = "database"
+ }
+
+ privilege_set = ["CONNECT", "TEMPORARY", "CREATE"]
+ }
+
+ modify_type = "grantObject"
+ is_cascade = false
+ }
+}
+```
+
+## Argument Reference
+
+The following arguments are supported:
+
+* `db_instance_id` - (Required, String, ForceNew) Instance ID in the format of postgres-4wdeb0zv.
+* `modify_privilege_set` - (Required, List) Privileges to modify. Batch modification supported, up to 50 entries at a time.
+* `user_name` - (Required, String, ForceNew) Instance username.
+
+The `database_privilege` object of `modify_privilege_set` supports the following:
+
+* `object` - (Optional, List) Database object.If ObjectType is database, DatabaseName/SchemaName/TableName can be null.If ObjectType is schema, SchemaName/TableName can be null.If ObjectType is table, TableName can be null.If ObjectType is column, DatabaseName/SchemaName/TableName can't be null.In all other cases, DatabaseName/SchemaName/TableName can be null. Note: This field may return null, indicating that no valid value can be obtained.
+* `privilege_set` - (Optional, Set) Privileges the specific account has on database object. Note: This field may return null, indicating that no valid value can be obtained.
+
+The `modify_privilege_set` object supports the following:
+
+* `database_privilege` - (Optional, List) Database objects and the user permissions on these objects. Note: This field may return null, indicating that no valid value can be obtained.
+* `is_cascade` - (Optional, Bool) Required only when ModifyType is revokeObject. When the parameter is true, revoking permissions will cascade. The default value is false.
+* `modify_type` - (Optional, String) Supported modification method: grantObject, revokeObject, alterRole. grantObject represents granting permissions on object, revokeObject represents revoking permissions on object, and alterRole represents modifying the account type.
+
+The `object` object of `database_privilege` supports the following:
+
+* `object_name` - (Required, String) Database object Name. Note: This field may return null, indicating that no valid value can be obtained.
+* `object_type` - (Required, String) Supported database object types: account, database, schema, sequence, procedure, type, function, table, view, matview, column. Note: This field may return null, indicating that no valid value can be obtained.
+* `database_name` - (Optional, String) Database name to which the database object belongs. This parameter is mandatory when ObjectType is not database. Note: This field may return null, indicating that no valid value can be obtained.
+* `schema_name` - (Optional, String) Schema name to which the database object belongs. This parameter is mandatory when ObjectType is not database or schema. Note: This field may return null, indicating that no valid value can be obtained.
+* `table_name` - (Optional, String) Table name to which the database object belongs. This parameter is mandatory when ObjectType is column. Note: This field may return null, indicating that no valid value can be obtained.
+
+## Attributes Reference
+
+In addition to all arguments above, the following attributes are exported:
+
+* `id` - ID of the resource.
+
+
+
diff --git a/website/tencentcloud.erb b/website/tencentcloud.erb
index afdad8772e..67207d30a3 100644
--- a/website/tencentcloud.erb
+++ b/website/tencentcloud.erb
@@ -5734,6 +5734,9 @@
Data Sources