Documentation
¶
Overview ¶
Copyright (c) 2025 Nexlayer. All rights reserved.n// Use of this source code is governed by an MIT-stylen// license that can be found in the LICENSE file.nn
Index ¶
- type APIClient
- type APIClientForCommands
- type APIError
- type APIResponse
- type Client
- func (c *Client) GetDeploymentInfo(ctx context.Context, namespace string, appID string) (*APIResponse[Deployment], error)
- func (c *Client) GetDeployments(ctx context.Context, appID string) (*APIResponse[[]Deployment], error)
- func (c *Client) GetLogs(ctx context.Context, namespace string, appID string, follow bool, tail int) ([]string, error)
- func (c *Client) ListDeployments(ctx context.Context) (*APIResponse[[]Deployment], error)
- func (c *Client) SaveCustomDomain(ctx context.Context, appID string, domain string) (*APIResponse[DomainResponse], error)
- func (c *Client) SendFeedback(ctx context.Context, text string) error
- func (c *Client) SetToken(token string)
- func (c *Client) StartDeployment(ctx context.Context, appID string, yamlFile string) (*APIResponse[DeploymentResponse], error)
- func (c *Client) StartDeploymentRaw(ctx context.Context, appID string, yamlData []byte) (*APIResponse[DeploymentResponse], error)
- type ClientAPI
- type Deployment
- type DeploymentResponse
- type Domain
- type DomainResponse
- type Feedback
- type MockServer
- type PodStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient interface {
// StartDeployment starts a new deployment using a YAML configuration file.
// The YAML file should be provided as binary data using the 'text/x-yaml' content type.
// Endpoint: POST /startUserDeployment/{applicationID?}
StartDeployment(ctx context.Context, appID string, configPath string) (*APIResponse[DeploymentResponse], error)
// StartDeploymentRaw starts a new deployment using raw YAML data without any parsing.
// Endpoint: POST /startUserDeployment/{applicationID?}
StartDeploymentRaw(ctx context.Context, appID string, yamlData []byte) (*APIResponse[DeploymentResponse], error)
// SendFeedback submits feedback to Nexlayer regarding deployment or application experience.
// Endpoint: POST /feedback
SendFeedback(ctx context.Context, text string) error
// SaveCustomDomain associates a custom domain with a specific application deployment.
// Endpoint: POST /saveCustomDomain/{applicationID}
SaveCustomDomain(ctx context.Context, appID string, domain string) (*APIResponse[DomainResponse], error)
// GetDeployments retrieves all deployments for a specific application.
// Endpoint: GET /getDeployments/{applicationID}
GetDeployments(ctx context.Context, appID string) (*APIResponse[[]Deployment], error)
// GetDeploymentInfo retrieves detailed information about a specific deployment.
// Endpoint: GET /getDeploymentInfo/{namespace}/{applicationID}
GetDeploymentInfo(ctx context.Context, namespace string, appID string) (*APIResponse[Deployment], error)
// GetLogs retrieves logs for a specific deployment.
// If follow is true, streams logs in real-time.
// tail specifies the number of lines to return from the end of the logs.
// Endpoint: GET /getDeploymentLogs/{namespace}
GetLogs(ctx context.Context, namespace string, appID string, follow bool, tail int) ([]string, error)
}
type APIClientForCommands ¶
type APIClientForCommands interface {
GetDeploymentInfo(ctx context.Context, namespace string, appID string) (*APIResponse[Deployment], error)
GetDeployments(ctx context.Context, appID string) (*APIResponse[[]Deployment], error)
SaveCustomDomain(ctx context.Context, appID string, domain string) (*APIResponse[DomainResponse], error)
}
APIClientForCommands interface is used for API client operations used in commands.
type APIError ¶
type APIError struct {
Message string `json:"message"`
ErrorCode string `json:"error"`
StatusCode int `json:"statusCode"`
}
APIError represents an error returned by the API
type APIResponse ¶
APIResponse is a generic response type for all API responses
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an API client for interacting with the Nexlayer API. The Nexlayer API enables rapid deployment of full-stack AI-powered applications by providing a simple template-based interface that abstracts away deployment complexity.
func (*Client) GetDeploymentInfo ¶
func (c *Client) GetDeploymentInfo(ctx context.Context, namespace string, appID string) (*APIResponse[Deployment], error)
GetDeploymentInfo retrieves detailed information about a specific deployment. Endpoint: GET /getDeploymentInfo/{namespace}/{applicationID}
func (*Client) GetDeployments ¶
func (c *Client) GetDeployments(ctx context.Context, appID string) (*APIResponse[[]Deployment], error)
GetDeployments retrieves all deployments for a specific application. Endpoint: GET /getDeployments/{applicationID}
func (*Client) GetLogs ¶
func (c *Client) GetLogs(ctx context.Context, namespace string, appID string, follow bool, tail int) ([]string, error)
GetLogs retrieves logs for a specific deployment
func (*Client) ListDeployments ¶
func (c *Client) ListDeployments(ctx context.Context) (*APIResponse[[]Deployment], error)
NewClient creates a new Nexlayer API client. If baseURL is empty, defaults to the staging environment at app.staging.nexlayer.io. ListDeployments retrieves all deployments. Endpoint: GET /listDeployments
func (*Client) SaveCustomDomain ¶
func (c *Client) SaveCustomDomain(ctx context.Context, appID string, domain string) (*APIResponse[DomainResponse], error)
SaveCustomDomain associates a custom domain with a specific application deployment. Endpoint: POST /saveCustomDomain/{applicationID}
func (*Client) SendFeedback ¶
SendFeedback submits feedback to Nexlayer. Endpoint: POST /feedback
func (*Client) StartDeployment ¶
func (c *Client) StartDeployment(ctx context.Context, appID string, yamlFile string) (*APIResponse[DeploymentResponse], error)
StartDeployment starts a new deployment using a YAML configuration file. The applicationID parameter is optional as per the OpenAPI spec (/startUserDeployment/{applicationID?}). If applicationID is empty, the deployment will be created without an associated application. Endpoint: POST /startUserDeployment/{applicationID?}
func (*Client) StartDeploymentRaw ¶
func (c *Client) StartDeploymentRaw(ctx context.Context, appID string, yamlData []byte) (*APIResponse[DeploymentResponse], error)
StartDeploymentRaw starts a new deployment using raw YAML data without any parsing. Endpoint: POST /startUserDeployment/{applicationID?}
type ClientAPI ¶
type ClientAPI interface {
StartDeployment(ctx context.Context, appID string, configPath string) (*APIResponse[DeploymentResponse], error)
SendFeedback(ctx context.Context, text string) error
SaveCustomDomain(ctx context.Context, appID string, domain string) (*APIResponse[DomainResponse], error)
GetDeployments(ctx context.Context, appID string) (*APIResponse[[]Deployment], error)
GetDeploymentInfo(ctx context.Context, namespace string, appID string) (*APIResponse[Deployment], error)
GetLogs(ctx context.Context, namespace string, appID string, follow bool, tail int) ([]string, error)
}
ClientAPI is an interface that abstracts the methods required for API interactions.
type Deployment ¶
type Deployment struct {
Namespace string `json:"namespace"`
TemplateID string `json:"templateID"`
TemplateName string `json:"templateName"`
Status string `json:"deploymentStatus"`
URL string `json:"url,omitempty"`
CustomDomain string `json:"customDomain,omitempty"`
Version string `json:"version,omitempty"`
CreatedAt time.Time `json:"createdAt,omitempty"`
LastUpdated time.Time `json:"lastUpdated,omitempty"`
PodStatuses []PodStatus `json:"podStatuses,omitempty"`
}
Deployment represents a deployment in the system Matches getDeploymentInfoResponse in OpenAPI spec
type DeploymentResponse ¶
type DeploymentResponse struct {
Message string `json:"message"`
Namespace string `json:"namespace"`
URL string `json:"url"`
}
DeploymentResponse represents the response from starting a deployment Matches startUserDeploymentResponse in OpenAPI spec
type Domain ¶
type Domain struct {
CreatedAt time.Time `json:"createdAt"`
Domain string `json:"domain"`
ApplicationID string `json:"applicationId"`
Status string `json:"status"`
SSLEnabled bool `json:"sslEnabled"`
}
Domain represents a custom domain configuration
type DomainResponse ¶
type DomainResponse struct {
Message string `json:"message"`
}
DomainResponse represents the response from saving a custom domain Matches saveCustomDomainResponse in OpenAPI spec
type Feedback ¶
type Feedback struct {
Text string `json:"text"`
}
Feedback represents the feedback request body
type MockServer ¶
type MockServer struct {
// contains filtered or unexported fields
}
func NewMockServer ¶
func NewMockServer() *MockServer
func (*MockServer) Close ¶
func (s *MockServer) Close()
func (*MockServer) URL ¶
func (s *MockServer) URL() string
type PodStatus ¶
type PodStatus struct {
CreatedAt time.Time `json:"createdAt"`
Name string `json:"name"`
Type string `json:"type"`
Status string `json:"status"`
Image string `json:"image"`
Restarts int `json:"restarts"`
Ready bool `json:"ready"`
}
PodStatus represents the status of a pod in a deployment
Directories
¶
| Path | Synopsis |
|---|---|
|
Package testing provides test utilities for the Nexlayer API client
|
Package testing provides test utilities for the Nexlayer API client |