apigee

package module
v0.0.0-...-b414be1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: Apache-2.0, BSD-3-Clause, MIT Imports: 21 Imported by: 0

README

golang client library for Apigee Edge administrative API

Use this from Go-lang programs to invoke administrative operations on Apigee Edge.

The goal is to allow golang programs to easiy do these things:

entity type actions
apis list, query, inquire revisions, inquire deployment status, import, export, delete, delete revision, deploy, undeploy
sharedflows list, query, inquire revisions, inquire deployment status, import, export, delete, delete revision, deploy, undeploy
apiproducts list, query, create, delete, change quota, modify public/private, modify description, modify approvalType, modify scopes, add or remove proxy, modify custom attrs
developers list, query, create, delete, make active or inactive, modify custom attrs
developerapps list, query, create, delete, revoke, approve, add new credential, remove credential, modify custom attrs
credential list, revoke, approve, add apiproduct, remove apiproduct
kvm list, query, create, delete, get all entries, get entry, add entry, modify entry, remove entry
cache list, query, create, delete, clear
environment list, query

The Apigee Edge administrative API is just a REST-ful API, so of course any go program could invoke it directly. This library will provide a wrapper, which will make it easier.

Not yet in scope:

  • OAuth2.0 tokens - Listing, Querying, Approving, Revoking, Deleting, or Updating
  • TargetServers: list, create, edit, etc
  • keystores, truststores: adding certs, listing certs
  • data masks
  • specs
  • analytics or custom reports
  • DebugSessions (trace)
  • OPDK-specific things. Like starting or stopping services, manipulating pods, adding servers into environments, etc.

These items may be added later as need and demand warrants.

This is not an official Google product

This library and any example tools included here are not an official Google product, nor are they part of an official Google product. Support is available on a best-effort basis via github or community.apigee.com .

This code is Copyright (c) 2016 Apigee Corp, 2017-2019 Google LLC. it is licensed under the Apache 2.0 Source Licese.

Status

This project is a work-in-progress. Here's the status:

entity type implemented not implemented yet
apis list, query, inquire revisions, import, export, delete, delete revision, deploy, undeploy, inquire deployment status
sharedflows list, query, inquire revisions, import, export, delete, delete revision, deploy, undeploy, inquire deployment status
apiproducts list, query, create, delete modify description, modify approvalType, modify scopes, add or remove proxy, add or remove custom attrs, modify public/private, change quota
developers list, query, create, update, delete, modify custom attrs, make active or inactive, modify custom attrs
developerapps list, query, create, delete, revoke, approve, modify custom attrs add new credential, remove credential
credential list, revoke, approve, add apiproduct, remove apiproduct
kvm list, query, create, delete, get all entries, get entry, add entry, modify entry, remove entry
cache list, query create, delete, clear
environment list, query

Pull requests are welcomed.

Usage Examples

Importing a Proxy
package main

import (
  "fmt"
  "flag"
  "time"
  "github.com/DinoChiesa/go-apigee-edge"
)

func usage() {
  fmt.Printf("import-proxy -user dino@example.org -org cap500 -name foobar -src /path/to/apiproxy\n\n")
}


func main() {
  proxyName := ""
  namePtr := flag.String("name", "", "name for the API Proxy")
  srcPtr := flag.String("src", "", "a directory containing an exploded apiproxy bundle, or a zipped bundle")
  orgPtr := flag.String("org", "", "an Edge Organization")
  flag.Parse()

  if *namePtr != "" {
    proxyName = *namePtr
  }

  if *srcPtr == "" || *orgPtr == "" {
    usage()
    return
  }

  var auth *apigee.EdgeAuth = nil

  // Specifying nil for Auth implies "read from .netrc"
  // Specify a password explicitly like so:
  // auth := apigee.EdgeAuth{Username: "user@example.org", Password: "Secret*123"}

  opts := &apigee.EdgeClientOptions{Org: *orgPtr, Auth: auth, Debug: false }
  client, e := apigee.NewEdgeClient(opts)
  if e != nil {
    fmt.Printf("while initializing Edge client, error:\n%#v\n", e)
    return
  }

  fmt.Printf("\nImporting...\n")
  proxyRev, resp, e := client.Proxies.Import(proxyName, *srcPtr)
  if e != nil {
    fmt.Printf("while importing, error:\n%#v\n", e)
    return
  }
  fmt.Printf("status: %s\n", resp.Status)
  defer resp.Body.Close()
  fmt.Printf("proxyRev: %#v\n", proxyRev)
}

