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

阿里云ECS同步bug #16

Open
Makecodeeasy opened this issue Nov 8, 2022 · 0 comments
Open

阿里云ECS同步bug #16

Makecodeeasy opened this issue Nov 8, 2022 · 0 comments

Comments

@Makecodeeasy
Copy link

只能同步100条数据。
修改ecs.go
if response.TotalCount > 0 {
for i := 0; i < response.TotalCount/100+1; i++ {
request.PageSize = "100"
+ pageNumber := fmt.Sprintf("%d", i+1)
+ request.PageNumber = requests.Integer(pageNumber) // 设定请求的PageNumber
r, err := ecsClient.DescribeInstances(request)
if err != nil {
log.Errorf("查询ECS实例列表失败,%v", err)
return err
}

			ecsList = append(ecsList, r.Instances.Instance...)
		}

	}

以上可解决ecs数量超过100同步不全的bug

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

No branches or pull requests

1 participant