-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[create-pull-request] automated change (#285)
Co-authored-by: nicolasparada <[email protected]>
- Loading branch information
1 parent
cade88a
commit d399f41
Showing
8 changed files
with
689 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package client | ||
|
||
import ( | ||
"context" | ||
"net/http" | ||
"net/url" | ||
"strconv" | ||
|
||
"github.com/calyptia/api/types" | ||
"github.com/calyptia/api/types/legacy" | ||
) | ||
|
||
func (c *Client) CreateProcessingRuleV1(ctx context.Context, in legacy.CreateProcessingRule) (legacy.CreatedProcessingRule, error) { | ||
var out legacy.CreatedProcessingRule | ||
return out, c.do(ctx, http.MethodPost, "/v1/pipelines/"+url.PathEscape(in.PipelineID)+"/processing_rules", in, &out) | ||
} | ||
|
||
func (c *Client) ProcessingRulesV1(ctx context.Context, params legacy.ProcessingRulesParams) (legacy.ProcessingRules, error) { | ||
var out legacy.ProcessingRules | ||
q := url.Values{} | ||
if params.Last != nil { | ||
q.Set("last", strconv.FormatUint(uint64(*params.Last), uintBase)) | ||
} | ||
if params.Before != nil { | ||
q.Set("before", *params.Before) | ||
} | ||
path := "/v1/pipelines/" + url.PathEscape(params.PipelineID) + "/processing_rules?" + q.Encode() | ||
return out, c.do(ctx, http.MethodGet, path, nil, &out.Items, withCursor(&out.EndCursor)) | ||
} | ||
|
||
func (c *Client) ProcessingRuleV1(ctx context.Context, processingRuleID string) (legacy.ProcessingRule, error) { | ||
var out legacy.ProcessingRule | ||
return out, c.do(ctx, http.MethodGet, "/v1/processing_rules/"+url.PathEscape(processingRuleID), nil, &out) | ||
} | ||
|
||
func (c *Client) UpdateProcessingRuleV1(ctx context.Context, in legacy.UpdateProcessingRule) (types.Updated, error) { | ||
var out types.Updated | ||
return out, c.do(ctx, http.MethodPatch, "/v1/processing_rules/"+url.PathEscape(in.ProcessingRuleID), in, &out) | ||
} | ||
|
||
func (c *Client) DeleteProcessingRuleV1(ctx context.Context, processingRuleID string) error { | ||
return c.do(ctx, http.MethodDelete, "/v1/processing_rules/"+url.PathEscape(processingRuleID), nil, nil) | ||
} | ||
|
||
func (c *Client) PreviewProcessingRuleV1(ctx context.Context, in legacy.PreviewProcessingRule) ([]types.FluentBitLog, error) { | ||
var out []types.FluentBitLog | ||
return out, c.do(ctx, http.MethodPost, "/v1/preview_processing_rule", in, &out) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.