response

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(client *golangsdk.ServiceClient, gatewayID, groupID, id string) (err error)

func DeleteErrorType

func DeleteErrorType(client *golangsdk.ServiceClient, gatewayID, groupID, id, respType string) (err error)

Types

type CreateOpts

type CreateOpts struct {
	// Gateway ID
	GatewayID string `json:"-"`
	// Group ID.
	GroupId string `json:"-"`
	// 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"`
}

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"`
	// Gateway ID.
	GatewayID string `json:"-"`
	// Group ID.
	GroupID string `json:"-"`
}

ListOpts allows to filter list data using given parameters.

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.
	CreatedAt string `json:"create_time"`
	// Update time.
	UpdatedAt string `json:"update_time"`
}

func Create

func Create(client *golangsdk.ServiceClient, opts CreateOpts) (*Response, error)

func ExtractResponses

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

func Get

func Get(client *golangsdk.ServiceClient, gatewayID, groupID, id string) (*Response, error)

func List

func List(client *golangsdk.ServiceClient, opts ListOpts) ([]Response, error)

func Update

func Update(client *golangsdk.ServiceClient, id string, opts CreateOpts) (*Response, error)

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 GetErrorType

func GetErrorType(client *golangsdk.ServiceClient, gatewayID, groupID, id, respType string) (*ResponseInfo, error)

func UpdateErrorType

func UpdateErrorType(client *golangsdk.ServiceClient, respType string, opts UpdateErrorOpts) (*ResponseInfo, error)

type ResponsePage

type ResponsePage struct {
	pagination.NewSinglePageBase
}

type UpdateErrorOpts

type UpdateErrorOpts struct {
	// Gateway ID
	GatewayID string `json:"-"`
	// Group ID.
	GroupId string `json:"-"`
	// Response ID.
	ID string `json:"-"`
	// HTTP status code of the response.
	Status int `json:"status,omitempty"`
	// Response body template.
	Body string `json:"body,omitempty"`
}

Jump to

Keyboard shortcuts

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