fastedge

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: Apache-2.0 Imports: 15 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"`
	// Binary ID
	Binary int64 `json:"binary"`
	// App description
	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"`
	// Environment variables
	Env map[string]string `json:"env"`
	// Logging channel (by default - kafka, which allows exploring logs with API)
	//
	// Any of "kafka", "none".
	Log AppLog `json:"log,nullable"`
	// App name
	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
	// 3 - hourly call limit exceeded
	// 4 - daily call limit exceeded
	// 5 - suspended
	Status int64 `json:"status"`
	// KV stores for the app
	Stores map[string]int64 `json:"stores"`
	// Template ID
	Template int64 `json:"template"`
	// Template name
	TemplateName string `json:"template_name"`
	// App URL
	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 {
	// Binary ID
	Binary param.Opt[int64] `query:"binary,omitzero" json:"-"`
	// Limit for pagination
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Name of the app
	Name param.Opt[string] `query:"name,omitzero" json:"-"`
	// Offset for pagination
	Offset param.Opt[int64] `query:"offset,omitzero" json:"-"`
	// 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:"-"`
	// Template ID
	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:"-"`
	// Ordering
	//
	// 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

Ordering

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

Logging channel (by default - kafka, which allows exploring logs with API)

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

type AppLogListParams

type AppLogListParams struct {
	// Search by client IP
	ClientIP param.Opt[string] `query:"client_ip,omitzero" format:"ipv4" json:"-"`
	// Edge name
	Edge param.Opt[string] `query:"edge,omitzero" format:"string" json:"-"`
	// Reporting period start time, RFC3339 format. Default 1 hour ago.
	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 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
}

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 {
	// Wasm API type
	APIType param.Opt[string] `json:"api_type,omitzero"`
	// Binary ID
	Binary param.Opt[int64] `json:"binary,omitzero"`
	// App description
	Comment param.Opt[string] `json:"comment,omitzero"`
	// Switch on logging for 30 minutes (switched off by default)
	Debug param.Opt[bool] `json:"debug,omitzero"`
	// When debugging finishes
	DebugUntil param.Opt[time.Time] `json:"debug_until,omitzero" format:"date-time"`
	// App name
	Name param.Opt[string] `json:"name,omitzero"`
	// Plan name
	Plan param.Opt[string] `json:"plan,omitzero"`
	// Plan ID
	PlanID param.Opt[int64] `json:"plan_id,omitzero"`
	// 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] `json:"status,omitzero"`
	// Template ID
	Template param.Opt[int64] `json:"template,omitzero"`
	// Template name
	TemplateName param.Opt[string] `json:"template_name,omitzero"`
	// App URL
	URL param.Opt[string] `json:"url,omitzero"`
	// Logging channel (by default - kafka, which allows exploring logs with API)
	//
	// Any of "kafka", "none".
	Log AppLog `json:"log,omitzero"`
	// Environment variables
	Env map[string]string `json:"env,omitzero"`
	// Networks
	Networks []string `json:"networks,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"`
	// KV stores for the app
	Stores map[string]int64 `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,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,required"`
	// 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"`
	// 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
	Logs    AppLogService
}

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, id int64, opts ...option.RequestOption) (err error)

Delete app

func (*AppService) Get

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

Get app details

func (*AppService) List

List client's apps

func (*AppService) ListAutoPaging

List client's apps

func (*AppService) New

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

Add a new app

func (*AppService) Replace

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

Update an app

func (*AppService) Update

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

Update app

type AppShort

