Documentation ¶
Overview ¶
Package apigee provides a client for administering Apigee Edge.
Index ¶
- func Bool(v bool) *bool
- func CheckResponse(r *http.Response) error
- func Int(v int) *int
- func StreamToString(stream io.Reader) string
- func String(v string) *string
- type DeletedProxyInfo
- type EdgeAuth
- type EdgeClient
- func (c *EdgeClient) Do(req *http.Request, v interface{}) (*Response, error)
- func (c *EdgeClient) IsHybrid() bool
- func (c *EdgeClient) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)
- func (c *EdgeClient) NewRequestNoEnv(method, urlStr string, body interface{}) (*http.Request, error)
- func (c *EdgeClient) OnRequestCompleted(rc RequestCompletionCallback)
- type EdgeClientOptions
- type EdgeServer
- type Entry
- type EnvironmentDeployment
- type ErrorResponse
- type HybridDeployment
- type HybridDeployments
- type KVM
- type KVMService
- type KVMServiceOp
- type ListOptions
- type ProxiesService
- type ProxiesServiceOp
- func (s *ProxiesServiceOp) Deploy(proxyName, env string, rev Revision) (*ProxyRevisionDeployment, *Response, error)
- func (s *ProxiesServiceOp) Get(proxy string) (*Proxy, *Response, error)
- func (s *ProxiesServiceOp) GetDeployedRevision(proxy string) (*Revision, error)
- func (s *ProxiesServiceOp) GetDeployment(proxy string) (*EnvironmentDeployment, *Response, error)
- func (s *ProxiesServiceOp) GetHybridDeployedRevision(proxy string) (*Revision, error)
- func (s *ProxiesServiceOp) GetHybridDeployments(proxy string) ([]HybridDeployment, *Response, error)
- func (s *ProxiesServiceOp) Import(proxyName string, source string) (*ProxyRevision, *Response, error)
- func (s *ProxiesServiceOp) Undeploy(proxyName, env string, rev Revision) (*ProxyRevisionDeployment, *Response, error)
- type Proxy
- type ProxyDeployment
- type ProxyMetadata
- type ProxyRevision
- type ProxyRevisionDeployment
- type RequestCompletionCallback
- type Response
- type Revision
- type RevisionDeployment
- type RevisionSlice
- type Timestamp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
func Int ¶
Int is a helper routine that allocates a new int32 value to store v and returns a pointer to it, but unlike Int32 its argument value is an int.
func StreamToString ¶
StreamToString converts a reader to a string
Types ¶
type DeletedProxyInfo ¶
type DeletedProxyInfo struct {
Name string `json:"name,omitempty"`
}
DeletedProxyInfo contains the name of the deleted proxy
type EdgeAuth ¶
type EdgeAuth struct { // Optional. The path to the .netrc file that holds credentials for the Edge Management server. // By default, this is ${HOME}/.netrc . If you specify a Password, this option is ignored. NetrcPath string // Optional. The username to use when authenticating to the Edge Management server. // Ignored if you specify a NetrcPath. Username string // Optional. Used if you explicitly specify a Password. Password string // if set to true, no auth will be set SkipAuth bool // BearerToken token for OAuth or SAML BearerToken string }
EdgeAuth holds information about how to authenticate to the Edge Management server.
type EdgeClient ¶
type EdgeClient struct { // Base URL for API requests. BaseURL *url.URL // Base URL for API requests. BaseURLEnv *url.URL // User agent for client UserAgent string // Services used for communicating with the API Proxies ProxiesService KVMService KVMService // contains filtered or unexported fields }
EdgeClient manages communication with Apigee Edge V1 Admin API.
func NewEdgeClient ¶
func NewEdgeClient(o *EdgeClientOptions) (*EdgeClient, error)
NewEdgeClient returns a new EdgeClient.
func (*EdgeClient) Do ¶
func (c *EdgeClient) Do(req *http.Request, v interface{}) (*Response, error)
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.
func (*EdgeClient) IsHybrid ¶
func (c *EdgeClient) IsHybrid() bool
IsHybrid returns true if Apigee hybrid target
func (*EdgeClient) NewRequest ¶
func (c *EdgeClient) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)
NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLS should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included in as the request body. The current environment path element will be included in the URL.
func (*EdgeClient) NewRequestNoEnv ¶
func (c *EdgeClient) NewRequestNoEnv(method, urlStr string, body interface{}) (*http.Request, error)
NewRequestNoEnv creates an API request as NewRequest, but does not include the environment path element.
func (*EdgeClient) OnRequestCompleted ¶
func (c *EdgeClient) OnRequestCompleted(rc RequestCompletionCallback)
OnRequestCompleted sets the request completion callback for the API
type EdgeClientOptions ¶
type EdgeClientOptions struct { // MgmtURL is the Admin base URL. Optional. For example, if using OPDK this might be // http://192.168.10.56:8080. It defaults to https://api.enterprise.apigee.com. MgmtURL string // Specify the Edge organization name. Org string //Specify the Edge environment name. Env string // Required. Authentication information for the Edge Management server. Auth *EdgeAuth // Optional. Warning: if set to true, HTTP Basic Auth base64 blobs will appear in output. Debug bool // contains filtered or unexported fields }
EdgeClientOptions sets options for accessing edge APIs
type EdgeServer ¶
type EdgeServer struct { Status string `json:"status,omitempty"` UUID string `json:"uUID,omitempty"` Type []string `json:"type,omitempty"` }
EdgeServer is the deployment status for the edge server. When inquiring the deployment status of an API Proxy revision, even implicitly as when performing a Deploy or Undeploy, the response includes the deployment status for each particular Edge Server in the environment. This struct deserializes that information. It will normally not be useful at all. In rare cases, it may be useful in helping to diagnose problems. For example, if there is a problem with a deployment change, as when a Message Processor is experiencing a problem and cannot undeploy, or more commonly, cannot deploy an API Proxy, this struct will hold relevant information.
type EnvironmentDeployment ¶
type EnvironmentDeployment struct { Name string `json:"name,omitempty"` Revision []RevisionDeployment `json:"revision,omitempty"` }
EnvironmentDeployment is the deployment state of an environment
type ErrorResponse ¶
type ErrorResponse struct { // HTTP response that caused this error Response *http.Response // Error message - maybe the json for this is "fault" Message string `json:"message"` }
An ErrorResponse reports the error caused by an API request
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type HybridDeployment ¶
type HybridDeployment struct { Environment string `json:"environment,omitempty"` Name string `json:"apiProxy,omitempty"` Revision string `json:"revision,omitempty"` DeployStartTime string `json:"deployStartTime,omitempty"` BasePath string `json:"basePath,omitempty"` }
HybridDeployment contains information about a deployment in hybrid.
type HybridDeployments ¶
type HybridDeployments struct {
Deployments []HybridDeployment `json:"deployments,omitempty"`
}
HybridDeployments holds an array of HybridDeployment objects.
type KVM ¶
type KVM struct { Name string `json:"name,omitempty"` Encrypted bool `json:"encrypted,omitempty"` Entries []Entry `json:"entry,omitempty"` }
KVM represents an Apigee KVM
type KVMService ¶
type KVMService interface { Get(mapname string) (*KVM, *Response, error) Create(kvm KVM) (*Response, error) UpdateEntry(kvmName string, entry Entry) (*Response, error) AddEntry(kvmName string, entry Entry) (*Response, error) }
KVMService is an interface for interfacing with the Apigee Edge Admin API dealing with kvm.
type KVMServiceOp ¶
type KVMServiceOp struct {
// contains filtered or unexported fields
}
KVMServiceOp represents a KVM service operation
func (*KVMServiceOp) AddEntry ¶
func (s *KVMServiceOp) AddEntry(kvmName string, entry Entry) (*Response, error)
AddEntry add an entry to the KVM
func (*KVMServiceOp) Create ¶
func (s *KVMServiceOp) Create(kvm KVM) (*Response, error)
Create creates a KVM and returns a response
func (*KVMServiceOp) Get ¶
func (s *KVMServiceOp) Get(mapname string) (*KVM, *Response, error)
Get returns a response given a KVM map name
func (*KVMServiceOp) UpdateEntry ¶
func (s *KVMServiceOp) UpdateEntry(kvmName string, entry Entry) (*Response, error)
UpdateEntry updates a KVM entry
type ListOptions ¶
type ListOptions struct { // to ask for expanded results Expand bool `url:"expand"` }
ListOptions holds optional parameters to various List methods
type ProxiesService ¶
type ProxiesService interface { // List() ([]string, *Response, error) Get(string) (*Proxy, *Response, error) Import(proxyName string, source string) (*ProxyRevision, *Response, error) // Delete(string) (*DeletedProxyInfo, *Response, error) // DeleteRevision(string, Revision) (*ProxyRevision, *Response, error) Deploy(string, string, Revision) (*ProxyRevisionDeployment, *Response, error) Undeploy(string, string, Revision) (*ProxyRevisionDeployment, *Response, error) // Export(string, Revision) (string, *Response, error) GetDeployment(proxy string) (*EnvironmentDeployment, *Response, error) GetDeployedRevision(proxy string) (*Revision, error) GetHybridDeployments(proxy string) ([]HybridDeployment, *Response, error) GetHybridDeployedRevision(proxy string) (*Revision, error) }
ProxiesService is an interface for interfacing with the Apigee Edge Admin API dealing with apiproxies.
type ProxiesServiceOp ¶
type ProxiesServiceOp struct {
// contains filtered or unexported fields
}
ProxiesServiceOp represents operations against Apigee proxies
func (*ProxiesServiceOp) Deploy ¶
func (s *ProxiesServiceOp) Deploy(proxyName, env string, rev Revision) (*ProxyRevisionDeployment, *Response, error)
Deploy a revision of an API proxy to a specific environment within an organization.
func (*ProxiesServiceOp) Get ¶
func (s *ProxiesServiceOp) Get(proxy string) (*Proxy, *Response, error)
Get retrieves the information about an API Proxy in an organization, information including the list of available revisions, and the created and last modified dates and actors.
func (*ProxiesServiceOp) GetDeployedRevision ¶
func (s *ProxiesServiceOp) GetDeployedRevision(proxy string) (*Revision, error)
GetDeployedRevision returns the Revision that is deployed to an environment.
func (*ProxiesServiceOp) GetDeployment ¶
func (s *ProxiesServiceOp) GetDeployment(proxy string) (*EnvironmentDeployment, *Response, error)
GetDeployment retrieves the information about the deployment of an API Proxy in an environment. DOES NOT WORK WITH HYBRID!
func (*ProxiesServiceOp) GetHybridDeployedRevision ¶
func (s *ProxiesServiceOp) GetHybridDeployedRevision(proxy string) (*Revision, error)
GetHybridDeployedRevision returns the Revision that is deployed to an environment in hybrid.
func (*ProxiesServiceOp) GetHybridDeployments ¶
func (s *ProxiesServiceOp) GetHybridDeployments(proxy string) ([]HybridDeployment, *Response, error)
GetHybridDeployments retrieves the information about deployments of an API Proxy in an hybrid organization, including the environment names and revision numbers.
func (*ProxiesServiceOp) Import ¶
func (s *ProxiesServiceOp) Import(proxyName string, source string) (*ProxyRevision, *Response, error)
Import an API proxy into an organization, creating a new API Proxy revision. The proxyName can be passed as "nil" in which case the name is derived from the source. The source can be either a filesystem directory containing an exploded apiproxy bundle, OR the path of a zip file containing an API Proxy bundle. Returns the API proxy revision information. This method does not deploy the imported proxy. See the Deploy method.
func (*ProxiesServiceOp) Undeploy ¶
func (s *ProxiesServiceOp) Undeploy(proxyName, env string, rev Revision) (*ProxyRevisionDeployment, *Response, error)
Undeploy a specific revision of an API Proxy from a particular environment within an Edge organization.
type Proxy ¶
type Proxy struct { Revisions []Revision `json:"revision,omitempty"` Name string `json:"name,omitempty"` MetaData ProxyMetadata `json:"metaData,omitempty"` }
Proxy contains information about an API Proxy within an Edge organization.
type ProxyDeployment ¶
type ProxyDeployment struct { Environments []EnvironmentDeployment `json:"environment,omitempty"` Name string `json:"name,omitempty"` Organization string `json:"organization,omitempty"` }
ProxyDeployment holds information about the deployment state of a all revisions of an API Proxy.
type ProxyMetadata ¶
type ProxyMetadata struct { LastModifiedBy string `json:"lastModifiedBy,omitempty"` CreatedBy string `json:"createdBy,omitempty"` LastModifiedAt Timestamp `json:"lastModifiedAt,omitempty"` CreatedAt Timestamp `json:"createdAt,omitempty"` }
ProxyMetadata contains information related to the creation and last modified time and actor for an API Proxy within an organization.
type ProxyRevision ¶
type ProxyRevision struct { CreatedBy string `json:"createdBy,omitempty"` CreatedAt Timestamp `json:"createdAt,omitempty"` Description string `json:"description,omitempty"` ContextInfo string `json:"contextInfo,omitempty"` DisplayName string `json:"displayName,omitempty"` Name string `json:"name,omitempty"` LastModifiedBy string `json:"lastModifiedBy,omitempty"` LastModifiedAt Timestamp `json:"lastModifiedAt,omitempty"` Revision Revision `json:"revision,omitempty"` TargetEndpoints []string `json:"targetEndpoints,omitempty"` TargetServers []string `json:"targetServers,omitempty"` Resources []string `json:"resources,omitempty"` ProxyEndpoints []string `json:"proxyEndpoints,omitempty"` Policies []string `json:"policies,omitempty"` Type string `json:"type,omitempty"` }
ProxyRevision holds information about a revision of an API Proxy.
type ProxyRevisionDeployment ¶
type ProxyRevisionDeployment struct { Name string `json:"aPIProxy,omitempty"` Revision Revision `json:"revision,omitempty"` Environment string `json:"environment,omitempty"` Organization string `json:"organization,omitempty"` State string `json:"state,omitempty"` Servers []EdgeServer `json:"server,omitempty"` }
ProxyRevisionDeployment holds information about the deployment state of a single revision of an API Proxy.
type RequestCompletionCallback ¶
RequestCompletionCallback defines the type of the request callback function
type Revision ¶
type Revision int
Revision represents a revision number. Edge returns rev numbers in string form. This marshals and unmarshals between that format and int.
func (*Revision) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface. It marshals from a Revision holding an integer value like 2, into a string like "2".
func (*Revision) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface. It unmarshals from a string like "2" (including the quotes), into an integer 2.
type RevisionDeployment ¶
type RevisionDeployment struct { Number Revision `json:"name,omitempty"` State string `json:"state,omitempty"` Servers []EdgeServer `json:"server,omitempty"` }
RevisionDeployment is the deployment state of a revision
type RevisionSlice ¶
type RevisionSlice []Revision
RevisionSlice is for sorting
func (RevisionSlice) Len ¶
func (p RevisionSlice) Len() int
func (RevisionSlice) Less ¶
func (p RevisionSlice) Less(i, j int) bool
func (RevisionSlice) Swap ¶
func (p RevisionSlice) Swap(i, j int)
type Timestamp ¶
Timestamp represents a time that can be unmarshalled from a JSON string formatted as "java time" = milliseconds-since-unix-epoch.
func (Timestamp) MarshalJSON ¶
MarshalJSON creates a JSON representation of this Timestamp
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.