apimodels

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AllNamespacesNamespace is a sentinel Namespace value to indicate that api should search for
	// jobs and allocations in all the namespaces the requester can access.
	AllNamespacesNamespace = "*"

	// HTTPHeaderClientID is the header used to pass the client ID to the server.
	HTTPHeaderClientID = "X-Bacalhau-Client-ID"

	// HTTPHeaderJobID is the header used to pass the job ID to the server.
	HTTPHeaderJobID = "X-Bacalhau-Job-ID"

	// HTTPHeaderAppID is the header used to pass the application ID to the server.
	HTTPHeaderAppID = "X-Bacalhau-App-ID"

	// HTTPHeaderBacalhauGitVersion is the header used to pass the agent version, eg v1.2.3
	HTTPHeaderBacalhauGitVersion = "X-Bacalhau-Git-Version"
	// HTTPHeaderBacalhauGitCommit is the header used to pass the agent git commit
	HTTPHeaderBacalhauGitCommit = "X-Bacalhau-Git-Commit"
	// HTTPHeaderBacalhauBuildDate is the header used to pass the agent build date in UTC
	HTTPHeaderBacalhauBuildDate = "X-Bacalhau-Build-Date"
	// HTTPHeaderBacalhauBuildOS is the header used to pass the agent operating system
	HTTPHeaderBacalhauBuildOS = "X-Bacalhau-Build-OS"
	// HTTPHeaderBacalhauArch is the header used to pass the agent architecture
	HTTPHeaderBacalhauArch = "X-Bacalhau-Arch"
)

Variables

View Source
var ErrInvalidToken = errors.New("invalid token")

Functions

This section is empty.

Types

type AuthnRequest added in v1.2.1

type AuthnRequest struct {
	BaseRequest
	Name       string
	MethodData []byte
}

type AuthnResponse added in v1.2.1

type AuthnResponse struct {
	BaseResponse
	Authentication authn.Authentication
}

type BaseGetRequest

type BaseGetRequest struct {
	BaseRequest
}

BaseGetRequest is the base request used for all get requests

type BaseGetResponse

type BaseGetResponse struct {
	BaseResponse `json:",omitempty,inline" yaml:",omitempty,inline"`
}

type BaseListRequest

type BaseListRequest struct {
	BaseGetRequest
	Limit     uint32 `query:"limit"`
	NextToken string `query:"next_token"`
	OrderBy   string `query:"order_by"`
	Reverse   bool   `query:"reverse"`
}

BaseListRequest is the base request used for all list requests

func (*BaseListRequest) ToHTTPRequest

func (o *BaseListRequest) ToHTTPRequest() *HTTPRequest

ToHTTPRequest is used to convert the request to an HTTP request

type BaseListResponse

type BaseListResponse struct {
	BaseGetResponse `json:",omitempty,inline" yaml:",omitempty,inline"`
	NextToken       string
}

func (*BaseListResponse) GetNextToken

func (o *BaseListResponse) GetNextToken() string

type BasePostRequest added in v1.3.0

type BasePostRequest struct {
	BaseRequest
	IdempotencyToken string `query:"idempotency_token"`
}

BasePostRequest is the base request used for all POST requests

func (*BasePostRequest) ToHTTPRequest added in v1.3.0

func (o *BasePostRequest) ToHTTPRequest() *HTTPRequest

ToHTTPRequest is used to convert the request to an HTTP request

type BasePostResponse added in v1.3.0

type BasePostResponse struct {
	BaseResponse `json:",omitempty,inline" yaml:",omitempty,inline"`
}

type BasePutRequest

type BasePutRequest struct {
	BaseRequest
	IdempotencyToken string `query:"idempotency_token"`
}

BasePutRequest is the base request used for all put requests

func (*BasePutRequest) ToHTTPRequest

func (o *BasePutRequest) ToHTTPRequest() *HTTPRequest

ToHTTPRequest is used to convert the request to an HTTP request

type BasePutResponse

type BasePutResponse struct {
	BaseResponse `json:",omitempty,inline" yaml:",omitempty,inline"`
}

type BaseRequest

type BaseRequest struct {
	Namespace  string            `query:"namespace"`
	Headers    map[string]string `query:"-" json:"-"`
	Credential *HTTPCredential   `header:"Authorization"`
}

BaseRequest is the base request used for all requests

func (*BaseRequest) SetCredential added in v1.2.2

func (o *BaseRequest) SetCredential(cred *HTTPCredential)

