Skip to content

Commit

Permalink
formatting, error upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismarget-j committed Jan 24, 2025
1 parent 76dba50 commit 185594a
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions apstra/two_stage_l3_clos_configlet.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,19 @@ func (o *TwoStageL3ClosConfiglet) UnmarshalJSON(bytes []byte) error {
}

func (o *TwoStageL3ClosClient) getAllConfiglets(ctx context.Context) ([]TwoStageL3ClosConfiglet, error) {
response := &struct {
var response struct {
Items []TwoStageL3ClosConfiglet `json:"items"`
}{}
}

err := o.client.talkToApstra(ctx, &talkToApstraIn{
method: http.MethodGet,
urlStr: fmt.Sprintf(apiUrlBlueprintConfiglets, o.blueprintId.String()),
apiResponse: response,
apiResponse: &response,
})
if err != nil {
return nil, convertTtaeToAceWherePossible(err)
}

return response.Items, nil
}

Expand All @@ -73,10 +75,12 @@ func (o *TwoStageL3ClosClient) getAllConfigletIds(ctx context.Context) ([]Object
if err != nil {
return nil, convertTtaeToAceWherePossible(err)
}

ids := make([]ObjectId, len(configlets))
for i, c := range configlets {
ids[i] = c.Id
}

return ids, nil
}

Expand All @@ -90,6 +94,7 @@ func (o *TwoStageL3ClosClient) getConfiglet(ctx context.Context, id ObjectId) (*
if err != nil {
return nil, convertTtaeToAceWherePossible(err)
}

return &response, nil
}

Expand Down Expand Up @@ -135,6 +140,7 @@ func (o *TwoStageL3ClosClient) createConfiglet(ctx context.Context, in *TwoStage
if err != nil {
return "", convertTtaeToAceWherePossible(err)
}

return response.Id, nil
}

Expand All @@ -147,12 +153,18 @@ func (o *TwoStageL3ClosClient) updateConfiglet(ctx context.Context, id ObjectId,
if err != nil {
return convertTtaeToAceWherePossible(err)
}

return nil
}

func (o *TwoStageL3ClosClient) deleteConfiglet(ctx context.Context, id ObjectId) error {
return o.client.talkToApstra(ctx, &talkToApstraIn{
err := o.client.talkToApstra(ctx, &talkToApstraIn{
method: http.MethodDelete,
urlStr: fmt.Sprintf(apiUrlBlueprintConfigletsById, o.blueprintId.String(), id.String()),
})
if err != nil {
return convertTtaeToAceWherePossible(err)
}

return nil
}

0 comments on commit 185594a

Please sign in to comment.