api

package
v0.5.10 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnauthorized refers to the http response code unauthorized, which really means not authenticated, despite its name. See https://stackoverflow.com/a/6937030/155585
	ErrUnauthorized = fmt.Errorf("unauthorized")
	// ErrForbidden means you don't have permissions to the requested resource
	ErrForbidden = fmt.Errorf("forbidden")

	ErrDuplicate  = fmt.Errorf("duplicate record")
	ErrNotFound   = fmt.Errorf("record not found")
	ErrBadRequest = fmt.Errorf("bad request")
	ErrInternal   = fmt.Errorf("internal error")
)

Functions

This section is empty.

Types

type AccessKey added in v0.5.4

type AccessKey struct {
	ID                uid.ID            `json:"id"`
	Created           time.Time         `json:"created"`
	Name              string            `json:"name"`
	IssuedFor         uid.PolymorphicID `json:"issuedFor"`
	Expires           time.Time         `json:"expires,omitempty"`
	ExtensionDeadline time.Time         `json:"extensionDeadline"`
}

type Client added in v0.5.0

type Client struct {
	Url       string
	AccessKey string
	Http      http.Client
}

func (Client) CreateAccessKey added in v0.5.4

func (c Client) CreateAccessKey(req *CreateAccessKeyRequest) (*CreateAccessKeyResponse, error)

func (Client) CreateDestination added in v0.5.0

func (c Client) CreateDestination(req *CreateDestinationRequest) (*Destination, error)

func (Client) CreateGrant added in v0.5.0

func (c Client) CreateGrant(req *CreateGrantRequest) (*Grant, error)

func (Client) CreateGroup added in v0.5.0

func (c Client) CreateGroup(req *CreateGroupRequest) (*Group, error)

func (Client) CreateMachine added in v0.5.4

func (c Client) CreateMachine(req *CreateMachineRequest) (*Machine, error)

func (Client) CreateProvider added in v0.5.0

func (c Client) CreateProvider(req *CreateProviderRequest) (*Provider, error)

func (Client) CreateToken added in v0.5.0

func (c Client) CreateToken(req *CreateTokenRequest) (*CreateTokenResponse, error)

func (Client) CreateUser added in v0.5.0

func (c Client) CreateUser(req *CreateUserRequest) (*User, error)

func (Client) DeleteAccessKey added in v0.5.8

func (c Client) DeleteAccessKey(id uid.ID) error

func (Client) DeleteDestination added in v0.5.0

func (c Client) DeleteDestination(id uid.ID) error

func (Client) DeleteGrant added in v0.5.0

func (c Client) DeleteGrant(id uid.ID) error

func (Client) DeleteMachine added in v0.5.4

func (c Client) DeleteMachine(id uid.ID) error

func (Client) DeleteProvider added in v0.5.0

func (c Client) DeleteProvider(id uid.ID) error

func (Client) GetGroup added in v0.5.0

func (c Client) GetGroup(id uid.ID) (*Group, error)

func (Client) GetMachine added in v0.5.8

func (c Client) GetMachine(id uid.ID) (*Machine, error)

func (Client) GetProvider added in v0.5.0

func (c Client) GetProvider(id uid.ID) (*Provider, error)

func (Client) GetUser added in v0.5.0

func (c Client) GetUser(id uid.ID) (*User, error)

func (Client) GetVersion added in v0.5.0

func (c Client) GetVersion() (*Version, error)

func (Client) Introspect added in v0.5.8

func (c Client) Introspect() (*Introspect, error)

func (Client) ListAccessKeys added in v0.5.8

func (c Client) ListAccessKeys(req ListAccessKeysRequest) ([]AccessKey, error)

func (Client) ListDestinations added in v0.5.0

func (c Client) ListDestinations(req ListDestinationsRequest) ([]Destination, error)

func (Client) ListGrants added in v0.5.0

func (c Client) ListGrants(req ListGrantsRequest) ([]Grant, error)

func (Client) ListGroupGrants added in v0.5.0

func (c Client) ListGroupGrants(id uid.ID) ([]Grant, error)

func (Client) ListGroups added in v0.5.0

func (c Client) ListGroups(req ListGroupsRequest) ([]Group, error)

func (Client) ListMachineGrants added in v0.5.8

func (c Client) ListMachineGrants(id uid.ID) ([]Grant, error)

func (Client) ListMachines added in v0.5.4

func (c Client) ListMachines(req ListMachinesRequest) ([]Machine, error)

func (Client) ListProviders added in v0.5.0

func (c Client) ListProviders(name string) ([]Provider, error)

func (Client) ListUserGrants added in v0.5.0

func (c Client) ListUserGrants(id uid.ID) ([]Grant, error)

func (Client) ListUserGroups added in v0.5.0