func (*BaseRequest) ToHTTPRequest

func (o *BaseRequest) ToHTTPRequest() *HTTPRequest

ToHTTPRequest is used to convert the request to an HTTP request

type BaseResponse

type BaseResponse struct {
}

func (*BaseResponse) Normalize

func (o *BaseResponse) Normalize()

Normalize normalizes the response

type GetAgentNodeRequest

type GetAgentNodeRequest struct {
	BaseGetRequest
}

GetAgentNodeRequest is the request to get the agent node.

type GetAgentNodeResponse

type GetAgentNodeResponse struct {
	BaseGetResponse
	*models.NodeInfo
}

type GetJobRequest

type GetJobRequest struct {
	BaseGetRequest
	JobID   string
	Include string `query:"include" validate:"omitempty,oneof=history executions"`
	Limit   uint32 `query:"limit"`
}

func (*GetJobRequest) ToHTTPRequest added in v1.2.2

func (o *GetJobRequest) ToHTTPRequest() *HTTPRequest

ToHTTPRequest is used to convert the request to an HTTP request

type GetJobResponse

type GetJobResponse struct {
	BaseGetResponse
	Job        *models.Job                `json:"Job"`
	History    *ListJobHistoryResponse    `json:"History,omitempty"`
	Executions *ListJobExecutionsResponse `json:"Executions,omitempty"`
}

func (*GetJobResponse) Normalize

func (r *GetJobResponse) Normalize()

Normalize is used to33 canonicalize fields in the GetJobResponse.

type GetLogsRequest added in v1.2.2

type GetLogsRequest struct {
	BaseGetRequest
	JobID       string `query:"-"`
	ExecutionID string `query:"execution_id" validate:"omitempty"`
	Tail        bool   `query:"tail"`
	Follow      bool   `query:"follow"`
}

func (*GetLogsRequest) ToHTTPRequest added in v1.2.2

func (o *GetLogsRequest) ToHTTPRequest() *HTTPRequest

ToHTTPRequest is used to convert the request to an HTTP request

type GetNodeRequest

type GetNodeRequest struct {
	BaseGetRequest
	NodeID string
}

type GetNodeResponse

type GetNodeResponse struct {
	BaseGetResponse
	Node *models.NodeInfo
}

type GetRequest

type GetRequest interface {
	Request
}

type GetResponse

type GetResponse interface {
	Response
}

type GetVersionResponse

type GetVersionResponse struct {
	BaseGetResponse
	*models.BuildVersionInfo
}

GetVersionResponse is the response to the Version request.

type HTTPCredential added in v1.2.1

type HTTPCredential struct {
	// An HTTP authorization scheme, such as one registered with IANA
	// https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml
	Scheme string

	// For authorization schemes that only provide a single value, such as
	// Basic, the single string value providing the credential
	Value string

	// For authorization schemes that provide multiple values, a map of names to
	// values providing the credential
	Params map[string]string
}

func (HTTPCredential) String added in v1.2.1

func (cred HTTPCredential) String() string

type HTTPRequest

type HTTPRequest struct {
	Params  url.Values
	Body    io.Reader
	BodyObj interface{}
	Ctx     context.Context
	Header  http.Header
}

HTTPRequest is used to help build up a request

func NewHTTPRequest

func NewHTTPRequest() *HTTPRequest

NewHTTPRequest is used to create a new request

type IsAliveResponse

type IsAliveResponse struct {
	BaseGetResponse `json:",omitempty,inline" yaml:",omitempty,inline"`
	Status          string
}

IsAliveResponse is the response to the IsAlive request.

func (*IsAliveResponse) IsReady

func (r *IsAliveResponse) IsReady() bool

type ListAuthnMethodsRequest added in v1.2.1

type ListAuthnMethodsRequest struct {
	BaseListRequest
}

type ListAuthnMethodsResponse added in v1.2.1

type ListAuthnMethodsResponse struct {
	BaseListResponse
	Methods map[string]authn.Requirement
}

type ListJobExecutionsRequest

type ListJobExecutionsRequest struct {
	BaseListRequest
	JobID string `query:"-"`
}

type ListJobExecutionsResponse

type ListJobExecutionsResponse struct {
	BaseListResponse
	Executions []*models.Execution
}

type ListJobHistoryRequest

type ListJobHistoryRequest struct {
	BaseListRequest
	JobID       string `query:"-"`
	Since       int64  `query:"since" validate:"min=0"`
	EventType   string `query:"event_type" validate:"omitempty,oneof=all job execution"`
	ExecutionID string `query:"execution_id" validate:"omitempty"`
	NodeID      string `query:"node_id" validate:"omitempty"`
}

