apis

package
v0.0.0-...-d823fe1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiInstance

type ApiInstance struct {
	// ID of the API
	Id string `json:"id"`
	// Name of the API
	Name string `json:"name"`
	// ID of the API group to which the API to be created will belong
	GroupId string `json:"group_id"`
	// Name of the API group
	GroupName string `json:"group_name"`
	// status of the API
	Status int `json:"status"`
	// Type of the API. 1: public, 2: private
	Type int `json:"type"`
	// Version of the API
	Version string `json:"version"`
	// Request protocol
	ReqProtocol string `json:"req_protocol"`
	// Request method
	ReqMethod string `json:"req_method"`
	// Access address
	ReqUri string `json:"req_uri"`
	// Request parameter list
	ReqParams []RequestParameter `json:"req_params"`
	// Security authentication mode, which can be: None, App and IAM
	AuthType string `json:"auth_type"`
	// Route matching mode
	MatchMode string `json:"match_mode"`
	// backend type, which can be: HTTP, Function and MOCK
	BackendType string `json:"backend_type"`
	// Backend parameter list
	BackendParams []BackendParameter `json:"backend_params"`
	//Web backend details
	BackendInfo BackendInfo `json:"backend_api"`
	// FunctionGraph backend details
	FunctionInfo FunctionInfo `json:"func_info"`
	// Mock backend details
	MockInfo MockInfo `json:"mock_info"`
	// Example response for a successful request
	ResultNormalSample string `json:"result_normal_sample"`
	// Example response for a failed request
	ResultFailureSample string `json:"result_failure_sample"`
	// Description of the API
	Remark string `json:"remark"`
	// tags of the API
	Tags []string `json:"tags"`
	// Description of the API request body
	BodyRemark string `json:"body_remark"`
	// whether CORS is supported
	Cors bool `json:"cors"`

	EnvName          string    `json:"run_env_name"`
	EnvId            string    `json:"run_env_id"`
	PublishId        string    `json:"publish_id"`
	ArrangeNecessary int       `json:"arrange_necessary"`
	RegisterAt       time.Time `json:"-"`
	UpdateAt         time.Time `json:"-"`
}

ApiInstance contains all the information associated with a API.

type BackendInfo

type BackendInfo struct {
	Protocol  string `json:"req_protocol"`
	Method    string `json:"req_method"`
	Uri       string `json:"req_uri"`
	Timeout   int    `json:"timeout"`
	VpcStatus int    `json:"vpc_status"`
	VpcInfo   string `json:"vpc_info"`
	UrlDomain string `json:"url_domain"`
	Version   string `json:"version"`
	Remark    string `json:"remark"`
}

type BackendOpts

type BackendOpts struct {
	Protocol     string     `json:"req_protocol" required:"true"`
	Method       string     `json:"req_method" required:"true"`
	Uri          string     `json:"req_uri" required:"true"`
	Timeout      int        `json:"timeout" required:"true"`
	VpcStatus    int        `json:"vpc_status,omitempty"`
	VpcInfo      VpcChannel `json:"vpc_info,omitempty"`
	UrlDomain    string     `json:"url_domain,omitempty"`
	Version      string     `json:"version,omitempty"`
	Remark       string     `json:"remark,omitempty"`
	AuthorizerId string     `json:"authorizer_id,omitempty"`
}

type BackendParameter

type BackendParameter struct {
	Name     string `json:"name" required:"true"`
	Location string `json:"location" required:"true"`
	Origin   string `json:"origin" required:"true"`
	Value    string `json:"value" required:"true"`
	Remark   string `json:"remark,omitempty"`
}

type CreateOpts

