Skip to content

Commit

Permalink
Merge pull request #236 from calyptia/create-pull-request/patch
Browse files Browse the repository at this point in the history
update types/spec/client to v1.4.7
  • Loading branch information
niedbalski authored Sep 5, 2023
2 parents 8c5073b + 961b258 commit e110787
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
24 changes: 22 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"io"
"net/http"
"net/url"
"os"

"github.com/peterhellberg/link"
"gopkg.in/yaml.v2"
Expand All @@ -18,8 +19,11 @@ import (

const (
// DefaultBaseURL of the API.
DefaultBaseURL = "https://cloud-api.calyptia.com"
uintBase = 10
DefaultBaseURL = "https://cloud-api.calyptia.com"
uintBase = 10
CalyptiaEnvAPIURL = "CALYPTIA_API_URL"
//nolint: gosec // no credential leaks just a variable.
CalyptiaEnvAPIToken = "CALYPTIA_API_TOKEN"
)

// Client is the client over the REST HTTP API of Calyptia Cloud.
Expand All @@ -41,6 +45,22 @@ func New() *Client {
}
}

// NewFromEnv creates a new client using default environment variables.
func NewFromEnv() *Client {
c := New()

// Update the BaseURL if environment variable is set
if apiURL := os.Getenv(CalyptiaEnvAPIURL); apiURL != "" {
c.BaseURL = apiURL
}

// Set the ProjectToken if environment variable is set
if token := os.Getenv(CalyptiaEnvAPIToken); token != "" {
c.SetProjectToken(token)
}
return c
}

// SetUserAgent sets the "User-Agent" header of the client.
func (c *Client) SetUserAgent(s string) {
c.userAgent = s
Expand Down
13 changes: 13 additions & 0 deletions spec/open-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3953,6 +3953,19 @@ components:
example: "My template"
definition:
$ref: "#/components/schemas/ProcessingRuleDef"
pipelineVersion:
type: string
example: v1.3.5
description: semver version of core-fluent-bit is running
input:
type: string
example: {"log": "line 2"}
maxLength: 1048576
minimum: 1
description: input to use as an example for the processing rule template
isRawInput:
type: boolean
description: define if the input parameter is in raw or json format (false)
createdAt:
type: string
format: date-time
Expand Down

0 comments on commit e110787

Please sign in to comment.