Deleting an API Proxy
func main() {
  opts := &apigee.EdgeClientOptions{Org: *orgPtr, Auth: nil, Debug: false }
  client, e := apigee.NewEdgeClient(opts)
  if e != nil {
    fmt.Printf("while initializing Edge client, error:\n%#v\n", e)
    return
  }
  fmt.Printf("Deleting...\n")
  deletedRev, resp, e := client.Proxies.DeleteRevision(proxyName, Revision{2})
  if e != nil {
    fmt.Printf("while deleting, error:\n%#v\n", e)
    return
  }
  fmt.Printf("status: %s\n", resp.Status)
  defer resp.Body.Close()
  fmt.Printf("proxyRev: %#v\n", deletedRev)
}
Listing API Products
func main() {
  orgPtr := flag.String("org", "", "an Edge Organization")
  flag.Parse()
  if *orgPtr == "" {
    usage()
    return
  }

  opts := &apigee.EdgeClientOptions{Org: *orgPtr, Auth: nil, Debug: false }
  client, e := apigee.NewEdgeClient(opts)
  if e != nil {
    fmt.Printf("while initializing Edge client, error:\n%#v\n", e)
    return
  }

  fmt.Printf("\nListing...\n")
  list, resp, e := client.Products.List()
  if e != nil {
    fmt.Printf("while listing, error:\n%#v\n", e)
    return
  }
  showStatus(resp)
  fmt.Printf("products: %#v\n", list)
  resp.Body.Close()

  for _, element := range list {
    product, resp, e := client.Products.Get(element)
    if e != nil {
      fmt.Printf("while getting, error:\n%#v\n", e)
      return
    }
    showStatus(resp)
    fmt.Printf("product: %#v\n", product)
    resp.Body.Close()
  }

  fmt.Printf("\nall done.\n")
}

Bugs

  • There tests are incomplete.

  • The examples are incomplete.

  • There is no package versioning strategy (eg, no use of GoPkg.in)

  • When deploying a proxy, there's no way to specify the override and delay parameters.

Documentation

Overview

Package apigee provides a client for administering Apigee Edge.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func CheckResponse

func CheckResponse(r *http.Response) error

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

func Int(v int) *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

func StreamToString(stream io.Reader) string

StreamToString converts a reader to a string

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

Types

type ApiProduct

type ApiProduct struct {
	Name           string     `json:"name,omitempty"`
	ApiResources   []string   `json:"apiResources,omitempty"`
	ApprovalType   string     `json:"approvalType,omitempty"`
	Attributes     Attributes `json:"attributes,omitempty"`
	CreatedBy      string     `json:"createdBy,omitempty"`
	CreatedAt      Timestamp  `json:"createdAt,omitempty"`
	Description    string     `json:"description,omitempty"`
	DisplayName    string     `json:"displayName,omitempty"`
	LastModifiedBy string     `json:"lastModifiedBy,omitempty"`
	LastModifiedAt Timestamp  `json:"lastModifiedAt,omitempty"`
	Environments   []string   `json:"environments,omitempty"`
	Proxies        []string   `json:"proxies,omitempty"`
	Scopes         []string   `json:"scopes,omitempty"`
}

ApiProduct contains information about an API Product within an Edge organization.

type Attributes

type Attributes map[string]string

Attributes represents a revision number. Edge returns rev numbers in string form. This marshals and unmarshals between that format and int.

func (Attributes) MarshalJSON

func (attrs Attributes) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. It marshals from an Attributes object (which is really a map[string]string) into a JSON that looks like

[ { "name" : "aaaaaa", "value" : "1234abcd"}, { "name" : "...", "value" : "..."} ]

func (Attributes) String

func (a Attributes) String() string

func (*Attributes) UnmarshalJSON

func (attrs *Attributes) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. It unmarshals from a string like "2" (including the quotes), into an integer 2.

type Cache

type Cache struct {
	Name                string      `json:"name,omitempty"`
	Description         string      `json:"description,omitempty"`
	OverflowToDisk      bool        `json:"overflowToDisk,omitempty"`
	Persistent          bool        `json:"persistent,omitempty"`
	Distributed         bool        `json:"distributed,omitempty"`
	DiskSizeInMB        int         `json:"diskSizeInMB,omitempty"`
	InMemorySizeInKB    int         `json:"inMemorySizeInKB,omitempty"`
	MaxElementsInMemory int         `json:"maxElementsInMemory,omitempty"`
	MaxElementsOnDisk   int         `json:"maxElementsOnDisk,omitempty"`
	Expiry              CacheExpiry `json:"expirySettings,omitempty"`
}

Cache contains information about a cache within an Edge organization.

type CacheExpiry

