api

package
v0.0.0-...-9a44728 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GrantTypeDeviceCode        = GrantType(oidc.GrantTypeDeviceCode)
	GrantTypeClientCredentials = GrantType(oidc.GrantTypeClientCredentials)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Login    string `json:"login"`
	Password string `json:"password"`
}

func (*Auth) UnmarshalJSON

func (u *Auth) UnmarshalJSON(data []byte) error

type Entity

type Entity interface {
	GetKind() string
	GetMetadata() Metadata
	GetSpec() any
}

type GrantType

type GrantType oidc.GrantType

GrantType is a subset of the OAuth 2.0 grant types. In our case, we will explicitly need them only in the /token endpoint, that we are using only in the context of device code flow and client credentials flow.

type Metadata

type Metadata interface {
	GetName() string
	Flatten(sensitive bool)
}

type Migrate

type Migrate struct {
	Input                map[string]string `json:"input,omitempty"`
	GrafanaDashboard     json.RawMessage   `json:"grafanaDashboard"`
	UseDefaultDatasource bool              `json:"useDefaultDatasource,omitempty"`
}

func (*Migrate) UnmarshalJSON

func (m *Migrate) UnmarshalJSON(data []byte) error

type OAuthError

type OAuthError struct {
	ErrorCode        string `json:"error"`
	ErrorDescription string `json:"error_description"`
}

OAuthError represents the error response of a possible oauth endpoint. It is used to control the error type in the response of the backend request (client and server side) It helps for example when polling device access token to know if the device code is still valid, or if we need to slow down, etc ... Refs: https://www.rfc-editor.org/rfc/rfc8628#section-3.5 https://www.rfc-editor.org/rfc/rfc6749#section-5.2

func (*OAuthError) Error

func (e *OAuthError) Error() string

Error makes it an error, which can be convenient.

type PublicAuth

type PublicAuth struct {
	Login    string        `json:"login"`
	Password secret.Hidden `json:"password"`
}

func NewPublicAuth

func NewPublicAuth(auth *Auth) *PublicAuth

type RefreshRequest

type RefreshRequest struct {
	RefreshToken string `json:"refresh_token"`
}

RefreshRequest represents the request used to refresh an access token from a refresh token. Disclaimer: This is an exception to the general camelCase convention in the project, to respect oauth 2.0 specs. -> https://datatracker.ietf.org/doc/html/rfc6749#section-6

func (*RefreshRequest) UnmarshalJSON

func (r *RefreshRequest) UnmarshalJSON(data []byte) error

type TokenRequest

type TokenRequest struct {
	GrantType    GrantType `json:"grant_type"`
	DeviceCode   string    `json:"device_code"`
	ClientID     string    `json:"client_id"`
	ClientSecret string    `json:"client_secret"`
}

TokenRequest represents the body of a /token endpoint request. DeviceCode or ClientID, ClientSecret will be necessary based on the grant type.

func (*TokenRequest) UnmarshalJSON

func (r *TokenRequest) UnmarshalJSON(data []byte) error

Directories

Path Synopsis
v1

Jump to

Keyboard shortcuts

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