responses

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

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

List is a method to obtain an array of one or more custom reponses according to the query parameters.

Types

type CreateResult

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

CreateResult represents a result of the Create method.

func Create

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

Create is a method by which to create function that create a new custom response.

func (CreateResult) Extract

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

Extract is a method to extract an response struct.

type DeleteResult

type DeleteResult struct {
	golangsdk.ErrResult
}

DeleteResult represents a result of the Delete and DeleteSpecResp method.

func Delete

func Delete(client *golangsdk.ServiceClient, instanceId, groupId, respId string) (r DeleteResult)

Delete is a method to delete the existing custom response.

func DeleteSpecResp

func DeleteSpecResp(client *golangsdk.ServiceClient, respType string, specOpts SpecRespOptsBuilder) (r DeleteResult)

DeleteSpecResp is a method to delete an existing custom response configuration from an group.

type GetResult

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

GetResult represents a result of the Get operation.

func Get

func Get(client *golangsdk.ServiceClient, instanceId, groupId, respId string) (r GetResult)

Get is a method to obtain the specified custom response according to the instanceId, appId and respId.

func (GetResult) Extract

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

Extract is a method to extract an response struct.

type GetSpecRespResult

type GetSpecRespResult struct {
	SpecRespResult
}

GetSpecRespResult represents a result of the GetSpecResp method.

func GetSpecResp

func GetSpecResp(client *golangsdk.ServiceClient, respType string, opts SpecRespOptsBuilder) (r GetSpecRespResult)

GetSpecResp is a method to get the specifies custom response configuration from an group.

func (GetSpecRespResult) Extract

func (r GetSpecRespResult) Extract() (*Response, error)

Extract is a method to extract an response struct.

type ListOpts

type ListOpts struct {
	// Offset from which the query starts.
	// If the offset is less than 0, the value is automatically converted to 0. Default to 0.
	Offset int `q:"offset"`
	// Number of items displayed on each page. The valid values are range form 1 to 500, default to 20.
	Limit int `q:"limit"`
	// APIG dedicated instance ID.
	InstanceId string `json:"-"`
	// APIG group ID.
	GroupId string `json:"-"`
}

ListOpts allows to filter list data using given parameters.

func (ListOpts) GetGroupId

func (opts ListOpts) GetGroupId() string

func (ListOpts) GetInstanceId

func (opts ListOpts) GetInstanceId() string

func (ListOpts) ToListQuery

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

type ListOptsBuilder

type ListOptsBuilder interface {
	ToListQuery() (string, error)
	GetInstanceId() string
	GetGroupId() string
}

type Response

type Response struct {
	// Response ID.
	Id string `json:"id"`
	// Response name.
	Name string `json:"name"`
	// Response type definition, which includes a key and value. Options of the key:
	//     AUTH_FAILURE: Authentication failed.
	//     AUTH_HEADER_MISSING: The identity source is missing.
	//     AUTHORIZER_FAILURE: Custom authentication failed.
	//     AUTHORIZER_CONF_FAILURE: There has been a custom authorizer error.
	//     AUTHORIZER_IDENTITIES_FAILURE: The identity source of the custom authorizer is invalid.
	//     BACKEND_UNAVAILABLE: The backend service is unavailable.
	//     BACKEND_TIMEOUT: Communication with the backend service timed out.
	//     THROTTLED: The request was rejected due to request throttling.
	//     UNAUTHORIZED: The app you are using has not been authorized to call the API.
	//     ACCESS_DENIED: Access denied.
	//     NOT_FOUND: No API is found.
	//     REQUEST_PARAMETERS_FAILURE: The request parameters are incorrect.
	//     DEFAULT_4XX: Another 4XX error occurred.
	//     DEFAULT_5XX: Another 5XX error occurred.
	// Each error type is in JSON format.
	Responses map[string]ResponseInfo `json:"responses"`
	// Indicates whether the group response is the default response.
	IsDefault bool `json:"default"`
	// Creation time.
	CreateTime string `json:"create_time"`
	// Update time.
	UpdateTime string `json:"update_time"`
}

func ExtractResponses

func ExtractResponses(r pagination.Page) ([]Response, error)

ExtractResponses is a method to extract an response struct list.

type ResponseInfo

type ResponseInfo struct {
	// Response body template.
	Body string `json:"body" required:"true"`
	// HTTP status code of the response. If omitted, the status will be cancelled.
	Status int `json:"status,omitempty"`
	// Indicates whether the response is the default response.
	// Only the response of the API call is supported.
	IsDefault bool `json:"default,omitempty"`
}

