function

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	FGS      = "fgs"
	FUNCTION = "functions"
	CODE     = "code"
	CONFIG   = "config"
	VERSION  = "versions"
	ALIAS    = "aliases"
	INVOKE   = "invocations"
	ASINVOKE = "invocations-async"
)

Variables

This section is empty.

Functions

func List

func List(client *golangsdk.ServiceClient, opts ListOptsBuilder) pagination.Pager

functions list

func ListAlias

func ListAlias(c *golangsdk.ServiceClient, functionUrn string) pagination.Pager

Querying the Aliases of a Function's All Versions

func ListVersions

func ListVersions(c *golangsdk.ServiceClient, opts ListOptsBuilder, functionUrn string) pagination.Pager

Querying the Alias Information of a Function Version

Types

type AliasResult

type AliasResult struct {
	Name         string `json:"name"`
	Version      string `json:"version"`
	Description  string `json:"description"`
	LastModified string `json:"last_modified"`
	AliasUrn     string `json:"alias_urn"`
}

func ExtractAliasList

func ExtractAliasList(r pagination.Page) ([]AliasResult, error)

type CreateAliasOpts

type CreateAliasOpts struct {
	Name    string `json:"name" required:"true"`
	Version string `json:"version" required:"true"`
}

Alias struct

func (CreateAliasOpts) ToCreateFunctionMap

func (opts CreateAliasOpts) ToCreateFunctionMap() (map[string]interface{}, error)

type CreateOpts

type CreateOpts struct {
	FuncName      string           `json:"func_name" required:"true"`
	Package       string           `json:"package" required:"true"`
	CodeType      string           `json:"code_type" required:"true"`
	CodeUrl       string           `json:"code_url,omitempty"`
	Description   string           `json:"description,omitempty"`
	CodeFilename  string           `json:"code_filename,omitempty"`
	Handler       string           `json:"handler" required:"true"`
	MemorySize    int              `json:"memory_size" required:"true"`
	Runtime       string           `json:"runtime" required:"true"`
	Timeout       int              `json:"timeout" required:"true"`
	UserData      string           `json:"user_data,omitempty"`
	Xrole         string           `json:"xrole,omitempty"`
	AppXrole      string           `json:"app_xrole,omitempty"`
	DependencyPkg string           `json:"dependency_pkg,omitempty"`
	FuncCode      FunctionCodeOpts `json:"func_code" required:"true"`
}

function struct

func (CreateOpts) ToCreateFunctionMap

func (opts CreateOpts) ToCreateFunctionMap() (map[string]interface{}, error)

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToCreateFunctionMap() (map[string]interface{}, error)
}

Create function

type CreateResult

type CreateResult struct {
	// contains filtered or unexported fields
}

func AsyncInvoke

func AsyncInvoke(c *golangsdk.ServiceClient, m map[string]interface{}, functionUrn string) (r CreateResult)

Executing a Function Asynchronously

func Create