func (c Client) ListUserGroups(id uid.ID) ([]Group, error)

func (Client) ListUsers added in v0.5.0

func (c Client) ListUsers(req ListUsersRequest) ([]User, error)

func (Client) Login added in v0.5.0

func (c Client) Login(req *LoginRequest) (*LoginResponse, error)

func (Client) Logout added in v0.5.0

func (c Client) Logout() error

func (Client) Setup added in v0.5.9

func (c Client) Setup() (*CreateAccessKeyResponse, error)

func (Client) SetupRequired added in v0.5.9

func (c Client) SetupRequired() (*SetupRequiredResponse, error)

func (Client) UpdateDestination added in v0.5.0

func (c Client) UpdateDestination(req UpdateDestinationRequest) (*Destination, error)

func (Client) UpdateProvider added in v0.5.0

func (c Client) UpdateProvider(req UpdateProviderRequest) (*Provider, error)

type CreateAccessKeyRequest added in v0.5.4

type CreateAccessKeyRequest struct {
	MachineID         uid.ID `json:"machineID" validate:"required"`
	Name              string `json:"name"`
	TTL               string `json:"ttl"`                         // maximum time valid
	ExtensionDeadline string `json:"extensionDeadline,omitempty"` // the access key must be used within this amount of time to renew validity
}

type CreateAccessKeyResponse added in v0.5.4

type CreateAccessKeyResponse struct {
	ID                uid.ID            `json:"id"`
	Created           time.Time         `json:"created"`
	Name              string            `json:"name"`
	IssuedFor         uid.PolymorphicID `json:"issuedFor"`
	Expires           time.Time         `json:"expires"`           // after this deadline the key is no longer valid
	ExtensionDeadline time.Time         `json:"extensionDeadline"` // the key must be used by this time to remain valid
	AccessKey         string            `json:"accessKey"`
}

type CreateDestinationRequest added in v0.5.0

type CreateDestinationRequest struct {
	UniqueID   string                `json:"uniqueID"`
	Name       string                `json:"name" validate:"required"`
	Connection DestinationConnection `json:"connection"`
}

type CreateGrantRequest added in v0.5.0

type CreateGrantRequest struct {
	Identity  uid.PolymorphicID `json:"identity" validate:"required"`
	Resource  string            `json:"resource" validate:"required"`
	Privilege string            `json:"privilege" validate:"required"`
}

type CreateGroupRequest added in v0.5.0

type CreateGroupRequest struct {
	Name       string `json:"name" validate:"required"`
	ProviderID uid.ID `json:"providerID" validate:"required"`
}

type CreateMachineRequest added in v0.5.4

type CreateMachineRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

CreateMachineRequest struct for CreateMachineRequest

type CreateProviderRequest added in v0.5.0

type CreateProviderRequest struct {
	Name         string `json:"name" validate:"required"`
	URL          string `json:"url" validate:"required"`
	ClientID     string `json:"clientID"`
	ClientSecret string `json:"clientSecret"`
}

type CreateTokenRequest added in v0.5.0

type CreateTokenRequest struct {
	UserID uid.ID `json:"userID" validate:"required"`
}

type CreateTokenResponse added in v0.5.0

type CreateTokenResponse struct {
	Expires time.Time `json:"expires"`
	Token   string    `json:"token"`
}

type CreateUserRequest added in v0.5.0

type CreateUserRequest struct {
	Email      string `json:"email" validate:"email,required"`
	ProviderID uid.ID `json:"providerID" validate:"required"`
}

type Destination

type Destination struct {
	ID       uid.ID `json:"id"`
	UniqueID string `json:"uniqueID" form:"uniqueID"`
	Name     string `json:"name" form:"name"`
	// created time in seconds since 1970-01-01
	Created int64 `json:"created"`
	// updated time in seconds since 1970-01-01
	Updated    int64                 `json:"updated"`
	Connection DestinationConnection `json:"connection"`
}

type DestinationConnection added in v0.5.0

type DestinationConnection struct {
	URL string `json:"url" validate:"required"`
	CA  string `json:"ca"`
}

type EmptyRequest added in v0.5.0

type EmptyRequest struct{}

type EmptyResponse added in v0.5.0

type EmptyResponse struct{}

type Error

type Error struct {
	Code    int32  `json:"code"` // should be a repeat of the http response status code
	Message string `json:"message"`
}

type Grant added in v0.5.0

type Grant struct {
	ID uid.ID `json:"id"`

	Created   int64  `json:"created"`    // created time in seconds since 1970-01-01 00:00:00 UTC
	CreatedBy uid.ID `json:"created_by"` // id of user who created the grant
	Updated   int64  `json:"updated"`    // updated time in seconds since 1970-01-01 00:00:00 UTC

	Identity  uid.PolymorphicID `json:"identity"`
	Privilege string            `json:"privilege"` // role or permission
	Resource  string            `json:"resource"`  // Universal Resource Notation

	ExpiresAt *int64 `json:"expires_at"` // time this grant expires at in seconds since 1970-01-01 00:00:00 UTC
}