func (*ListJobHistoryRequest) ToHTTPRequest added in v1.1.0

func (o *ListJobHistoryRequest) ToHTTPRequest() *HTTPRequest

ToHTTPRequest is used to convert the request to an HTTP request

type ListJobHistoryResponse

type ListJobHistoryResponse struct {
	BaseListResponse
	History []*models.JobHistory
}

type ListJobResultsRequest

type ListJobResultsRequest struct {
	BaseListRequest
	JobID string `query:"-"`
}

type ListJobResultsResponse

type ListJobResultsResponse struct {
	BaseListResponse
	Results []*models.SpecConfig
}

type ListJobsRequest

type ListJobsRequest struct {
	BaseListRequest
	Labels []labels.Requirement `query:"-"` // don't auto bind as it requires special handling
}

func (*ListJobsRequest) ToHTTPRequest added in v1.1.0

func (o *ListJobsRequest) ToHTTPRequest() *HTTPRequest

ToHTTPRequest is used to convert the request to an HTTP request

type ListJobsResponse

type ListJobsResponse struct {
	BaseListResponse
	Jobs []*models.Job `json:"Jobs"`
}

func (*ListJobsResponse) Normalize

func (r *ListJobsResponse) Normalize()

Normalize is used to canonicalize fields in the ListJobsResponse.

type ListNodesRequest

type ListNodesRequest struct {
	BaseListRequest
	Labels         []labels.Requirement `query:"-"` // don't auto bind as it requires special handling
	FilterByStatus string               `query:"filter-status"`
}

func (*ListNodesRequest) ToHTTPRequest

func (o *ListNodesRequest) ToHTTPRequest() *HTTPRequest

ToHTTPRequest is used to convert the request to an HTTP request

type ListNodesResponse

type ListNodesResponse struct {
	BaseListResponse
	Nodes []*models.NodeInfo
}

type ListRequest

type ListRequest interface {
	GetRequest
}

type ListResponse

type ListResponse interface {
	GetResponse

	// GetNextToken is the token used to indicate where to start paging
	// for queries that support paginated lists. To resume paging from
	// this point, pass this token in the next request
	GetNextToken() string
}

type NodeAction added in v1.3.0

type NodeAction string
const (
	NodeActionApprove NodeAction = "approve"
	NodeActionReject  NodeAction = "reject"
)

func (NodeAction) Description added in v1.3.0

func (n NodeAction) Description() string

func (NodeAction) IsValid added in v1.3.0

func (n NodeAction) IsValid() bool

type PostRequest added in v1.3.0

type PostRequest interface {
	Request
}

type PostResponse added in v1.3.0

type PostResponse interface {
	Response
}

type PutJobRequest

type PutJobRequest struct {
	BasePutRequest
	Job *models.Job `json:"Job"`
}

func (*PutJobRequest) Normalize

func (r *PutJobRequest) Normalize()

Normalize is used to canonicalize fields in the PutJobRequest.

func (*PutJobRequest) Validate

func (r *PutJobRequest) Validate() error

Validate is used to validate fields in the PutJobRequest.

type PutJobResponse

type PutJobResponse struct {
	BasePutResponse
	JobID        string   `json:"JobID"`
	EvaluationID string   `json:"EvaluationID"`
	Warnings     []string `json:"Warnings"`
}

type PutNodeRequest added in v1.3.0

type PutNodeRequest struct {
	BasePutRequest
	Action  string
	Message string
	NodeID  string
}

type PutNodeResponse added in v1.3.0

type PutNodeResponse struct {
	BasePutResponse
	Success bool
	Error   string
}

type PutRequest

type PutRequest interface {
	Request
}

type PutResponse

type PutResponse interface {
	Response
}

type Request

type Request interface {
	// SetCredential is used to set the authorization token for the request
	SetCredential(*HTTPCredential)
	// ToHTTPRequest is used to convert the request to an HTTP request
	ToHTTPRequest() *HTTPRequest
}

type Response

type Response interface {
	// Normalize normalizes the response
	Normalize()
}

type StopJobRequest

type StopJobRequest struct {
	BasePutRequest
	JobID  string `json:"-"`
	Reason string `json:"reason"`
}

type StopJobResponse

type StopJobResponse struct {
	BasePutResponse
	EvaluationID string `json:"EvaluationID"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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