type CreateOpts struct {
	// ID of the API group to which the API to be created will belong
	// The value cannot be modified when updating
	GroupId string `json:"group_id" required:"true"`
	// Name of the API
	Name string `json:"name" required:"true"`
	// Type of the API. 1: public, 2: private
	Type int `json:"type" required:"true"`
	// Request method
	ReqMethod string `json:"req_method" required:"true"`
	// Access address
	ReqUri string `json:"req_uri" required:"true"`
	// Request protocol, defaults to HTTPS
	ReqProtocol string `json:"req_protocol,omitempty"`
	// Request parameter list
	ReqParams []RequestParameter `json:"req_params,omitempty"`
	// Security authentication mode, which can be: None, App and IAM
	AuthType string `json:"auth_type" required:"true"`
	// backend type, which can be: HTTP, Function and MOCK
	BackendType string `json:"backend_type" required:"true"`
	// Backend parameter list
	BackendParams []BackendParameter `json:"backend_params,omitempty"`
	//Web backend details
	BackendOpts BackendOpts `json:"backend_api,omitempty"`
	// FunctionGraph backend details
	FunctionOpts FunctionOpts `json:"func_info,omitempty"`
	// Mock backend details
	MockOpts MockOpts `json:"mock_info,omitempty"`
	// Example response for a successful request
	ResultNormalSample string `json:"result_normal_sample" required:"true"`
	// Example response for a failed request
	ResultFailureSample string `json:"result_failure_sample,omitempty"`
	// ID of customer authorizer
	AuthorizerId string `json:"authorizer_id,omitempty"`
	// Version of the API
	Version string `json:"version,omitempty"`
	// Route matching mode
	MatchMode string `json:"match_mode,omitempty"`
	// Description of the API
	Remark string `json:"remark,omitempty"`
	// tags of the API
	Tags []string `json:"tags,omitempty"`
	// Description of the API request body
	BodyRemark string `json:"body_remark,omitempty"`
	// whether CORS is supported
	Cors bool `json:"cors,omitempty"`
}

CreateOpts contains options for creating a API. This object is passed to the APIs Create function.

func (CreateOpts) ToAPICreateMap

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

ToAPICreateMap assembles a request body based on the contents of a CreateOpts.

type CreateOptsBuilder

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

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateResult

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

CreateResult contains the response body and error from a Create request.

func Create

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

Create will create a new API based on the values in CreateOpts.

func (CreateResult) Extract

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

Extract will get the Group object out of the commonResult object.

type DeleteResult

type DeleteResult struct {
	golangsdk.ErrResult
}

DeleteResult contains the response body and error from a Delete request.

func Delete

func Delete(client *golangsdk.ServiceClient, id string) (r DeleteResult)

Delete will delete the existing API with the provided ID.

type FunctionInfo

type FunctionInfo struct {
	FunctionUrn    string `json:"function_urn" required:"true"`
	InvocationType string `json:"invocation_type" required:"true"`
	Timeout        int    `json:"timeout" required:"true"`
	Version        string `json:"version,omitempty"`
	Remark         string `json:"remark,omitempty"`
}

type FunctionOpts

type FunctionOpts FunctionInfo

type GetResult

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

GetResult contains the response body and error from a Get request.

func Get

func Get(client *golangsdk.ServiceClient, id string) (r GetResult)

Get retrieves the API with the provided ID. To extract the API object from the response, call the Extract method on the GetResult.

func (GetResult) Extract

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

Extract will get the Group object out of the commonResult object.

type MockInfo

type MockInfo struct {
	ResultContent string `json:"result_content,omitempty"`
	Version       string `json:"version,omitempty"`
	Remark        string `json:"remark,omitempty"`
}

type MockOpts

type MockOpts MockInfo

type RequestParameter

type RequestParameter struct {
	Name         string `json:"name" required:"true"`
	Type         string `json:"type" required:"true"`
	Location     string `json:"location" required:"true"`
	Required     int    `json:"required" required:"true"`
	ValidEnable  int    `json:"valid_enable" required:"true"`
	DefaultValue string `json:"default_value,omitempty"`
	SampleValue  string `json:"sample_value,omitempty"`
	Remark       string `json:"remark,omitempty"`
	Enumerations string `json:"enumerations,omitempty"`
	MinNum       int    `json:"min_num,omitempty"`
	MaxNum       int    `json:"max_num,omitempty"`
	MinSize      int    `json:"min_size,omitempty"`
	MaxSize      int    `json:"max_size,omitempty"`
}

type UpdateResult

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

UpdateResult contains the response body and error from an Update request.

func Update

func Update(client *golangsdk.ServiceClient, id string, opts CreateOptsBuilder) (r UpdateResult)

Update will update the API with provided information. To extract the updated API from the response, call the Extract method on the UpdateResult. parameters of update is same with parameters of create. (group_id cannot be modified)

func (UpdateResult) Extract

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

Extract will get the Group object out of the commonResult object.

type VpcChannel

type VpcChannel struct {
	VpcId        string `json:"vpc_id" required:"true"`
	VpcProxyHost string `json:"vpc_proxy_host,omitempty"`
}

Jump to

Keyboard shortcuts

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