func (ResponseInfo) ToSpecRespUpdateMap

func (opts ResponseInfo) ToSpecRespUpdateMap() (map[string]interface{}, error)

type ResponseOpts

type ResponseOpts struct {
	// APIG group name, which can contain 1 to 64 characters, only letters, digits, hyphens (-) and
	// underscores (_) are allowed.
	Name string `json:"name" required:"true"`
	// Response type definition, which includes a key and value. Options of the key:
	//     AUTH_FAILURE: Authentication failed.
	//     AUTH_HEADER_MISSING: The identity source is missing.
	//     AUTHORIZER_FAILURE: Custom authentication failed.
	//     AUTHORIZER_CONF_FAILURE: There has been a custom authorizer error.
	//     AUTHORIZER_IDENTITIES_FAILURE: The identity source of the custom authorizer is invalid.
	//     BACKEND_UNAVAILABLE: The backend service is unavailable.
	//     BACKEND_TIMEOUT: Communication with the backend service timed out.
	//     THROTTLED: The request was rejected due to request throttling.
	//     UNAUTHORIZED: The app you are using has not been authorized to call the API.
	//     ACCESS_DENIED: Access denied.
	//     NOT_FOUND: No API is found.
	//     REQUEST_PARAMETERS_FAILURE: The request parameters are incorrect.
	//     DEFAULT_4XX: Another 4XX error occurred.
	//     DEFAULT_5XX: Another 5XX error occurred.
	// Each error type is in JSON format.
	Responses map[string]ResponseInfo `json:"responses,omitempty"`
	// APIG dedicated instance ID.
	InstanceId string `json:"-"`
	// APIG group ID.
	GroupId string `json:"-"`
}

ResponseOpts allows to create a new custom response or update the existing custom response using given parameters.

func (ResponseOpts) GetGroupId

func (opts ResponseOpts) GetGroupId() string

func (ResponseOpts) GetInstanceId

func (opts ResponseOpts) GetInstanceId() string

func (ResponseOpts) ToResponseOptsMap

func (opts ResponseOpts) ToResponseOptsMap() (map[string]interface{}, error)

type ResponseOptsBuilder

type ResponseOptsBuilder interface {
	ToResponseOptsMap() (map[string]interface{}, error)
	GetInstanceId() string
	GetGroupId() string
}

type ResponsePage

type ResponsePage struct {
	pagination.SinglePageBase
}

ResponsePage represents the response pages of the List operation.

type SpecRespOpts

type SpecRespOpts struct {
	InstanceId string
	GroupId    string
	RespId     string
}

SpecRespOpts is used to build the APIG response url. All parameters are required.

func (SpecRespOpts) GetGroupId

func (opts SpecRespOpts) GetGroupId() string

func (SpecRespOpts) GetInstanceId

func (opts SpecRespOpts) GetInstanceId() string

func (SpecRespOpts) GetResponseId

func (opts SpecRespOpts) GetResponseId() string

type SpecRespOptsBuilder

type SpecRespOptsBuilder interface {
	GetInstanceId() string
	GetGroupId() string
	GetResponseId() string
}

type SpecRespResult

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

func (SpecRespResult) Extract

func (r SpecRespResult) Extract() (*Response, error)

Extract is a method to extract an response struct.

func (SpecRespResult) ExtractSpecResp

func (r SpecRespResult) ExtractSpecResp(key string) (*ResponseInfo, error)

ExtractSpecResp is a method to extract an response struct using a specifies key.

type UpdateResult

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

UpdateResult represents a result of the Update operation.

func Update

func Update(client *golangsdk.ServiceClient, respId string, opts ResponseOptsBuilder) (r UpdateResult)

Update is a method by which to create function that udpate the existing custom response.

func (UpdateResult) Extract

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

Extract is a method to extract an response struct.

type UpdateSpecRespBuilder

type UpdateSpecRespBuilder interface {
	ToSpecRespUpdateMap() (map[string]interface{}, error)
}

type UpdateSpecRespResult

type UpdateSpecRespResult struct {
	SpecRespResult
}

UpdateSpecRespResult represents a result of the UpdateSpecResp method.

func UpdateSpecResp

func UpdateSpecResp(client *golangsdk.ServiceClient, respType string, specOpts SpecRespOptsBuilder,
	respOpts UpdateSpecRespBuilder) (r UpdateSpecRespResult)

UpdateSpecResp is a method to update an existing custom response configuration from an group.

func (UpdateSpecRespResult) Extract

func (r UpdateSpecRespResult) Extract() (*Response, error)

Extract is a method to extract an response struct.

Jump to

Keyboard shortcuts

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