fastedge

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// Wasm API type
	APIType string `json:"api_type"`
	// ID of the WebAssembly binary to deploy
	Binary int64 `json:"binary"`
	// Optional human-readable description of the application's purpose
	Comment string `json:"comment"`
	// Enable verbose debug logging for 30 minutes. Automatically expires to prevent
	// performance impact.
	Debug bool `json:"debug"`
	// When debugging finishes
	DebugUntil time.Time `json:"debug_until" format:"date-time"`
	// Environment variables
	Env map[string]string `json:"env"`
	// Any of "kafka", "none".
	//
	// Deprecated: deprecated
	Log AppLog `json:"log" api:"nullable"`
	// Unique application name (alphanumeric, hyphens allowed)
	Name string `json:"name"`
	// Networks
	Networks []string `json:"networks"`
	// Plan name
	Plan string `json:"plan"`
	// Plan ID
	PlanID int64 `json:"plan_id"`
	// Extra headers to add to the response
	RspHeaders map[string]string `json:"rsp_headers"`
	// Application secrets
	Secrets map[string]AppSecret `json:"secrets"`
	// Status code:
	// 0 - draft (inactive)
	// 1 - enabled
	// 2 - disabled
	// 5 - suspended
	Status int64 `json:"status"`
	// Application edge stores
	Stores map[string]AppStore `json:"stores"`
	// Template ID
	Template int64 `json:"template"`
	// Template name
	TemplateName string `json:"template_name"`
	// Auto-generated URL where the application is accessible
	URL string `json:"url"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIType      respjson.Field
		Binary       respjson.Field
		Comment      respjson.Field
		Debug        respjson.Field
		DebugUntil   respjson.Field
		Env          respjson.Field
		Log          respjson.Field
		Name         respjson.Field
		Networks     respjson.Field
		Plan         respjson.Field
		PlanID       respjson.Field
		RspHeaders   respjson.Field
		Secrets      respjson.Field
		Status       respjson.Field
		Stores       respjson.Field
		Template     respjson.Field
		TemplateName respjson.Field
		URL          respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (App) RawJSON

func (r App) RawJSON() string

Returns the unmodified JSON received from the API

func (App) ToParam

func (r App) ToParam() AppParam

ToParam converts this App to a AppParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with AppParam.Overrides()

func (*App) UnmarshalJSON

func (r *App) UnmarshalJSON(data []byte) error

type AppListParams

type AppListParams struct {
	// Filter by binary ID (shows apps using this binary)
	Binary param.Opt[int64] `query:"binary,omitzero" json:"-"`
	// Maximum number of results to return
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Filter by application name (case-insensitive partial match)
	Name param.Opt[string] `query:"name,omitzero" json:"-"`
	// Number of results to skip for pagination
	Offset param.Opt[int64] `query:"offset,omitzero" json:"-"`
	// Filter by plan ID
	Plan param.Opt[int64] `query:"plan,omitzero" json:"-"`
	// Status code:
	// 0 - draft (inactive)
	// 1 - enabled
	// 2 - disabled
	// 3 - hourly call limit exceeded
	// 4 - daily call limit exceeded
	// 5 - suspended
	Status param.Opt[int64] `query:"status,omitzero" json:"-"`
	// Filter by template ID (shows apps created from this template)
	Template param.Opt[int64] `query:"template,omitzero" json:"-"`
	// API type:
	// wasi-http - WASI with HTTP entry point
	// proxy-wasm - Proxy-Wasm app, callable from CDN
	//
	// Any of "wasi-http", "proxy-wasm".
	APIType AppListParamsAPIType `query:"api_type,omitzero" json:"-"`
	// Sort order. Use - prefix for descending (e.g., -name sorts by name descending)
	//
	// Any of "name", "-name", "status", "-status", "id", "-id", "template",
	// "-template", "binary", "-binary", "plan", "-plan".
	Ordering AppListParamsOrdering `query:"ordering,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (AppListParams) URLQuery

func (r AppListParams) URLQuery() (v url.Values, err error)

URLQuery serializes AppListParams's query parameters as `url.Values`.

type AppListParamsAPIType

type AppListParamsAPIType string

API type: wasi-http - WASI with HTTP entry point proxy-wasm - Proxy-Wasm app, callable from CDN

const (
	AppListParamsAPITypeWasiHTTP  AppListParamsAPIType = "wasi-http"
	AppListParamsAPITypeProxyWasm AppListParamsAPIType = "proxy-wasm"
)

type AppListParamsOrdering

type AppListParamsOrdering string

Sort order. Use - prefix for descending (e.g., -name sorts by name descending)

const (
	AppListParamsOrderingName          AppListParamsOrdering = "name"
	AppListParamsOrderingMinusName     AppListParamsOrdering = "-name"
	AppListParamsOrderingStatus        AppListParamsOrdering = "status"
	AppListParamsOrderingMinusStatus   AppListParamsOrdering = "-status"
	AppListParamsOrderingID            AppListParamsOrdering = "id"
	AppListParamsOrderingMinusID       AppListParamsOrdering = "-id"
	AppListParamsOrderingTemplate      AppListParamsOrdering = "template"
	AppListParamsOrderingMinusTemplate AppListParamsOrdering = "-template"
	AppListParamsOrderingBinary        AppListParamsOrdering = "binary"
	AppListParamsOrderingMinusBinary   AppListParamsOrdering = "-binary"
	AppListParamsOrderingPlan          AppListParamsOrdering = "plan"
	AppListParamsOrderingMinusPlan     AppListParamsOrdering = "-plan"
)

type AppLog

type AppLog string
const (
	AppLogKafka AppLog = "kafka"
	AppLogNone  AppLog = "none"
)

type AppLogListParams

