faas

package
v0.6.28 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFunction

func CreateFunction(c *gcorecloud.ServiceClient, nsName string, opts CreateFunctionOptsBuilder) (r tasks.Result)

CreateFunction create FaaS function.

func CreateNamespace

func CreateNamespace(c *gcorecloud.ServiceClient, opts CreateNamespaceOptsBuilder) (r tasks.Result)

CreateNamespace create FaaS namespace.

func DeleteFunction

func DeleteFunction(c *gcorecloud.ServiceClient, nsName, fName string) (r tasks.Result)

DeleteFunction delete FaaS function.

func DeleteKey

func DeleteKey(c *gcorecloud.ServiceClient, kName string) error

DeleteKey delete FaaS key.

func DeleteNamespace

func DeleteNamespace(c *gcorecloud.ServiceClient, name string) (r tasks.Result)

DeleteNamespace delete FaaS namespace.

func ExtractFunctionsInto

func ExtractFunctionsInto(p pagination.Page, v interface{}) error

func ExtractKeysInto

func ExtractKeysInto(p pagination.Page, v interface{}) error

func ExtractNamespacesInto

func ExtractNamespacesInto(r pagination.Page, v interface{}) error

func ListFunctions

func ListFunctions(c *gcorecloud.ServiceClient, nsName string, opts ListOptsBuilder) pagination.Pager

ListFunctions returns a Pager which allows you to iterate over a collection of functions. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

func ListKeys

ListKeys returns a Pager which allows you to iterate over a collection of keys. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

func ListNamespace

ListNamespace returns a Pager which allows you to iterate over a collection of namespaces. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

func UpdateFunction

func UpdateFunction(c *gcorecloud.ServiceClient, nsName, fName string, opts UpdateFunctionOptsBuilder) (r tasks.Result)

UpdateFunction update FaaS function.

func UpdateNamespace

func UpdateNamespace(c *gcorecloud.ServiceClient, name string, opts UpdateNamespaceOptsBuilder) (r tasks.Result)

UpdateNamespace update FaaS namespace.

Types

type CreateFunctionOpts

type CreateFunctionOpts struct {
	Name         string              `json:"name"`
	Description  string              `json:"description"`
	Envs         map[string]string   `json:"envs"`
	Runtime      string              `json:"runtime"`
	Timeout      int                 `json:"timeout"`
	Flavor       string              `json:"flavor"`
	Autoscaling  FunctionAutoscaling `json:"autoscaling"`
	CodeText     string              `json:"code_text"`
	EnableApiKey *bool               `json:"enable_api_key,omitempty"`
	Keys         []string            `json:"keys,omitempty"`
	Disabled     *bool               `json:"disabled,omitempty"`
	MainMethod   string              `json:"main_method"`
	Dependencies string              `json:"dependencies,omitempty"`
}

CreateFunctionOpts represents options used to create a function.

func (CreateFunctionOpts) ToFunctionCreateMap

func (opts CreateFunctionOpts) ToFunctionCreateMap() (map[string]interface{}, error)

ToFunctionCreateMap builds a request body from CreateFunctionOpts.

type CreateFunctionOptsBuilder

type CreateFunctionOptsBuilder interface {
	ToFunctionCreateMap() (map[string]interface{}, error)
}

CreateFunctionOptsBuilder allows extensions to add additional parameters to the request.

type CreateKeyOpts

type CreateKeyOpts struct {
	Name        string                    `json:"name"`
	Description string                    `json:"description"`
	Expire      *gcorecloud.JSONRFC3339ZZ `json:"expire,omitempty"`
	Functions   []KeysFunction            `json:"functions,omitempty"`
}

CreateKeyOpts represents options used to create a key.

func (CreateKeyOpts) ToKeyCreateMap

func (opts CreateKeyOpts) ToKeyCreateMap() (map[string]any, error)

type CreateKeyOptsBuilder

type CreateKeyOptsBuilder interface {
	ToKeyCreateMap() (map[string]any, error)
}

CreateKeyOptsBuilder allows extensions to add additional parameters to the request.

type CreateNamespaceOpts

type CreateNamespaceOpts struct {
	Name        string            `json:"name" required:"true" validate:"required"`
	Description string            `json:"description"`
	Envs        map[string]string `json:"envs"`
}

CreateNamespaceOpts represents options used to create a namespace.

func (CreateNamespaceOpts) ToNamespaceCreateMap

func (opts CreateNamespaceOpts) ToNamespaceCreateMap() (map[string]interface{}, error)

ToNamespaceCreateMap builds a request body from CreateNamespaceOpts.

type CreateNamespaceOptsBuilder

type CreateNamespaceOptsBuilder interface {
	ToNamespaceCreateMap() (map[string]interface{}, error)
}

CreateNamespaceOptsBuilder allows extensions to add additional parameters to the request.

type DeleteResult

type DeleteResult struct {
	gcorecloud.ErrResult
}

DeleteResult represents the result of a delete operation

type DeployStatus

