Documentation ¶
Overview ¶
Package gravitee provides access to the Gravitee Management API (http://gravitee.io/).
More information is available on the project website: https://github.com/konsorten/go-gravitee/
Index ¶
- type APIRequest
- type ApiDetails
- type ApiDetailsEndpoint
- type ApiDetailsEndpointHttp
- type ApiDetailsEndpointSSL
- type ApiDetailsPath
- type ApiInfo
- type ApiMetadata
- type ApiMetadataFormat
- type ApiState
- type ApiVisibility
- type ConfigOptions
- type GraviteeSession
- func (s *GraviteeSession) AddOrUpdateEndpoints(id string, endpoints []ApiDetailsEndpoint, replaceAll bool) error
- func (s *GraviteeSession) DeployAPI(id string) error
- func (s *GraviteeSession) GetAPI(id string) (*ApiDetails, error)
- func (s *GraviteeSession) GetAPIMetadata(id string) ([]ApiMetadata, error)
- func (s *GraviteeSession) GetAPIsByLabel(label string) ([]ApiInfo, error)
- func (s *GraviteeSession) GetAllAPIs() ([]ApiInfo, error)
- func (s *GraviteeSession) GetLocalAPIMetadata(id string, metadataKey string) (*ApiMetadata, error)
- func (s *GraviteeSession) Ping() (bool, error)
- func (s *GraviteeSession) SetLocalAPIMetadata(id string, metadataKey string, value string, format ApiMetadataFormat) error
- func (s *GraviteeSession) String() string
- func (s *GraviteeSession) UnsetLocalAPIMetadata(id string, metadataKey string) error
- type RequestError
- type UserReference
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIRequest ¶
APIRequest builds our request before sending it to the server.
type ApiDetails ¶
type ApiDetails struct { ID string `json:"id"` Name string `json:"name"` Version string `json:"version"` Description string `json:"description"` Visibility ApiVisibility `json:"visibility"` State ApiState `json:"state"` Tags []string `json:"tags"` Labels []string `json:"labels"` //Paths map[string]ApiDetailsPath `json:"paths"` CreatedAt int `json:"created_at"` UpdatedAdd int `json:"updated_at"` DeployedAt int `json:"deployed_at"` Owner UserReference `json:"owner"` PictureURL string `json:"picture_url"` ContextPath string `json:"context_path"` Proxy struct { ContextPath string `json:"context_path"` StripContextPath bool `json:"strip_context_path"` LoggingMode string `json:"loggingMode"` Endpoints []ApiDetailsEndpoint `json:"endpoints"` LoadBalancing struct { Type string `json:"type"` } `json:"load_balancing"` CORS struct { IsEnabled bool `json:"enabled"` AllowCredentials bool `json:"allowCredentials"` AllowHeaders []string `json:"allowHeaders"` AllowMethods []string `json:"allowMethods"` AllowOrigin []string `json:"allowOrigin"` ExposeHeaders []string `json:"exposeHeaders"` MaxAgeSeconds int `json:"maxAge"` } `json:"cors"` } `json:"proxy"` }
func (ApiDetails) String ¶
func (ai ApiDetails) String() string
type ApiDetailsEndpoint ¶
type ApiDetailsEndpoint struct { Name string `json:"name"` Target string `json:"target"` Weight int `json:"weight"` IsBackup bool `json:"backup"` Type string `json:"type"` Http ApiDetailsEndpointHttp `json:"http"` SSL ApiDetailsEndpointSSL `json:"ssl"` }
func MakeApiDetailsEndpoint ¶
func MakeApiDetailsEndpoint(name, target string) ApiDetailsEndpoint
func (ApiDetailsEndpoint) String ¶
func (ai ApiDetailsEndpoint) String() string
type ApiDetailsEndpointHttp ¶
type ApiDetailsEndpointHttp struct { ConnectTimeoutMS int `json:"connectTimeout"` IdleTimeoutMS int `json:"idleTimeout"` ReadTimeoutMS int `json:"readTimeout"` KeepAlive bool `json:"keepAlive"` Pipelining bool `json:"pipelining"` MaxConcurrentConnections int `json:"maxConcurrentConnections"` UseCompression bool `json:"useCompression"` FollowRedirects bool `json:"followRedirects"` }
type ApiDetailsEndpointSSL ¶
type ApiDetailsPath ¶
type ApiDetailsPath struct { }
type ApiInfo ¶
type ApiInfo struct { ID string `json:"id"` Name string `json:"name"` Version string `json:"version"` Description string `json:"description"` Visibility ApiVisibility `json:"visibility"` State ApiState `json:"state"` Views []string `json:"views"` Labels []string `json:"labels"` Manageable bool `json:"manageable"` NumberOfRatings int `json:"numberOfRatings"` CreatedAt int `json:"created_at"` UpdatedAdd int `json:"updated_at"` Owner UserReference `json:"owner"` PictureURL string `json:"picture_url"` ContextPath string `json:"context_path"` }
type ApiMetadata ¶
type ApiMetadata struct { Key string `json:"key"` Name string `json:"name"` Format ApiMetadataFormat `json:"format"` LocalValue string `json:"value"` DefaultValue string `json:"defaultValue,omitempty"` ApiID string `json:"apiId,omitempty"` }
func (ApiMetadata) IsLocal ¶
func (ai ApiMetadata) IsLocal() bool
func (ApiMetadata) String ¶
func (ai ApiMetadata) String() string
func (ApiMetadata) Value ¶
func (ai ApiMetadata) Value() string
type ApiMetadataFormat ¶
type ApiMetadataFormat string
ApiMetadataFormat is an enumeration of possible *Format* to be used for an API metdata entry.
const ( ApiMetadataFormat_String ApiMetadataFormat = "string" ApiMetadataFormat_Numeric ApiMetadataFormat = "numeric" ApiMetadataFormat_Boolean ApiMetadataFormat = "boolean" ApiMetadataFormat_Date ApiMetadataFormat = "date" ApiMetadataFormat_Mail ApiMetadataFormat = "mail" ApiMetadataFormat_URL ApiMetadataFormat = "url" )
type ApiState ¶
type ApiState string
ApiState is an enumeration of possible *State* to be used for an API.
type ApiVisibility ¶
type ApiVisibility string
ApiVisibility is an enumeration of possible *Visibility* to be used for an API.
const ( ApiVisibility_Private ApiVisibility = "private" ApiVisibility_Public ApiVisibility = "public" )
type ConfigOptions ¶
ConfigOptions contains some advanced settings on server communication.
type GraviteeSession ¶
type GraviteeSession struct { Host string Authorization string Transport *http.Transport ConfigOptions *ConfigOptions }
GraviteeSession is a container for our session state.
func Connect ¶
func Connect(host, username, password string, configOptions *ConfigOptions) (*GraviteeSession, error)
Connect sets up our connection to the Zevenet system.
func (*GraviteeSession) AddOrUpdateEndpoints ¶
func (s *GraviteeSession) AddOrUpdateEndpoints(id string, endpoints []ApiDetailsEndpoint, replaceAll bool) error
AddOrUpdateEndpoints adds or updates an endpoint to an API registered in Gravitee.
func (*GraviteeSession) DeployAPI ¶
func (s *GraviteeSession) DeployAPI(id string) error
DeployAPI deploys the current configuration of the API to the gateway instances.
func (*GraviteeSession) GetAPI ¶
func (s *GraviteeSession) GetAPI(id string) (*ApiDetails, error)
GetAPI retrieves details on an API registered in Gravitee.
func (*GraviteeSession) GetAPIMetadata ¶
func (s *GraviteeSession) GetAPIMetadata(id string) ([]ApiMetadata, error)
GetAPIMetadata retrieves the metadata on an API registered in Gravitee.
func (*GraviteeSession) GetAPIsByLabel ¶
func (s *GraviteeSession) GetAPIsByLabel(label string) ([]ApiInfo, error)
GetAPIsByLabel retrieves a list of all APIs registered in Gravitee.
func (*GraviteeSession) GetAllAPIs ¶
func (s *GraviteeSession) GetAllAPIs() ([]ApiInfo, error)
GetAllAPIs retrieves a list of all APIs registered in Gravitee.
func (*GraviteeSession) GetLocalAPIMetadata ¶
func (s *GraviteeSession) GetLocalAPIMetadata(id string, metadataKey string) (*ApiMetadata, error)
GetLocalAPIMetadata retrieves a local metadata entry on an API registered in Gravitee.
func (*GraviteeSession) Ping ¶
func (s *GraviteeSession) Ping() (bool, error)
Ping checks if the API is available.
func (*GraviteeSession) SetLocalAPIMetadata ¶
func (s *GraviteeSession) SetLocalAPIMetadata(id string, metadataKey string, value string, format ApiMetadataFormat) error
SetLocalAPIMetadata updates or creates a local metadata entry on an API registered in Gravitee.
func (*GraviteeSession) String ¶
func (s *GraviteeSession) String() string
String returns the session's hostname.
func (*GraviteeSession) UnsetLocalAPIMetadata ¶
func (s *GraviteeSession) UnsetLocalAPIMetadata(id string, metadataKey string) error
UnsetLocalAPIMetadata removes a local metadata entry on an API registered in Gravitee.
type RequestError ¶
type RequestError struct { Message string `json:"message,omitempty"` HttpStatus int `json:"http_status,omitempty"` }
RequestError contains information about any error we get from a request.