type Group

type Group struct {
	ID         uid.ID `json:"id"`
	Name       string `json:"name"`
	Created    int64  `json:"created"`
	Updated    int64  `json:"updated"`
	ProviderID uid.ID `json:"providerID"`
}

type Introspect added in v0.5.8

type Introspect struct {
	ID           uid.ID `json:"id"`
	Name         string `json:"name"`         // the machine name or the user email
	IdentityType string `json:"identityType"` // user or machine
}

Introspect returns information about the party that the calling token was issued for

type ListAccessKeysRequest added in v0.5.8

type ListAccessKeysRequest struct {
	MachineID uid.ID `form:"machineID"`
	Name      string `form:"name"`
}

type ListDestinationsRequest added in v0.5.0

type ListDestinationsRequest struct {
	Name     string `form:"name"`
	UniqueID string `form:"unique_id"`
}

type ListGrantsRequest added in v0.5.0

type ListGrantsRequest struct {
	Identity  uid.PolymorphicID `form:"identity"`
	Resource  string            `form:"resource"`
	Privilege string            `form:"privilege"`
}

type ListGroupsRequest added in v0.5.0

type ListGroupsRequest struct {
	Name       string `form:"name"`
	ProviderID uid.ID `form:"provider_id"`
}

type ListMachinesRequest added in v0.5.4

type ListMachinesRequest struct {
	Name string `form:"name"`
}

type ListProvidersRequest added in v0.5.0

type ListProvidersRequest struct {
	Name string `form:"name"`
}

type ListUsersRequest added in v0.5.0

type ListUsersRequest struct {
	Email      string `form:"email"`
	ProviderID uid.ID `form:"provider_id"`
}

type LoginRequest

type LoginRequest struct {
	OIDC      *LoginRequestOIDC `json:"oidc" validate:"excluded_with=KeyExchange"`
	AccessKey string            `json:"accessKey"  validate:"excluded_with=OIDC"`
}

type LoginRequestOIDC added in v0.5.9

type LoginRequestOIDC struct {
	ProviderID  uid.ID `json:"providerID" validate:"required"`
	RedirectURL string `json:"redirectURL" validate:"required"`
	Code        string `json:"code" validate:"required"`
}

type LoginResponse added in v0.2.3

type LoginResponse struct {
	PolymorphicID uid.PolymorphicID `json:"polymorphicId"`
	Name          string            `json:"name"`
	AccessKey     string            `json:"accessKey"`
}

type Machine added in v0.5.4

type Machine struct {
	ID      uid.ID `json:"id"`
	Created int64  `json:"created"`
	// updated time in seconds since 1970-01-01
	Updated int64 `json:"updated"`
	// timestamp of this machine's last interaction with Infra in seconds since 1970-01-01
	LastSeenAt  int64  `json:"lastSeenAt"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

Machine struct for Machine Identities

type Provider added in v0.4.0

type Provider struct {
	ID       uid.ID `json:"id"`
	Name     string `json:"name"`
	Created  int64  `json:"created"`
	Updated  int64  `json:"updated"`
	URL      string `json:"url" validate:"fqdn,required"`
	ClientID string `json:"clientID" validate:"required"`
}

type Resource added in v0.5.0

type Resource struct {
	ID uid.ID `uri:"id" validate:"required"`
}

type SetupRequiredResponse added in v0.5.9

type SetupRequiredResponse struct {
	Required bool `json:"required"`
}

type UpdateDestinationRequest added in v0.5.0

type UpdateDestinationRequest struct {
	ID         uid.ID                `uri:"id" json:"-" validate:"required"`
	Name       string                `json:"name" validate:"required"`
	UniqueID   string                `json:"uniqueID"`
	Connection DestinationConnection `json:"connection"`
}

type UpdateProviderRequest added in v0.5.0

type UpdateProviderRequest struct {
	ID           uid.ID `uri:"id" json:"-" validate:"required"`
	Name         string `json:"name"`
	URL          string `json:"url"`
	ClientID     string `json:"clientID"`
	ClientSecret string `json:"clientSecret"`
}

type User

type User struct {
	ID         uid.ID `json:"id"`
	Email      string `json:"email" validate:"email,required"`
	Created    int64  `json:"created"`
	Updated    int64  `json:"updated"`
	LastSeenAt int64  `json:"lastSeenAt"`
	ProviderID uid.ID `json:"providerID"`
}

type Version

type Version struct {
	Version string `json:"version"`
}

Jump to

Keyboard shortcuts

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