From 9b3ba2be85dcd93abb13d4b93dc33d89e6868432 Mon Sep 17 00:00:00 2001 From: SevenEarth <391613297@qq.com> Date: Thu, 6 Mar 2025 17:52:38 +0800 Subject: [PATCH 1/7] add --- .../resource_tc_sqlserver_instance.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tencentcloud/services/sqlserver/resource_tc_sqlserver_instance.go b/tencentcloud/services/sqlserver/resource_tc_sqlserver_instance.go index cf105d4b22..fc9ebe42d4 100644 --- a/tencentcloud/services/sqlserver/resource_tc_sqlserver_instance.go +++ b/tencentcloud/services/sqlserver/resource_tc_sqlserver_instance.go @@ -124,6 +124,16 @@ func TencentSqlServerBasicInfo(isROInstance bool) map[string]*schema.Schema { Deprecated: "It has been deprecated from version 1.81.2.", Description: "The way to execute the allocation. Supported values include: 0 - execute immediately, 1 - execute in maintenance window.", }, + "dns_pod_domain": { + Type: schema.TypeString, + Computed: true, + Description: "Internet address domain name.", + }, + "tgw_wan_vport": { + Type: schema.TypeInt, + Computed: true, + Description: "External port number.", + }, } if !isROInstance { @@ -616,6 +626,14 @@ func tencentSqlServerBasicInfoRead(ctx context.Context, d *schema.ResourceData, _ = d.Set("charge_type", svcpostgresql.COMMON_PAYTYPE_POSTPAID) } + if instance.DnsPodDomain != nil { + _ = d.Set("dns_pod_domain", instance.DnsPodDomain) + } + + if instance.TgwWanVPort != nil { + _ = d.Set("tgw_wan_vport", instance.TgwWanVPort) + } + var securityGroup []string outErr = resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { securityGroup, inErr = sqlserverService.DescribeInstanceSecurityGroups(ctx, instanceId) From 8cbd1c49891f90d816cdc3e93c8ea6eb37f48663 Mon Sep 17 00:00:00 2001 From: SevenEarth <391613297@qq.com> Date: Tue, 11 Mar 2025 15:32:36 +0800 Subject: [PATCH 2/7] add --- tencentcloud/provider.go | 1 + .../resource_tc_sqlserver_basic_instance.go | 17 + ...rce_tc_sqlserver_general_cloud_instance.go | 18 + .../resource_tc_sqlserver_wan_ip_config.go | 208 ++++++ .../resource_tc_sqlserver_wan_ip_config.md | 37 ++ ...esource_tc_sqlserver_wan_ip_config_test.go | 33 + .../tencentcloud/sts/v20180813/client.go | 626 +++++++++--------- .../r/sqlserver_basic_instance.html.markdown | 2 + ...erver_general_cloud_instance.html.markdown | 3 +- .../docs/r/sqlserver_instance.html.markdown | 2 + .../sqlserver_readonly_instance.html.markdown | 2 + 11 files changed, 638 insertions(+), 311 deletions(-) create mode 100644 tencentcloud/services/sqlserver/resource_tc_sqlserver_wan_ip_config.go create mode 100644 tencentcloud/services/sqlserver/resource_tc_sqlserver_wan_ip_config.md create mode 100644 tencentcloud/services/sqlserver/resource_tc_sqlserver_wan_ip_config_test.go diff --git a/tencentcloud/provider.go b/tencentcloud/provider.go index 39b4db63d1..4cd8c8e17d 100644 --- a/tencentcloud/provider.go +++ b/tencentcloud/provider.go @@ -1669,6 +1669,7 @@ func Provider() *schema.Provider { "tencentcloud_sqlserver_database_tde": sqlserver.ResourceTencentCloudSqlserverDatabaseTDE(), "tencentcloud_sqlserver_general_cloud_ro_instance": sqlserver.ResourceTencentCloudSqlserverGeneralCloudRoInstance(), "tencentcloud_sqlserver_instance_ssl": sqlserver.ResourceTencentCloudSqlserverInstanceSsl(), + "tencentcloud_sqlserver_wan_ip_config": sqlserver.ResourceTencentCloudSqlserverWanIpConfig(), "tencentcloud_tcr_instance": tcr.ResourceTencentCloudTcrInstance(), "tencentcloud_tcr_namespace": tcr.ResourceTencentCloudTcrNamespace(), "tencentcloud_tcr_repository": tcr.ResourceTencentCloudTcrRepository(), diff --git a/tencentcloud/services/sqlserver/resource_tc_sqlserver_basic_instance.go b/tencentcloud/services/sqlserver/resource_tc_sqlserver_basic_instance.go index 2c34bf88bb..1c0e4e31e1 100644 --- a/tencentcloud/services/sqlserver/resource_tc_sqlserver_basic_instance.go +++ b/tencentcloud/services/sqlserver/resource_tc_sqlserver_basic_instance.go @@ -177,6 +177,16 @@ func ResourceTencentCloudSqlserverBasicInstance() *schema.Resource { Optional: true, Description: "The tags of the SQL Server basic instance.", }, + "dns_pod_domain": { + Type: schema.TypeString, + Computed: true, + Description: "Internet address domain name.", + }, + "tgw_wan_vport": { + Type: schema.TypeInt, + Computed: true, + Description: "External port number.", + }, }, } } @@ -333,6 +343,13 @@ func resourceTencentCloudSqlserverBasicInstanceRead(d *schema.ResourceData, meta _ = d.Set("storage", instance.Storage) _ = d.Set("vip", instance.Vip) _ = d.Set("vport", instance.Vport) + if instance.DnsPodDomain != nil { + _ = d.Set("dns_pod_domain", instance.DnsPodDomain) + } + + if instance.TgwWanVPort != nil { + _ = d.Set("tgw_wan_vport", instance.TgwWanVPort) + } //maintanence var weekSet []int diff --git a/tencentcloud/services/sqlserver/resource_tc_sqlserver_general_cloud_instance.go b/tencentcloud/services/sqlserver/resource_tc_sqlserver_general_cloud_instance.go index 11848d6546..11f2005604 100644 --- a/tencentcloud/services/sqlserver/resource_tc_sqlserver_general_cloud_instance.go +++ b/tencentcloud/services/sqlserver/resource_tc_sqlserver_general_cloud_instance.go @@ -150,6 +150,16 @@ func ResourceTencentCloudSqlserverGeneralCloudInstance() *schema.Resource { Deprecated: "It has been deprecated from version 1.81.2.", Description: "Upgrade the high-availability architecture of sqlserver, upgrade from mirror disaster recovery to always on cluster disaster recovery, only support 2017 and above and support always on high-availability instances, do not support downgrading to mirror disaster recovery, CLUSTER-upgrade to always on capacity Disaster, if not filled, the high-availability architecture will not be modified.", }, + "dns_pod_domain": { + Type: schema.TypeString, + Computed: true, + Description: "Internet address domain name.", + }, + "tgw_wan_vport": { + Type: schema.TypeInt, + Computed: true, + Description: "External port number.", + }, }, } } @@ -412,6 +422,14 @@ func resourceTencentCloudSqlserverGeneralCloudInstanceRead(d *schema.ResourceDat _ = d.Set("time_zone", generalCloudInstance.TimeZone) } + if generalCloudInstance.DnsPodDomain != nil { + _ = d.Set("dns_pod_domain", generalCloudInstance.DnsPodDomain) + } + + if generalCloudInstance.TgwWanVPort != nil { + _ = d.Set("tgw_wan_vport", generalCloudInstance.TgwWanVPort) + } + maintenanceSpan, err := service.DescribeMaintenanceSpanById(ctx, instanceId) if err != nil { return err diff --git a/tencentcloud/services/sqlserver/resource_tc_sqlserver_wan_ip_config.go b/tencentcloud/services/sqlserver/resource_tc_sqlserver_wan_ip_config.go new file mode 100644 index 0000000000..395354bb1f --- /dev/null +++ b/tencentcloud/services/sqlserver/resource_tc_sqlserver_wan_ip_config.go @@ -0,0 +1,208 @@ +package sqlserver + +import ( + "context" + "fmt" + "log" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + sqlserver "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sqlserver/v20180328" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func ResourceTencentCloudSqlserverWanIpConfig() *schema.Resource { + return &schema.Resource{ + Create: resourceTencentCloudSqlserverWanIpConfigCreate, + Read: resourceTencentCloudSqlserverWanIpConfigRead, + Update: resourceTencentCloudSqlserverWanIpConfigUpdate, + Delete: resourceTencentCloudSqlserverWanIpConfigDelete, + Schema: map[string]*schema.Schema{ + "instance_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Instance ID.", + }, + + "ro_group_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: "Read only group ID.", + }, + + "enable_wan_ip": { + Type: schema.TypeBool, + Required: true, + Description: "Whether to open wan ip, true: enable; false: disable.", + }, + }, + } +} + +func resourceTencentCloudSqlserverWanIpConfigCreate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_sqlserver_wan_ip_config.create")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + instanceId string + roGroupId string + ) + + if v, ok := d.GetOk("instance_id"); ok { + instanceId = v.(string) + } + + if v, ok := d.GetOk("ro_group_id"); ok { + roGroupId = v.(string) + } + + if roGroupId != "" { + d.SetId(strings.Join([]string{instanceId, roGroupId}, tccommon.FILED_SP)) + } else { + d.SetId(instanceId) + } + + return resourceTencentCloudSqlserverWanIpConfigUpdate(d, meta) +} + +func resourceTencentCloudSqlserverWanIpConfigRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_sqlserver_wan_ip_config.read")() + defer tccommon.InconsistentCheck(d, meta)() + + return nil +} + +func resourceTencentCloudSqlserverWanIpConfigUpdate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_sqlserver_wan_ip_config.update")() + defer tccommon.InconsistentCheck(d, meta)() + + var ( + logId = tccommon.GetLogId(tccommon.ContextNil) + ctx = tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + instanceId string + roGroupId string + enableWanIp bool + flowId uint64 + ) + + idSplit := strings.Split(d.Id(), tccommon.FILED_SP) + if len(idSplit) == 1 { + instanceId = idSplit[0] + } else if len(idSplit) == 2 { + instanceId = idSplit[0] + roGroupId = idSplit[1] + } else { + return fmt.Errorf("tencentcloud_sqlserver_wan_ip_config id is broken, id is %s", d.Id()) + } + + if v, ok := d.GetOkExists("enable_wan_ip"); ok { + enableWanIp = v.(bool) + } + + if enableWanIp { + request := sqlserver.NewModifyOpenWanIpRequest() + response := sqlserver.NewModifyOpenWanIpResponse() + request.InstanceId = &instanceId + if roGroupId != "" { + request.RoGroupId = &roGroupId + } + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseSqlserverClient().ModifyOpenWanIpWithContext(ctx, 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()) + } + + if result == nil || result.Response == nil { + return resource.NonRetryableError(fmt.Errorf("Open sqlserver wan ip failed, Response is nil.")) + } + + response = result + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s open sqlserver wan ip failed, reason:%+v", logId, err) + return err + } + + if response.Response.FlowId == nil { + return fmt.Errorf("FlowId is nil.") + } + + flowId = *response.Response.FlowId + } else { + request := sqlserver.NewModifyCloseWanIpRequest() + response := sqlserver.NewModifyCloseWanIpResponse() + request.InstanceId = &instanceId + if roGroupId != "" { + request.RoGroupId = &roGroupId + } + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseSqlserverClient().ModifyCloseWanIpWithContext(ctx, 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()) + } + + if result == nil || result.Response == nil { + return resource.NonRetryableError(fmt.Errorf("Close sqlserver wan ip failed, Response is nil.")) + } + + response = result + return nil + }) + + if err != nil { + log.Printf("[CRITAL]%s close sqlserver wan ip failed, reason:%+v", logId, err) + return err + } + + if response.Response.FlowId == nil { + return fmt.Errorf("FlowId is nil.") + } + + flowId = *response.Response.FlowId + } + + // wait + flowRequest := sqlserver.NewDescribeFlowStatusRequest() + flowRequest.FlowId = helper.UInt64Int64(flowId) + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseSqlserverClient().DescribeFlowStatus(flowRequest) + if e != nil { + return tccommon.RetryError(e) + } + + if result == nil || result.Response == nil || result.Response.Status == nil { + return resource.NonRetryableError(fmt.Errorf("Describe FlowStatus failed, Response is nil.")) + } + + if *result.Response.Status == SQLSERVER_TASK_SUCCESS { + return nil + } + + return resource.RetryableError(fmt.Errorf("Operate sqlserver wan ip status is %d.", *result.Response.Status)) + }) + + if err != nil { + log.Printf("[CRITAL]%s operate sqlserver wan ip failed, reason:%+v", logId, err) + return err + } + + return resourceTencentCloudSqlserverWanIpConfigRead(d, meta) +} + +func resourceTencentCloudSqlserverWanIpConfigDelete(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_sqlserver_wan_ip_config.delete")() + defer tccommon.InconsistentCheck(d, meta)() + + return nil +} diff --git a/tencentcloud/services/sqlserver/resource_tc_sqlserver_wan_ip_config.md b/tencentcloud/services/sqlserver/resource_tc_sqlserver_wan_ip_config.md new file mode 100644 index 0000000000..ed843400e8 --- /dev/null +++ b/tencentcloud/services/sqlserver/resource_tc_sqlserver_wan_ip_config.md @@ -0,0 +1,37 @@ +Provides a resource to create a sqlserver wan ip config + +Example Usage + +Open/Close wan ip for SQL instance + +```hcl +# open +resource "tencentcloud_sqlserver_wan_ip_config" "example" { + instance_id = "mssql-gy1lc54f" + enable_wan_ip = true +} + +# close +resource "tencentcloud_sqlserver_wan_ip_config" "example" { + instance_id = "mssql-gy1lc54f" + enable_wan_ip = false +} +``` + +Open/Close wan ip for SQL read only group + +```hcl +# open +resource "tencentcloud_sqlserver_wan_ip_config" "example" { + instance_id = "mssql-gy1lc54f" + ro_group_id = "mssqlrg-hyxotm31" + enable_wan_ip = true +} + +# close +resource "tencentcloud_sqlserver_wan_ip_config" "example" { + instance_id = "mssql-gy1lc54f" + ro_group_id = "mssqlrg-hyxotm31" + enable_wan_ip = false +} +``` diff --git a/tencentcloud/services/sqlserver/resource_tc_sqlserver_wan_ip_config_test.go b/tencentcloud/services/sqlserver/resource_tc_sqlserver_wan_ip_config_test.go new file mode 100644 index 0000000000..0e94ec929b --- /dev/null +++ b/tencentcloud/services/sqlserver/resource_tc_sqlserver_wan_ip_config_test.go @@ -0,0 +1,33 @@ +package sqlserver_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudSqlserverWanIpConfigResource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{{ + Config: testAccSqlserverWanIpConfig, + Check: resource.ComposeTestCheckFunc(resource.TestCheckResourceAttrSet("tencentcloud_sqlserver_wan_ip_config.sqlserver_wan_ip_config", "id")), + }, { + ResourceName: "tencentcloud_sqlserver_wan_ip_config.sqlserver_wan_ip_config", + ImportState: true, + ImportStateVerify: true, + }}, + }) +} + +const testAccSqlserverWanIpConfig = ` + +resource "tencentcloud_sqlserver_wan_ip_config" "sqlserver_wan_ip_config" { +} +` diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sts/v20180813/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sts/v20180813/client.go index c197144ac9..1ce52c513d 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sts/v20180813/client.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sts/v20180813/client.go @@ -15,282 +15,284 @@ package v20180813 import ( - "context" - "errors" - "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" - tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http" - "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile" + "context" + "errors" + + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common" + tchttp "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http" + "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile" ) const APIVersion = "2018-08-13" type Client struct { - common.Client + common.Client } // Deprecated func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error) { - cpf := profile.NewClientProfile() - client = &Client{} - client.Init(region).WithSecretId(secretId, secretKey).WithProfile(cpf) - return + cpf := profile.NewClientProfile() + client = &Client{} + client.Init(region).WithSecretId(secretId, secretKey).WithProfile(cpf) + return } func NewClient(credential common.CredentialIface, region string, clientProfile *profile.ClientProfile) (client *Client, err error) { - client = &Client{} - client.Init(region). - WithCredential(credential). - WithProfile(clientProfile) - return + client = &Client{} + client.Init(region). + WithCredential(credential). + WithProfile(clientProfile) + return } - func NewAssumeRoleRequest() (request *AssumeRoleRequest) { - request = &AssumeRoleRequest{ - BaseRequest: &tchttp.BaseRequest{}, - } - - request.Init().WithApiInfo("sts", APIVersion, "AssumeRole") - - - return + request = &AssumeRoleRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("sts", APIVersion, "AssumeRole") + + return } func NewAssumeRoleResponse() (response *AssumeRoleResponse) { - response = &AssumeRoleResponse{ - BaseResponse: &tchttp.BaseResponse{}, - } - return + response = &AssumeRoleResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return } // AssumeRole // 申请扮演角色 // // 可能返回的错误码: -// INTERNALERROR_DBERROR = "InternalError.DbError" -// INTERNALERROR_ENCRYPTERROR = "InternalError.EncryptError" -// INTERNALERROR_GETAPPIDERROR = "InternalError.GetAppIdError" -// INTERNALERROR_GETROLEERROR = "InternalError.GetRoleError" -// INTERNALERROR_GETSEEDTOKENERROR = "InternalError.GetSeedTokenError" -// INTERNALERROR_ILLEGALROLE = "InternalError.IllegalRole" -// INTERNALERROR_PBSERIALIZEERROR = "InternalError.PbSerializeError" -// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" -// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError" -// INVALIDPARAMETER_ACCOUNTNOTAVALIABLE = "InvalidParameter.AccountNotAvaliable" -// INVALIDPARAMETER_EXTENDSTRATEGYOVERSIZE = "InvalidParameter.ExtendStrategyOverSize" -// INVALIDPARAMETER_GRANTOTHERRESOURCE = "InvalidParameter.GrantOtherResource" -// INVALIDPARAMETER_OVERLIMIT = "InvalidParameter.OverLimit" -// INVALIDPARAMETER_OVERTIMEERROR = "InvalidParameter.OverTimeError" -// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" -// INVALIDPARAMETER_POLICYTOOLONG = "InvalidParameter.PolicyTooLong" -// INVALIDPARAMETER_RESOUCEERROR = "InvalidParameter.ResouceError" -// INVALIDPARAMETER_STRATEGYFORMATERROR = "InvalidParameter.StrategyFormatError" -// INVALIDPARAMETER_STRATEGYINVALID = "InvalidParameter.StrategyInvalid" -// INVALIDPARAMETER_TEMPCODENOTAVALIABLE = "InvalidParameter.TempCodeNotAvaliable" -// RESOURCENOTFOUND_ROLENOTFOUND = "ResourceNotFound.RoleNotFound" -// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" -// UNSUPPORTEDOPERATION = "UnsupportedOperation" +// +// INTERNALERROR_DBERROR = "InternalError.DbError" +// INTERNALERROR_ENCRYPTERROR = "InternalError.EncryptError" +// INTERNALERROR_GETAPPIDERROR = "InternalError.GetAppIdError" +// INTERNALERROR_GETROLEERROR = "InternalError.GetRoleError" +// INTERNALERROR_GETSEEDTOKENERROR = "InternalError.GetSeedTokenError" +// INTERNALERROR_ILLEGALROLE = "InternalError.IllegalRole" +// INTERNALERROR_PBSERIALIZEERROR = "InternalError.PbSerializeError" +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError" +// INVALIDPARAMETER_ACCOUNTNOTAVALIABLE = "InvalidParameter.AccountNotAvaliable" +// INVALIDPARAMETER_EXTENDSTRATEGYOVERSIZE = "InvalidParameter.ExtendStrategyOverSize" +// INVALIDPARAMETER_GRANTOTHERRESOURCE = "InvalidParameter.GrantOtherResource" +// INVALIDPARAMETER_OVERLIMIT = "InvalidParameter.OverLimit" +// INVALIDPARAMETER_OVERTIMEERROR = "InvalidParameter.OverTimeError" +// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" +// INVALIDPARAMETER_POLICYTOOLONG = "InvalidParameter.PolicyTooLong" +// INVALIDPARAMETER_RESOUCEERROR = "InvalidParameter.ResouceError" +// INVALIDPARAMETER_STRATEGYFORMATERROR = "InvalidParameter.StrategyFormatError" +// INVALIDPARAMETER_STRATEGYINVALID = "InvalidParameter.StrategyInvalid" +// INVALIDPARAMETER_TEMPCODENOTAVALIABLE = "InvalidParameter.TempCodeNotAvaliable" +// RESOURCENOTFOUND_ROLENOTFOUND = "ResourceNotFound.RoleNotFound" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +// UNSUPPORTEDOPERATION = "UnsupportedOperation" func (c *Client) AssumeRole(request *AssumeRoleRequest) (response *AssumeRoleResponse, err error) { - return c.AssumeRoleWithContext(context.Background(), request) + return c.AssumeRoleWithContext(context.Background(), request) } // AssumeRole // 申请扮演角色 // // 可能返回的错误码: -// INTERNALERROR_DBERROR = "InternalError.DbError" -// INTERNALERROR_ENCRYPTERROR = "InternalError.EncryptError" -// INTERNALERROR_GETAPPIDERROR = "InternalError.GetAppIdError" -// INTERNALERROR_GETROLEERROR = "InternalError.GetRoleError" -// INTERNALERROR_GETSEEDTOKENERROR = "InternalError.GetSeedTokenError" -// INTERNALERROR_ILLEGALROLE = "InternalError.IllegalRole" -// INTERNALERROR_PBSERIALIZEERROR = "InternalError.PbSerializeError" -// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" -// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError" -// INVALIDPARAMETER_ACCOUNTNOTAVALIABLE = "InvalidParameter.AccountNotAvaliable" -// INVALIDPARAMETER_EXTENDSTRATEGYOVERSIZE = "InvalidParameter.ExtendStrategyOverSize" -// INVALIDPARAMETER_GRANTOTHERRESOURCE = "InvalidParameter.GrantOtherResource" -// INVALIDPARAMETER_OVERLIMIT = "InvalidParameter.OverLimit" -// INVALIDPARAMETER_OVERTIMEERROR = "InvalidParameter.OverTimeError" -// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" -// INVALIDPARAMETER_POLICYTOOLONG = "InvalidParameter.PolicyTooLong" -// INVALIDPARAMETER_RESOUCEERROR = "InvalidParameter.ResouceError" -// INVALIDPARAMETER_STRATEGYFORMATERROR = "InvalidParameter.StrategyFormatError" -// INVALIDPARAMETER_STRATEGYINVALID = "InvalidParameter.StrategyInvalid" -// INVALIDPARAMETER_TEMPCODENOTAVALIABLE = "InvalidParameter.TempCodeNotAvaliable" -// RESOURCENOTFOUND_ROLENOTFOUND = "ResourceNotFound.RoleNotFound" -// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" -// UNSUPPORTEDOPERATION = "UnsupportedOperation" +// +// INTERNALERROR_DBERROR = "InternalError.DbError" +// INTERNALERROR_ENCRYPTERROR = "InternalError.EncryptError" +// INTERNALERROR_GETAPPIDERROR = "InternalError.GetAppIdError" +// INTERNALERROR_GETROLEERROR = "InternalError.GetRoleError" +// INTERNALERROR_GETSEEDTOKENERROR = "InternalError.GetSeedTokenError" +// INTERNALERROR_ILLEGALROLE = "InternalError.IllegalRole" +// INTERNALERROR_PBSERIALIZEERROR = "InternalError.PbSerializeError" +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError" +// INVALIDPARAMETER_ACCOUNTNOTAVALIABLE = "InvalidParameter.AccountNotAvaliable" +// INVALIDPARAMETER_EXTENDSTRATEGYOVERSIZE = "InvalidParameter.ExtendStrategyOverSize" +// INVALIDPARAMETER_GRANTOTHERRESOURCE = "InvalidParameter.GrantOtherResource" +// INVALIDPARAMETER_OVERLIMIT = "InvalidParameter.OverLimit" +// INVALIDPARAMETER_OVERTIMEERROR = "InvalidParameter.OverTimeError" +// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" +// INVALIDPARAMETER_POLICYTOOLONG = "InvalidParameter.PolicyTooLong" +// INVALIDPARAMETER_RESOUCEERROR = "InvalidParameter.ResouceError" +// INVALIDPARAMETER_STRATEGYFORMATERROR = "InvalidParameter.StrategyFormatError" +// INVALIDPARAMETER_STRATEGYINVALID = "InvalidParameter.StrategyInvalid" +// INVALIDPARAMETER_TEMPCODENOTAVALIABLE = "InvalidParameter.TempCodeNotAvaliable" +// RESOURCENOTFOUND_ROLENOTFOUND = "ResourceNotFound.RoleNotFound" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +// UNSUPPORTEDOPERATION = "UnsupportedOperation" func (c *Client) AssumeRoleWithContext(ctx context.Context, request *AssumeRoleRequest) (response *AssumeRoleResponse, err error) { - if request == nil { - request = NewAssumeRoleRequest() - } - - if c.GetCredential() == nil { - return nil, errors.New("AssumeRole require credential") - } - - request.SetContext(ctx) - - response = NewAssumeRoleResponse() - err = c.Send(request, response) - return + if request == nil { + request = NewAssumeRoleRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("AssumeRole require credential") + } + + request.SetContext(ctx) + + response = NewAssumeRoleResponse() + err = c.Send(request, response) + return } func NewAssumeRoleWithSAMLRequest() (request *AssumeRoleWithSAMLRequest) { - request = &AssumeRoleWithSAMLRequest{ - BaseRequest: &tchttp.BaseRequest{}, - } - request.SetSkipSign(true) - request.Init().WithApiInfo("sts", APIVersion, "AssumeRoleWithSAML") - - - return + request = &AssumeRoleWithSAMLRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.SetSkipSign(true) + request.Init().WithApiInfo("sts", APIVersion, "AssumeRoleWithSAML") + + return } func NewAssumeRoleWithSAMLResponse() (response *AssumeRoleWithSAMLResponse) { - response = &AssumeRoleWithSAMLResponse{ - BaseResponse: &tchttp.BaseResponse{}, - } - return + response = &AssumeRoleWithSAMLResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return } // AssumeRoleWithSAML // 本接口(AssumeRoleWithSAML)用于根据 SAML 断言申请角色临时凭证。 // // 可能返回的错误码: -// INTERNALERROR_DBERROR = "InternalError.DbError" -// INTERNALERROR_ENCRYPTERROR = "InternalError.EncryptError" -// INTERNALERROR_GETAPPIDERROR = "InternalError.GetAppIdError" -// INTERNALERROR_GETROLEERROR = "InternalError.GetRoleError" -// INTERNALERROR_GETSEEDTOKENERROR = "InternalError.GetSeedTokenError" -// INTERNALERROR_ILLEGALROLE = "InternalError.IllegalRole" -// INTERNALERROR_PBSERIALIZEERROR = "InternalError.PbSerializeError" -// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" -// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError" -// INVALIDPARAMETER_ACCOUNTNOTAVALIABLE = "InvalidParameter.AccountNotAvaliable" -// INVALIDPARAMETER_EXTENDSTRATEGYOVERSIZE = "InvalidParameter.ExtendStrategyOverSize" -// INVALIDPARAMETER_GRANTOTHERRESOURCE = "InvalidParameter.GrantOtherResource" -// INVALIDPARAMETER_OVERTIMEERROR = "InvalidParameter.OverTimeError" -// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" -// INVALIDPARAMETER_POLICYTOOLONG = "InvalidParameter.PolicyTooLong" -// INVALIDPARAMETER_RESOUCEERROR = "InvalidParameter.ResouceError" -// INVALIDPARAMETER_STRATEGYFORMATERROR = "InvalidParameter.StrategyFormatError" -// INVALIDPARAMETER_STRATEGYINVALID = "InvalidParameter.StrategyInvalid" -// INVALIDPARAMETER_TEMPCODENOTAVALIABLE = "InvalidParameter.TempCodeNotAvaliable" -// RESOURCENOTFOUND_ROLENOTFOUND = "ResourceNotFound.RoleNotFound" -// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +// +// INTERNALERROR_DBERROR = "InternalError.DbError" +// INTERNALERROR_ENCRYPTERROR = "InternalError.EncryptError" +// INTERNALERROR_GETAPPIDERROR = "InternalError.GetAppIdError" +// INTERNALERROR_GETROLEERROR = "InternalError.GetRoleError" +// INTERNALERROR_GETSEEDTOKENERROR = "InternalError.GetSeedTokenError" +// INTERNALERROR_ILLEGALROLE = "InternalError.IllegalRole" +// INTERNALERROR_PBSERIALIZEERROR = "InternalError.PbSerializeError" +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError" +// INVALIDPARAMETER_ACCOUNTNOTAVALIABLE = "InvalidParameter.AccountNotAvaliable" +// INVALIDPARAMETER_EXTENDSTRATEGYOVERSIZE = "InvalidParameter.ExtendStrategyOverSize" +// INVALIDPARAMETER_GRANTOTHERRESOURCE = "InvalidParameter.GrantOtherResource" +// INVALIDPARAMETER_OVERTIMEERROR = "InvalidParameter.OverTimeError" +// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" +// INVALIDPARAMETER_POLICYTOOLONG = "InvalidParameter.PolicyTooLong" +// INVALIDPARAMETER_RESOUCEERROR = "InvalidParameter.ResouceError" +// INVALIDPARAMETER_STRATEGYFORMATERROR = "InvalidParameter.StrategyFormatError" +// INVALIDPARAMETER_STRATEGYINVALID = "InvalidParameter.StrategyInvalid" +// INVALIDPARAMETER_TEMPCODENOTAVALIABLE = "InvalidParameter.TempCodeNotAvaliable" +// RESOURCENOTFOUND_ROLENOTFOUND = "ResourceNotFound.RoleNotFound" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" func (c *Client) AssumeRoleWithSAML(request *AssumeRoleWithSAMLRequest) (response *AssumeRoleWithSAMLResponse, err error) { - return c.AssumeRoleWithSAMLWithContext(context.Background(), request) + return c.AssumeRoleWithSAMLWithContext(context.Background(), request) } // AssumeRoleWithSAML // 本接口(AssumeRoleWithSAML)用于根据 SAML 断言申请角色临时凭证。 // // 可能返回的错误码: -// INTERNALERROR_DBERROR = "InternalError.DbError" -// INTERNALERROR_ENCRYPTERROR = "InternalError.EncryptError" -// INTERNALERROR_GETAPPIDERROR = "InternalError.GetAppIdError" -// INTERNALERROR_GETROLEERROR = "InternalError.GetRoleError" -// INTERNALERROR_GETSEEDTOKENERROR = "InternalError.GetSeedTokenError" -// INTERNALERROR_ILLEGALROLE = "InternalError.IllegalRole" -// INTERNALERROR_PBSERIALIZEERROR = "InternalError.PbSerializeError" -// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" -// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError" -// INVALIDPARAMETER_ACCOUNTNOTAVALIABLE = "InvalidParameter.AccountNotAvaliable" -// INVALIDPARAMETER_EXTENDSTRATEGYOVERSIZE = "InvalidParameter.ExtendStrategyOverSize" -// INVALIDPARAMETER_GRANTOTHERRESOURCE = "InvalidParameter.GrantOtherResource" -// INVALIDPARAMETER_OVERTIMEERROR = "InvalidParameter.OverTimeError" -// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" -// INVALIDPARAMETER_POLICYTOOLONG = "InvalidParameter.PolicyTooLong" -// INVALIDPARAMETER_RESOUCEERROR = "InvalidParameter.ResouceError" -// INVALIDPARAMETER_STRATEGYFORMATERROR = "InvalidParameter.StrategyFormatError" -// INVALIDPARAMETER_STRATEGYINVALID = "InvalidParameter.StrategyInvalid" -// INVALIDPARAMETER_TEMPCODENOTAVALIABLE = "InvalidParameter.TempCodeNotAvaliable" -// RESOURCENOTFOUND_ROLENOTFOUND = "ResourceNotFound.RoleNotFound" -// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +// +// INTERNALERROR_DBERROR = "InternalError.DbError" +// INTERNALERROR_ENCRYPTERROR = "InternalError.EncryptError" +// INTERNALERROR_GETAPPIDERROR = "InternalError.GetAppIdError" +// INTERNALERROR_GETROLEERROR = "InternalError.GetRoleError" +// INTERNALERROR_GETSEEDTOKENERROR = "InternalError.GetSeedTokenError" +// INTERNALERROR_ILLEGALROLE = "InternalError.IllegalRole" +// INTERNALERROR_PBSERIALIZEERROR = "InternalError.PbSerializeError" +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError" +// INVALIDPARAMETER_ACCOUNTNOTAVALIABLE = "InvalidParameter.AccountNotAvaliable" +// INVALIDPARAMETER_EXTENDSTRATEGYOVERSIZE = "InvalidParameter.ExtendStrategyOverSize" +// INVALIDPARAMETER_GRANTOTHERRESOURCE = "InvalidParameter.GrantOtherResource" +// INVALIDPARAMETER_OVERTIMEERROR = "InvalidParameter.OverTimeError" +// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" +// INVALIDPARAMETER_POLICYTOOLONG = "InvalidParameter.PolicyTooLong" +// INVALIDPARAMETER_RESOUCEERROR = "InvalidParameter.ResouceError" +// INVALIDPARAMETER_STRATEGYFORMATERROR = "InvalidParameter.StrategyFormatError" +// INVALIDPARAMETER_STRATEGYINVALID = "InvalidParameter.StrategyInvalid" +// INVALIDPARAMETER_TEMPCODENOTAVALIABLE = "InvalidParameter.TempCodeNotAvaliable" +// RESOURCENOTFOUND_ROLENOTFOUND = "ResourceNotFound.RoleNotFound" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" func (c *Client) AssumeRoleWithSAMLWithContext(ctx context.Context, request *AssumeRoleWithSAMLRequest) (response *AssumeRoleWithSAMLResponse, err error) { - if request == nil { - request = NewAssumeRoleWithSAMLRequest() - } - - request.SetContext(ctx) - - response = NewAssumeRoleWithSAMLResponse() - err = c.Send(request, response) - return + if request == nil { + request = NewAssumeRoleWithSAMLRequest() + } + + request.SetContext(ctx) + + response = NewAssumeRoleWithSAMLResponse() + err = c.Send(request, response) + return } func NewAssumeRoleWithWebIdentityRequest() (request *AssumeRoleWithWebIdentityRequest) { - request = &AssumeRoleWithWebIdentityRequest{ - BaseRequest: &tchttp.BaseRequest{}, - } - request.SetSkipSign(true) - request.Init().WithApiInfo("sts", APIVersion, "AssumeRoleWithWebIdentity") - - - return + request = &AssumeRoleWithWebIdentityRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.SetSkipSign(true) + request.Init().WithApiInfo("sts", APIVersion, "AssumeRoleWithWebIdentity") + + return } func NewAssumeRoleWithWebIdentityResponse() (response *AssumeRoleWithWebIdentityResponse) { - response = &AssumeRoleWithWebIdentityResponse{ - BaseResponse: &tchttp.BaseResponse{}, - } - return + response = &AssumeRoleWithWebIdentityResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return } // AssumeRoleWithWebIdentity // 申请OIDC角色临时密钥 // // 可能返回的错误码: -// INTERNALERROR_GETROLEERROR = "InternalError.GetRoleError" -// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" -// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError" -// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" -// INVALIDPARAMETER_WEBIDENTITYTOKENERROR = "InvalidParameter.WebIdentityTokenError" -// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +// +// INTERNALERROR_GETROLEERROR = "InternalError.GetRoleError" +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError" +// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" +// INVALIDPARAMETER_WEBIDENTITYTOKENERROR = "InvalidParameter.WebIdentityTokenError" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" func (c *Client) AssumeRoleWithWebIdentity(request *AssumeRoleWithWebIdentityRequest) (response *AssumeRoleWithWebIdentityResponse, err error) { - return c.AssumeRoleWithWebIdentityWithContext(context.Background(), request) + return c.AssumeRoleWithWebIdentityWithContext(context.Background(), request) } // AssumeRoleWithWebIdentity // 申请OIDC角色临时密钥 // // 可能返回的错误码: -// INTERNALERROR_GETROLEERROR = "InternalError.GetRoleError" -// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" -// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError" -// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" -// INVALIDPARAMETER_WEBIDENTITYTOKENERROR = "InvalidParameter.WebIdentityTokenError" -// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +// +// INTERNALERROR_GETROLEERROR = "InternalError.GetRoleError" +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError" +// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" +// INVALIDPARAMETER_WEBIDENTITYTOKENERROR = "InvalidParameter.WebIdentityTokenError" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" func (c *Client) AssumeRoleWithWebIdentityWithContext(ctx context.Context, request *AssumeRoleWithWebIdentityRequest) (response *AssumeRoleWithWebIdentityResponse, err error) { - if request == nil { - request = NewAssumeRoleWithWebIdentityRequest() - } - - request.SetContext(ctx) - - response = NewAssumeRoleWithWebIdentityResponse() - err = c.Send(request, response) - return + if request == nil { + request = NewAssumeRoleWithWebIdentityRequest() + } + + request.SetContext(ctx) + + response = NewAssumeRoleWithWebIdentityResponse() + err = c.Send(request, response) + return } func NewGetCallerIdentityRequest() (request *GetCallerIdentityRequest) { - request = &GetCallerIdentityRequest{ - BaseRequest: &tchttp.BaseRequest{}, - } - - request.Init().WithApiInfo("sts", APIVersion, "GetCallerIdentity") - - - return + request = &GetCallerIdentityRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("sts", APIVersion, "GetCallerIdentity") + + return } func NewGetCallerIdentityResponse() (response *GetCallerIdentityResponse) { - response = &GetCallerIdentityResponse{ - BaseResponse: &tchttp.BaseResponse{}, - } - return + response = &GetCallerIdentityResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return } // GetCallerIdentity @@ -299,11 +301,12 @@ func NewGetCallerIdentityResponse() (response *GetCallerIdentityResponse) { // 接口支持主账号,子账号长期密钥以及AssumeRole,GetFederationToken生成的临时凭据的身份获取。 // // 可能返回的错误码: -// AUTHFAILURE_ACCESSKEYILLEGAL = "AuthFailure.AccessKeyIllegal" -// INTERNALERROR_GETSEEDTOKENERROR = "InternalError.GetSeedTokenError" -// INVALIDPARAMETER_ACCESSKEYNOTSUPPORT = "InvalidParameter.AccessKeyNotSupport" +// +// AUTHFAILURE_ACCESSKEYILLEGAL = "AuthFailure.AccessKeyIllegal" +// INTERNALERROR_GETSEEDTOKENERROR = "InternalError.GetSeedTokenError" +// INVALIDPARAMETER_ACCESSKEYNOTSUPPORT = "InvalidParameter.AccessKeyNotSupport" func (c *Client) GetCallerIdentity(request *GetCallerIdentityRequest) (response *GetCallerIdentityResponse, err error) { - return c.GetCallerIdentityWithContext(context.Background(), request) + return c.GetCallerIdentityWithContext(context.Background(), request) } // GetCallerIdentity @@ -312,153 +315,156 @@ func (c *Client) GetCallerIdentity(request *GetCallerIdentityRequest) (response // 接口支持主账号,子账号长期密钥以及AssumeRole,GetFederationToken生成的临时凭据的身份获取。 // // 可能返回的错误码: -// AUTHFAILURE_ACCESSKEYILLEGAL = "AuthFailure.AccessKeyIllegal" -// INTERNALERROR_GETSEEDTOKENERROR = "InternalError.GetSeedTokenError" -// INVALIDPARAMETER_ACCESSKEYNOTSUPPORT = "InvalidParameter.AccessKeyNotSupport" +// +// AUTHFAILURE_ACCESSKEYILLEGAL = "AuthFailure.AccessKeyIllegal" +// INTERNALERROR_GETSEEDTOKENERROR = "InternalError.GetSeedTokenError" +// INVALIDPARAMETER_ACCESSKEYNOTSUPPORT = "InvalidParameter.AccessKeyNotSupport" func (c *Client) GetCallerIdentityWithContext(ctx context.Context, request *GetCallerIdentityRequest) (response *GetCallerIdentityResponse, err error) { - if request == nil { - request = NewGetCallerIdentityRequest() - } - - if c.GetCredential() == nil { - return nil, errors.New("GetCallerIdentity require credential") - } - - request.SetContext(ctx) - - response = NewGetCallerIdentityResponse() - err = c.Send(request, response) - return + if request == nil { + request = NewGetCallerIdentityRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("GetCallerIdentity require credential") + } + + request.SetContext(ctx) + + response = NewGetCallerIdentityResponse() + err = c.Send(request, response) + return } func NewGetFederationTokenRequest() (request *GetFederationTokenRequest) { - request = &GetFederationTokenRequest{ - BaseRequest: &tchttp.BaseRequest{}, - } - - request.Init().WithApiInfo("sts", APIVersion, "GetFederationToken") - - - return + request = &GetFederationTokenRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("sts", APIVersion, "GetFederationToken") + + return } func NewGetFederationTokenResponse() (response *GetFederationTokenResponse) { - response = &GetFederationTokenResponse{ - BaseResponse: &tchttp.BaseResponse{}, - } - return + response = &GetFederationTokenResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return } // GetFederationToken // 获取联合身份临时访问凭证 // // 可能返回的错误码: -// INTERNALERROR_DBERROR = "InternalError.DbError" -// INTERNALERROR_ENCRYPTERROR = "InternalError.EncryptError" -// INTERNALERROR_GETAPPIDERROR = "InternalError.GetAppIdError" -// INTERNALERROR_GETSEEDTOKENERROR = "InternalError.GetSeedTokenError" -// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" -// INVALIDPARAMETER_ACCOUNTNOTAVALIABLE = "InvalidParameter.AccountNotAvaliable" -// INVALIDPARAMETER_EXTENDSTRATEGYOVERSIZE = "InvalidParameter.ExtendStrategyOverSize" -// INVALIDPARAMETER_GRANTOTHERRESOURCE = "InvalidParameter.GrantOtherResource" -// INVALIDPARAMETER_OVERTIMEERROR = "InvalidParameter.OverTimeError" -// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" -// INVALIDPARAMETER_POLICYTOOLONG = "InvalidParameter.PolicyTooLong" -// INVALIDPARAMETER_RESOUCEERROR = "InvalidParameter.ResouceError" -// INVALIDPARAMETER_STRATEGYFORMATERROR = "InvalidParameter.StrategyFormatError" -// INVALIDPARAMETER_STRATEGYINVALID = "InvalidParameter.StrategyInvalid" -// INVALIDPARAMETER_TEMPCODENOTAVALIABLE = "InvalidParameter.TempCodeNotAvaliable" -// RESOURCENOTFOUND_ROLENOTFOUND = "ResourceNotFound.RoleNotFound" -// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +// +// INTERNALERROR_DBERROR = "InternalError.DbError" +// INTERNALERROR_ENCRYPTERROR = "InternalError.EncryptError" +// INTERNALERROR_GETAPPIDERROR = "InternalError.GetAppIdError" +// INTERNALERROR_GETSEEDTOKENERROR = "InternalError.GetSeedTokenError" +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// INVALIDPARAMETER_ACCOUNTNOTAVALIABLE = "InvalidParameter.AccountNotAvaliable" +// INVALIDPARAMETER_EXTENDSTRATEGYOVERSIZE = "InvalidParameter.ExtendStrategyOverSize" +// INVALIDPARAMETER_GRANTOTHERRESOURCE = "InvalidParameter.GrantOtherResource" +// INVALIDPARAMETER_OVERTIMEERROR = "InvalidParameter.OverTimeError" +// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" +// INVALIDPARAMETER_POLICYTOOLONG = "InvalidParameter.PolicyTooLong" +// INVALIDPARAMETER_RESOUCEERROR = "InvalidParameter.ResouceError" +// INVALIDPARAMETER_STRATEGYFORMATERROR = "InvalidParameter.StrategyFormatError" +// INVALIDPARAMETER_STRATEGYINVALID = "InvalidParameter.StrategyInvalid" +// INVALIDPARAMETER_TEMPCODENOTAVALIABLE = "InvalidParameter.TempCodeNotAvaliable" +// RESOURCENOTFOUND_ROLENOTFOUND = "ResourceNotFound.RoleNotFound" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" func (c *Client) GetFederationToken(request *GetFederationTokenRequest) (response *GetFederationTokenResponse, err error) { - return c.GetFederationTokenWithContext(context.Background(), request) + return c.GetFederationTokenWithContext(context.Background(), request) } // GetFederationToken // 获取联合身份临时访问凭证 // // 可能返回的错误码: -// INTERNALERROR_DBERROR = "InternalError.DbError" -// INTERNALERROR_ENCRYPTERROR = "InternalError.EncryptError" -// INTERNALERROR_GETAPPIDERROR = "InternalError.GetAppIdError" -// INTERNALERROR_GETSEEDTOKENERROR = "InternalError.GetSeedTokenError" -// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" -// INVALIDPARAMETER_ACCOUNTNOTAVALIABLE = "InvalidParameter.AccountNotAvaliable" -// INVALIDPARAMETER_EXTENDSTRATEGYOVERSIZE = "InvalidParameter.ExtendStrategyOverSize" -// INVALIDPARAMETER_GRANTOTHERRESOURCE = "InvalidParameter.GrantOtherResource" -// INVALIDPARAMETER_OVERTIMEERROR = "InvalidParameter.OverTimeError" -// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" -// INVALIDPARAMETER_POLICYTOOLONG = "InvalidParameter.PolicyTooLong" -// INVALIDPARAMETER_RESOUCEERROR = "InvalidParameter.ResouceError" -// INVALIDPARAMETER_STRATEGYFORMATERROR = "InvalidParameter.StrategyFormatError" -// INVALIDPARAMETER_STRATEGYINVALID = "InvalidParameter.StrategyInvalid" -// INVALIDPARAMETER_TEMPCODENOTAVALIABLE = "InvalidParameter.TempCodeNotAvaliable" -// RESOURCENOTFOUND_ROLENOTFOUND = "ResourceNotFound.RoleNotFound" -// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +// +// INTERNALERROR_DBERROR = "InternalError.DbError" +// INTERNALERROR_ENCRYPTERROR = "InternalError.EncryptError" +// INTERNALERROR_GETAPPIDERROR = "InternalError.GetAppIdError" +// INTERNALERROR_GETSEEDTOKENERROR = "InternalError.GetSeedTokenError" +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// INVALIDPARAMETER_ACCOUNTNOTAVALIABLE = "InvalidParameter.AccountNotAvaliable" +// INVALIDPARAMETER_EXTENDSTRATEGYOVERSIZE = "InvalidParameter.ExtendStrategyOverSize" +// INVALIDPARAMETER_GRANTOTHERRESOURCE = "InvalidParameter.GrantOtherResource" +// INVALIDPARAMETER_OVERTIMEERROR = "InvalidParameter.OverTimeError" +// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" +// INVALIDPARAMETER_POLICYTOOLONG = "InvalidParameter.PolicyTooLong" +// INVALIDPARAMETER_RESOUCEERROR = "InvalidParameter.ResouceError" +// INVALIDPARAMETER_STRATEGYFORMATERROR = "InvalidParameter.StrategyFormatError" +// INVALIDPARAMETER_STRATEGYINVALID = "InvalidParameter.StrategyInvalid" +// INVALIDPARAMETER_TEMPCODENOTAVALIABLE = "InvalidParameter.TempCodeNotAvaliable" +// RESOURCENOTFOUND_ROLENOTFOUND = "ResourceNotFound.RoleNotFound" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" func (c *Client) GetFederationTokenWithContext(ctx context.Context, request *GetFederationTokenRequest) (response *GetFederationTokenResponse, err error) { - if request == nil { - request = NewGetFederationTokenRequest() - } - - if c.GetCredential() == nil { - return nil, errors.New("GetFederationToken require credential") - } - - request.SetContext(ctx) - - response = NewGetFederationTokenResponse() - err = c.Send(request, response) - return + if request == nil { + request = NewGetFederationTokenRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("GetFederationToken require credential") + } + + request.SetContext(ctx) + + response = NewGetFederationTokenResponse() + err = c.Send(request, response) + return } func NewQueryApiKeyRequest() (request *QueryApiKeyRequest) { - request = &QueryApiKeyRequest{ - BaseRequest: &tchttp.BaseRequest{}, - } - - request.Init().WithApiInfo("sts", APIVersion, "QueryApiKey") - - - return + request = &QueryApiKeyRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("sts", APIVersion, "QueryApiKey") + + return } func NewQueryApiKeyResponse() (response *QueryApiKeyResponse) { - response = &QueryApiKeyResponse{ - BaseResponse: &tchttp.BaseResponse{}, - } - return + response = &QueryApiKeyResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return } // QueryApiKey // 拉取API密钥列表 // // 可能返回的错误码: -// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" -// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError" -// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" +// +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError" +// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" func (c *Client) QueryApiKey(request *QueryApiKeyRequest) (response *QueryApiKeyResponse, err error) { - return c.QueryApiKeyWithContext(context.Background(), request) + return c.QueryApiKeyWithContext(context.Background(), request) } // QueryApiKey // 拉取API密钥列表 // // 可能返回的错误码: -// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" -// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError" -// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" +// +// INTERNALERROR_SYSTEMERROR = "InternalError.SystemError" +// INTERNALERROR_UNKNOWNERROR = "InternalError.UnknownError" +// INVALIDPARAMETER_PARAMERROR = "InvalidParameter.ParamError" func (c *Client) QueryApiKeyWithContext(ctx context.Context, request *QueryApiKeyRequest) (response *QueryApiKeyResponse, err error) { - if request == nil { - request = NewQueryApiKeyRequest() - } - - if c.GetCredential() == nil { - return nil, errors.New("QueryApiKey require credential") - } - - request.SetContext(ctx) - - response = NewQueryApiKeyResponse() - err = c.Send(request, response) - return + if request == nil { + request = NewQueryApiKeyRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("QueryApiKey require credential") + } + + request.SetContext(ctx) + + response = NewQueryApiKeyResponse() + err = c.Send(request, response) + return } diff --git a/website/docs/r/sqlserver_basic_instance.html.markdown b/website/docs/r/sqlserver_basic_instance.html.markdown index 17337c2f08..c2eab6b4e7 100644 --- a/website/docs/r/sqlserver_basic_instance.html.markdown +++ b/website/docs/r/sqlserver_basic_instance.html.markdown @@ -90,7 +90,9 @@ In addition to all arguments above, the following attributes are exported: * `id` - ID of the resource. * `create_time` - Create time of the SQL Server basic instance. +* `dns_pod_domain` - Internet address domain name. * `status` - Status of the SQL Server basic instance. 1 for applying, 2 for running, 3 for running with limit, 4 for isolated, 5 for recycling, 6 for recycled, 7 for running with task, 8 for off-line, 9 for expanding, 10 for migrating, 11 for readonly, 12 for rebooting. +* `tgw_wan_vport` - External port number. * `vip` - IP for private access. * `vport` - Port for private access. diff --git a/website/docs/r/sqlserver_general_cloud_instance.html.markdown b/website/docs/r/sqlserver_general_cloud_instance.html.markdown index f97fc529e8..225140f9d8 100644 --- a/website/docs/r/sqlserver_general_cloud_instance.html.markdown +++ b/website/docs/r/sqlserver_general_cloud_instance.html.markdown @@ -97,7 +97,8 @@ The `resource_tags` object supports the following: In addition to all arguments above, the following attributes are exported: * `id` - ID of the resource. - +* `dns_pod_domain` - Internet address domain name. +* `tgw_wan_vport` - External port number. ## Import diff --git a/website/docs/r/sqlserver_instance.html.markdown b/website/docs/r/sqlserver_instance.html.markdown index 1234aaa3a3..ec70f55cd5 100644 --- a/website/docs/r/sqlserver_instance.html.markdown +++ b/website/docs/r/sqlserver_instance.html.markdown @@ -75,8 +75,10 @@ In addition to all arguments above, the following attributes are exported: * `id` - ID of the resource. * `create_time` - Create time of the SQL Server instance. +* `dns_pod_domain` - Internet address domain name. * `ro_flag` - Readonly flag. `RO` (read-only instance), `MASTER` (primary instance with read-only instances). If it is left empty, it refers to an instance which is not read-only and has no RO group. * `status` - Status of the SQL Server instance. 1 for applying, 2 for running, 3 for running with limit, 4 for isolated, 5 for recycling, 6 for recycled, 7 for running with task, 8 for off-line, 9 for expanding, 10 for migrating, 11 for readonly, 12 for rebooting. +* `tgw_wan_vport` - External port number. * `vip` - IP for private access. * `vport` - Port for private access. diff --git a/website/docs/r/sqlserver_readonly_instance.html.markdown b/website/docs/r/sqlserver_readonly_instance.html.markdown index 468a780bed..6fe402a48b 100644 --- a/website/docs/r/sqlserver_readonly_instance.html.markdown +++ b/website/docs/r/sqlserver_readonly_instance.html.markdown @@ -99,11 +99,13 @@ In addition to all arguments above, the following attributes are exported: * `id` - ID of the resource. * `create_time` - Create time of the SQL Server instance. +* `dns_pod_domain` - Internet address domain name. * `engine_version` - Version of the SQL Server database engine. * `ha_type` - Instance type. * `project_id` - Project ID. * `ro_flag` - Readonly flag. `RO` (read-only instance), `MASTER` (primary instance with read-only instances). If it is left empty, it refers to an instance which is not read-only and has no RO group. * `status` - Status of the SQL Server instance. 1 for applying, 2 for running, 3 for running with limit, 4 for isolated, 5 for recycling, 6 for recycled, 7 for running with task, 8 for off-line, 9 for expanding, 10 for migrating, 11 for readonly, 12 for rebooting. +* `tgw_wan_vport` - External port number. * `vip` - IP for private access. * `vport` - Port for private access. From 17102d3fa86709ab932b9060be65cfb6fa33c3e7 Mon Sep 17 00:00:00 2001 From: SevenEarth <391613297@qq.com> Date: Tue, 11 Mar 2025 15:36:08 +0800 Subject: [PATCH 3/7] add --- .changelog/3198.txt | 15 +++++ tencentcloud/provider.md | 1 + .../r/sqlserver_wan_ip_config.html.markdown | 65 +++++++++++++++++++ website/tencentcloud.erb | 3 + 4 files changed, 84 insertions(+) create mode 100644 .changelog/3198.txt create mode 100644 website/docs/r/sqlserver_wan_ip_config.html.markdown diff --git a/.changelog/3198.txt b/.changelog/3198.txt new file mode 100644 index 0000000000..0ff954699e --- /dev/null +++ b/.changelog/3198.txt @@ -0,0 +1,15 @@ +```release-note:new-resource +tencentcloud_sqlserver_wan_ip_config +``` + +```release-note:enhancement +resource/tencentcloud_sqlserver_general_cloud_instance: add new params +``` + +```release-note:enhancement +resource/tencentcloud_sqlserver_basic_instance: add new params +``` + +```release-note:enhancement +resource/tencentcloud_sqlserver_instance: add new params +``` diff --git a/tencentcloud/provider.md b/tencentcloud/provider.md index 0ea2c1989a..278c6f46e6 100644 --- a/tencentcloud/provider.md +++ b/tencentcloud/provider.md @@ -1047,6 +1047,7 @@ tencentcloud_sqlserver_start_xevent tencentcloud_sqlserver_instance_tde tencentcloud_sqlserver_database_tde tencentcloud_sqlserver_general_cloud_ro_instance +tencentcloud_sqlserver_wan_ip_config SSL Certificates(ssl) Data Source diff --git a/website/docs/r/sqlserver_wan_ip_config.html.markdown b/website/docs/r/sqlserver_wan_ip_config.html.markdown new file mode 100644 index 0000000000..e9a0b8f7e5 --- /dev/null +++ b/website/docs/r/sqlserver_wan_ip_config.html.markdown @@ -0,0 +1,65 @@ +--- +subcategory: "SQLServer" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_sqlserver_wan_ip_config" +sidebar_current: "docs-tencentcloud-resource-sqlserver_wan_ip_config" +description: |- + Provides a resource to create a sqlserver wan ip config +--- + +# tencentcloud_sqlserver_wan_ip_config + +Provides a resource to create a sqlserver wan ip config + +## Example Usage + +### Open/Close wan ip for SQL instance + +```hcl +# open +resource "tencentcloud_sqlserver_wan_ip_config" "example" { + instance_id = "mssql-gy1lc54f" + enable_wan_ip = true +} + +# close +resource "tencentcloud_sqlserver_wan_ip_config" "example" { + instance_id = "mssql-gy1lc54f" + enable_wan_ip = false +} +``` + +### Open/Close wan ip for SQL read only group + +```hcl +# open +resource "tencentcloud_sqlserver_wan_ip_config" "example" { + instance_id = "mssql-gy1lc54f" + ro_group_id = "mssqlrg-hyxotm31" + enable_wan_ip = true +} + +# close +resource "tencentcloud_sqlserver_wan_ip_config" "example" { + instance_id = "mssql-gy1lc54f" + ro_group_id = "mssqlrg-hyxotm31" + enable_wan_ip = false +} +``` + +## Argument Reference + +The following arguments are supported: + +* `enable_wan_ip` - (Required, Bool) Whether to open wan ip, true: enable; false: disable. +* `instance_id` - (Required, String, ForceNew) Instance ID. +* `ro_group_id` - (Optional, String, ForceNew) Read only group ID. + +## 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 d47e40dcaa..2a62e86c81 100644 --- a/website/tencentcloud.erb +++ b/website/tencentcloud.erb @@ -3569,6 +3569,9 @@