type CacheExpiry struct {
	ExpiryType  string
	ExpiryValue string
	ValuesNull  bool
}

CacheExpiry represents the expiry settings on a cache. This struct marshals and unmarshals between the json format Edge uses and a reasonably clear golang struct.

func (CacheExpiry) MarshalJSON

func (ce CacheExpiry) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. It marshals from the form used by Apigee Edge into a CacheExpiry struct. Eg,

{
  "expiryDate": { "value": "{mm-dd-yyyy}" },
  "valuesNull" : false
}

func (CacheExpiry) String

func (ce CacheExpiry) String() string

func (*CacheExpiry) UnmarshalJSON

func (ce *CacheExpiry) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. It unmarshals from a string like

{
  "expiryDate": { "value": "{mm-dd-yyyy}" },
  "valuesNull" : false
}

...into a CacheExpiry struct.

type CachesService

type CachesService interface {
	List(string) ([]string, *Response, error)
	Get(string, string) (*Cache, *Response, error)
}

CachesService is an interface for interfacing with the Apigee Edge Admin API dealing with caches.

type CachesServiceOp

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

func (*CachesServiceOp) Get

func (s *CachesServiceOp) Get(name, env string) (*Cache, *Response, error)

Get retrieves the information about a Cache in an organization, or about a cache in an environment within an organization. This information includes the properties, and the created and last modified details.

func (*CachesServiceOp) List

func (s *CachesServiceOp) List(env string) ([]string, *Response, error)

List retrieves the list of cache names for the organization referred by the EdgeClient, or a set of cache names for a specific environment within an organization.

type DeletedProxyInfo

type DeletedProxyInfo struct {
	Name string `json:"name,omitempty"`
}

When Delete returns successfully, it returns a payload that contains very little useful information. This struct deserializes that information.

type Developer

type Developer struct {
	UserName         string     `json:"userName,omitempty"`
	LastName         string     `json:"lastName,omitempty"`
	FirstName        string     `json:"firstName,omitempty"`
	Status           string     `json:"status,omitempty"` // active, inactive, ??
	Attributes       Attributes `json:"attributes,omitempty"`
	Companies        []string   `json:"companies,omitempty"`
	OrganizationName string     `json:"organizationName,omitempty"`
	Email            string     `json:"email,omitempty"`
	Id               string     `json:"uuid,omitempty"`
	Apps             []string   `json:"apps,omitempty"`
}

Developer contains information about a registered Developer within an Edge organization.

type DeveloperApp

type DeveloperApp struct {
	Name             string     `json:"name,omitempty"`
	ApiProducts      []string   `json:"apiProducts,omitempty"`
	InitialKeyExpiry string     `json:"keyExpiresIn,omitempty"`
	Attributes       Attributes `json:"attributes,omitempty"`
	Id               string     `json:"appId,omitempty"`
	DeveloperId      string     `json:"developerId,omitempty"`
	Scopes           []string   `json:"scopes,omitempty"`
	Status           string     `json:"status,omitempty"`
}

DeveloperApp holds information about a registered DeveloperApp.

type DeveloperAppsService

type DeveloperAppsService interface {
	Create(DeveloperApp) (*DeveloperApp, *Response, error)
	Delete(string) (*DeveloperApp, *Response, error)
	Revoke(string) (*Response, error)
	Approve(string) (*Response, error)
	List() ([]string, *Response, error)
	Get(string) (*DeveloperApp, *Response, error)
	Update(DeveloperApp) (*DeveloperApp, *Response, error)
}

DeveloperAppsService is an interface for interfacing with the Apigee Edge Admin API dealing with apps that belong to a particular developer.

type DeveloperAppsServiceOp

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

func (*DeveloperAppsServiceOp) Approve

func (s *DeveloperAppsServiceOp) Approve(appName string) (*Response, error)

func (*DeveloperAppsServiceOp) Create

func (*DeveloperAppsServiceOp) Delete

func (s *DeveloperAppsServiceOp) Delete(appName string) (*DeveloperApp, *Response, error)

func (*DeveloperAppsServiceOp) Get

func (*DeveloperAppsServiceOp) List

func (s *DeveloperAppsServiceOp) List() ([]string, *Response, error)

func (*DeveloperAppsServiceOp) Revoke

func (s *DeveloperAppsServiceOp) Revoke(appName string) (*Response, error)

func (*DeveloperAppsServiceOp) Update

type DevelopersService

type DevelopersService interface {
	List() ([]string, *Response, error)
	Get(string) (*Developer, *Response, error)
	Create(Developer) (*Developer, *Response, error)
	Update(Developer) (*Developer, *Response, error)
	Delete(string) (*Developer, *Response, error)
	Revoke(string) (*Response, error)
	Approve(string) (*Response, error)
	Apps(string) DeveloperAppsService
}

