Skip to content

Commit

Permalink
remove NewQuery()
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismarget-j committed Aug 19, 2023
1 parent 92821ce commit 8693c18
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
9 changes: 3 additions & 6 deletions apstra/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1215,11 +1215,6 @@ func (o *Client) DeleteTemplate(ctx context.Context, id ObjectId) error {
return o.deleteTemplate(ctx, id)
}

// NewQuery returns a *PathQuery with embedded *Client
func (o *Client) NewQuery(blueprint ObjectId) *PathQuery {
return o.newQuery(blueprint)
}

// ListAllInterfaceMapIds returns []ObjectId representing all interface maps
func (o *Client) ListAllInterfaceMapIds(ctx context.Context) ([]ObjectId, error) {
return o.listAllInterfaceMapIds(ctx)
Expand Down Expand Up @@ -1674,7 +1669,9 @@ func (o *Client) BlueprintOverlayControlProtocol(ctx context.Context, id ObjectI
} `json:"items"`
}

query := o.NewQuery(id).
query := new(PathQuery).
SetBlueprintId(id).
SetClient(o).
Node([]QEEAttribute{
{"type", QEStringVal("virtual_network_policy")},
{"name", QEStringVal("n_virtual_network_policy")},
Expand Down
6 changes: 4 additions & 2 deletions apstra/query_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ func TestParsingQueryInfo(t *testing.T) {
} `json:"n_system"`
} `json:"items"`
}
log.Printf("testing NewQuery() against %s %s (%s)", client.clientType, clientName, client.client.ApiVersion())
err = client.client.NewQuery(bpClient.Id()).
log.Printf("testing PathQuery.Do() against %s %s (%s)", client.clientType, clientName, client.client.ApiVersion())
err = new(PathQuery).
SetClient(bpClient.client).
SetBlueprintId(bpClient.Id()).
Node([]QEEAttribute{
{"type", QEStringVal("system")},
{"name", QEStringVal("n_system")},
Expand Down
15 changes: 9 additions & 6 deletions apstra/two_stage_l3_clos_virtual_networks_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,15 @@ func TestCreateUpdateDeleteVirtualNetwork(t *testing.T) {
} `json:"items"`
}

query := client.client.NewQuery(bpClient.Id()).Node([]QEEAttribute{
{"type", QEStringVal("system")},
{"system_type", QEStringVal("switch")},
{"role", QEStringVal("leaf")},
{"name", QEStringVal("system")},
})
query := new(PathQuery).
SetClient(client.client).
SetBlueprintId(bpClient.Id()).
Node([]QEEAttribute{
{"type", QEStringVal("system")},
{"system_type", QEStringVal("switch")},
{"role", QEStringVal("leaf")},
{"name", QEStringVal("system")},
})

err = query.Do(ctx, &result)
if err != nil {
Expand Down

0 comments on commit 8693c18

Please sign in to comment.