client

package
v0.1.35 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ClientID is the auth0 client identifier (injected at build time)
	ClientID string

	// ClientSecret is the auth0 client secret (injected at build time)
	ClientSecret string

	// AuthServerDomain is the auth0 domain (injected at build time)
	AuthServerDomain string
)

Functions

This section is empty.

Types

type APITokenClient added in v0.1.33

type APITokenClient struct {
	// contains filtered or unexported fields
}

The APITokenClient type is a Client implementation used to upload data readings to the Jetstack Secure platform using API tokens as its authentication method.

func NewAPITokenClient added in v0.1.33

func NewAPITokenClient(agentMetadata *api.AgentMetadata, apiToken, baseURL string) (*APITokenClient, error)

NewAPITokenClient returns a new instance of the APITokenClient type that will perform HTTP requests using the provided API token for authentication.

func (*APITokenClient) Post added in v0.1.33

func (c *APITokenClient) Post(path string, body io.Reader) (*http.Response, error)

Post performs an HTTP POST request.

func (*APITokenClient) PostDataReadings added in v0.1.33

func (c *APITokenClient) PostDataReadings(orgID, clusterID string, readings []*api.DataReading) error

PostDataReadings uploads the slice of api.DataReading to the Jetstack Secure backend to be processed for later viewing in the user-interface.

type Client added in v0.1.33

type Client interface {
	PostDataReadings(orgID, clusterID string, readings []*api.DataReading) error
	Post(path string, body io.Reader) (*http.Response, error)
}

The Client interface describes types that perform requests against the Jetstack Secure backend.

type Credentials

type Credentials struct {
	// UserID is the ID or email for the user or service account.
	UserID string `json:"user_id"`
	// UserSecret is the secret for the user or service account.
	UserSecret string `json:"user_secret"`
	// The following fields are optional as the default behaviour
	// is to use the equivalent variables defined at package level
	// and injected at build time.
	// ClientID is the oauth2 client ID.
	ClientID string `json:"client_id,omitempty"`
	// ClientSecret is the oauth2 client secret.
	ClientSecret string `json:"client_secret,omitempty"`
	// AuthServerDomain is the domain for the auth server.
	AuthServerDomain string `json:"auth_server_domain,omitempty"`
}

Credentials defines the format of the credentials.json file.

func ParseCredentials

func ParseCredentials(data []byte) (*Credentials, error)

ParseCredentials reads credentials into a struct used. Performs validations.

func (*Credentials) IsClientSet

func (c *Credentials) IsClientSet() bool

IsClientSet returns whether the client credentials are set or not.

type OAuthClient added in v0.1.33

type OAuthClient struct {
	// contains filtered or unexported fields
}

The OAuthClient type is a Client implementation used to upload data readings to the Jetstack Secure platform using OAuth as its authentication method.

func NewOAuthClient added in v0.1.33

func NewOAuthClient(agentMetadata *api.AgentMetadata, credentials *Credentials, baseURL string) (*OAuthClient, error)

NewOAuthClient returns a new instance of the OAuthClient type that will perform HTTP requests using OAuth to provide authentication tokens to the backend API.

func (*OAuthClient) Post added in v0.1.33

func (c *OAuthClient) Post(path string, body io.Reader) (*http.Response, error)

Post performs an HTTP POST request.

func (*OAuthClient) PostDataReadings added in v0.1.33

func (c *OAuthClient) PostDataReadings(orgID, clusterID string, readings []*api.DataReading) error

PostDataReadings uploads the slice of api.DataReading to the Jetstack Secure backend to be processed for later viewing in the user-interface.

type UnauthenticatedClient added in v0.1.33

type UnauthenticatedClient struct {
	// contains filtered or unexported fields
}

The UnauthenticatedClient type is a Client implementation used to upload data readings to the Jetstack Secure platform using no authentication method.

func NewUnauthenticatedClient added in v0.1.33

func NewUnauthenticatedClient(agentMetadata *api.AgentMetadata, baseURL string) (*UnauthenticatedClient, error)

NewUnauthenticatedClient returns a new instance of the UnauthenticatedClient type that will perform HTTP requests using no authentication.

func (*UnauthenticatedClient) Post added in v0.1.33

func (c *UnauthenticatedClient) Post(path string, body io.Reader) (*http.Response, error)

Post performs an HTTP POST request.

func (*UnauthenticatedClient) PostDataReadings added in v0.1.33

func (c *UnauthenticatedClient) PostDataReadings(orgID, clusterID string, readings []*api.DataReading) error

PostDataReadings uploads the slice of api.DataReading to the Jetstack Secure backend to be processed for later viewing in the user-interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL