Skip to content

Commit

Permalink
Alerts scheduler (#186)
Browse files Browse the repository at this point in the history
* patch - alerts_scheduler
  • Loading branch information
OrNovo authored Jan 10, 2024
1 parent 4449a55 commit 157e665
Show file tree
Hide file tree
Showing 28 changed files with 6,145 additions and 9 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,4 +386,9 @@ New Features:
New Features:
#### resource/coralogix_archive_logs
* Adding support for `coralogix_archive_logs` [resource](https://github.com/coralogix/terraform-provider-coralogix/tree/master/docs/resources/archive_logs.md) and [data-source](https://github.com/coralogix/terraform-provider-coralogix/tree/master/docs/data-sources/archive_logs.md).
* Adding support for `coralogix_archive_metrics` [resource](https://github.com/coralogix/terraform-provider-coralogix/tree/master/docs/resources/archive_metrics.md) and [data-source](https://github.com/coralogix/terraform-provider-coralogix/tree/master/docs/data-sources/archive_metrics.md).
* Adding support for `coralogix_archive_metrics` [resource](https://github.com/coralogix/terraform-provider-coralogix/tree/master/docs/resources/archive_metrics.md) and [data-source](https://github.com/coralogix/terraform-provider-coralogix/tree/master/docs/data-sources/archive_metrics.md).

## Release 1.10.9
New Features:
#### resource/coralogix_archive_retentions
* Adding support for `coralogix_archive_retentions` [resource](https://github.com/coralogix/terraform-provider-coralogix/tree/master/docs/resources/alerts_scheduler.md) and [data-source](https://github.com/coralogix/terraform-provider-coralogix/tree/master/docs/data-sources/alerts_scheduler.md).
67 changes: 67 additions & 0 deletions coralogix/clientset/alerts-scheduler-client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package clientset

import (
"context"

alertsSchedulers "terraform-provider-coralogix/coralogix/clientset/grpc/alerts-scheduler"
)

type AlertsSchedulersClient struct {
callPropertiesCreator *CallPropertiesCreator
}

func (c AlertsSchedulersClient) CreateAlertScheduler(ctx context.Context, req *alertsSchedulers.CreateAlertSchedulerRuleRequest) (*alertsSchedulers.CreateAlertSchedulerRuleResponse, error) {
callProperties, err := c.callPropertiesCreator.GetCallProperties(ctx)
if err != nil {
return nil, err
}

conn := callProperties.Connection
defer conn.Close()
client := alertsSchedulers.NewAlertSchedulerRuleServiceClient(conn)

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

func (c AlertsSchedulersClient) GetAlertScheduler(ctx context.Context, req *alertsSchedulers.GetAlertSchedulerRuleRequest) (*alertsSchedulers.GetAlertSchedulerRuleResponse, error) {
callProperties, err := c.callPropertiesCreator.GetCallProperties(ctx)
if err != nil {
return nil, err
}

conn := callProperties.Connection
defer conn.Close()
client := alertsSchedulers.NewAlertSchedulerRuleServiceClient(conn)

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

func (c AlertsSchedulersClient) UpdateAlertScheduler(ctx context.Context, req *alertsSchedulers.UpdateAlertSchedulerRuleRequest) (*alertsSchedulers.UpdateAlertSchedulerRuleResponse, error) {
callProperties, err := c.callPropertiesCreator.GetCallProperties(ctx)
if err != nil {
return nil, err
}

conn := callProperties.Connection
defer conn.Close()
client := alertsSchedulers.NewAlertSchedulerRuleServiceClient(conn)

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

func (c AlertsSchedulersClient) DeleteAlertScheduler(ctx context.Context, req *alertsSchedulers.DeleteAlertSchedulerRuleRequest) (*alertsSchedulers.DeleteAlertSchedulerRuleResponse, error) {
callProperties, err := c.callPropertiesCreator.GetCallProperties(ctx)
if err != nil {
return nil, err
}

conn := callProperties.Connection
defer conn.Close()
client := alertsSchedulers.NewAlertSchedulerRuleServiceClient(conn)

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

func NewAlertsSchedulersClient(c *CallPropertiesCreator) *AlertsSchedulersClient {
return &AlertsSchedulersClient{callPropertiesCreator: c}
}
6 changes: 6 additions & 0 deletions coralogix/clientset/clientset.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type ClientSet struct {
archiveRetentions *ArchiveRetentionsClient
archiveMetrics *ArchiveMetricsClient
archiveLogs *ArchiveLogsClient
alertsSchedulers *AlertsSchedulersClient
}

func (c *ClientSet) RuleGroups() *RuleGroupsClient {
Expand Down Expand Up @@ -84,6 +85,10 @@ func (c *ClientSet) ArchiveLogs() *ArchiveLogsClient {
return c.archiveLogs
}

func (c *ClientSet) AlertSchedulers() *AlertsSchedulersClient {
return c.alertsSchedulers
}

func NewClientSet(targetUrl, apiKey, teamsApiKey string) *ClientSet {
apikeyCPC := NewCallPropertiesCreator(targetUrl, apiKey)
_ = NewCallPropertiesCreator(targetUrl, teamsApiKey)
Expand All @@ -105,5 +110,6 @@ func NewClientSet(targetUrl, apiKey, teamsApiKey string) *ClientSet {
archiveRetentions: NewArchiveRetentionsClient(apikeyCPC),
archiveMetrics: NewArchiveMetricsClient(apikeyCPC),
archiveLogs: NewArchiveLogsClient(apikeyCPC),
alertsSchedulers: NewAlertsSchedulersClient(apikeyCPC),
}
}
171 changes: 171 additions & 0 deletions coralogix/clientset/grpc/alerts-scheduler/active_timeframe.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 157e665

Please sign in to comment.