DevelopersService is an interface for interfacing with the Apigee Edge Admin API dealing with developers.

type DevelopersServiceOp

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

func (*DevelopersServiceOp) Approve

func (s *DevelopersServiceOp) Approve(developerEmailOrId string) (*Response, error)

func (*DevelopersServiceOp) Apps

func (s *DevelopersServiceOp) Apps(developerEmailOrId string) DeveloperAppsService

func (*DevelopersServiceOp) Create

func (s *DevelopersServiceOp) Create(dev Developer) (*Developer, *Response, error)

func (*DevelopersServiceOp) Delete

func (s *DevelopersServiceOp) Delete(devEmailOrId string) (*Developer, *Response, error)

func (*DevelopersServiceOp) Get

func (s *DevelopersServiceOp) Get(developerEmailOrId string) (*Developer, *Response, error)

func (*DevelopersServiceOp) List

func (s *DevelopersServiceOp) List() ([]string, *Response, error)

func (*DevelopersServiceOp) Revoke

func (s *DevelopersServiceOp) Revoke(developerEmailOrId string) (*Response, error)

func (*DevelopersServiceOp) Update

func (s *DevelopersServiceOp) Update(dev Developer) (*Developer, *Response, error)

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
}

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

	// User agent for client
	UserAgent string

	// Services used for communicating with the API
	Proxies      ProxiesService
	Products     ProductsService
	Developers   DevelopersService
	Environments EnvironmentsService
	Organization OrganizationService
	Caches       CachesService
	Options      EdgeClientOptions
	// 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) 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.

func (*EdgeClient) OnRequestCompleted

func (c *EdgeClient) OnRequestCompleted(rc RequestCompletionCallback)

sets the request completion callback for the API

type EdgeClientOptions

type EdgeClientOptions struct {

	// Optional. The Admin base URL. 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

	// 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
}

type EdgeServer

type EdgeServer struct {
	Status string   `json:"status,omitempty"`
	Uuid   string   `json:"uUID,omitempty"`
	Type   []string `json:"type,omitempty"`
}

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 Environment

type Environment struct {
	Name           string          `json:"name,omitempty"`
	CreatedBy      string          `json:"createdBy,omitempty"`
	CreatedAt      Timestamp       `json:"createdAt,omitempty"`
	LastModifiedBy string          `json:"lastModifiedBy,omitempty"`
	LastModifiedAt Timestamp       `json:"lastModifiedAt,omitempty"`
	Properties     PropertyWrapper `json:"properties,omitempty"`
}

Environment contains information about an environment within an Edge organization.

type EnvironmentDeployment

type EnvironmentDeployment struct {
	Name     string               `json:"name,omitempty"`
	Revision []RevisionDeployment `json:"revision,omitempty"`
}

type EnvironmentsService

type EnvironmentsService interface {
	List() ([]string, *Response, error)
	Get(string) (*Environment, *Response, error)
}

EnvironmentsService is an interface for interfacing with the Apigee Edge Admin API querying Edge environments.

type EnvironmentsServiceOp

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

func (*EnvironmentsServiceOp) Get

Get retrieves the information about an Environment in an organization, information including the properties, and the created and last modified details.

func (*EnvironmentsServiceOp) List

func (s *EnvironmentsServiceOp) List() ([]string, *Response, error)

List retrieves the list of environment names for the organization referred by the EdgeClient.

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 ListOptions

type ListOptions struct {
	// to ask for expanded results
	Expand bool `url:"expand"`
}

ListOptions holds optional parameters to various List methods

type Organization

type Organization struct {
	LastModifiedBy string          `json:"lastModifiedBy,omitempty"`
	CreatedBy      string          `json:"createdBy,omitempty"`
	LastModifiedAt Timestamp       `json:"lastModifiedAt,omitempty"`
	CreatedAt      Timestamp       `json:"createdAt,omitempty"`
	DisplayName    string          `json:"displayName,omitempty"`
	Environments   []string        `json:"environments,omitempty"`
	Name           string          `json:"name,omitempty"`
	Type           string          `json:"type,omitempty"`
	Properties     PropertyWrapper `json:"properties,omitempty"`
}

type OrganizationService

type OrganizationService interface {
	Get(string) (*Organization, *Response, error)
}

OrganizationsService is an interface for interfacing with the Apigee Edge Admin API querying Edge environments.

type OrganizationServiceOp

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

func (*OrganizationServiceOp) Get

