apimodel

package
v0.0.0-...-b7d53eb Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPError

func NewHTTPError(err error) *echo.HTTPError

NewHTTPError creates a new echo.HTTPError from the given error We make sure the messages in the response body is sanitized without leaking sensitive information

Types

type APIAudit

type APIAudit struct {
	CreatedAt iso8601ms.Time `json:"created_at,omitempty"`
	UpdatedAt iso8601ms.Time `json:"updated_at,omitempty"`
	Plane     string         `json:"plane,omitempty"`
	Domain    string         `json:"domain,omitempty"`

	HTTPPath       string `json:"http_path,omitempty"`
	HTTPMethod     string `json:"http_method,omitempty"`
	SentHTTPStatus int    `json:"sent_http_status,omitempty"`
}

APIAudit is the response apimodel

type CreateFact

type CreateFact struct {
	ScopeCustomID string `json:"scope_custom_id"`
	FactTypeSlug  string `json:"fact_type_slug" validate:"required"`
	Value         string `json:"value" validate:"required"`
}

CreateFact represents the request to create a fact

type CreateFactType

type CreateFactType struct {
	Slug       string `json:"slug"`
	Validation string `json:"validation"`
}

CreateFactType represents the request to create a fact_type

type CreateGrant

type CreateGrant struct {
	Domain             string   `json:"domain" validate:"fqdn"`
	AllowedHTTPMethods []string `json:"allowed_http_methods" validate:"gt=0,dive,oneof=* GET POST PUT DELETE"`

	// Paths represent the path the grant token can access
	// We leverage KeyMatch2 to define paths https://github.com/casbin/casbin/blob/v2.25.5/util/builtin_operators_test.go#L88-L117
	// By default if "paths" is not set, by default it's "*". For example,
	//
	//     *
	//     /api/v1/facts
	//     /api/v1/facts/:id
	//     /api/v1/*
	//     /js/v1/facts
	//
	Paths []string `json:"paths"`
}

CreateGrant represents the request object of creating a grant

type CreateScope

type CreateScope struct {
	CustomID string `json:"type"`
}

CreateScope represents the request of creating a scope

type Fact

type Fact struct {
	ID            string `json:"id"`
	ScopeCustomID string `json:"scope_custom_id,omitempty"`
	FactTypeSlug  string `json:"fact_type_slug"`
	Domain        string `json:"domain"`
	Value         string `json:"value,omitempty"`
}

Fact represents a fact

type FactType

type FactType struct {
	ID         string `json:"id"`
	Slug       string `json:"slug"`
	BuiltIn    bool   `json:"built_in"`
	Validation string `json:"validation"`
}

FactType represents the fact_type api model struct

type Grant

type Grant struct {
	Token              string   `json:"token"`
	Domain             string   `json:"domain"`
	AllowedHTTPMethods []string `json:"allowed_http_methods"`
	Paths              []string `json:"paths,omitempty"`
}

Grant represents the grant object

type GrantToken

type GrantToken struct {
	Version string
	Domain  string
	// contains filtered or unexported fields
}

GrantToken represents a secret token

func NewToken

func NewToken(version string, domain string) (*GrantToken, error)

NewToken creates a new Token

func (*GrantToken) Hash

func (t *GrantToken) Hash(h crypto.Hasher) string

Hash uses HashFaster to hash the grant

func (*GrantToken) ParseFromString

func (t *GrantToken) ParseFromString(s string) error

ParseFromString creates a new Token from its plaintext string

func (*GrantToken) String

func (t *GrantToken) String() string

String returns the plaintext encoding of the Token

type Healthz

type Healthz struct {
	Status string `json:"status"`
}

Healthz represents the health check response struct

type QueryAPIAudit

type QueryAPIAudit struct {
	Domain         *string `query:"domain"`
	Plane          *string `query:"plane"`
	HTTPPath       *string `query:"http_path"`
	HTTPMethod     *string `query:"http_method"`
	SentHTTPStatus *int    `query:"sent_http_status"`

	Limit     *int    `query:"limit"`
	Offset    *int    `query:"offset"`
	OrderBy   *string `query:"order_by"`
	OrderDesc bool    `query:"order_desc"`
}

QueryAPIAudit is the query struct

type Scope

type Scope struct {
	ID       string `json:"id"`
	CustomID string `json:"custom_id"`
}

Scope represents the struct of a scope

Jump to

Keyboard shortcuts

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