Skip to content

Commit

Permalink
fix(bug): Remove FIQL based filters from list calls
Browse files Browse the repository at this point in the history
FIQL filtering has been deprecated by the APIs for some time now.
We should avoid using it altogether.
  • Loading branch information
thunderboltsid committed Oct 2, 2024
1 parent 78f61d1 commit 6ccc19c
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions controllers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ func GetPEUUID(ctx context.Context, client *prismclientv3.Client, peName, peUUID
}
return *peIntentResponse.Metadata.UUID, nil
} else if peName != nil && *peName != "" {
filter := getFilterForName(*peName)
responsePEs, err := client.V3.ListAllCluster(ctx, filter)
responsePEs, err := client.V3.ListAllCluster(ctx, "")

Check warning on line 203 in controllers/helpers.go

View check run for this annotation

Codecov / codecov/patch

controllers/helpers.go#L203

Added line #L203 was not covered by tests
if err != nil {
return "", err
}
Expand Down Expand Up @@ -261,10 +260,9 @@ func GetSubnetUUID(ctx context.Context, client *prismclientv3.Client, peUUID str
}
}
foundSubnetUUID = *subnetIntentResponse.Metadata.UUID
} else if subnetName != nil {
filter := getFilterForName(*subnetName)
} else { // else search by name

Check warning on line 263 in controllers/helpers.go

View check run for this annotation

Codecov / codecov/patch

controllers/helpers.go#L263

Added line #L263 was not covered by tests
// Not using additional filtering since we want to list overlay and vlan subnets
responseSubnets, err := client.V3.ListAllSubnet(ctx, filter, nil)
responseSubnets, err := client.V3.ListAllSubnet(ctx, "", nil)

Check warning on line 265 in controllers/helpers.go

View check run for this annotation

Codecov / codecov/patch

controllers/helpers.go#L265

Added line #L265 was not covered by tests
if err != nil {
return "", err
}
Expand Down Expand Up @@ -315,9 +313,8 @@ func GetImageUUID(ctx context.Context, client *prismclientv3.Client, imageName,
}
}
foundImageUUID = *imageIntentResponse.Metadata.UUID
} else if imageName != nil {
filter := getFilterForName(*imageName)
responseImages, err := client.V3.ListAllImage(ctx, filter)
} else { // else search by name
responseImages, err := client.V3.ListAllImage(ctx, "")

Check warning on line 317 in controllers/helpers.go

View check run for this annotation

Codecov / codecov/patch

controllers/helpers.go#L316-L317

Added lines #L316 - L317 were not covered by tests
if err != nil {
return "", err
}
Expand Down Expand Up @@ -636,9 +633,8 @@ func GetProjectUUID(ctx context.Context, client *prismclientv3.Client, projectNa
}
}
foundProjectUUID = *projectIntentResponse.Metadata.UUID
} else if projectName != nil {
filter := getFilterForName(*projectName)
responseProjects, err := client.V3.ListAllProject(ctx, filter)
} else { // else search by name
responseProjects, err := client.V3.ListAllProject(ctx, "")

Check warning on line 637 in controllers/helpers.go

View check run for this annotation

Codecov / codecov/patch

controllers/helpers.go#L636-L637

Added lines #L636 - L637 were not covered by tests
if err != nil {
return "", err
}
Expand All @@ -663,10 +659,6 @@ func GetProjectUUID(ctx context.Context, client *prismclientv3.Client, projectNa
return foundProjectUUID, nil
}

func getFilterForName(name string) string {
return fmt.Sprintf("name==%s", name)
}

func hasPEClusterServiceEnabled(peCluster *prismclientv3.ClusterIntentResponse, serviceName string) bool {
if peCluster.Status == nil ||
peCluster.Status.Resources == nil ||
Expand Down

0 comments on commit 6ccc19c

Please sign in to comment.