diff --git a/apstra/api_iba_dashboards.go b/apstra/api_iba_dashboards.go index 19faf82..374d8af 100644 --- a/apstra/api_iba_dashboards.go +++ b/apstra/api_iba_dashboards.go @@ -196,10 +196,11 @@ func (o *Client) getIbaDashboardByLabel(ctx context.Context, blueprintId ObjectI func (o *Client) createIbaDashboard(ctx context.Context, blueprintId ObjectId, in *IbaDashboardData) (ObjectId, error) { var response objectIdResponse if in.UpdatedBy != "" { - return "", errors.New("UpdatedBy is set by Apstra") + return "", errors.New("attempt to create dashboard with non-empty updated_by value - this value can be set only by the server") } if in.PredefinedDashboard != "" { - return "", errors.New("to instantiate predefined dashboard, please use InstantiatePredefinedDashboard") + return "", errors.New("attempt to create dashboard with non-empty predefined_dashboard value - this value can " + + "be set only by the server, and only when a dashboard is instantiated from a predefined template") } err := o.talkToApstra(ctx, &talkToApstraIn{ method: http.MethodPost, @@ -251,8 +252,14 @@ func (o *Client) createIbaDashboard(ctx context.Context, blueprintId ObjectId, i } func (o *Client) updateIbaDashboard(ctx context.Context, blueprintId ObjectId, id ObjectId, in *IbaDashboardData) error { - in.UpdatedBy = "" - in.PredefinedDashboard = "" + if in.UpdatedBy != "" { + return errors.New("attempt to update dashboard with non-empty updated_by value - this value can be set only by the server") + } + if in.PredefinedDashboard != "" { + return errors.New("attempt to update dashboard with non-empty predefined_dashboard value - this value can " + + "be set only by the server, and only when a dashboard is instantiated from a predefined template") + } + err := o.talkToApstra(ctx, &talkToApstraIn{ method: http.MethodPut, urlStr: fmt.Sprintf(apiUrlIbaDashboardsById, blueprintId, id), apiInput: in, }) diff --git a/apstra/api_iba_dashboards_test.go b/apstra/api_iba_dashboards_test.go index f23eca5..2333e4a 100644 --- a/apstra/api_iba_dashboards_test.go +++ b/apstra/api_iba_dashboards_test.go @@ -47,9 +47,6 @@ func TestCreateReadUpdateDeleteIbaDashboards(t *testing.T) { } id, err := bpClient.InstantiateIbaPredefinedDashboard(ctx, d, d.String()) - if err != nil { - t.Log(err) - } require.NoError(t, err) t.Logf("Name :%s Created Id :%s", d, id)