-
Notifications
You must be signed in to change notification settings - Fork 135
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
fix(scf): [116337119] return functionId #2590
Conversation
@@ -147,15 +148,21 @@ func (me *ScfService) CreateFunction(ctx context.Context, info scfFunctionInfo) | |||
return nil | |||
} | |||
|
|||
func (me *ScfService) DescribeFunction(ctx context.Context, name, namespace string) (resp *scf.GetFunctionResponse, err error) { | |||
func (me *ScfService) DescribeFunction(ctx context.Context, name, namespace string, functionId ...string) (resp *scf.GetFunctionResponse, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DescribeFunction 这个函数除了在 query 里面调用外,在其他地方有调用吗,包括其他的资源中有调用这个函数吗
函数的定义改成
DescribeFunction(ctx context.Context, name, namespace string, functionId string)
成本高吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果可以的话,下面这段可以简化吧:
保持跟之前一样就行,只需要
var iacExtInfo connectivity.IacExtInfo
iacExtInfo.InstanceId = strings.Join([]string{name, namespace}, tccommon.FILED_SP)
if err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
ratelimit.Check(request.GetAction())
response, err := me.client.UseScfClient(iacExtInfo).GetFunction(request)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DescribeFunction函数当前resource自己本身就有4个地方调用,所以这里不能将functionId作为参数必传,因为这是一个选填参数,强制增加functionId函数会影响其余地方的入参规则
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里无法保持一行哈,因为有不定长参数,需要判断是否传functionId
@@ -147,15 +148,21 @@ func (me *ScfService) CreateFunction(ctx context.Context, info scfFunctionInfo) | |||
return nil | |||
} | |||
|
|||
func (me *ScfService) DescribeFunction(ctx context.Context, name, namespace string) (resp *scf.GetFunctionResponse, err error) { | |||
func (me *ScfService) DescribeFunction(ctx context.Context, name, namespace string, functionId ...string) (resp *scf.GetFunctionResponse, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果可以的话,下面这段可以简化吧:
保持跟之前一样就行,只需要
var iacExtInfo connectivity.IacExtInfo
iacExtInfo.InstanceId = strings.Join([]string{name, namespace}, tccommon.FILED_SP)
if err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
ratelimit.Check(request.GetAction())
response, err := me.client.UseScfClient(iacExtInfo).GetFunction(request)
@@ -868,7 +879,8 @@ func resourceTencentCloudScfFunctionRead(d *schema.ResourceData, m interface{}) | |||
} | |||
namespace, name := split[0], split[1] | |||
|
|||
response, err := service.DescribeFunction(ctx, name, namespace) | |||
functionId := d.Get("function_id").(string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
acctest 测试用例增加下 functionid 的验证吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已补充
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.