type DeployStatus struct {
	Total int `json:"total"`
	Ready int `json:"ready"`
}

type Function

type Function struct {
	Name         string                   `json:"name"`
	Description  string                   `json:"description"`
	BuildMessage string                   `json:"build_message"`
	BuildStatus  string                   `json:"build_status"`
	Status       string                   `json:"status"`
	DeployStatus DeployStatus             `json:"deploy_status"`
	Dependencies string                   `json:"dependencies"`
	Envs         map[string]string        `json:"envs"`
	Runtime      string                   `json:"runtime"`
	Timeout      int                      `json:"timeout"`
	Flavor       string                   `json:"flavor"`
	Autoscaling  FunctionAutoscaling      `json:"autoscaling"`
	CodeText     string                   `json:"code_text"`
	MainMethod   string                   `json:"main_method"`
	Endpoint     string                   `json:"endpoint"`
	Disabled     bool                     `json:"disabled"`
	EnableAPIKey bool                     `json:"enable_api_key"`
	Keys         []string                 `json:"keys"`
	CreatedAt    gcorecloud.JSONRFC3339ZZ `json:"created_at"`
}

Function represents FaaS function.

func ExtractFunctions

func ExtractFunctions(p pagination.Page) ([]Function, error)

ExtractFunctions accepts a Page struct, specifically a FunctionPage struct, and extracts the elements into a slice of Function structs. In other words, a generic collection is mapped into a relevant slice.

func ListFunctionsALL

func ListFunctionsALL(c *gcorecloud.ServiceClient, nsName string, opts ListOptsBuilder) ([]Function, error)

ListFunctionsALL returns all functions.

type FunctionAutoscaling

type FunctionAutoscaling struct {
	MinInstances *int `json:"min_instances,omitempty"`
	MaxInstances *int `json:"max_instances,omitempty"`
}

type FunctionPage

type FunctionPage struct {
	pagination.LinkedPageBase
}

FunctionPage is the page returned by a pager when traversing over a collection of functions.

func (FunctionPage) IsEmpty

func (f FunctionPage) IsEmpty() (bool, error)

IsEmpty checks whether a Function struct is empty.

func (FunctionPage) NextPageURL

