client

package
v0.1.47 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// URL for the venafi-cloud backend services
	VenafiCloudProdURL = "https://api.venafi.cloud"
)

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.

func (*APITokenClient) PostDataReadingsWithOptions added in v0.1.44

func (c *APITokenClient) PostDataReadingsWithOptions(readings []*api.DataReading, opts Options) error

PostDataReadingsWithOptions 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
	PostDataReadingsWithOptions(readings []*api.DataReading, options Options) 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 interface {
	IsClientSet() bool
	Validate() error
}

The Credentials interface describes methods for credential types to implement for verification.

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 *OAuthCredentials, 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.

func (*OAuthClient) PostDataReadingsWithOptions added in v0.1.44

func (c *OAuthClient) PostDataReadingsWithOptions(readings []*api.DataReading, opts Options) error

type OAuthCredentials added in v0.1.40

type OAuthCredentials 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"`
}

OAuthCredentials defines the format of the credentials.json file.

func ParseOAuthCredentials added in v0.1.40

func ParseOAuthCredentials(data []byte) (*OAuthCredentials, error)

ParseOAuthCredentials reads credentials into an OAuthCredentials struct. Performs validations.

func (*OAuthCredentials) IsClientSet added in v0.1.40

func (c *OAuthCredentials) IsClientSet() bool

IsClientSet returns whether the client credentials are set or not.

func (*OAuthCredentials) Validate added in v0.1.40

func (c *OAuthCredentials) Validate() error

type Options added in v0.1.44

type Options struct {
	OrgID              string
	ClusterID          string
	ClusterName        string
	ClusterDescription string
}

Options is the struct describing additional information pertinent to an agent that isn't a data reading These fields will then be uploaded together with data readings.

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.

func (*UnauthenticatedClient) PostDataReadingsWithOptions added in v0.1.44

func (c *UnauthenticatedClient) PostDataReadingsWithOptions(readings []*api.DataReading, opts Options) error

type VenafiCloudClient added in v0.1.40

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

The VenafiCloudClient type is a Client implementation used to upload data readings to the Venafi Cloud platform using service account authentication as its authentication method.

This form of authentication follows the Private Key JWT standard found at https://oauth.net/private-key-jwt, which is a combination of two RFCs: * RFC 7521 (Assertion Framework) * RFC 7523 (JWT Profile for Client Authentication)

func NewVenafiCloudClient added in v0.1.40

func NewVenafiCloudClient(agentMetadata *api.AgentMetadata, credentials *VenafiSvcAccountCredentials, baseURL string, uploaderID string, uploadPath string) (*VenafiCloudClient, error)

NewVenafiCloudClient returns a new instance of the VenafiCloudClient type that will perform HTTP requests using a bearer token to authenticate to the backend API.

func (*VenafiCloudClient) Post added in v0.1.40

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

Post performs an HTTP POST request.

func (*VenafiCloudClient) PostDataReadings added in v0.1.40

func (c *VenafiCloudClient) PostDataReadings(_ string, _ string, readings []*api.DataReading) error

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

func (*VenafiCloudClient) PostDataReadingsWithOptions added in v0.1.44

func (c *VenafiCloudClient) PostDataReadingsWithOptions(readings []*api.DataReading, opts Options) error

PostDataReadingsWithOptions uploads the slice of api.DataReading to the Venafi Cloud backend to be processed. The Options are then passed as URL params in the request

type VenafiSvcAccountCredentials added in v0.1.40

type VenafiSvcAccountCredentials struct {
	// ClientID is the service account client ID
	ClientID string `json:"client_id,omitempty"`
	// PrivateKeyFile is the path to the private key file paired to
	// the public key in the service account
	PrivateKeyFile string `json:"private_key_file,omitempty"`
}

func ParseVenafiCredentials added in v0.1.40

func ParseVenafiCredentials(data []byte) (*VenafiSvcAccountCredentials, error)

ParseVenafiCredentials reads credentials into a VenafiSvcAccountCredentials struct. Performs validations.

func (*VenafiSvcAccountCredentials) IsClientSet added in v0.1.40

func (c *VenafiSvcAccountCredentials) IsClientSet() bool

IsClientSet returns whether the client credentials are set or not.

func (*VenafiSvcAccountCredentials) Validate added in v0.1.40

func (c *VenafiSvcAccountCredentials) Validate() error

Jump to

Keyboard shortcuts

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