Skip to content

Commit

Permalink
Merge pull request #67 from douwentao/dwt_dev
Browse files Browse the repository at this point in the history
部分接口兼容性适配
  • Loading branch information
zshongyi authored Jun 18, 2024
2 parents 9f05b42 + 4fe9eff commit d6b91c2
Show file tree
Hide file tree
Showing 39 changed files with 1,920 additions and 701 deletions.
9 changes: 5 additions & 4 deletions alibabacloudstack/data_source_apsarastack_dns_domains.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package alibabacloudstack
import (
"encoding/json"
"fmt"
"regexp"
"strings"

"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
"github.com/aliyun/terraform-provider-alibabacloudstack/alibabacloudstack/connectivity"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"regexp"
"strings"
)

func dataSourceAlibabacloudStackDnsDomains() *schema.Resource {
Expand Down Expand Up @@ -120,7 +121,7 @@ func dataSourceAlibabacloudStackDnsDomainsRead(d *schema.ResourceData, meta inte
request.Method = "POST"
request.Product = "CloudDns"
request.Domain = client.Domain
request.Version = "2022-06-24"
request.Version = "2021-06-24"
name := d.Get("domain_name").(string)
request.PageNumber = requests.NewInteger(2)
request.PageSize = requests.NewInteger(PageSizeLarge)
Expand All @@ -137,7 +138,7 @@ func dataSourceAlibabacloudStackDnsDomainsRead(d *schema.ResourceData, meta inte
"Product": "CloudDns",
"RegionId": client.RegionId,
"Action": "DescribeGlobalZones",
"Version": "2022-06-24",
"Version": "2021-06-24",
"PageNumber": fmt.Sprint(1),
"PageSize": fmt.Sprint(PageSizeLarge),
"Name": name,
Expand Down
19 changes: 18 additions & 1 deletion alibabacloudstack/diff_suppress_funcs.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package alibabacloudstack

import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"log"
"sort"
"strconv"
"strings"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func vpcTypeResourceDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool {
Expand Down Expand Up @@ -266,6 +267,22 @@ func PostPaidAndRenewDiffSuppressFunc(k, old, new string, d *schema.ResourceData
return true
}

func ArchitectureTypeDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool {
if strings.ToLower(d.Get("series").(string)) == "enterprise" && new == "rwsplit" {
return false
} else {
return true
}
}

func NodeTypeDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool {
if strings.ToLower(d.Get("series").(string)) == "enterprise" && new == "readone" {
return false
} else {
return true
}
}

func routerInterfaceAcceptsideDiffSuppressFunc(k, old, new string, d *schema.ResourceData) bool {
return d.Get("role").(string) == string(AcceptingSide)
}
Expand Down
2 changes: 2 additions & 0 deletions alibabacloudstack/extension_rds.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ type KVStoreEngineVersion string
const (
KVStore2Dot8 = KVStoreEngineVersion("2.8")
KVStore4Dot0 = KVStoreEngineVersion("4.0")
KVStore5Dot0 = KVStoreEngineVersion("5.0")
KVStore6Dot0 = KVStoreEngineVersion("6.0")
)
37 changes: 25 additions & 12 deletions alibabacloudstack/resource_apsarastack_cms_alarm_contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"
"strings"

"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
"github.com/aliyun/alibaba-cloud-sdk-go/services/cms"
"github.com/aliyun/terraform-provider-alibabacloudstack/alibabacloudstack/connectivity"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -58,39 +59,51 @@ func resourceAlibabacloudstackCmsAlarmContact() *schema.Resource {
func resourceAlibabacloudstackCmsAlarmContactCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*connectivity.AlibabacloudStackClient)

request := cms.CreatePutContactRequest()
request := requests.NewCommonRequest()
if strings.ToLower(client.Config.Protocol) == "https" {
request.Scheme = "https"
} else {
request.Scheme = "http"
}
request.ApiName = "PutContact"
request.Method = "POST"
request.Product = "Cms"
request.Domain = client.Domain
request.Version = "2019-01-01"
request.RegionId = client.RegionId
request.Headers = map[string]string{"RegionId": client.RegionId}
request.QueryParams = map[string]string{"AccessKeySecret": client.SecretKey, "Product": "Cms", "Department": client.Department, "ResourceGroup": client.ResourceGroup}
request.ContactName = d.Get("alarm_contact_name").(string)
request.Headers = map[string]string{"RegionId": client.RegionId, "Content-Type": "application/json; charset=UTF-8"}
request.QueryParams = map[string]string{
"AccessKeySecret": client.SecretKey,
"Product": "Cms",
"Action": "PutContact",
"Version": "2019-01-01",
"Department": client.Department,
"ResourceGroup": client.ResourceGroup,
"ContactName": d.Get("alarm_contact_name").(string),
"Describe": d.Get("describe").(string),
}
if v, ok := d.GetOk("channels_aliim"); ok {
request.ChannelsAliIM = v.(string)
request.QueryParams["Channels.AliIM "] = v.(string)
}

if v, ok := d.GetOk("channels_ding_web_hook"); ok {
request.ChannelsDingWebHook = v.(string)
request.QueryParams["Channels.DingWebHook"] = v.(string)
}

if v, ok := d.GetOk("channels_mail"); ok {
request.ChannelsMail = v.(string)
request.QueryParams["ChannelsMail"] = v.(string)
}

if v, ok := d.GetOk("channels_sms"); ok {
request.ChannelsSMS = v.(string)
request.QueryParams["Channels.SMS"] = v.(string)
}

request.Describe = d.Get("describe").(string)
if v, ok := d.GetOk("lang"); ok {
request.Lang = v.(string)
request.QueryParams["Lang"] = v.(string)
}

raw, err := client.WithCmsClient(func(cmsClient *cms.Client) (interface{}, error) {
return cmsClient.PutContact(request)
return cmsClient.ProcessCommonRequest(request)
})
if err != nil {
return WrapErrorf(err, DefaultErrorMsg, "alibabacloudstack_cms_alarm_contact", request.GetActionName(), AlibabacloudStackSdkGoERROR)
Expand All @@ -101,7 +114,7 @@ func resourceAlibabacloudstackCmsAlarmContactCreate(d *schema.ResourceData, meta
if response.Code != "200" {
return WrapError(Error("PutContact failed for " + response.Message))
}
d.SetId(fmt.Sprintf("%v", request.ContactName))
d.SetId(fmt.Sprintf("%v", d.Get("alarm_contact_name").(string)))

return resourceAlibabacloudstackCmsAlarmContactRead(d, meta)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func resourceAlibabacloudstackCmsAlarmContactGroup() *schema.Resource {
},
"describe": {
Type: schema.TypeString,
Optional: true,
Required: true,
},
"enable_subscribed": {
Type: schema.TypeBool,
Expand Down
Loading

0 comments on commit d6b91c2

Please sign in to comment.