func Create(c *golangsdk.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

create funtion

func CreateAlias

func CreateAlias(c *golangsdk.ServiceClient, opts CreateOptsBuilder, functionUrn string) (r CreateResult)

Creating an Alias for a Function Version

func CreateVersion

func CreateVersion(c *golangsdk.ServiceClient, opts CreateOptsBuilder, functionUrn string) (r CreateResult)

Publishing a Function Version

func Invoke

func Invoke(c *golangsdk.ServiceClient, m map[string]interface{}, functionUrn string) (r CreateResult)

Executing a Function Synchronously

func (CreateResult) Extract

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

func (CreateResult) ExtractAlias

func (r CreateResult) ExtractAlias() (*AliasResult, error)

func (CreateResult) ExtractInvoke

func (r CreateResult) ExtractInvoke() (interface{}, error)

type CreateVersionOpts

type CreateVersionOpts struct {
	Digest      string `json:"digest,omitempty"`
	Description string `json:"description,omitempty"`
	Version     string `json:"version,omitempty"`
}

verstion struct

func (CreateVersionOpts) ToCreateFunctionMap

func (opts CreateVersionOpts) ToCreateFunctionMap() (map[string]interface{}, error)

type DeleteResult

type DeleteResult struct {
	golangsdk.ErrResult
}

func Delete

func Delete(c *golangsdk.ServiceClient, functionUrn string) (r DeleteResult)

Deleting a Function or Function Version

func DeleteAlias

func DeleteAlias(c *golangsdk.ServiceClient, functionUrn, aliasName string) (r DeleteResult)

Deleting an Alias of a Function Version

type Dependency

type Dependency struct {
	Id           string             `json:"id"`
	Owner        string             `json:"owner"`
	Namespace    string             `json:"-"`
	Link         string             `json:"link"`
	Runtime      string             `json:"runtime"`
	ETag         string             `json:"etag"`
	Size         int64              `json:"size"`
	Name         string             `json:"name"`
	Description  string             `json:"description"`
	FileName     string             `json:"file_name,omitempty"`
	FuncVersions []*FunctionVersion `json:"-"`
	SaveType     int                `json:"-"`
}

dependency

type FuncMount

type FuncMount struct {
	Id             string             `json:"id"`
	MountType      string             `json:"mount_type"`
	MountResource  string             `json:"mount_resource"`
	MountSharePath string             `json:"mount_share_path"`
	LocalMountPath string             `json:"local_mount_path" description:"local file path in function runtime environment"`
	UserGroupId    *int               `json:"-"`
	UserId         *int               `json:"-"`
	Status         string             `json:"status"` //ACTIVE或DISABLED,和触发器类似。如果已经存在的配置不可用了processrouter不会挂载。
	ProjectId      string             `json:"-"`
	FuncVersions   []*FunctionVersion `json:"-"`
	SaveType       int                `json:"-"` //仅仅在数据处理时用到,如果需要保存新的映射关系,则将其置为1,如要删除老的,将其置为2
}

type FuncVpc

type FuncVpc struct {
	Id         string `json:"-"`
	DomainId   string `json:"-" validate:"regexp=^[a-zA-Z0-9-]+$" description:"domain id"`
	Namespace  string `json:"-"`
	VpcName    string `json:"vpc_name"`
	VpcId      string `json:"vpc_id"`
	SubnetName string `json:"subnet_name"`
	SubnetId   string `json:"subnet_id"`
	Cidr       string `json:"cidr"`
	Gateway    string `json:"gateway"`
}

type Function

type Function struct {
	Id                 string         `json:"-"`
	FuncId             string         `json:"-"`
	FuncUrn            string         `json:"func_urn"`
	FuncName           string         `json:"func_name"`
	DomainId           string         `json:"domain_id"`
	Namespace          string         `json:"namespace"`
	ProjectName        string         `json:"project_name"`
	Package            string         `json:"package"`
	Runtime            string         `json:"runtime"`
	Timeout            int            `json:"timeout"`
	Handler            string         `json:"handler"`
	MemorySize         int            `json:"memory_size"`
	Cpu                int            `json:"cpu"`
	CodeType           string         `json:"code_type"`
	CodeUrl            string         `json:"code_url"`
	CodeFileName       string         `json:"code_filename"`
	CodeSize           int64          `json:"code_size"`
	UserData           string         `json:"user_data"`
	Digest             string         `json:"digest"`
	Version            string         `json:"version"`
	ImageName          string         `json:"image_name"`
	Xrole              string         `json:"xrole"`
	AppXrole           *string        `json:"app_xrole"`
	Description        string         `json:"description"`
	VersionDescription string         `json:"version_description"`
	LastmodifiedUtc    int64          `json:"-"`
	LastModified       string         `json:"last_modified"`
	FuncCode           FunctionCode   `json:"func_code"`
	FuncVpc            *FuncVpc       `json:"func_vpc"`
	MountConfig        *MountConfig   `json:"mount_config,omitempty"`
	Concurrency        int            `json:"-"`
	DependList         []string       `json:"depend_list"`
	StrategyConfig     StrategyConfig `json:"strategy_config"`
	ExtendConfig       string         `json:"extend_config"`
	Dependencies       []*Dependency  `json:"dependencies"`
	InitializerTimeout int            `json:"initializer_timeout,omitempty"`
	InitializerHandler string         `json:"initializer_handler,omitempty"`
}

type FunctionBase

type FunctionBase struct {
	Id          string `json:"-"`
	FuncName    string `json:"func_name"`
	DomainId    string `description:"domain id"`
	Namespace   string `json:"namespace"`
	ProjectName string `json:"project_name"`
	Package     string `json:"package"`
}

noinspection GoNameStartsWithPackageName

type FunctionCode

type FunctionCode struct {
	File string `json:"file"`
	Link string `json:"link"`
}

noinspection GoNameStartsWithPackageName

type FunctionCodeOpts

type FunctionCodeOpts struct {
	File string `json:"file" required:"true"`
	Link string `json:"-"`
}

funcCode struct

type FunctionList

type FunctionList struct {
	Functions  []Function `json:"functions"`
	NextMarker int        `json:"next_marker"`
}

noinspection GoNameStartsWithPackageName

func ExtractList

func ExtractList(r pagination.Page) (FunctionList, error)

type FunctionPage

type FunctionPage struct {
	pagination.SinglePageBase
}

type FunctionVersion

type FunctionVersion struct {
	Id                 string        `json:"-"`
	FuncId             string        `json:"-"`
	Runtime            string        `json:"runtime"`
	Timeout            int           `json:"timeout"`
	Handler            string        `json:"handler"`
	MemorySize         int           `json:"memory_size"`
	Cpu                int           `json:"cpu"`
	CodeType           string        `json:"code_type"`
	CodeUrl            string        `json:"code_url"`
	CodeFileName       string        `json:"code_file_name"`
	CodeSize           int64         `json:"code_size"`
	UserData           string        `json:"user_data"`
	ImageName          string        `json:"image_name"`
	Digest             string        `json:"digest"`
	Version            string        `json:"version"`
	Xrole              string        `json:"xrole"`
	AppXrole           string        `json:"app_xrole"`
	Description        string        `json:"description"`
	VersionDescription string        `json:"version_description"`
	LastModified       int64         `json:"last_modified"`
	Concurrency        int           `json:"concurrency"`
	ExtendConfig       string        `json:"extend_config"`
	Dependencies       []*Dependency `json:"dependencies"`
	FuncBase           *FunctionBase `json:"func_base"`
	FuncVpcId          string        `json:"-"`
	FuncMounts         []*FuncMount
	MountConfig        *MountConfig `json:"mount_config"`
	Vpc                *FuncVpc     `json:"vpc"`
	InitializerTimeout int
	InitializerHandler string `description:"the function initializer handler"`
}

noinspection GoNameStartsWithPackageName

type GetResult

type GetResult struct {
	// contains filtered or unexported fields
}

func GetAlias

func GetAlias(c *golangsdk.ServiceClient, functionUrn, aliasName string) (r GetResult)

Querying the Alias Information of a Function Version

func GetCode

func GetCode(c *golangsdk.ServiceClient, functionUrn string) (r GetResult)

Querying the Code of a Function

func GetMetadata

func GetMetadata(c *golangsdk.ServiceClient, functionUrn string) (r GetResult)

Querying the Metadata Information of a Function

func (GetResult) Extract

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

func (GetResult) ExtractAlias

func (r GetResult) ExtractAlias() (*AliasResult, error)

func (GetResult) ExtractInvoke

func (r GetResult) ExtractInvoke() (interface{}, error)

type ListOpts

type ListOpts struct {
	Marker   string `q:"marker"`
	MaxItems string `q:"maxitems"`
}

functions list struct

func (ListOpts) ToMetricsListQuery

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

type ListOptsBuilder

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

type MountConfig

type MountConfig struct {
	MountUser  *MountUser   `json:"mount_user"`
	FuncMounts []*FuncMount `json:"func_mounts"`
}

type MountUser

type MountUser struct {
	UserId      *int `json:"user_id"`
	UserGroupId *int `json:"user_group_id"`
}

type StrategyConfig

type StrategyConfig struct {
	Concurrency *int `json:"concurrency"`
}

type UpdateAliasOpts

type UpdateAliasOpts struct {
	Version     string `json:"version" required:"true"`
	Description string `json:"description,omitempty"`
}

Alias struct for update

func (UpdateAliasOpts) ToUpdateMap

func (opts UpdateAliasOpts) ToUpdateMap() (map[string]interface{}, error)

type UpdateCodeOpts

type UpdateCodeOpts struct {
	CodeType      string           `json:"code_type" required:"true"`
	CodeUrl       string           `json:"code_url,omitempty"`
	DependencyPkg string           `json:"dependency_pkg,omitempty"`
	FuncCode      FunctionCodeOpts `json:"func_code,omitempty"`
}

Function struct for update

func (UpdateCodeOpts) ToUpdateMap

func (opts UpdateCodeOpts) ToUpdateMap() (map[string]interface{}, error)

type UpdateMetadataOpts

type UpdateMetadataOpts struct {
	Runtime       string `json:"runtime" required:"true"`
	CodeType      string `json:"code_type" required:"true"`
	CodeUrl       string `json:"code_url,omitempty"`
	Description   string `json:"description,omitempty"`
	MemorySize    int    `json:"memory_size" required:"true"`
	Handler       string `json:"handler" required:"true"`
	Timeout       int    `json:"timeout" required:"true"`
	UserData      string `json:"user_data,omitempty"`
	DependencyPkg string `json:"dependency_pkg,omitempty"`
	Xrole         string `json:"xrole,omitempty"`
	AppXrole      string `json:"app_xrole,omitempty"`
}

Metadata struct for update

func (UpdateMetadataOpts) ToUpdateMap

func (opts UpdateMetadataOpts) ToUpdateMap() (map[string]interface{}, error)

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToUpdateMap() (map[string]interface{}, error)
}

type UpdateResult

type UpdateResult struct {
	// contains filtered or unexported fields
}

func UpdateAlias

func UpdateAlias(c *golangsdk.ServiceClient, functionUrn, aliasName string, opts UpdateOptsBuilder) (r UpdateResult)

Modifying the Alias Information of a Function Version

func UpdateCode

func UpdateCode(c *golangsdk.ServiceClient, functionUrn string, opts UpdateOptsBuilder) (r UpdateResult)

Modifying the Code of a Function

func UpdateMetadata

func UpdateMetadata(c *golangsdk.ServiceClient, functionUrn string, opts UpdateOptsBuilder) (r UpdateResult)

Modifying the Metadata Information of a Function

func (UpdateResult) Extract

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

func (UpdateResult) ExtractAlias

func (r UpdateResult) ExtractAlias() (*AliasResult, error)

func (UpdateResult) ExtractInvoke

func (r UpdateResult) ExtractInvoke() (interface{}, error)

type Versions

type Versions struct {
	Versions   []Function `json:"versions"`
	NextMarker int        `json:"next_marker"`
}

func ExtractVersionlist

func ExtractVersionlist(r pagination.Page) (Versions, error)

Jump to

Keyboard shortcuts

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