rest

package
v0.0.0-...-7447044 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2017 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	BASE_PATH         = "/apiplatform/repository/v2"
	ORG_PATH          = "/organizations/{orgId}"
	SEARCH_API_PATH   = "/apis?ascending=false&limit={limit}&offset={offset}&query={APIName}&sort={sortOrder}"
	API_PATH          = BASE_PATH + ORG_PATH + "/apis/{apiId}"
	VERSION_PATH      = API_PATH + "/versions/{versionId}"
	API_ENDPOINT_PATH = VERSION_PATH + "/endpoint"
	ENVIRONMENTS      = "/accounts/api/organizations/{orgId}/environments"
	ARM               = "/armui/api/v1"
	APPLICATIONS      = ARM + "/applications"
	SERVERS           = ARM + "/servers"
	HYBRID            = "/hybrid/api/v1"
	CLUSTERS          = HYBRID + "/clusters"
	CLUSTER           = HYBRID + "/clusters/{clusterId}"
)
View Source
const (
	LOGIN     string = "/accounts/login"
	ME        string = "/accounts/api/me"
	HIERARCHY string = "/accounts/api/organizations/{orgId}/hierarchy"
)

Variables

This section is empty.

Functions

func Login

func Login(httpClient *RestClient, uri, pUsername, pPassword string) string

Login the given user and return the bearer Token

func NewHttpError

func NewHttpError(code int, theMsg string) error

Types

type API

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

func NewAPI

func NewAPI(uri, token string) *API

NewAPI - Create a new API struct

func NewAPIWithCredentials

func NewAPIWithCredentials(uri, username, password string) *API

func (*API) CreateCluster

func (api *API) CreateCluster(orgId, environment string, cluster *Cluster) (string, error)

* UNICAST REQUEST: POST

{
 "name":"UNICAST",
 "multicastEnabled":false,
 "servers":[
 	{
 		"serverId":20,
 		"serverIp":"10.8.8.3"
 	},
 	{
 		"serverId":19,
 		"serverIp":"10.8.8.3"
 	}
 ]
}

MULTICAST REQUEST:

{
	"name":"MULTICAST",
	"multicastEnabled":true,
	"servers":[
		{"serverId":20},
		{"serverId":19}
	]
}

func (*API) DeleteCluster

func (api *API) DeleteCluster(orgId, environmentName, clusterName string) (interface{}, error)

func (*API) FindEnvironmentByName

func (api *API) FindEnvironmentByName(orgId, environment string) (map[string]interface{}, error)

func (*API) GetAllServers

func (api *API) GetAllServers(orgId, environment string) ([]interface{}, error)

func (*API) GetApplicationByName

func (api *API) GetApplicationByName(orgId, environment, appName string) (map[string]interface{}, error)

func (*API) GetApplications

func (api *API) GetApplications(orgId, environment string) ([]interface{}, error)

func (*API) GetEndpointAsJSONString

func (api *API) GetEndpointAsJSONString(orgId string, apiId, versionId int) (string, error)

func (*API) GetEndpointAsMap

func (api *API) GetEndpointAsMap(orgId string, apiId, versionId int) (map[string]interface{}, error)

func (*API) SearchAPIAsJSON

func (api *API) SearchAPIAsJSON(orgID string, params *SearchParameters) (map[string]interface{}, error)

SearchAPIAsJSON - Search an API by name

func (*API) SearchAPIAsString

func (api *API) SearchAPIAsString(orgID string, params *SearchParameters) (string, error)

func (*API) SearchAllApplicationsByName

func (api *API) SearchAllApplicationsByName(orgId, environment, appName string) ([]interface{}, error)

func (*API) SearchServers

func (api *API) SearchServers(orgId, environment, serverName string) ([]interface{}, error)

func (*API) SetEndpoint

func (api *API) SetEndpoint(endpoint *Endpoint) error

type Auth

type Auth struct {
	Token string
	// contains filtered or unexported fields
}

func NewAuthWithCredentials

func NewAuthWithCredentials(uri, username, password string) *Auth

func NewAuthWithToken

