Documentation ¶
Index ¶
- Constants
- func ConstructControlPlaneRequest(id *string, gwLabel []string, controlPlaneParams controlPlaneParameters, ...) *http.Request
- func FetchAPIs(id *string, gwLabel []string, c chan SyncAPIResponse, resourceEndpoint string, ...)
- func InitializeWorkerPool(maxWorkers, jobQueueCapacity int, delayForFaultRequests time.Duration, ...)
- func RetryFetchingAPIs(c chan SyncAPIResponse, data SyncAPIResponse, endpoint string, sendType bool, ...)
- func SendRequestToControlPlane(req *http.Request, apiID *string, gwLabels []string, c chan SyncAPIResponse, ...) bool
- type APIConfigs
- type APIDeployment
- type APIEnvProps
- type DeploymentData
- type DeploymentDescriptor
- type GatewayLabel
- type SyncAPIResponse
Constants ¶
const ( // Authorization represent the authorization header string. Authorization string = "Authorization" // RuntimeArtifactEndpoint represents the /runtime-artifacts endpoint. RuntimeArtifactEndpoint string = "internal/data/v1/runtime-artifacts" // APIArtifactEndpoint represents the /retrieve-api-artifacts endpoint. APIArtifactEndpoint string = "internal/data/v1/retrieve-api-artifacts" )
Variables ¶
This section is empty.
Functions ¶
func ConstructControlPlaneRequest ¶
func ConstructControlPlaneRequest(id *string, gwLabel []string, controlPlaneParams controlPlaneParameters, resourceEndpoint string, sendType bool, apiUUIDList []string, queryParamMap map[string]string) *http.Request
ConstructControlPlaneRequest constructs the http Request used to send to the control plane
func FetchAPIs ¶
func FetchAPIs(id *string, gwLabel []string, c chan SyncAPIResponse, resourceEndpoint string, sendType bool, apiUUIDList []string, queryParamMap map[string]string)
FetchAPIs submits the control plane http request to the thread pool. The thread pool would process it and return the http response to the channel which contains a zip file.
func InitializeWorkerPool ¶
func InitializeWorkerPool(maxWorkers, jobQueueCapacity int, delayForFaultRequests time.Duration, trustStoreLocation string, skipSSL bool, requestTimeout, retryInterval time.Duration, serviceURL, username, password string)
InitializeWorkerPool creates the Worker Pool used for the Control Plane Rest API invocations. maxWorkers indicate the maximum number of parallel workers sending requests to the control plane. jobQueueCapacity indicate the maximum number of requests can kept inside a single worker's queue. delayForFaultRequests indicate the delay a worker enforce (in seconds) when a fault response is received.
func RetryFetchingAPIs ¶
func RetryFetchingAPIs(c chan SyncAPIResponse, data SyncAPIResponse, endpoint string, sendType bool, queryParamMap map[string]string)
RetryFetchingAPIs function keeps retrying to fetch APIs from runtime-artifact endpoint.
func SendRequestToControlPlane ¶
func SendRequestToControlPlane(req *http.Request, apiID *string, gwLabels []string, c chan SyncAPIResponse, client *http.Client) bool
SendRequestToControlPlane is the function triggered to send the request to the control plane. It returns true if a response is received from the api manager.
Types ¶
type APIConfigs ¶
type APIConfigs struct { ProductionEndpoint string `mapstructure:"productionEndpoint,omitempty"` SandBoxEndpoint string `mapstructure:"sandboxEndpoint,omitempty"` }
APIConfigs represents env properties belongs to the API
type APIDeployment ¶
type APIDeployment struct { APIFile string `json:"apiFile"` Environments []GatewayLabel `json:"environments"` // These properties are used by global Adapter OrganizationID string `json:"organizationId"` APIContext string `json:"apiContext"` Version string `json:"version"` }
APIDeployment represents an API project that contains zip file name and gateway environments (labels) that the project to be deployed
type APIEnvProps ¶
type APIEnvProps struct { EnvID string `mapstructure:"envId,omitempty"` APIConfigs APIConfigs `mapstructure:"configs,omitempty"` }
APIEnvProps represents env properties
type DeploymentData ¶
type DeploymentData struct {
Deployments []APIDeployment `json:"deployments"`
}
DeploymentData contains list of APIDeployment to be deployed to the gateway
type DeploymentDescriptor ¶
type DeploymentDescriptor struct { Type string `json:"type"` Version string `json:"version"` Data DeploymentData `json:"data"` }
DeploymentDescriptor represents deployment descriptor file contains in Artifact received from control plane
func ReadRootFiles ¶
func ReadRootFiles(reader *zip.Reader) (*DeploymentDescriptor, map[string]map[string]APIEnvProps, error)
ReadRootFiles function reads following files inside the root zip deployment.json env_properties.json
type GatewayLabel ¶
GatewayLabel represents gateway environment name and VHost of an API project
type SyncAPIResponse ¶
type SyncAPIResponse struct { Resp []byte Err error ErrorCode int APIUUID string GatewayLabels []string }
SyncAPIResponse struct contains information related to response of the API pulling/fetching from control plane along with the apiId and the gateway label that the call was made with.