Skip to content

Commit

Permalink
Archive setup (#181)
Browse files Browse the repository at this point in the history
* patch - archive_retentions
  • Loading branch information
OrNovo authored Dec 17, 2023
1 parent 28d3a24 commit a49ff57
Show file tree
Hide file tree
Showing 22 changed files with 3,021 additions and 21 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,4 +375,9 @@ Breaking Changes:
## Release 1.10.4
Breaking Changes:
#### resource/coralogix_tco_policy_overrides
* the resource was deprecated and removed.
* the resource was deprecated and removed.

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

import (
"context"

archiveRetention "terraform-provider-coralogix/coralogix/clientset/grpc/archive-retentions"
)

type ArchiveRetentionsClient struct {
callPropertiesCreator *CallPropertiesCreator
}

func (c ArchiveRetentionsClient) GetRetentions(ctx context.Context, req *archiveRetention.GetRetentionsRequest) (*archiveRetention.GetRetentionsResponse, error) {
callProperties, err := c.callPropertiesCreator.GetCallProperties(ctx)
if err != nil {
return nil, err
}

conn := callProperties.Connection
defer conn.Close()
client := archiveRetention.NewRetentionsServiceClient(conn)

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

func (c ArchiveRetentionsClient) UpdateRetentions(ctx context.Context, req *archiveRetention.UpdateRetentionsRequest) (*archiveRetention.UpdateRetentionsResponse, error) {
callProperties, err := c.callPropertiesCreator.GetCallProperties(ctx)
if err != nil {
return nil, err
}

conn := callProperties.Connection
defer conn.Close()
client := archiveRetention.NewRetentionsServiceClient(conn)

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

func (c ArchiveRetentionsClient) ActivateRetentions(ctx context.Context, req *archiveRetention.ActivateRetentionsRequest) (*archiveRetention.ActivateRetentionsResponse, error) {
callProperties, err := c.callPropertiesCreator.GetCallProperties(ctx)
if err != nil {
return nil, err
}

conn := callProperties.Connection
defer conn.Close()
client := archiveRetention.NewRetentionsServiceClient(conn)

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

func (c ArchiveRetentionsClient) GetRetentionsEnabled(ctx context.Context, req *archiveRetention.GetRetentionsEnabledRequest) (*archiveRetention.GetRetentionsEnabledResponse, error) {
callProperties, err := c.callPropertiesCreator.GetCallProperties(ctx)
if err != nil {
return nil, err
}

conn := callProperties.Connection
defer conn.Close()
client := archiveRetention.NewRetentionsServiceClient(conn)

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

func NewArchiveRetentionsClient(c *CallPropertiesCreator) *ArchiveRetentionsClient {
return &ArchiveRetentionsClient{callPropertiesCreator: c}
}
7 changes: 7 additions & 0 deletions coralogix/clientset/clientset.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type ClientSet struct {
webhooks *WebhooksClient
events2Metrics *Events2MetricsClient
slis *SLIClient
archiveRetentions *ArchiveRetentionsClient
}

func (c *ClientSet) RuleGroups() *RuleGroupsClient {
Expand Down Expand Up @@ -68,6 +69,11 @@ func (c *ClientSet) SLIs() *SLIClient {
return c.slis
}

func (c *ClientSet) ArchiveRetentions() *ArchiveRetentionsClient {
return c.archiveRetentions

}

func NewClientSet(targetUrl, apiKey, teamsApiKey string) *ClientSet {
apikeyCPC := NewCallPropertiesCreator(targetUrl, apiKey)
_ = NewCallPropertiesCreator(targetUrl, teamsApiKey)
Expand All @@ -86,5 +92,6 @@ func NewClientSet(targetUrl, apiKey, teamsApiKey string) *ClientSet {
tcoPoliciesOverrides: NewTCOPoliciesOverridesClient(apikeyCPC),
webhooks: NewWebhooksClient(apikeyCPC),
slis: NewSLIsClient(apikeyCPC),
archiveRetentions: NewArchiveRetentionsClient(apikeyCPC),
}
}
189 changes: 189 additions & 0 deletions coralogix/clientset/grpc/archive-retentions/retention.pb.go

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

Loading

0 comments on commit a49ff57

Please sign in to comment.