type AppShort struct {
	// App ID
	ID int64 `json:"id,required"`
	// Wasm API type
	APIType string `json:"api_type,required"`
	// Binary ID
	Binary int64 `json:"binary,required"`
	// App name
	Name string `json:"name,required"`
	// Application plan ID
	PlanID int64 `json:"plan_id,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,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 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,required"`
	// Wasm API type
	APIType string `json:"api_type,required"`
	// Source language:
	// 0 - unknown
	// 1 - Rust
	// 2 - JavaScript
	Source int64 `json:"source,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,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,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
}

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, id int64, opts ...option.RequestOption) (err error)

Delete a binary

func (*BinaryService) Get

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

Get binary

func (*BinaryService) List

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

List binaries

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)

Store compiled WASM binary

type BinaryShort

type BinaryShort struct {
	// Binary ID
	ID int64 `json:"id,required"`
	// Wasm API type
	APIType string `json:"api_type,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,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
		Status      respjson.Field
		Checksum    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,required"`
	// Beginning ot reporting slot
	Time time.Time `json:"time,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,required"`
	// HTTP status
	Status int64 `json:"status,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,required"`
	// Max allowed number of apps
	AppLimit int64 `json:"app_limit,required"`
	// Actual number of calls for all apps during the current day (UTC)
	DailyConsumption int64 `json:"daily_consumption,required"`
	// Max allowed calls for all apps during a day (UTC)
	DailyLimit int64 `json:"daily_limit,required"`
	// Actual number of calls for all apps during the current hour
	HourlyConsumption int64 `json:"hourly_consumption,required"`
	// Max allowed calls for all apps during an hour
	HourlyLimit int64 `json:"hourly_limit,required"`
	// Actual number of calls for all apps during the current calendar month (UTC)
	MonthlyConsumption int64 `json:"monthly_consumption,required"`
	// List of enabled networks
	Networks []ClientNetwork `json:"networks,required"`
	// Plan ID
	PlanID int64 `json:"plan_id,required"`
	// Status code:
	// 1 - enabled
	// 2 - disabled
	// 3 - hourly call limit exceeded
	// 4 - daily call limit exceeded
	// 5 - suspended
	Status int64 `json:"status,required"`
	// Plan name
	Plan string `json:"plan"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AppCount           respjson.Field
		AppLimit           respjson.Field
		DailyConsumption   respjson.Field
		DailyLimit         respjson.Field
		HourlyConsumption  respjson.Field
		HourlyLimit        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,required"`
	// Network name
	Name string `json:"name,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,required"`
	// Max duration in usec
	Max int64 `json:"max,required"`
	// Median (50% percentile) duration in usec
	Median int64 `json:"median,required"`
	// Min duration in usec
	Min int64 `json:"min,required"`
	// 75% percentile duration in usec
	Perc75 int64 `json:"perc75,required"`
	// 90% percentile duration in usec
	Perc90 int64 `json:"perc90,required"`
	// Beginning ot reporting slot
	Time time.Time `json:"time,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
	Templates  TemplateService
	Secrets    SecretService
	Binaries   BinaryService
	Statistics StatisticService
	Apps       AppService
	KvStores   KvStoreService
}

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)

Get status and limits for the client

type KvStore

type KvStore struct {
	// The unique identifier of the store
	ID int64 `json:"id"`
	// 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"`
	// Last update time
	Updated time.Time `json:"updated" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		AppCount    respjson.Field
		Byod        respjson.Field
		Comment     respjson.Field
		Updated     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
	Prefix string `json:"prefix,required"`
	// URL to connect to
	URL string `json:"url,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
	Prefix string `json:"prefix,required"`
	// URL to connect to
	URL string `json:"url,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 KvStoreGetResponse

type KvStoreGetResponse struct {
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
	KvStore
	KvStoreStats
}

func (KvStoreGetResponse) RawJSON

func (r KvStoreGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*KvStoreGetResponse) UnmarshalJSON

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

type KvStoreListParams

type KvStoreListParams struct {
	// App ID
	AppID param.Opt[int64] `query:"app_id,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,required"`
	Stores []KvStoreShort `json:"stores"`
	// 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 KvStoreParam

type KvStoreParam struct {
	// The unique identifier of the store
	ID param.Opt[int64] `json:"id,omitzero"`
	// The number of applications that use this store
	AppCount param.Opt[int64] `json:"app_count,omitzero"`
	// A description of the store
	Comment param.Opt[string] `json:"comment,omitzero"`
	// Last update time
	Updated param.Opt[time.Time] `json:"updated,omitzero" format:"date-time"`
	// BYOD (Bring Your Own Data) settings
	Byod KvStoreByodParam `json:"byod,omitzero"`
	// contains filtered or unexported fields
}

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
}

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, id int64, opts ...option.RequestOption) (err error)

Delete a store

func (*KvStoreService) Get

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

Get store by id

func (*KvStoreService) List

List available stores

func (*KvStoreService) New

func (r *KvStoreService) New(ctx context.Context, body KvStoreNewParams, opts ...option.RequestOption) (res *KvStore, err error)

Add a new KV store

func (*KvStoreService) Replace

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

Update a store

type KvStoreShort

type KvStoreShort struct {
	// The unique identifier of the store
	ID int64 `json:"id"`
	// A description of the store
	Comment string `json:"comment"`
	// Last update time
	Updated time.Time `json:"updated" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Comment     respjson.Field
		Updated     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 KvStoreStats

type KvStoreStats struct {
	// Store statistics
	Stats KvStoreStatsStats `json:"stats"`
	// 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 (KvStoreStats) RawJSON

func (r KvStoreStats) RawJSON() string

Returns the unmodified JSON received from the API

func (*KvStoreStats) UnmarshalJSON

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

type KvStoreStatsStats

type KvStoreStatsStats struct {
	// Total number of Cuckoo filter entries
	CfCount int64 `json:"cf_count,required"`
	// Total number of KV entries
	KvCount int64 `json:"kv_count,required"`
	// Total store size in bytes
	Size int64 `json:"size,required"`
	// Total number of sorted set entries
	ZsetCount int64 `json:"zset_count,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CfCount     respjson.Field
		KvCount     respjson.Field
		Size        respjson.Field
		ZsetCount   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Store statistics

func (KvStoreStatsStats) RawJSON

func (r KvStoreStatsStats) RawJSON() string

Returns the unmodified JSON received from the API

func (*KvStoreStatsStats) UnmarshalJSON

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

type Log

type Log struct {
	// Id of the log
	ID string `json:"id"`
	// Name of the application
	AppName string `json:"app_name"`
	// Client IP
	ClientIP string `json:"client_ip"`
	// Edge name
	Edge string `json:"edge"`
	// Log message
	Log string `json:"log"`
	// Timestamp of a log in 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
		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 {
	// Force delete secret even if it is used in slots
	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 {
	Secrets []SecretShort `json:"secrets,required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		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 {
	// The number of applications that use this secret.
	AppCount param.Opt[int64] `json:"app_count,omitzero"`
	// 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 {
	// Secret slot ID.
	Slot int64 `json:"slot,required"`
	// A checksum of the secret value for integrity verification.
	Checksum string `json:"checksum"`
	// The value of the secret.
	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 {
	// Secret slot ID.
	Slot int64 `json:"slot,required"`
	// A checksum of the secret value for integrity verification.
	Checksum param.Opt[string] `json:"checksum,omitzero"`
	// The value of the secret.
	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
}

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, id int64, body SecretDeleteParams, opts ...option.RequestOption) (err error)

Delete a secret

func (*SecretService) Get

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

Get secret by id

func (*SecretService) List

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

List available secrets

func (*SecretService) New

Add a new secret

func (*SecretService) Replace

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

Update a secret

func (*SecretService) Update

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

Update a secret

type SecretShort

type SecretShort struct {
	// The unique name of the secret.
	Name string `json:"name,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, RFC3339 format
	From time.Time `query:"from,required" format:"date-time" json:"-"`
	// Reporting granularity, in seconds
	Step int64 `query:"step,required" json:"-"`
	// Reporting period end time (not included into reporting period), RFC3339 format
	To time.Time `query:"to,required" format:"date-time" json:"-"`
	// App ID
	ID param.Opt[int64] `query:"id,omitzero" json:"-"`
	// 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,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, RFC3339 format
	From time.Time `query:"from,required" format:"date-time" json:"-"`
	// Reporting granularity, in seconds
	Step int64 `query:"step,required" json:"-"`
	// Reporting period end time (not included into reporting period), RFC3339 format
	To time.Time `query:"to,required" format:"date-time" json:"-"`
	// App ID
	ID param.Opt[int64] `query:"id,omitzero" json:"-"`
	// 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,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
}

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

Call statistics

func (*StatisticService) GetDurationSeries

Execution duration statistics

type Template

type Template struct {
	// Wasm API type
	APIType string `json:"api_type,required"`
	// Binary ID
	BinaryID int64 `json:"binary_id,required"`
	// Name of the template
	Name string `json:"name,required"`
	// Is the template owned by user?
	Owned bool `json:"owned,required"`
	// Parameters
	Params []TemplateParameterResp `json:"params,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 {
		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 {
	// Force template deletion even if it is shared to groups
	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 {
	// Limit for pagination
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Offset for pagination
	Offset param.Opt[int64] `query:"offset,omitzero" json:"-"`
	// Only my 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 {
	// Wasm API type
	APIType string `json:"api_type,required"`
	// Binary ID
	BinaryID int64 `json:"binary_id,required"`
	// Name of the template
	Name string `json:"name,required"`
	// Is the template owned by user?
	Owned bool `json:"owned,required"`
	// Parameters
	Params []TemplateParameter `json:"params,omitzero,required"`
	// Long description of the template
	LongDescr param.Opt[string] `json:"long_descr,omitzero"`
	// Short description of the template
	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
	//
	// Any of "string", "number", "date", "time", "secret".
	DataType TemplateParameterDataType `json:"data_type,omitzero,required"`
	// Is this field mandatory?
	Mandatory bool `json:"mandatory,required"`
	// Parameter name
	Name string `json:"name,required"`
	// Parameter description
	Descr param.Opt[string] `json:"descr,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

const (
	TemplateParameterDataTypeString TemplateParameterDataType = "string"
	TemplateParameterDataTypeNumber TemplateParameterDataType = "number"
	TemplateParameterDataTypeDate   TemplateParameterDataType = "date"
	TemplateParameterDataTypeTime   TemplateParameterDataType = "time"
	TemplateParameterDataTypeSecret TemplateParameterDataType = "secret"
)

type TemplateParameterResp

type TemplateParameterResp struct {
	// Parameter type
	//
	// Any of "string", "number", "date", "time", "secret".
	DataType TemplateParameterDataType `json:"data_type,required"`
	// Is this field mandatory?
	Mandatory bool `json:"mandatory,required"`
	// Parameter name
	Name string `json:"name,required"`
	// Parameter description
	Descr string `json:"descr"`
	// 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
		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
}

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, id int64, body TemplateDeleteParams, opts ...option.RequestOption) (err error)

Delete template

func (*TemplateService) Get

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

Get template details

func (*TemplateService) List

List app templates

func (*TemplateService) ListAutoPaging

List app templates

func (*TemplateService) New

Add template

func (*TemplateService) Replace

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

Update template

type TemplateShort

type TemplateShort struct {
	// Template ID
	ID int64 `json:"id,required"`
	// Wasm API type
	APIType string `json:"api_type,required"`
	// Name of the template
	Name string `json:"name,required"`
	// Is the template owned by user?
	Owned bool `json:"owned,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