diff --git a/post-processor/alicloud-import/post-processor.go b/post-processor/alicloud-import/post-processor.go index 5bbf591aa..2606e5fdf 100644 --- a/post-processor/alicloud-import/post-processor.go +++ b/post-processor/alicloud-import/post-processor.go @@ -232,17 +232,18 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac getEndPonit(p.config.OSSBucket), p.config.OSSKey, err) } if _, err := ramClient.AttachPolicyToRole(ram.AttachPolicyToRoleRequest{ - ram.PolicyRequest{ + PolicyRequest: ram.PolicyRequest{ PolicyName: "AliyunECSImageImportRolePolicy", PolicyType: "System", - }, "AliyunECSImageImportDefaultRole", + }, + RoleName: "AliyunECSImageImportDefaultRole", }); err != nil { return nil, false, fmt.Errorf("Failed to start import from %s/%s: %s", getEndPonit(p.config.OSSBucket), p.config.OSSKey, err) } } else { policyListResponse, err := ramClient.ListPoliciesForRole(ram.RoleQueryRequest{ - "AliyunECSImageImportDefaultRole", + RoleName: "AliyunECSImageImportDefaultRole", }) if err != nil { return nil, false, fmt.Errorf("Failed to start import from %s/%s: %s", @@ -258,10 +259,11 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac } if isAliyunECSImageImportRolePolicyNotExit { if _, err := ramClient.AttachPolicyToRole(ram.AttachPolicyToRoleRequest{ - ram.PolicyRequest{ + PolicyRequest: ram.PolicyRequest{ PolicyName: "AliyunECSImageImportRolePolicy", PolicyType: "System", - }, "AliyunECSImageImportDefaultRole", + }, + RoleName: "AliyunECSImageImportDefaultRole", }); err != nil { return nil, false, fmt.Errorf("Failed to start import from %s/%s: %s", getEndPonit(p.config.OSSBucket), p.config.OSSKey, err)