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 Client
- func (c *Client) GetDeploymentInfo(ctx context.Context, namespace string, appID string) (*schema.APIResponse[schema.Deployment], error)
- func (c *Client) GetDeployments(ctx context.Context, appID string) (*schema.APIResponse[[]schema.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) (*schema.APIResponse[[]schema.Deployment], error)
- func (c *Client) SaveCustomDomain(ctx context.Context, appID string, domain string) (*schema.APIResponse[struct{}], 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) (*schema.APIResponse[schema.DeploymentResponse], error)
- type MockServer
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) (*schema.APIResponse[schema.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) (*schema.APIResponse[struct{}], error)
// ListDeployments retrieves all deployments.
// Endpoint: GET /listDeployments
ListDeployments(ctx context.Context) (*schema.APIResponse[[]schema.Deployment], error)
// GetDeploymentInfo retrieves detailed information about a specific deployment.
// Endpoint: GET /getDeploymentInfo/{namespace}/{applicationID}
GetDeploymentInfo(ctx context.Context, namespace string, appID string) (*schema.APIResponse[schema.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.
GetLogs(ctx context.Context, namespace string, appID string, follow bool, tail int) ([]string, error)
}
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) (*schema.APIResponse[schema.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) (*schema.APIResponse[[]schema.Deployment], error)
GetDeployments retrieves all deployments associated with the specified application ID. 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) (*schema.APIResponse[[]schema.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) (*schema.APIResponse[struct{}], error)
SaveCustomDomain associates a custom domain with a specific application deployment. Endpoint: POST /saveCustomDomain/{applicationID}
func (*Client) SendFeedback ¶
SendFeedback sends user feedback to Nexlayer. The feedback text will be used to improve the service.
func (*Client) StartDeployment ¶
func (c *Client) StartDeployment(ctx context.Context, appID string, yamlFile string) (*schema.APIResponse[schema.DeploymentResponse], error)
StartDeployment starts a new deployment using a YAML configuration file. Endpoint: POST /startUserDeployment/{applicationID?}
Parameters: - ctx: Context for the request - appID: Optional application ID. If empty, uses Nexlayer profile - yamlFile: Path to YAML configuration file
The YAML file must follow the Nexlayer schema v2 format with: - Required: application.name, pods[].name, pods[].image, pods[].servicePorts - Optional: application.url, application.registryLogin
Returns: - StartDeploymentResponse containing:
- message: Deployment status message
- namespace: Generated namespace
- url: Application URL
- error: Any error that occurred
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