func (f FunctionPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of functions has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type FunctionResult

type FunctionResult struct {
	gcorecloud.Result
}

func GetFunction

func GetFunction(c *gcorecloud.ServiceClient, nsName, fName string) (r FunctionResult)

GetFunction get FaaS function.

func (FunctionResult) Extract

func (r FunctionResult) Extract() (*Function, error)

Extract is a function that accepts a result and extracts a FunctionResult resource.

func (FunctionResult) ExtractInto

func (r FunctionResult) ExtractInto(v interface{}) error

type Key

type Key struct {
	Name        string                   `json:"name"`
	Description string                   `json:"description"`
	Functions   []KeysFunction           `json:"functions"`
	Expire      gcorecloud.JSONRFC3339ZZ `json:"expire"`
	CreatedAt   gcorecloud.JSONRFC3339ZZ `json:"created_at"`
	Secret      string                   `json:"secret,omitempty"`
	Status      string                   `json:"status"`
}

func CreateKey

func CreateKey(c *gcorecloud.ServiceClient, opts CreateKeyOptsBuilder) (r Key, err error)

CreateKey create FaaS key.

func ExtractKeys

func ExtractKeys(p pagination.Page) ([]Key, error)

ExtractKeys accepts a Page struct, specifically a KeyPage struct, and extracts the elements into a slice of Key structs. In other words, a generic collection is mapped into a relevant slice.

func ListKeysAll

func ListKeysAll(c *gcorecloud.ServiceClient, opts ListOptsBuilder) ([]Key, error)

ListKeysAll returns all keys.

func UpdateKey

func UpdateKey(c *gcorecloud.ServiceClient, kName string, opts UpdateKeyOptsBuilder) (k Key, err error)

UpdateKey update FaaS key.

type KeyPage

type KeyPage struct {
	pagination.LinkedPageBase
}

KeyPage is the page returned by a paper when traversing over a collection of keys

func (KeyPage) IsEmpty

func (k KeyPage) IsEmpty() (bool, error)

IsEmpty checks whether a Key struct is empty.

func (KeyPage) NextPageURL

func (k KeyPage) NextPageURL() (string, error)

NextPageURL is invoked when a pagination collection of keys has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type KeyResult

type KeyResult struct {
	gcorecloud.Result
}

func GetKey

func GetKey(c *gcorecloud.ServiceClient, kName string) (r KeyResult)

GetKey get FaaS key.

func (KeyResult) Extract

func (r KeyResult) Extract() (*Key, error)

func (KeyResult) ExtractInto

func (r KeyResult) ExtractInto(v interface{}) error

type KeysFunction

type KeysFunction struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

type ListOpts

type ListOpts struct {
	Limit   int    `q:"limit"`
	Offset  int    `q:"offset"`
	Search  string `q:"search"`
	OrderBy string `q:"order_by"`
}

ListOpts allows the filtering and sorting of paginated collections through the API.

func (ListOpts) ToFaaSListQuery

func (opts ListOpts) ToFaaSListQuery() (string, error)

ToFaaSListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToFaaSListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the Versions request.

type Namespace

type Namespace struct {
	Name                  string                   `json:"name"`
	Description           string                   `json:"description"`
	Status                string                   `json:"status"`
	Envs                  map[string]string        `json:"envs"`
	Functions             []Function               `json:"functions"`
	FunctionsDeployStatus DeployStatus             `json:"functions_deploy_status"`
	CreatedAt             gcorecloud.JSONRFC3339ZZ `json:"created_at"`
}

Namespace represents FaaS namespace.

func ExtractNamespaces

func ExtractNamespaces(r pagination.Page) ([]Namespace, error)

ExtractNamespaces accepts a Page struct, specifically a NamespacePage struct, and extracts the elements into a slice of Namespace structs. In other words, a generic collection is mapped into a relevant slice.

func ListNamespaceALL

func ListNamespaceALL(c *gcorecloud.ServiceClient, opts ListOptsBuilder) ([]Namespace, error)

ListNamespaceALL returns all namespaces.

type NamespacePage

type NamespacePage struct {
	pagination.LinkedPageBase
}

NamespacePage is the page returned by a pager when traversing over a collection of namespace.

func (NamespacePage) IsEmpty

func (r NamespacePage) IsEmpty() (bool, error)

IsEmpty checks whether a Namespace struct is empty.

func (NamespacePage) NextPageURL

func (r NamespacePage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of namespaces has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.

type NamespaceResult

type NamespaceResult struct {
	gcorecloud.Result
}

func GetNamespace

func GetNamespace(c *gcorecloud.ServiceClient, name string) (r NamespaceResult)

GetNamespace retrieves a specific namespace based on its name.

func (NamespaceResult) Extract

func (r NamespaceResult) Extract() (*Namespace, error)

Extract is a function that accepts a result and extracts a NamespaceResult resource.

func (NamespaceResult) ExtractInto

func (r NamespaceResult) ExtractInto(v interface{}) error

type UpdateFunctionOpts

type UpdateFunctionOpts struct {
	Description  string               `json:"description,omitempty"`
	Envs         map[string]string    `json:"envs,omitempty"`
	Timeout      int                  `json:"timeout,omitempty"`
	Flavor       string               `json:"flavor,omitempty"`
	Autoscaling  *FunctionAutoscaling `json:"autoscaling,omitempty"`
	CodeText     string               `json:"code_text,omitempty"`
	EnableApiKey *bool                `json:"enable_api_key,omitempty"`
	Keys         *[]string            `json:"keys,omitempty"`
	Disabled     *bool                `json:"disabled,omitempty"`
	Dependencies string               `json:"dependencies,omitempty"`
	MainMethod   string               `json:"main_method,omitempty"`
}

UpdateFunctionOpts represents options used to Update a function.

func (UpdateFunctionOpts) ToFunctionUpdateMap

func (opts UpdateFunctionOpts) ToFunctionUpdateMap() (map[string]interface{}, error)

ToFunctionUpdateMap builds a request body from UpdateFunctionOpts.

type UpdateFunctionOptsBuilder

type UpdateFunctionOptsBuilder interface {
	ToFunctionUpdateMap() (map[string]interface{}, error)
}

UpdateFunctionOptsBuilder allows extensions to add additional parameters to the request.

type UpdateKeyOpts

type UpdateKeyOpts struct {
	Description string                    `json:"description,omitempty"`
	Expire      *gcorecloud.JSONRFC3339ZZ `json:"expire,omitempty"`
	Functions   []KeysFunction            `json:"functions,omitempty"`
}

UpdateKeyOpts represents options used to Update a key.

func (UpdateKeyOpts) ToKeyUpdateMap

func (opts UpdateKeyOpts) ToKeyUpdateMap() (map[string]interface{}, error)

ToKeyUpdateMap builds a request body from UpdateKeyOpts.

type UpdateKeyOptsBuilder

type UpdateKeyOptsBuilder interface {
	ToKeyUpdateMap() (map[string]any, error)
}

UpdateKeyOptsBuilder allows extensions to add additional parameters to the request.

type UpdateNamespaceOpts

type UpdateNamespaceOpts struct {
	Description string            `json:"description,omitempty"`
	Envs        map[string]string `json:"envs,omitempty"`
}

UpdateNamespaceOpts represents options used to update a namespace.

func (UpdateNamespaceOpts) ToNamespaceUpdateMap

func (opts UpdateNamespaceOpts) ToNamespaceUpdateMap() (map[string]interface{}, error)

ToNamespaceUpdateMap builds a request body from UpdateNamespaceOpts.

type UpdateNamespaceOptsBuilder

type UpdateNamespaceOptsBuilder interface {
	ToNamespaceUpdateMap() (map[string]interface{}, error)
}

UpdateNamespaceOptsBuilder allows extensions to add additional parameters to the request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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