type AppLogListParams struct {
	// Search by client IP address
	ClientIP param.Opt[string] `query:"client_ip,omitzero" json:"-"`
	// Edge name
	Edge param.Opt[string] `query:"edge,omitzero" format:"string" json:"-"`
	// Start of log retrieval period in RFC3339 format. Defaults to 1 hour ago if not
	// specified.
	From param.Opt[time.Time] `query:"from,omitzero" format:"date-time" json:"-"`
	// Limit for pagination
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Offset for pagination
	Offset param.Opt[int64] `query:"offset,omitzero" json:"-"`
	// Search by request ID
	RequestID param.Opt[string] `query:"request_id,omitzero" json:"-"`
	// Search string
	Search param.Opt[string] `query:"search,omitzero" format:"string" json:"-"`
	// Reporting period end time, RFC3339 format. Default current time in UTC.
	To param.Opt[time.Time] `query:"to,omitzero" format:"date-time" json:"-"`
	// Sort order (default desc)
	//
	// Any of "desc", "asc".
	Sort AppLogListParamsSort `query:"sort,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (AppLogListParams) URLQuery

func (r AppLogListParams) URLQuery() (v url.Values, err error)

URLQuery serializes AppLogListParams's query parameters as `url.Values`.

type AppLogListParamsSort

type AppLogListParamsSort string

Sort order (default desc)

const (
	AppLogListParamsSortDesc AppLogListParamsSort = "desc"
	AppLogListParamsSortAsc  AppLogListParamsSort = "asc"
)

type AppLogService

type AppLogService struct {
	Options []option.RequestOption
}

Apps are descriptions of edge apps, that reference the binary and may contain app-specific settings, such as environment variables.

AppLogService contains methods and other services that help with interacting with the gcore API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAppLogService method instead.

func NewAppLogService

func NewAppLogService(opts ...option.RequestOption) (r AppLogService)

NewAppLogService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AppLogService) List

List logs for the app

func (*AppLogService) ListAutoPaging

List logs for the app

type AppNewParams

type AppNewParams struct {
	App AppParam
	// contains filtered or unexported fields
}

func (AppNewParams) MarshalJSON

func (r AppNewParams) MarshalJSON() (data []byte, err error)

func (*AppNewParams) UnmarshalJSON

func (r *AppNewParams) UnmarshalJSON(data []byte) error

type AppParam

type AppParam struct {
	// ID of the WebAssembly binary to deploy
	Binary param.Opt[int64] `json:"binary,omitzero"`
	// Optional human-readable description of the application's purpose
	Comment param.Opt[string] `json:"comment,omitzero"`
	// Enable verbose debug logging for 30 minutes. Automatically expires to prevent
	// performance impact.
	Debug param.Opt[bool] `json:"debug,omitzero"`
	// Unique application name (alphanumeric, hyphens allowed)
	Name param.Opt[string] `json:"name,omitzero"`
	// Status code:
	// 0 - draft (inactive)
	// 1 - enabled
	// 2 - disabled
	// 5 - suspended
	Status param.Opt[int64] `json:"status,omitzero"`
	// Template ID
	Template param.Opt[int64] `json:"template,omitzero"`
	// Any of "kafka", "none".
	//
	// Deprecated: deprecated
	Log AppLog `json:"log,omitzero"`
	// Environment variables
	Env map[string]string `json:"env,omitzero"`
	// Extra headers to add to the response
	RspHeaders map[string]string `json:"rsp_headers,omitzero"`
	// Application secrets
	Secrets map[string]AppSecretParam `json:"secrets,omitzero"`
	// Application edge stores
	Stores map[string]AppStoreParam `json:"stores,omitzero"`
	// contains filtered or unexported fields
}

func (AppParam) MarshalJSON

func (r AppParam) MarshalJSON() (data []byte, err error)

func (*AppParam) UnmarshalJSON

func (r *AppParam) UnmarshalJSON(data []byte) error

type AppReplaceParams

type AppReplaceParams struct {
	Body AppReplaceParamsBody
	// contains filtered or unexported fields
}

func (AppReplaceParams) MarshalJSON

func (r AppReplaceParams) MarshalJSON() (data []byte, err error)

func (*AppReplaceParams) UnmarshalJSON

func (r *AppReplaceParams) UnmarshalJSON(data []byte) error

type AppReplaceParamsBody

type AppReplaceParamsBody struct {
	AppParam
}

func (AppReplaceParamsBody) MarshalJSON

func (r AppReplaceParamsBody) MarshalJSON() (data []byte, err error)

type AppSecret

type AppSecret struct {
	// The unique identifier of the secret.
	ID int64 `json:"id" api:"required"`
	// A description or comment about the secret.
	Comment string `json:"comment"`
	// The unique name of the secret.
	Name string `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Comment     respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Application secret short description

func (AppSecret) RawJSON

func (r AppSecret) RawJSON() string

Returns the unmodified JSON received from the API

func (*AppSecret) UnmarshalJSON

func (r *AppSecret) UnmarshalJSON(data []byte) error

type AppSecretParam

type AppSecretParam struct {
	// The unique identifier of the secret.
	ID int64 `json:"id" api:"required"`
	// contains filtered or unexported fields
}

Application secret short description

The property ID is required.

func (AppSecretParam) MarshalJSON

func (r AppSecretParam) MarshalJSON() (data []byte, err error)

func (*AppSecretParam) UnmarshalJSON

func (r *AppSecretParam) UnmarshalJSON(data []byte) error

type AppService

type AppService struct {
	Options []option.RequestOption
	// Apps are descriptions of edge apps, that reference the binary and may contain
	// app-specific settings, such as environment variables.
	Logs AppLogService
}

FastEdge applications combine a WebAssembly binary with configuration, environment variables, and secrets for deployment at the CDN edge.

AppService contains methods and other services that help with interacting with the gcore API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAppService method instead.

func NewAppService

func NewAppService(opts ...option.RequestOption) (r AppService)

NewAppService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AppService) Delete

func (r *AppService) Delete(ctx context.Context, appID int64, opts ...option.RequestOption) (err error)

Permanently delete an application and remove it from all edge networks. This action cannot be undone. The associated binary is not deleted and can be reused.

func (*AppService) Get

func (r *AppService) Get(ctx context.Context, appID int64, opts ...option.RequestOption) (res *App, err error)

Retrieve complete configuration and metadata for a specific application. Includes binary reference, plan limits, environment variables, and current status.

func (*AppService) List

Retrieve a paginated list of applications owned by the authenticated client. Results can be filtered by name, API type, status, template, binary, or plan, and sorted by various fields.

func (*AppService) ListAutoPaging

Retrieve a paginated list of applications owned by the authenticated client. Results can be filtered by name, API type, status, template, binary, or plan, and sorted by various fields.

func (*AppService) New

func (r *AppService) New(ctx context.Context, body AppNewParams, opts ...option.RequestOption) (res *AppShort, err error)

Create a new edge application from a WebAssembly binary. The app is configured with execution limits, environment variables, and network assignments. Apps start in draft status (0) and must be explicitly enabled to receive traffic.

func (*AppService) Replace

func (r *AppService) Replace(ctx context.Context, appID int64, body AppReplaceParams, opts ...option.RequestOption) (res *AppShort, err error)

Replace the complete configuration of an existing application. All fields must be provided - use PATCH for partial updates.

func (*AppService) Update

func (r *AppService) Update(ctx context.Context, appID int64, body AppUpdateParams, opts ...option.RequestOption) (res *AppShort, err error)

Partially update an application's configuration. Only the fields provided in the request body will be modified; others remain unchanged.

type AppShort

