kiali

package
v0.0.0-...-e779149 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthURL            = "%s/kiali/api/authenticate"
	KialiTokenCacheKey = "kubesphere:kubesphere:kiali"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Strategy Strategy

	ServiceToken string
	Host         string
	// contains filtered or unexported fields
}

Kiali Client

func NewClient

func NewClient(strategy Strategy,
	cache cache.Interface,
	client HttpClient,
	serviceToken string,
	host string) *Client

NewClient creates an instance of Kiali Client.

func NewDefaultClient

func NewDefaultClient(
	cache cache.Interface,
	serviceToken string,
	host string) *Client

NewDefaultClient creates an instance of Kiali Client with default http settings.

func (*Client) Get

func (c *Client) Get(url string) (resp *http.Response, err error)

Get issues a GET to the Kiali server with the url.

func (*Client) SetToken

func (c *Client) SetToken(req *http.Request) error

SetToken gets token from the Kiali server/cache and sets Bearer token to the request header.

type HttpClient

type HttpClient interface {
	// Do is an interface of http client Do method,
	// that sends an HTTP request and returns an HTTP response.
	Do(req *http.Request) (*http.Response, error)

	// PostForm is an interface of http client PostForm method,
	// that issues a POST to the specified URL.
	PostForm(url string, data url.Values) (resp *http.Response, err error)
}

type MockClient

type MockClient struct {
	TokenResult   []byte
	RequestResult string
}

func (*MockClient) Do

func (c *MockClient) Do(req *http.Request) (*http.Response, error)

func (*MockClient) PostForm

func (c *MockClient) PostForm(url string, data url.Values) (resp *http.Response, err error)

type Strategy

type Strategy string

Kiali Authentication Strategy

const (
	AuthStrategyToken     Strategy = "token"
	AuthStrategyAnonymous Strategy = "anonymous"
)

type TokenResponse

type TokenResponse struct {
	// The username for the token
	Username string `json:"username"`
	// The authentication token
	Token string `json:"token"`
	// The expired time for the token
	ExpiresOn string `json:"expiresOn"`
}

Kiali token Response

Jump to

Keyboard shortcuts

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