v1

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Identifier           string  `json:"identifier,omitempty" anxcloud:"identifier"`
	Name                 string  `json:"name,omitempty"`
	Description          *string `json:"description,omitempty"`
	TransferProtocol     string  `json:"transfer_protocol,omitempty"`
	DeploymentIdentifier string  `json:"deployment_identifier,omitempty"`
	// contains filtered or unexported fields
}

API represents Frontier's root object and contains a collection of endpoints. The API defines the transfer protocol, such as HTTP and HTTPS, for all containing endpoints.

func (*API) EndpointURL

func (*API) EndpointURL(ctx context.Context) (*url.URL, error)

EndpointURL returns the base URL path of the resources API

func (*API) FilterAPIResponse

func (*API) FilterAPIResponse(ctx context.Context, res *http.Response) (*http.Response, error)

func (*API) GetIdentifier

func (o *API) GetIdentifier(ctx context.Context) (string, error)

GetIdentifier returns the primary identifier of a API object

type Action

type Action struct {
	Identifier         string      `json:"identifier,omitempty" anxcloud:"identifier"`
	EndpointIdentifier string      `json:"endpoint_identifier,omitempty"`
	HTTPRequestMethod  string      `json:"http_request_method,omitempty"`
	Type               ActionType  `json:"type,omitempty"`
	Meta               *ActionMeta `json:"meta,omitempty"`
	// contains filtered or unexported fields
}

Action represents the lowest entity within Frontier's hierarchy and maps HTTP methods for an endpoint to action handlers. Those action handlers may be e5e functions, other HTTP-based APIs or mock responses.

func (*Action) EndpointURL

func (a *Action) EndpointURL(ctx context.Context) (*url.URL, error)

EndpointURL returns the base URL path of the resources API

func (*Action) FilterAPIResponse

func (*Action) FilterAPIResponse(ctx context.Context, res *http.Response) (*http.Response, error)

func (*Action) GetIdentifier

func (o *Action) GetIdentifier(ctx context.Context) (string, error)

GetIdentifier returns the primary identifier of a Action object

type ActionMeta

ActionMeta is used to configure an Action based on its Type

type ActionMetaE5EAsyncFunction

type ActionMetaE5EAsyncFunction struct {
	FunctionIdentifier string `json:"e5e_async_function_function,omitempty"`
}

ActionMetaE5EAsyncFunction is used to configure a resource of type "e5e_async_function"

type ActionMetaE5EAsyncResult

type ActionMetaE5EAsyncResult struct {
	FunctionIdentifier string `json:"e5e_async_result_function,omitempty"`
}

ActionMetaE5EAsyncResult is used to configure a resource of type "e5e_async_result"

type ActionMetaE5EFunction

type ActionMetaE5EFunction struct {
	FunctionIdentifier string `json:"e5e_function_function,omitempty"`
}

ActionMetaE5EFunction is used to configure a resource of type "e5e_function"

type ActionMetaMockResponse

type ActionMetaMockResponse struct {
	Body     string `json:"mock_response_body,omitempty"`
	Language string `json:"mock_response_language,omitempty"`
}

ActionMetaMockResponse is used to configure a resource of type "mock_response"

type ActionMetaURLRewrite

type ActionMetaURLRewrite struct {
	URL string `json:"url_rewrite_url,omitempty"`
}

ActionMetaURLRewrite is used to configure a resource of type "url_rewrite"

type ActionType

type ActionType string
const (
	// ActionTypeURLRewrite configures a rewrite to another URL
	ActionTypeURLRewrite ActionType = "url_rewrite"
	// ActionTypeMockResponse configures the action to return mock data
	ActionTypeMockResponse ActionType = "mock_response"
	// ActionTypeE5EFunction configures the action to synchronously call an e5e function
	ActionTypeE5EFunction ActionType = "e5e_function"
	// ActionTypeE5EAsyncFunction configures the action to asynchronously call an e5e function
	ActionTypeE5EAsyncFunction ActionType = "e5e_async_function"
	// ActionTypeE5EAsyncResult configures the action to fetch an asynchronously e5e function result
	ActionTypeE5EAsyncResult ActionType = "e5e_async_result"
)

type Deployment

type Deployment struct {
	Identifier    string `json:"identifier,omitempty" anxcloud:"identifier"`
	APIIdentifier string `json:"api_identifier,omitempty"`
	Name          string `json:"name,omitempty"`
	Slug          string `json:"slug,omitempty"`
	State         string `json:"state,omitempty"`
	// contains filtered or unexported fields
}

Deployment represents a published version of a Frontier API with all its endpoints and actions exactly as it was at the time it was deployed. Note that using api.Create on a `Deployment` only sets the Deployments `Identifier`. Use api.Get on the same struct instance to retrieve all data.

func (*Deployment) DecodeAPIResponse

func (d *Deployment) DecodeAPIResponse(ctx context.Context, data io.Reader) error

DecodeAPIResponse is a hook that extracts the identifier from the deviating response format when creating a Deployment

func (*Deployment) EndpointURL

func (d *Deployment) EndpointURL(ctx context.Context) (*url.URL, error)

EndpointURL returns the base URL path of the resources API Deployments are created via the (frontier) api API

func (*Deployment) FilterAPIRequestBody

func (d *Deployment) FilterAPIRequestBody(ctx context.Context) (interface{}, error)

FilterAPIRequestBody is a hook that handles the deviating request format expected when creating a Deployment

func (*Deployment) FilterAPIResponse

func (*Deployment) FilterAPIResponse(ctx context.Context, res *http.Response) (*http.Response, error)

func (*Deployment) GetIdentifier

func (o *Deployment) GetIdentifier(ctx context.Context) (string, error)

GetIdentifier returns the primary identifier of a Deployment object

type Endpoint

type Endpoint struct {
	Identifier    string `json:"identifier,omitempty" anxcloud:"identifier"`
	Name          string `json:"name,omitempty"`
	Path          string `json:"path,omitempty"`
	APIIdentifier string `json:"api_identifier,omitempty"`
	// contains filtered or unexported fields
}

Endpoint represents a path within an HTTP-based API and contains a collection of actions.

func (*Endpoint) EndpointURL

func (e *Endpoint) EndpointURL(ctx context.Context) (*url.URL, error)

EndpointURL returns the base URL path of the resources API

func (*Endpoint) FilterAPIResponse

func (*Endpoint) FilterAPIResponse(ctx context.Context, res *http.Response) (*http.Response, error)

func (*Endpoint) GetIdentifier

func (o *Endpoint) GetIdentifier(ctx context.Context) (string, error)

GetIdentifier returns the primary identifier of a Endpoint object

type TransferProtocol

type TransferProtocol string
const (
	TransferProtocolHTTP TransferProtocol = "http"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