type AppShort struct {
	// App ID
	ID int64 `json:"id" api:"required"`
	// Wasm API type
	APIType string `json:"api_type" api:"required"`
	// Binary ID
	Binary int64 `json:"binary" api:"required"`
	// App name
	Name string `json:"name" api:"required"`
	// Application plan ID
	PlanID int64 `json:"plan_id" api:"required"`
	// Status code:
	// 0 - draft (inactive)
	// 1 - enabled
	// 2 - disabled
	// 3 - hourly call limit exceeded
	// 4 - daily call limit exceeded
	// 5 - suspended
	Status int64 `json:"status" api:"required"`
	// Description of the binary
	Comment string `json:"comment"`
	// Switch on logging for 30 minutes (switched off by default)
	Debug bool `json:"debug"`
	// When debugging finishes
	DebugUntil time.Time `json:"debug_until" format:"date-time"`
	// Networks
	Networks []string `json:"networks"`
	// Application plan name
	Plan string `json:"plan"`
	// Template ID
	Template int64 `json:"template"`
	// Template name
	TemplateName string `json:"template_name"`
	// ID of the binary the app can be upgraded to
	UpgradeableTo int64 `json:"upgradeable_to"`
	// App URL
	URL string `json:"url"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		APIType       respjson.Field
		Binary        respjson.Field
		Name          respjson.Field
		PlanID        respjson.Field
		Status        respjson.Field
		Comment       respjson.Field
		Debug         respjson.Field
		DebugUntil    respjson.Field
		Networks      respjson.Field
		Plan          respjson.Field
		Template      respjson.Field
		TemplateName  respjson.Field
		UpgradeableTo respjson.Field
		URL           respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AppShort) RawJSON

func (r AppShort) RawJSON() string

Returns the unmodified JSON received from the API

func (*AppShort) UnmarshalJSON

func (r *AppShort) UnmarshalJSON(data []byte) error

type AppStore added in v0.32.0

type AppStore struct {
	// The identifier of the store
	ID int64 `json:"id" api:"required"`
	// A description of the store
	Comment string `json:"comment"`
	// The name of the store
	Name string `json:"name"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Comment     respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Application stores

func (AppStore) RawJSON added in v0.32.0

func (r AppStore) RawJSON() string

Returns the unmodified JSON received from the API

func (*AppStore) UnmarshalJSON added in v0.32.0

func (r *AppStore) UnmarshalJSON(data []byte) error

type AppStoreParam added in v0.32.0

type AppStoreParam struct {
	// The identifier of the store
	ID int64 `json:"id" api:"required"`
	// contains filtered or unexported fields
}

Application stores

The property ID is required.

func (AppStoreParam) MarshalJSON added in v0.32.0

func (r AppStoreParam) MarshalJSON() (data []byte, err error)

func (*AppStoreParam) UnmarshalJSON added in v0.32.0

func (r *AppStoreParam) UnmarshalJSON(data []byte) error

type AppUpdateParams

type AppUpdateParams struct {
	App AppParam
	// contains filtered or unexported fields
}

func (AppUpdateParams) MarshalJSON

func (r AppUpdateParams) MarshalJSON() (data []byte, err error)

func (*AppUpdateParams) UnmarshalJSON

func (r *AppUpdateParams) UnmarshalJSON(data []byte) error

type Binary

type Binary struct {
	// Binary ID
	ID int64 `json:"id" api:"required"`
	// Wasm API type
	APIType string `json:"api_type" api:"required"`
	// Source language:
	// 0 - unknown
	// 1 - Rust
	// 2 - JavaScript
	// 3 - Go
	Source int64 `json:"source" api:"required"`
	// Status code:
	// 0 - pending
	// 1 - compiled
	// 2 - compilation failed (errors available)
	// 3 - compilation failed (errors not available)
	// 4 - resulting binary exceeded the limit
	// 5 - unsupported source language
	Status int64 `json:"status" api:"required"`
	// MD5 hash of the binary
	Checksum string `json:"checksum"`
	// Not used since (UTC)
	UnrefSince string `json:"unref_since"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		APIType     respjson.Field
		Source      respjson.Field
		Status      respjson.Field
		Checksum    respjson.Field
		UnrefSince  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Binary) RawJSON

func (r Binary) RawJSON() string

Returns the unmodified JSON received from the API

func (*Binary) UnmarshalJSON

func (r *Binary) UnmarshalJSON(data []byte) error

type BinaryListResponse

type BinaryListResponse struct {
	Binaries []BinaryShort `json:"binaries" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Binaries    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BinaryListResponse) RawJSON

func (r BinaryListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BinaryListResponse) UnmarshalJSON

func (r *BinaryListResponse) UnmarshalJSON(data []byte) error

type BinaryService

type BinaryService struct {
	Options []option.RequestOption
}

FastEdge binaries are immutable WebAssembly modules that implement edge application logic.

BinaryService contains methods and other services that help with interacting with the gcore API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBinaryService method instead.

func NewBinaryService

func NewBinaryService(opts ...option.RequestOption) (r BinaryService)

NewBinaryService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*BinaryService) Delete

func (r *BinaryService) Delete(ctx context.Context, binaryID int64, opts ...option.RequestOption) (err error)

Delete a WebAssembly binary from the platform. Note: Binaries currently in use by applications cannot be deleted. Remove all application associations first.

func (*BinaryService) Get

func (r *BinaryService) Get(ctx context.Context, binaryID int64, opts ...option.RequestOption) (res *Binary, err error)

Retrieve complete information about a specific WebAssembly binary including metadata and compiled content. Use this to download or inspect binaries before using them in applications.

func (*BinaryService) List

func (r *BinaryService) List(ctx context.Context, opts ...option.RequestOption) (res *BinaryListResponse, err error)

Retrieve all WebAssembly binaries owned by the authenticated client. Binaries can be shared across multiple applications and include both WASI and Proxy-WASM formats.

func (*BinaryService) New added in v0.9.0

func (r *BinaryService) New(ctx context.Context, body io.Reader, opts ...option.RequestOption) (res *BinaryShort, err error)

Upload a compiled WebAssembly binary to the edge platform. The binary is automatically analyzed to detect its API type (WASI or Proxy-WASM) and stored for use in applications. Maximum binary size is 100MB.

type BinaryShort

