func()

in tools/mc2bq/pkg/export/v1.go [73:88]


func (mc *MCv1) AssetCount(ctx context.Context, pal mcutil.ProjectAndLocation) (int64, error) {
	resp, err := mc.client.AggregateAssetsValues(ctx, &migrationcenterpb.AggregateAssetsValuesRequest{
		Parent: pal.Path(),
		Aggregations: []*migrationcenterpb.Aggregation{
			{
				Field:               "*",
				AggregationFunction: &migrationcenterpb.Aggregation_Count_{Count: &migrationcenterpb.Aggregation_Count{}},
			},
		},
	})
	if err != nil {
		return -1, err
	}

	return resp.Results[0].GetCount().Value, nil
}