func NewAuthWithToken(uri, token string) *Auth

func (*Auth) FindBusinessGroup

func (auth *Auth) FindBusinessGroup(path string) string

func (*Auth) Hierarchy

func (auth *Auth) Hierarchy() []byte

func (*Auth) Me

func (auth *Auth) Me() []byte

type AuthToken

type AuthToken struct {
	BearerToken string `json:"access_token,omitempty"`
}

type Cluster

type Cluster struct {
	ClusterName string          `yaml:"cluster_name" json:"name"`
	Multicast   bool            `yaml:"mulsticast" json:"multicastEnabled"`
	Servers     []ClusterServer `yaml:"servers" json:"servers"`
}

type ClusterServer

type ClusterServer struct {
	ID   float64 `yaml:"id,omitempty" json:"serverId"`
	Name string  `yaml:"name" json:"-"`
	Ip   string  `yaml:"ip" json:"serverIp"`
}

type Clusters

type Clusters struct {
	ACluster []Cluster `yaml:"clusters"`
}

type ContentType

type ContentType int
const (
	Application_Json ContentType = iota
	Application_OctetStream
	Application_Pdf
	Application_Atom_Xml
	Application_Form_Urlencoded
	Application_SVG_XML
	Application_XHTML_XML
	Application_XML
	Multipart_Form_Data
	Text_HTML
	Text_Plain
	Text_XML
	Wildcard
)

type Endpoint

type Endpoint struct {
	Id                   int    `json:"id"`
	OrgID                string `json:"masterOrganizationId"`
	ApiID                int
	VersionID            int    `json:"apiVersionId"`
	Type                 string `json:"type"`
	Uri                  string `json:"uri"`
	ProxyUri             string `json:"proxyUri"`
	ProxyRegistrationUri string `json:"proxyRegistrationUri"`
	IsCloudHub           bool   `json:"isCloudHub"`
	ReferencesUserDomain bool   `json:"referencesUserDomain"`
	ResponseTimeout      int    `json:"responseTimeout"`
}

type Filters

type Filters string
const (
	API_FILTER_FAVORITES     Filters = "pinned"
	API_FILTER_ACTIVE        Filters = "active"
	API_FILTER_PUBLIC_PORTAL Filters = "public"
	API_FILTER_ALL           Filters = "all"
)

type HttpError

type HttpError struct {
	StatusCode int
	// contains filtered or unexported fields
}

func (*HttpError) Error

func (e *HttpError) Error() string

type LoginPayload

type LoginPayload struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type RestClient

type RestClient struct {
	URI   string
	Sling *sling.Sling
	// contains filtered or unexported fields
}

func NewRestClient

func NewRestClient(uri string) *RestClient

func (*RestClient) AddAuthHeader

func (client *RestClient) AddAuthHeader(token string) *RestClient

func (*RestClient) AddEnvHeader

func (client *RestClient) AddEnvHeader(envId string) *RestClient

func (*RestClient) AddHeader

func (client *RestClient) AddHeader(key, value string) *RestClient

func (*RestClient) AddOrgHeader

func (client *RestClient) AddOrgHeader(orgId string) *RestClient

func (*RestClient) DELETE

func (client *RestClient) DELETE(body interface{}, path string, cType ContentType, responseObj interface{}) (*http.Response, error)

DELETE - Perform an HTTP DELETE

func (*RestClient) GET

func (client *RestClient) GET(path string) ([]byte, error)

func (*RestClient) PATCH

func (client *RestClient) PATCH(body interface{}, path string, cType ContentType, responseObj interface{}) (*http.Response, error)

PATCH - Perform an HTTP PATCH

func (*RestClient) POST

func (client *RestClient) POST(body interface{}, path string, cType ContentType, responseObj interface{}) (*http.Response, error)

POST - Perform an HTTP POST

type SearchParameters

type SearchParameters struct {
	Name      string
	Limit     int
	Offset    int
	SortOrder string  `default:"createdDate"`
	Filter    Filters `default:"all""`
}

Jump to

Keyboard shortcuts

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