Documentation
¶
Index ¶
- func Exhaust(resp *http.Response)
- func GetJSON(client HTTPClient, headers http.Header, path *url.URL, data interface{}, ...) error
- func GetPaginatedJSON(client HTTPClient, headers http.Header, path *url.URL, p Paginator, ...) error
- func PostJSON(client HTTPClient, headers http.Header, path *url.URL, data interface{}) (http.Header, []byte, error)
- func PutJSON(client HTTPClient, headers http.Header, path *url.URL, data interface{}) (http.Header, []byte, error)
- func Query(client HTTPClient, method string, headers http.Header, path *url.URL, ...) (http.Header, error)
- func Update(client HTTPClient, method string, headers http.Header, path *url.URL, ...) (http.Header, []byte, error)
- type Backoff
- type DecodeError
- type ExponentialBackoff
- type HTTPClient
- type Keystone
- func (k *Keystone) Domains(client HTTPClient, headers http.Header, enabled bool) ([]models.Domain, error)
- func (k *Keystone) GroupRoles(client HTTPClient, headers http.Header, gids []string, skipErrors bool) ([]models.RoleAssignment, error)
- func (k *Keystone) Groups(client HTTPClient, headers http.Header) ([]models.Group, error)
- func (o *Keystone) Headers(subservice, token string) http.Header
- func (o *Keystone) Login(client HTTPClient, password string, retries Backoff) (string, string, error)
- func (k *Keystone) MyDomain(client HTTPClient, headers http.Header) (string, string, error)
- func (k *Keystone) PostAssignments(client HTTPClient, headers http.Header, assignments []models.RoleAssignment) error
- func (k *Keystone) PostGroups(client HTTPClient, headers http.Header, groups []models.Group) error
- func (k *Keystone) PostProjects(client HTTPClient, headers http.Header, projects []models.Project) error
- func (k *Keystone) PostUsers(client HTTPClient, headers http.Header, users []models.User) error
- func (k *Keystone) Projects(client HTTPClient, headers http.Header) ([]models.Project, error)
- func (k *Keystone) Roles(client HTTPClient, headers http.Header) ([]models.Role, error)
- func (k *Keystone) UserRoles(client HTTPClient, headers http.Header, uids []string, skipErrors bool) ([]models.RoleAssignment, error)
- func (k *Keystone) Users(client HTTPClient, headers http.Header) ([]models.User, error)
- type LinealBackoff
- type NetError
- type Paginator
- type SlicePaginator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetJSON ¶
func GetJSON(client HTTPClient, headers http.Header, path *url.URL, data interface{}, allowUnknownFields bool) error
GetJSON is a convenience wrapper for Query(client, http.MethodGet, ...) TODO: Add a variant with pagination support
func GetPaginatedJSON ¶
func GetPaginatedJSON(client HTTPClient, headers http.Header, path *url.URL, p Paginator, allowUnknownFields bool, maximum int) error
GetPaginatedJSON is a convenience wrapper for Query(client, http.MethodGet, ...)
func PostJSON ¶
func PostJSON(client HTTPClient, headers http.Header, path *url.URL, data interface{}) (http.Header, []byte, error)
PostJSON is a convenience wrapper for Update(client, http.MethodPost, ...)
func PutJSON ¶
func PutJSON(client HTTPClient, headers http.Header, path *url.URL, data interface{}) (http.Header, []byte, error)
PutJSON is a convenience wrapper for Update(client, http.MethodPut, ...)
Types ¶
type DecodeError ¶
type DecodeError struct {
Type interface{}
Data json.RawMessage
Err error
}
DecodeError returned when failed to decode json data
type ExponentialBackoff ¶
type ExponentialBackoff struct {
MaxRetries int
InitialDelay time.Duration
DelayFactor float64
MaxDelay time.Duration
}
ExponentialBackoff performs exponential backoff
func (ExponentialBackoff) KeepTrying ¶
func (l ExponentialBackoff) KeepTrying(retries int) (bool, time.Duration)
KeepTrying implements Retry
type HTTPClient ¶
HTTPClient encapsulates the funcionality required from *http.Client.
type Keystone ¶
Keystone manages Requests to the Identity Manager
func (*Keystone) GroupRoles ¶
func (k *Keystone) GroupRoles(client HTTPClient, headers http.Header, gids []string, skipErrors bool) ([]models.RoleAssignment, error)
func (*Keystone) Login ¶
func (o *Keystone) Login(client HTTPClient, password string, retries Backoff) (string, string, error)
Login into the Context Broker, get a session token
func (*Keystone) PostAssignments ¶
func (k *Keystone) PostAssignments(client HTTPClient, headers http.Header, assignments []models.RoleAssignment) error
func (*Keystone) PostGroups ¶
func (*Keystone) PostProjects ¶
type LinealBackoff ¶
LinealBackoff performs lineal backoff
func (LinealBackoff) KeepTrying ¶
func (l LinealBackoff) KeepTrying(retries int) (bool, time.Duration)
KeepTrying implements Retry
type NetError ¶
type NetError struct {
Req http.Request
StatusCode int
RespHeaders http.Header
Resp []byte
Err error
}
NetError describes an error performing a request
type Paginator ¶
type Paginator interface {
Append(item json.RawMessage, allowUnknownFields bool) error
}
type SlicePaginator ¶
type SlicePaginator[T any] struct { Slice []T }
SlicePaginator is a generic type of Paginator based on a slice
func NewPaginator ¶
func NewPaginator[T any](slice []T) *SlicePaginator[T]
NewPaginator creates a new paginator backed by the given slice
func (*SlicePaginator[T]) Append ¶
func (s *SlicePaginator[T]) Append(raw json.RawMessage, allowUnknownFields bool) error
Append implements Paginator