Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/alicloud_quotas_quota_alarm: Support for international languages. #7035

Merged
merged 1 commit into from Mar 14, 2024

Conversation

ChenHanZhang
Copy link
Collaborator

No description provided.

"AcceptLanguage": tea.String("en-US"),
}
param := &openapi.GlobalParameters{Queries: query}
config := &openapi.Config{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config 的构造抽成一个独立的方法,所有的 Client 都是共用的
包括上面的 query

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -128,7 +131,7 @@ func resourceAliCloudQuotasQuotaAlarmCreate(d *schema.ResourceData, meta interfa
}
wait := incrementalWait(3*time.Second, 5*time.Second)
err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError {
response, err = conn.DoRequest(StringPointer(action), nil, StringPointer("POST"), StringPointer("2020-05-10"), StringPointer("AK"), nil, request, &util.RuntimeOptions{})
response, err = conn.CallApi(genRpcParam(action, "POST", "2020-05-10"), &openapi.OpenApiRequest{Query: query, Body: request, HostMap: hostMap}, &util.RuntimeOptions{})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

POST 最好也直接用方法名来表达掉,rpcPostParam(action, "2020-05-10"))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hostMap 是干啥的?如果都是所有调用公用的,是不是也可以封装掉,我理解这个地方就只有Query和Body 两个参数,是不是可以用顺序来指定这两个参数。
另外,如果其中一个参数没有被用到,是不是可以不初始化,直接 nil 就可以

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有极少部分产品的参数会放到host上,如果没使用的话用nil即可

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

POST 最好也直接用方法名来表达掉,rpcPostParam(action, "2020-05-10"))

这个method可能为GET,当参数更合适一些吧

@@ -1633,6 +1633,20 @@ func genRoaParam(action, method, version, path string) *openapi.Params {
}
}

func genRpcParam(action, method, version string) *openapi.Params {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gen 这种前缀去掉吧

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@ChenHanZhang ChenHanZhang force-pushed the QuotaLanguage branch 2 times, most recently from 9c44ce7 to 573385c Compare March 11, 2024 07:24

openapiConfig.Endpoint = tea.String(endpoint)
_result := &openapi.Client{}
_result, _err := openapi.NewClient(&openapiConfig)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2861 行多余了吧

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sdk 官网给的example,这里我优化下

Pathname: tea.String("/"),
Method: tea.String(method),
AuthType: tea.String("AK"),
Style: tea.String("RPC"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是说不区分 rpc 和 roa 了么?是不是可以统一掉了

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不行,还是区分的

//}
//if c.SecureTransport != "" {
// config.SetSecureTransport(c.SecureTransport)
//}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两个如果确定不需要了或者挪到header 中了,那么这个地方就去掉吧,另外需要测试确认下自定义的 header 确实可以设置成功

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里就和具体的产品api风格有关了,放到client下进行设置

@ChenHanZhang ChenHanZhang force-pushed the QuotaLanguage branch 2 times, most recently from 78211eb to 068fefc Compare March 11, 2024 09:53
Copy link
Collaborator Author

@ChenHanZhang ChenHanZhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved

@ChenHanZhang ChenHanZhang merged commit 031a2a2 into aliyun:master Mar 14, 2024
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants