Skip to content

Commit

Permalink
dashboards_folder, dashboards validations and api updates (#196)
Browse files Browse the repository at this point in the history
* patch - dashboards_folder and dashboards updates
  • Loading branch information
OrNovo authored Feb 1, 2024
1 parent da2c27d commit 78f2d93
Show file tree
Hide file tree
Showing 82 changed files with 14,809 additions and 1,784 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,4 +430,13 @@ Bug fixing:

## Release 1.11.3
Bug fixing:
* adding validation for `env` field.
* adding validation for `env` field.

## Release 1.11.4
New Features:
#### resource/coralogix_dashboards_folder
* Adding support for `coralogix_dashboards_folder` [resource](https://github.com/coralogix/terraform-provider-coralogix/tree/master/docs/resources/dashboards_folder.md) and [data-source](https://github.com/coralogix/terraform-provider-coralogix/tree/master/docs/data-sources/dashboards_folder.md).
#### resource/coralogix_dashboard
* Adding support for `folder`, `annotations` fields.
* Adding support for `data_prime` for `bar_chart`, `data_table` and `pie_chart` widgets.
* adding validation for `env` field.
6 changes: 6 additions & 0 deletions coralogix/clientset/clientset.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type ClientSet struct {
alertsSchedulers *AlertsSchedulersClient
teams *TeamsClient
slos *SLOsClient
dahboardsFolders *DashboardsFoldersClient
}

func (c *ClientSet) RuleGroups() *RuleGroupsClient {
Expand Down Expand Up @@ -93,6 +94,10 @@ func (c *ClientSet) SLOs() *SLOsClient {
return c.slos
}

func (c *ClientSet) DashboardsFolders() *DashboardsFoldersClient {
return c.dahboardsFolders
}

func NewClientSet(targetUrl, apiKey, orgKey string) *ClientSet {
apikeyCPC := NewCallPropertiesCreator(targetUrl, apiKey)
teamsCPC := NewCallPropertiesCreator(targetUrl, orgKey)
Expand All @@ -116,5 +121,6 @@ func NewClientSet(targetUrl, apiKey, orgKey string) *ClientSet {
alertsSchedulers: NewAlertsSchedulersClient(apikeyCPC),
teams: NewTeamsClient(teamsCPC),
slos: NewSLOsClient(apikeyCPC),
dahboardsFolders: NewDashboardsFoldersClient(apikeyCPC),
}
}
67 changes: 67 additions & 0 deletions coralogix/clientset/dashboard-folders-client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package clientset

import (
"context"

dashboards "terraform-provider-coralogix/coralogix/clientset/grpc/dashboards"
)

type DashboardsFoldersClient struct {
callPropertiesCreator *CallPropertiesCreator
}

func (c DashboardsFoldersClient) CreateDashboardsFolder(ctx context.Context, req *dashboards.CreateDashboardFolderRequest) (*dashboards.CreateDashboardFolderResponse, error) {
callProperties, err := c.callPropertiesCreator.GetCallProperties(ctx)
if err != nil {
return nil, err
}

conn := callProperties.Connection
defer conn.Close()
client := dashboards.NewDashboardFoldersServiceClient(conn)

return client.CreateDashboardFolder(callProperties.Ctx, req, callProperties.CallOptions...)
}

func (c DashboardsFoldersClient) GetDashboardsFolders(ctx context.Context, req *dashboards.ListDashboardFoldersRequest) (*dashboards.ListDashboardFoldersResponse, error) {
callProperties, err := c.callPropertiesCreator.GetCallProperties(ctx)
if err != nil {
return nil, err
}

conn := callProperties.Connection
defer conn.Close()
client := dashboards.NewDashboardFoldersServiceClient(conn)

return client.ListDashboardFolders(callProperties.Ctx, req, callProperties.CallOptions...)
}

func (c DashboardsFoldersClient) UpdateDashboardsFolder(ctx context.Context, req *dashboards.ReplaceDashboardFolderRequest) (*dashboards.ReplaceDashboardFolderResponse, error) {
callProperties, err := c.callPropertiesCreator.GetCallProperties(ctx)
if err != nil {
return nil, err
}

conn := callProperties.Connection
defer conn.Close()
client := dashboards.NewDashboardFoldersServiceClient(conn)

return client.ReplaceDashboardFolder(callProperties.Ctx, req, callProperties.CallOptions...)
}

func (c DashboardsFoldersClient) DeleteDashboardsFolder(ctx context.Context, req *dashboards.DeleteDashboardFolderRequest) (*dashboards.DeleteDashboardFolderResponse, error) {
callProperties, err := c.callPropertiesCreator.GetCallProperties(ctx)
if err != nil {
return nil, err
}

conn := callProperties.Connection
defer conn.Close()
client := dashboards.NewDashboardFoldersServiceClient(conn)

return client.DeleteDashboardFolder(callProperties.Ctx, req, callProperties.CallOptions...)
}

func NewDashboardsFoldersClient(c *CallPropertiesCreator) *DashboardsFoldersClient {
return &DashboardsFoldersClient{callPropertiesCreator: c}
}
2 changes: 1 addition & 1 deletion coralogix/clientset/dashboards-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package clientset
import (
"context"

dashboards "terraform-provider-coralogix/coralogix/clientset/grpc/coralogix-dashboards/v1"
dashboards "terraform-provider-coralogix/coralogix/clientset/grpc/dashboards"
)

type DashboardsClient struct {
Expand Down
Loading

0 comments on commit 78f2d93

Please sign in to comment.