type BinaryShort struct {
	// Binary ID
	ID int64 `json:"id" api:"required"`
	// Wasm API type
	APIType string `json:"api_type" api:"required"`
	// Status code:
	// 0 - pending
	// 1 - compiled
	// 2 - compilation failed (errors available)
	// 3 - compilation failed (errors not available)
	// 4 - resulting binary exceeded the limit
	// 5 - unsupported source language
	Status int64 `json:"status" api:"required"`
	// MD5 hash of the binary
	Checksum string `json:"checksum"`
	// Source language:
	// 0 - unknown
	// 1 - Rust
	// 2 - JavaScript
	// 3 - Go
	Source int64 `json:"source"`
	// Not used since (UTC)
	UnrefSince string `json:"unref_since"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		APIType     respjson.Field
		Status      respjson.Field
		Checksum    respjson.Field
		Source      respjson.Field
		UnrefSince  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BinaryShort) RawJSON

func (r BinaryShort) RawJSON() string

Returns the unmodified JSON received from the API

func (*BinaryShort) UnmarshalJSON

func (r *BinaryShort) UnmarshalJSON(data []byte) error

type CallStatus

type CallStatus struct {
	// Count by status
	CountByStatus []CallStatusCountByStatus `json:"count_by_status" api:"required"`
	// Beginning ot reporting slot
	Time time.Time `json:"time" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CountByStatus respjson.Field
		Time          respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Edge app call statistics

func (CallStatus) RawJSON

func (r CallStatus) RawJSON() string

Returns the unmodified JSON received from the API

func (*CallStatus) UnmarshalJSON

func (r *CallStatus) UnmarshalJSON(data []byte) error

type CallStatusCountByStatus

type CallStatusCountByStatus struct {
	// Number of app calls
	Count int64 `json:"count" api:"required"`
	// HTTP status
	Status int64 `json:"status" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CallStatusCountByStatus) RawJSON

func (r CallStatusCountByStatus) RawJSON() string

Returns the unmodified JSON received from the API

func (*CallStatusCountByStatus) UnmarshalJSON

func (r *CallStatusCountByStatus) UnmarshalJSON(data []byte) error

type Client

type Client struct {
	// Actual allowed number of apps
	AppCount int64 `json:"app_count" api:"required"`
	// Actual number of calls for all apps during the current day (UTC)
	DailyConsumption int64 `json:"daily_consumption" api:"required"`
	// Actual number of calls for all apps during the current hour
	HourlyConsumption int64 `json:"hourly_consumption" api:"required"`
	// Actual number of calls for all apps during the current calendar month (UTC)
	MonthlyConsumption int64 `json:"monthly_consumption" api:"required"`
	// List of enabled networks
	Networks []ClientNetwork `json:"networks" api:"required"`
	// Plan ID
	PlanID int64 `json:"plan_id" api:"required"`
	// Status code:
	// 1 - enabled
	// 2 - disabled
	// 5 - suspended
	Status int64 `json:"status" api:"required"`
	// Plan name
	Plan string `json:"plan"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AppCount           respjson.Field
		DailyConsumption   respjson.Field
		HourlyConsumption  respjson.Field
		MonthlyConsumption respjson.Field
		Networks           respjson.Field
		PlanID             respjson.Field
		Status             respjson.Field
		Plan               respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Client) RawJSON

func (r Client) RawJSON() string

Returns the unmodified JSON received from the API

func (*Client) UnmarshalJSON

func (r *Client) UnmarshalJSON(data []byte) error

type ClientNetwork

type ClientNetwork struct {
	// Is network is default
	IsDefault bool `json:"is_default" api:"required"`
	// Network name
	Name string `json:"name" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		IsDefault   respjson.Field
		Name        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ClientNetwork) RawJSON

func (r ClientNetwork) RawJSON() string

Returns the unmodified JSON received from the API

func (*ClientNetwork) UnmarshalJSON

func (r *ClientNetwork) UnmarshalJSON(data []byte) error

type DurationStats

type DurationStats struct {
	// Average duration in usec
	Avg int64 `json:"avg" api:"required"`
	// Max duration in usec
	Max int64 `json:"max" api:"required"`
	// Median (50% percentile) duration in usec
	Median int64 `json:"median" api:"required"`
	// Min duration in usec
	Min int64 `json:"min" api:"required"`
	// 75% percentile duration in usec
	Perc75 int64 `json:"perc75" api:"required"`
	// 90% percentile duration in usec
	Perc90 int64 `json:"perc90" api:"required"`
	// Beginning of reporting slot
	Time time.Time `json:"time" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Avg         respjson.Field
		Max         respjson.Field
		Median      respjson.Field
		Min         respjson.Field
		Perc75      respjson.Field
		Perc90      respjson.Field
		Time        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Edge app execution duration statistics

func (DurationStats) RawJSON

func (r DurationStats) RawJSON() string

Returns the unmodified JSON received from the API

func (*DurationStats) UnmarshalJSON

func (r *DurationStats) UnmarshalJSON(data []byte) error

type Error

type Error = apierror.Error

type FastedgeService

type FastedgeService struct {
	Options []option.RequestOption
	// FastEdge templates encapsulate reusable configurations for FastEdge
	// applications, including a WebAssembly binary reference and configurable
	// parameters.
	Templates TemplateService
	// FastEdge secrets store sensitive values such as API keys and tokens that can be
	// referenced by FastEdge applications.
	Secrets SecretService
	// FastEdge binaries are immutable WebAssembly modules that implement edge
	// application logic.
	Binaries BinaryService
	// Statistics of edge app use
	Statistics StatisticService
	// FastEdge applications combine a WebAssembly binary with configuration,
	// environment variables, and secrets for deployment at the CDN edge.
	Apps AppService
	// Key-value edge storage for apps
	KvStores KvStoreService
}

Client-level settings and limits

FastedgeService contains methods and other services that help with interacting with the gcore API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFastedgeService method instead.

func NewFastedgeService

func NewFastedgeService(opts ...option.RequestOption) (r FastedgeService)

NewFastedgeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*FastedgeService) GetAccountOverview

func (r *FastedgeService) GetAccountOverview(ctx context.Context, opts ...option.RequestOption) (res *Client, err error)

Retrieve the authenticated client's account status, resource quotas, and usage limits. Shows current plan, available resources, and any active restrictions.

type KvStore

type KvStore struct {
	// A name of the store
	Name string `json:"name" api:"required"`
	// The number of applications that use this store
	AppCount int64 `json:"app_count"`
	// BYOD (Bring Your Own Data) settings
	Byod KvStoreByod `json:"byod"`
	// A description of the store
	Comment string `json:"comment"`
	// Current store revision (only for non-BYOD stores)
	Revision int64 `json:"revision"`
	// Total store size in bytes (zero for BYOD stores)
	Size int64 `json:"size"`
	// Timestamp of last store revision (only for non-BYOD stores)
	UpdatedAt time.Time `json:"updated_at" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name        respjson.Field
		AppCount    respjson.Field
		Byod        respjson.Field
		Comment     respjson.Field
		Revision    respjson.Field
		Size        respjson.Field
		UpdatedAt   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (KvStore) RawJSON

func (r KvStore) RawJSON() string

Returns the unmodified JSON received from the API

func (KvStore) ToParam

func (r KvStore) ToParam() KvStoreParam

ToParam converts this KvStore to a KvStoreParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with KvStoreParam.Overrides()

func (*KvStore) UnmarshalJSON

func (r *KvStore) UnmarshalJSON(data []byte) error

type KvStoreByod

type KvStoreByod struct {
	// Key prefix to namespace your data within the external store
	Prefix string `json:"prefix" api:"required"`
	// Connection URL for external storage service (Redis, PostgreSQL, etc.)
	URL string `json:"url" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Prefix      respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

BYOD (Bring Your Own Data) settings

func (KvStoreByod) RawJSON

func (r KvStoreByod) RawJSON() string

Returns the unmodified JSON received from the API

func (*KvStoreByod) UnmarshalJSON

func (r *KvStoreByod) UnmarshalJSON(data []byte) error

type KvStoreByodParam

type KvStoreByodParam struct {
	// Key prefix to namespace your data within the external store
	Prefix string `json:"prefix" api:"required"`
	// Connection URL for external storage service (Redis, PostgreSQL, etc.)
	URL string `json:"url" api:"required"`
	// contains filtered or unexported fields
}

BYOD (Bring Your Own Data) settings

The properties Prefix, URL are required.

func (KvStoreByodParam) MarshalJSON

func (r KvStoreByodParam) MarshalJSON() (data []byte, err error)

func (*KvStoreByodParam) UnmarshalJSON

func (r *KvStoreByodParam) UnmarshalJSON(data []byte) error

type KvStoreListParams

type KvStoreListParams struct {
	// Filter stores by application ID. Returns only stores associated with this app.
	AppID param.Opt[int64] `query:"app_id,omitzero" json:"-"`
	// Maximum number of stores to return per page
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Number of stores to skip for pagination
	Offset param.Opt[int64] `query:"offset,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (KvStoreListParams) URLQuery

func (r KvStoreListParams) URLQuery() (v url.Values, err error)

URLQuery serializes KvStoreListParams's query parameters as `url.Values`.

type KvStoreListResponse

type KvStoreListResponse struct {
	// Total number of stores
	Count  int64          `json:"count" api:"required"`
	Stores []KvStoreShort `json:"stores" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Stores      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (KvStoreListResponse) RawJSON

func (r KvStoreListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*KvStoreListResponse) UnmarshalJSON

func (r *KvStoreListResponse) UnmarshalJSON(data []byte) error

type KvStoreNewParams

type KvStoreNewParams struct {
	KvStore KvStoreParam
	// contains filtered or unexported fields
}

func (KvStoreNewParams) MarshalJSON

func (r KvStoreNewParams) MarshalJSON() (data []byte, err error)

func (*KvStoreNewParams) UnmarshalJSON

func (r *KvStoreNewParams) UnmarshalJSON(data []byte) error

type KvStoreNewResponse added in v0.32.0

type KvStoreNewResponse struct {
	// The unique identifier of the store.
	ID int64 `json:"id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	KvStore
}

func (KvStoreNewResponse) RawJSON added in v0.32.0

func (r KvStoreNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*KvStoreNewResponse) UnmarshalJSON added in v0.32.0

func (r *KvStoreNewResponse) UnmarshalJSON(data []byte) error

type KvStoreParam

type KvStoreParam struct {
	// A name of the store
	Name string `json:"name" api:"required"`
	// A description of the store
	Comment param.Opt[string] `json:"comment,omitzero"`
	// BYOD (Bring Your Own Data) settings
	Byod KvStoreByodParam `json:"byod,omitzero"`
	// contains filtered or unexported fields
}

The property Name is required.

func (KvStoreParam) MarshalJSON

func (r KvStoreParam) MarshalJSON() (data []byte, err error)

func (*KvStoreParam) UnmarshalJSON

func (r *KvStoreParam) UnmarshalJSON(data []byte) error

type KvStoreReplaceParams

type KvStoreReplaceParams struct {
	KvStore KvStoreParam
	// contains filtered or unexported fields
}

func (KvStoreReplaceParams) MarshalJSON

func (r KvStoreReplaceParams) MarshalJSON() (data []byte, err error)

func (*KvStoreReplaceParams) UnmarshalJSON

func (r *KvStoreReplaceParams) UnmarshalJSON(data []byte) error

type KvStoreService

type KvStoreService struct {
	Options []option.RequestOption
}

Key-value edge storage for apps

KvStoreService contains methods and other services that help with interacting with the gcore API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewKvStoreService method instead.

func NewKvStoreService

func NewKvStoreService(opts ...option.RequestOption) (r KvStoreService)

NewKvStoreService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*KvStoreService) Delete

func (r *KvStoreService) Delete(ctx context.Context, storeID int64, opts ...option.RequestOption) (err error)

Permanently delete an edge storage store and all its data. This action cannot be undone; all keys and values will be lost.

func (*KvStoreService) Get

func (r *KvStoreService) Get(ctx context.Context, storeID int64, opts ...option.RequestOption) (res *KvStore, err error)

Retrieve complete configuration and metadata for a specific edge storage store. Includes store type, size limits, and associated applications.

func (*KvStoreService) List

Retrieve key-value storage stores available to the authenticated client. Stores can contain KV pairs, sorted sets, or bloom filters for edge application data.

func (*KvStoreService) New

Create a new key-value storage store for edge applications. Stores support multiple data types: simple KV, sorted sets, and bloom filters.

func (*KvStoreService) Replace

func (r *KvStoreService) Replace(ctx context.Context, storeID int64, body KvStoreReplaceParams, opts ...option.RequestOption) (res *KvStore, err error)

Modify edge store configuration including name, description, and application associations. Store type cannot be changed after creation.

type KvStoreShort

type KvStoreShort struct {
	// The unique identifier of the store
	ID int64 `json:"id" api:"required"`
	// The number of applications that use this store
	AppCount int64 `json:"app_count" api:"required"`
	// A name of the store
	Name string `json:"name" api:"required"`
	// A description of the store
	Comment string `json:"comment"`
	// Total store size in bytes
	Size int64 `json:"size"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		AppCount    respjson.Field
		Name        respjson.Field
		Comment     respjson.Field
		Size        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (KvStoreShort) RawJSON

func (r KvStoreShort) RawJSON() string

Returns the unmodified JSON received from the API

func (*KvStoreShort) UnmarshalJSON

func (r *KvStoreShort) UnmarshalJSON(data []byte) error

type Log

type Log struct {
	// Unique identifier for this log entry
	ID string `json:"id"`
	// Name of the application that generated this log
	AppName string `json:"app_name"`
	// IP address of the client that triggered the log
	ClientIP string `json:"client_ip"`
	// Edge location where the log originated
	Edge string `json:"edge"`
	// The actual log message content
	Log string `json:"log"`
	// Request ID
	RequestID string `json:"request_id"`
	// When the log was generated (RFC3339 format)
	Timestamp time.Time `json:"timestamp" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		AppName     respjson.Field
		ClientIP    respjson.Field
		Edge        respjson.Field
		Log         respjson.Field
		RequestID   respjson.Field
		Timestamp   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Log) RawJSON

func (r Log) RawJSON() string

Returns the unmodified JSON received from the API

func (*Log) UnmarshalJSON

func (r *Log) UnmarshalJSON(data []byte) error

type Secret

type Secret struct {
	// The number of applications that use this secret.
	AppCount int64 `json:"app_count"`
	// A description or comment about the secret.
	Comment string `json:"comment"`
	// The unique name of the secret.
	Name string `json:"name"`
	// A list of secret slots associated with this secret.
	SecretSlots []SecretSecretSlot `json:"secret_slots"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AppCount    respjson.Field
		Comment     respjson.Field
		Name        respjson.Field
		SecretSlots respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Secret) RawJSON

func (r Secret) RawJSON() string

Returns the unmodified JSON received from the API

func (Secret) ToParam

func (r Secret) ToParam() SecretParam

ToParam converts this Secret to a SecretParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with SecretParam.Overrides()

func (*Secret) UnmarshalJSON

func (r *Secret) UnmarshalJSON(data []byte) error

type SecretDeleteParams

type SecretDeleteParams struct {
	// When true, deletes secret even if used by applications. Defaults to false.
	Force param.Opt[bool] `query:"force,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (SecretDeleteParams) URLQuery

func (r SecretDeleteParams) URLQuery() (v url.Values, err error)

URLQuery serializes SecretDeleteParams's query parameters as `url.Values`.

type SecretListParams

type SecretListParams struct {
	// App ID
	AppID param.Opt[int64] `query:"app_id,omitzero" json:"-"`
	// Secret name
	SecretName param.Opt[string] `query:"secret_name,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (SecretListParams) URLQuery

func (r SecretListParams) URLQuery() (v url.Values, err error)

URLQuery serializes SecretListParams's query parameters as `url.Values`.

type SecretListResponse

type SecretListResponse struct {
	// Total number of secrets matching the filters
	Count   int64         `json:"count" api:"required"`
	Secrets []SecretShort `json:"secrets" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Secrets     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SecretListResponse) RawJSON

func (r SecretListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*SecretListResponse) UnmarshalJSON

func (r *SecretListResponse) UnmarshalJSON(data []byte) error

type SecretNewParams

type SecretNewParams struct {
	Secret SecretParam
	// contains filtered or unexported fields
}

func (SecretNewParams) MarshalJSON

func (r SecretNewParams) MarshalJSON() (data []byte, err error)

func (*SecretNewParams) UnmarshalJSON

func (r *SecretNewParams) UnmarshalJSON(data []byte) error

type SecretNewResponse

type SecretNewResponse struct {
	// The unique identifier of the secret.
	ID int64 `json:"id"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	Secret
}

func (SecretNewResponse) RawJSON

func (r SecretNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*SecretNewResponse) UnmarshalJSON

func (r *SecretNewResponse) UnmarshalJSON(data []byte) error

type SecretParam

type SecretParam struct {
	// A description or comment about the secret.
	Comment param.Opt[string] `json:"comment,omitzero"`
	// The unique name of the secret.
	Name param.Opt[string] `json:"name,omitzero"`
	// A list of secret slots associated with this secret.
	SecretSlots []SecretSecretSlotParam `json:"secret_slots,omitzero"`
	// contains filtered or unexported fields
}

func (SecretParam) MarshalJSON

func (r SecretParam) MarshalJSON() (data []byte, err error)

func (*SecretParam) UnmarshalJSON

func (r *SecretParam) UnmarshalJSON(data []byte) error

type SecretReplaceParams

type SecretReplaceParams struct {
	Secret SecretParam
	// contains filtered or unexported fields
}

func (SecretReplaceParams) MarshalJSON

func (r SecretReplaceParams) MarshalJSON() (data []byte, err error)

func (*SecretReplaceParams) UnmarshalJSON

func (r *SecretReplaceParams) UnmarshalJSON(data []byte) error

type SecretSecretSlot

type SecretSecretSlot struct {
	// Unix timestamp (seconds since epoch) indicating when this secret version becomes
	// active. Use for time-based secret rotation.
	Slot int64 `json:"slot" api:"required"`
	// SHA-256 hash of the decrypted value for integrity verification (auto-generated)
	Checksum string `json:"checksum"`
	// The plaintext secret value. Will be encrypted with AES-256-GCM before storage.
	Value string `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Slot        respjson.Field
		Checksum    respjson.Field
		Value       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SecretSecretSlot) RawJSON

func (r SecretSecretSlot) RawJSON() string

Returns the unmodified JSON received from the API

func (*SecretSecretSlot) UnmarshalJSON

func (r *SecretSecretSlot) UnmarshalJSON(data []byte) error

type SecretSecretSlotParam

type SecretSecretSlotParam struct {
	// Unix timestamp (seconds since epoch) indicating when this secret version becomes
	// active. Use for time-based secret rotation.
	Slot int64 `json:"slot" api:"required"`
	// The plaintext secret value. Will be encrypted with AES-256-GCM before storage.
	Value param.Opt[string] `json:"value,omitzero"`
	// contains filtered or unexported fields
}

The property Slot is required.

func (SecretSecretSlotParam) MarshalJSON

func (r SecretSecretSlotParam) MarshalJSON() (data []byte, err error)

func (*SecretSecretSlotParam) UnmarshalJSON

func (r *SecretSecretSlotParam) UnmarshalJSON(data []byte) error

type SecretService

type SecretService struct {
	Options []option.RequestOption
}

FastEdge secrets store sensitive values such as API keys and tokens that can be referenced by FastEdge applications.

SecretService contains methods and other services that help with interacting with the gcore API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSecretService method instead.

func NewSecretService

func NewSecretService(opts ...option.RequestOption) (r SecretService)

NewSecretService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SecretService) Delete

func (r *SecretService) Delete(ctx context.Context, secretID int64, body SecretDeleteParams, opts ...option.RequestOption) (err error)

Permanently delete a secret and all its slot values. Secrets in use by applications require force=true to delete.

func (*SecretService) Get

func (r *SecretService) Get(ctx context.Context, secretID int64, opts ...option.RequestOption) (res *Secret, err error)

Retrieve complete metadata for a specific secret including all time-based slots. Secret values remain encrypted; use the encryption service to decrypt when needed.

func (*SecretService) List

func (r *SecretService) List(ctx context.Context, query SecretListParams, opts ...option.RequestOption) (res *SecretListResponse, err error)

Retrieve encrypted secrets available to the authenticated client. Secrets can be filtered by application ID or name. Values are encrypted and require decryption.

func (*SecretService) New

Create a new encrypted secret for use in edge applications. Secrets are encrypted with AES-256-GCM and can have multiple time-based slots for rotation.

func (*SecretService) Replace

func (r *SecretService) Replace(ctx context.Context, secretID int64, body SecretReplaceParams, opts ...option.RequestOption) (res *Secret, err error)

Updates secret metadata and/or adds new time-based slots with encrypted values

func (*SecretService) Update

func (r *SecretService) Update(ctx context.Context, secretID int64, body SecretUpdateParams, opts ...option.RequestOption) (res *Secret, err error)

Partially updates secret metadata and/or modifies specific slots

type SecretShort

type SecretShort struct {
	// The unique name of the secret.
	Name string `json:"name" api:"required"`
	// The unique identifier of the secret.
	ID int64 `json:"id"`
	// The number of applications that use this secret.
	AppCount int64 `json:"app_count"`
	// A description or comment about the secret.
	Comment string `json:"comment"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name        respjson.Field
		ID          respjson.Field
		AppCount    respjson.Field
		Comment     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SecretShort) RawJSON

func (r SecretShort) RawJSON() string

Returns the unmodified JSON received from the API

func (*SecretShort) UnmarshalJSON

func (r *SecretShort) UnmarshalJSON(data []byte) error

type SecretUpdateParams

type SecretUpdateParams struct {
	Secret SecretParam
	// contains filtered or unexported fields
}

func (SecretUpdateParams) MarshalJSON

func (r SecretUpdateParams) MarshalJSON() (data []byte, err error)

func (*SecretUpdateParams) UnmarshalJSON

func (r *SecretUpdateParams) UnmarshalJSON(data []byte) error

type StatisticGetCallSeriesParams

type StatisticGetCallSeriesParams struct {
	// Reporting period start time in RFC3339 format
	From time.Time `query:"from" api:"required" format:"date-time" json:"-"`
	// Reporting time granularity in seconds. Common values are 60 (1 minute), 300 (5
	// minutes), 3600 (1 hour).
	Step int64 `query:"step" api:"required" json:"-"`
	// Reporting period end time in RFC3339 format (exclusive)
	To time.Time `query:"to" api:"required" format:"date-time" json:"-"`
	// Filter statistics by specific application ID
	ID param.Opt[int64] `query:"id,omitzero" json:"-"`
	// Filter statistics by edge network name
	Network param.Opt[string] `query:"network,omitzero" format:"string" json:"-"`
	// contains filtered or unexported fields
}

func (StatisticGetCallSeriesParams) URLQuery

func (r StatisticGetCallSeriesParams) URLQuery() (v url.Values, err error)

URLQuery serializes StatisticGetCallSeriesParams's query parameters as `url.Values`.

type StatisticGetCallSeriesResponse

type StatisticGetCallSeriesResponse struct {
	Stats []CallStatus `json:"stats" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Stats       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (StatisticGetCallSeriesResponse) RawJSON

Returns the unmodified JSON received from the API

func (*StatisticGetCallSeriesResponse) UnmarshalJSON

func (r *StatisticGetCallSeriesResponse) UnmarshalJSON(data []byte) error

type StatisticGetDurationSeriesParams

type StatisticGetDurationSeriesParams struct {
	// Reporting period start time in RFC3339 format
	From time.Time `query:"from" api:"required" format:"date-time" json:"-"`
	// Reporting time granularity in seconds. Common values are 60 (1 minute), 300 (5
	// minutes), 3600 (1 hour).
	Step int64 `query:"step" api:"required" json:"-"`
	// Reporting period end time in RFC3339 format (exclusive)
	To time.Time `query:"to" api:"required" format:"date-time" json:"-"`
	// Filter statistics by specific application ID
	ID param.Opt[int64] `query:"id,omitzero" json:"-"`
	// Filter statistics by edge network name
	Network param.Opt[string] `query:"network,omitzero" format:"string" json:"-"`
	// contains filtered or unexported fields
}

func (StatisticGetDurationSeriesParams) URLQuery

func (r StatisticGetDurationSeriesParams) URLQuery() (v url.Values, err error)

URLQuery serializes StatisticGetDurationSeriesParams's query parameters as `url.Values`.

type StatisticGetDurationSeriesResponse

type StatisticGetDurationSeriesResponse struct {
	Stats []DurationStats `json:"stats" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Stats       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (StatisticGetDurationSeriesResponse) RawJSON

Returns the unmodified JSON received from the API

func (*StatisticGetDurationSeriesResponse) UnmarshalJSON

func (r *StatisticGetDurationSeriesResponse) UnmarshalJSON(data []byte) error

type StatisticService

type StatisticService struct {
	Options []option.RequestOption
}

Statistics of edge app use

StatisticService contains methods and other services that help with interacting with the gcore API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewStatisticService method instead.

func NewStatisticService

func NewStatisticService(opts ...option.RequestOption) (r StatisticService)

NewStatisticService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*StatisticService) GetCallSeries

Retrieve aggregated call statistics for applications within a specified time period. Data is aggregated by the specified step interval and can be filtered by application ID and network.

func (*StatisticService) GetDurationSeries

Retrieve execution time statistics showing how long applications took to process requests. Results are aggregated by the specified time interval and can be filtered by app and network.

type Template

type Template struct {
	// Wasm API type
	APIType string `json:"api_type" api:"required"`
	// ID of the WebAssembly binary to use for this template
	BinaryID int64 `json:"binary_id" api:"required"`
	// Unique name for the template (used for identification and searching)
	Name string `json:"name" api:"required"`
	// Is the template owned by user?
	Owned bool `json:"owned" api:"required"`
	// Parameters
	Params []TemplateParameterResp `json:"params" api:"required"`
	// Detailed markdown description explaining template features and usage
	LongDescr string `json:"long_descr"`
	// Brief one-line description displayed in template listings
	ShortDescr string `json:"short_descr"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		APIType     respjson.Field
		BinaryID    respjson.Field
		Name        respjson.Field
		Owned       respjson.Field
		Params      respjson.Field
		LongDescr   respjson.Field
		ShortDescr  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Template) RawJSON

func (r Template) RawJSON() string

Returns the unmodified JSON received from the API

func (Template) ToParam

func (r Template) ToParam() TemplateParam

ToParam converts this Template to a TemplateParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with TemplateParam.Overrides()

func (*Template) UnmarshalJSON

func (r *Template) UnmarshalJSON(data []byte) error

type TemplateDeleteParams

type TemplateDeleteParams struct {
	// When true, deletes template even if shared with groups. Defaults to false.
	Force param.Opt[bool] `query:"force,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TemplateDeleteParams) URLQuery

func (r TemplateDeleteParams) URLQuery() (v url.Values, err error)

URLQuery serializes TemplateDeleteParams's query parameters as `url.Values`.

type TemplateListParams

type TemplateListParams struct {
	// Maximum number of results to return
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Number of results to skip for pagination
	Offset param.Opt[int64] `query:"offset,omitzero" json:"-"`
	// When true, returns only templates created by the client. When false, includes
	// shared templates.
	OnlyMine param.Opt[bool] `query:"only_mine,omitzero" json:"-"`
	// API type:
	// wasi-http - WASI with HTTP entry point
	// proxy-wasm - Proxy-Wasm app, callable from CDN
	//
	// Any of "wasi-http", "proxy-wasm".
	APIType TemplateListParamsAPIType `query:"api_type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TemplateListParams) URLQuery

func (r TemplateListParams) URLQuery() (v url.Values, err error)

URLQuery serializes TemplateListParams's query parameters as `url.Values`.

type TemplateListParamsAPIType

type TemplateListParamsAPIType string

API type: wasi-http - WASI with HTTP entry point proxy-wasm - Proxy-Wasm app, callable from CDN

const (
	TemplateListParamsAPITypeWasiHTTP  TemplateListParamsAPIType = "wasi-http"
	TemplateListParamsAPITypeProxyWasm TemplateListParamsAPIType = "proxy-wasm"
)

type TemplateNewParams

type TemplateNewParams struct {
	Template TemplateParam
	// contains filtered or unexported fields
}

func (TemplateNewParams) MarshalJSON

func (r TemplateNewParams) MarshalJSON() (data []byte, err error)

func (*TemplateNewParams) UnmarshalJSON

func (r *TemplateNewParams) UnmarshalJSON(data []byte) error

type TemplateParam

type TemplateParam struct {
	// ID of the WebAssembly binary to use for this template
	BinaryID int64 `json:"binary_id" api:"required"`
	// Unique name for the template (used for identification and searching)
	Name string `json:"name" api:"required"`
	// Is the template owned by user?
	Owned bool `json:"owned" api:"required"`
	// Parameters
	Params []TemplateParameter `json:"params,omitzero" api:"required"`
	// Detailed markdown description explaining template features and usage
	LongDescr param.Opt[string] `json:"long_descr,omitzero"`
	// Brief one-line description displayed in template listings
	ShortDescr param.Opt[string] `json:"short_descr,omitzero"`
	// contains filtered or unexported fields
}

The properties APIType, BinaryID, Name, Owned, Params are required.

func (TemplateParam) MarshalJSON

func (r TemplateParam) MarshalJSON() (data []byte, err error)

func (*TemplateParam) UnmarshalJSON

func (r *TemplateParam) UnmarshalJSON(data []byte) error

type TemplateParameter

type TemplateParameter struct {
	// Parameter type determines validation and UI rendering:
	// string - text input
	// number - numeric input
	// date - date picker
	// time - time picker
	// secret - references a secret
	// store - references an edge store
	// bool - boolean toggle
	// json - JSON editor or multiline text area with JSON validation
	// enum - dropdown/select with allowed values defined via parameter metadata
	//
	// Any of "string", "number", "date", "time", "secret", "store", "bool", "json",
	// "enum".
	DataType TemplateParameterDataType `json:"data_type,omitzero" api:"required"`
	// If true, this parameter must be provided when instantiating the template
	Mandatory bool `json:"mandatory" api:"required"`
	// Parameter name used as a placeholder in template (e.g., `API_KEY`,
	// `DATABASE_URL`)
	Name string `json:"name" api:"required"`
	// Human-readable explanation of what this parameter controls
	Descr param.Opt[string] `json:"descr,omitzero"`
	// Optional JSON-encoded string for additional parameter metadata, such as allowed
	// values for enum types
	Metadata param.Opt[string] `json:"metadata,omitzero"`
	// contains filtered or unexported fields
}

The properties DataType, Mandatory, Name are required.

func (TemplateParameter) MarshalJSON

func (r TemplateParameter) MarshalJSON() (data []byte, err error)

func (*TemplateParameter) UnmarshalJSON

func (r *TemplateParameter) UnmarshalJSON(data []byte) error

type TemplateParameterDataType

type TemplateParameterDataType string

Parameter type determines validation and UI rendering: string - text input number - numeric input date - date picker time - time picker secret - references a secret store - references an edge store bool - boolean toggle json - JSON editor or multiline text area with JSON validation enum - dropdown/select with allowed values defined via parameter metadata

const (
	TemplateParameterDataTypeString TemplateParameterDataType = "string"
	TemplateParameterDataTypeNumber TemplateParameterDataType = "number"
	TemplateParameterDataTypeDate   TemplateParameterDataType = "date"
	TemplateParameterDataTypeTime   TemplateParameterDataType = "time"
	TemplateParameterDataTypeSecret TemplateParameterDataType = "secret"
	TemplateParameterDataTypeStore  TemplateParameterDataType = "store"
	TemplateParameterDataTypeBool   TemplateParameterDataType = "bool"
	TemplateParameterDataTypeJson   TemplateParameterDataType = "json"
	TemplateParameterDataTypeEnum   TemplateParameterDataType = "enum"
)

type TemplateParameterResp

type TemplateParameterResp struct {
	// Parameter type determines validation and UI rendering:
	// string - text input
	// number - numeric input
	// date - date picker
	// time - time picker
	// secret - references a secret
	// store - references an edge store
	// bool - boolean toggle
	// json - JSON editor or multiline text area with JSON validation
	// enum - dropdown/select with allowed values defined via parameter metadata
	//
	// Any of "string", "number", "date", "time", "secret", "store", "bool", "json",
	// "enum".
	DataType TemplateParameterDataType `json:"data_type" api:"required"`
	// If true, this parameter must be provided when instantiating the template
	Mandatory bool `json:"mandatory" api:"required"`
	// Parameter name used as a placeholder in template (e.g., `API_KEY`,
	// `DATABASE_URL`)
	Name string `json:"name" api:"required"`
	// Human-readable explanation of what this parameter controls
	Descr string `json:"descr"`
	// Optional JSON-encoded string for additional parameter metadata, such as allowed
	// values for enum types
	Metadata string `json:"metadata"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DataType    respjson.Field
		Mandatory   respjson.Field
		Name        respjson.Field
		Descr       respjson.Field
		Metadata    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TemplateParameterResp) RawJSON

func (r TemplateParameterResp) RawJSON() string

Returns the unmodified JSON received from the API

func (TemplateParameterResp) ToParam

ToParam converts this TemplateParameterResp to a TemplateParameter.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with TemplateParameter.Overrides()

func (*TemplateParameterResp) UnmarshalJSON

func (r *TemplateParameterResp) UnmarshalJSON(data []byte) error

type TemplateReplaceParams

type TemplateReplaceParams struct {
	Template TemplateParam
	// contains filtered or unexported fields
}

func (TemplateReplaceParams) MarshalJSON

func (r TemplateReplaceParams) MarshalJSON() (data []byte, err error)

func (*TemplateReplaceParams) UnmarshalJSON

func (r *TemplateReplaceParams) UnmarshalJSON(data []byte) error

type TemplateService

type TemplateService struct {
	Options []option.RequestOption
}

FastEdge templates encapsulate reusable configurations for FastEdge applications, including a WebAssembly binary reference and configurable parameters.

TemplateService contains methods and other services that help with interacting with the gcore API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTemplateService method instead.

func NewTemplateService

func NewTemplateService(opts ...option.RequestOption) (r TemplateService)

NewTemplateService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TemplateService) Delete

func (r *TemplateService) Delete(ctx context.Context, templateID int64, body TemplateDeleteParams, opts ...option.RequestOption) (err error)

Remove a template from the platform. Templates shared with groups require force=true parameter to delete.

func (*TemplateService) Get

func (r *TemplateService) Get(ctx context.Context, templateID int64, opts ...option.RequestOption) (res *Template, err error)

Retrieve complete configuration and metadata for a specific template. Use this to inspect template parameters before creating applications from it.

func (*TemplateService) List

Retrieve available application templates including system templates and user-created templates. Templates provide pre-configured application settings that can be reused for quick deployment.

func (*TemplateService) ListAutoPaging

Retrieve available application templates including system templates and user-created templates. Templates provide pre-configured application settings that can be reused for quick deployment.

func (*TemplateService) New

Create a new application template from an existing binary and configuration. Templates can be shared with groups to enable collaborative application development.

func (*TemplateService) Replace

func (r *TemplateService) Replace(ctx context.Context, templateID int64, body TemplateReplaceParams, opts ...option.RequestOption) (res *TemplateShort, err error)

Modify an existing template's configuration. Updates affect future applications created from this template; existing apps are not changed.

type TemplateShort

type TemplateShort struct {
	// Template ID
	ID int64 `json:"id" api:"required"`
	// Wasm API type
	APIType string `json:"api_type" api:"required"`
	// Name of the template
	Name string `json:"name" api:"required"`
	// Is the template owned by user?
	Owned bool `json:"owned" api:"required"`
	// Long description of the template
	LongDescr string `json:"long_descr"`
	// Short description of the template
	ShortDescr string `json:"short_descr"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		APIType     respjson.Field
		Name        respjson.Field
		Owned       respjson.Field
		LongDescr   respjson.Field
		ShortDescr  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TemplateShort) RawJSON

func (r TemplateShort) RawJSON() string

Returns the unmodified JSON received from the API

func (*TemplateShort) UnmarshalJSON

func (r *TemplateShort) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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