Get retrieves the information about an Organization, information including the properties, and the created and last modified details, the list of Environments, etc.

type ProductsService

type ProductsService interface {
	List() ([]string, *Response, error)
	Get(string) (*ApiProduct, *Response, error)
	Create(ApiProduct) (*ApiProduct, *Response, error)
	Update(ApiProduct) (*ApiProduct, *Response, error)
	Delete(string) (*ApiProduct, *Response, error)
}

ProductsService is an interface for interfacing with the Apigee Edge Admin API dealing with apiproducts.

type ProductsServiceOp

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

func (*ProductsServiceOp) Create

func (s *ProductsServiceOp) Create(product ApiProduct) (*ApiProduct, *Response, error)

func (*ProductsServiceOp) Delete

func (s *ProductsServiceOp) Delete(productName string) (*ApiProduct, *Response, error)

func (*ProductsServiceOp) Get

func (s *ProductsServiceOp) Get(productName string) (*ApiProduct, *Response, error)

Get retrieves the information about an API Product in an organization, information including the list of API Proxies, the scopes, the quota, and other attributes.

func (*ProductsServiceOp) List

func (s *ProductsServiceOp) List() ([]string, *Response, error)

List retrieves the list of apiproduct names for the organization referred by the EdgeClient.

func (*ProductsServiceOp) Update

func (s *ProductsServiceOp) Update(product ApiProduct) (*ApiProduct, *Response, error)

type PropertyWrapper

type PropertyWrapper struct {
	Property Attributes `json:"property,omitempty"`
}

This is just a wrapper struct to aid in serialization and de-serialization.

type ProxiesService

type ProxiesService interface {
	List() ([]string, *Response, error)
	Get(string) (*Proxy, *Response, error)
	Import(string, 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)
	GetDeployments(string) (*ProxyDeployment, *Response, 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
}

func (*ProxiesServiceOp) Delete

func (s *ProxiesServiceOp) Delete(proxyName string) (*DeletedProxyInfo, *Response, error)

Delete an API Proxy and all its revisions from an organization. This method will fail if any of the revisions of the named API Proxy are currently deployed in any environment.

func (*ProxiesServiceOp) DeleteRevision

func (s *ProxiesServiceOp) DeleteRevision(proxyName string, rev Revision) (*ProxyRevision, *Response, error)

DeleteRevision deletes a specific revision of an API Proxy from an organization. The revision must exist, and must not be currently deployed.

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) DeployAtPath

func (s *ProxiesServiceOp) DeployAtPath(proxyName, basepath, env string, rev Revision) (*ProxyRevisionDeployment, *Response, error)

Deploy a revision of an API proxy to a specific environment within an organization.

func (*ProxiesServiceOp) Export

func (s *ProxiesServiceOp) Export(proxyName string, rev Revision) (string, *Response, error)

Export a revision of an API proxy within an organization, to a filesystem file.

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) GetDeployments

func (s *ProxiesServiceOp) GetDeployments(proxy string) (*ProxyDeployment, *Response, error)

GetDeployments retrieves the information about deployments of an API Proxy in an 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) List

func (s *ProxiesServiceOp) List() ([]string, *Response, error)

List retrieves the list of apiproxy names for the organization referred by the EdgeClient.

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

type RequestCompletionCallback func(*http.Request, *http.Response)

RequestCompletionCallback defines the type of the request callback function

type Response

type Response struct {
	*http.Response
}

wrap the standard http.Response returned from Apigee Edge. (why?)

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

func (r *Revision) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. It marshals from a Revision holding an integer value like 2, into a string like "2".

func (Revision) String

func (r Revision) String() string

func (*Revision) UnmarshalJSON

func (r *Revision) UnmarshalJSON(b []byte) error

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"`
}

type Timespan

type Timespan struct {
	time.Duration
}

Timespan represents a timespan that can be parsed from a string like "3d" meaning "3 days". It will typically be serialized as milliseconds = milliseconds-since-unix-epoch.

func NewTimespan

func NewTimespan(initializer string) *Timespan

func (Timespan) MarshalJSON

func (span Timespan) MarshalJSON() ([]byte, error)

func (Timespan) String

func (span Timespan) String() string

func (*Timespan) UnmarshalJSON

func (span *Timespan) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp represents a time that can be unmarshalled from a JSON string formatted as "java time" = milliseconds-since-unix-epoch.

func (Timestamp) Equal

func (t Timestamp) Equal(u Timestamp) bool

Equal reports whether t and u are equal based on time.Equal

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

func (Timestamp) String

func (t Timestamp) String() string

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.

Jump to

Keyboard shortcuts

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