apigee

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

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

Go to latest
Published: Apr 27, 2022 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
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
developer app 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 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
  • apimodels
  • shared flows or flow hooks (for now; we will deliver this when shared flows are final)
  • analytics or custom reports
  • DebugSessions (trace)
  • anything in BaaS
  • 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 code is Copyright (c) 2016 Apigee Corp. 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
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, make active or inactive, create, delete, modify custom attrs
developer app list, query, create, delete, revoke, approve, add new credential, remove credential
credential list, revoke, approve, add apiproduct, remove apiproduct
kvm query, create, delete, get entry, add entry, modify entry, remove entry list, get all entries
cache list, query, create, delete, clear
environment list, query

Pull requests are welcomed.

Usage Example

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: %d\n", resp.StatusCode)
  fmt.Printf("status: %s\n", resp.Status)
  defer resp.Body.Close()
  fmt.Printf("proxyRev: %#v\n", proxyRev)

  // TODO: Deploy the proxy revision with override = 10

  // TODO: Undeploy the proxy revision

  fmt.Printf("\nWaiting...\n")
  time.Sleep(3 * time.Second)

  fmt.Printf("\nDeleting...\n")
  deletedRev, resp, e := client.Proxies.DeleteRevision(proxyRev.Name, proxyRev.Revision)
  if e != nil {
    fmt.Printf("while deleting, error:\n%#v\n", e)
    return
  }
  fmt.Printf("status: %d\n", resp.StatusCode)
  fmt.Printf("status: %s\n", resp.Status)
  defer resp.Body.Close()
  fmt.Printf("proxyRev: %#v\n", deletedRev)
}

Bugs

  • There are embarrassingly few tests.

  • When importing from a source directory, the library creates a temporary zip file, but doesn't delete the file.

  • There is no working code for example clients, included in the distribution here.

  • 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 App

type App struct {
	ApigeeId string
}

This is just a placeholder

type Attribute

type Attribute struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

type Company

type Company struct {
	Name        string      `json:"name,omitempty"`
	DisplayName string      `json:"displayName,omitempty"`
	Attributes  []Attribute `json:"attributes,omitempty"`

	Status string   `json:"status,omitempty"`
	Apps   []string `json:"apps,omitempty"`
}

type CompanyApp

type CompanyApp struct {
	Name        string       `json:"name,omitempty"`
	ApiProducts []string     `json:"apiProducts,omitempty"`
	Attributes  []Attribute  `json:"attributes,omitempty"`
	Scopes      []string     `json:"scopes,omitempty"`
	CallbackUrl string       `json:"callbackUrl,omitempty"`
	Credentials []Credential `json:"credentials,omitempty"`
	AppId       string       `json:"appId,omitempty"`
	CompanyName string       `json:"companyName,omitempty"`
	AppFamily   string       `json:"appFamily,omitempty"`
	Status      string       `json:"status,omitempty"`
}

type CompanyAppCredential

type CompanyAppCredential struct {
	ConsumerKey    string      `json:"consumerKey,omitempty"`
	ConsumerSecret string      `json:"consumerSecret,omitempty"`
	ApiProducts    []string    `json:"apiProducts,omitempty"`
	ExpiresAt      int         `json:"expiresAt,omitempty"`
	Attributes     []Attribute `json:"attributes,omitempty"`
	Scopes         []string    `json:"scopes,omitempty"`
}

type CompanyAppCredentialService

type CompanyAppCredentialService interface {
	Create(string, string, CompanyAppCredential) (*Credential, *Response, error)
	Update(string, string, string, CompanyAppCredential) (*Credential, *Response, error)
	Get(string, string, string) (*Credential, *Response, error)
	Delete(string, string, string) (*Response, error)
	RemoveApiProduct(string, string, string, string) (*Response, error)
}

CompanyAppCredentialService is an interface for interfacing with the Apigee Edge Admin API dealing with companyApp credentials/keys.

type CompanyAppCredentialServiceOp

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

func (*CompanyAppCredentialServiceOp) Create

func (s *CompanyAppCredentialServiceOp) Create(companyName string, appName string, companyAppCredential CompanyAppCredential) (*Credential, *Response, error)

Create a company app's consumer key and secret

func (*CompanyAppCredentialServiceOp) Delete

func (s *CompanyAppCredentialServiceOp) Delete(companyName string, appName string, consumerKey string) (*Response, error)

Delete a company app's consumer key

func (*CompanyAppCredentialServiceOp) Get

func (s *CompanyAppCredentialServiceOp) Get(companyName string, appName string, consumerKey string) (*Credential, *Response, error)

Get information about a company app's consumer key

func (*CompanyAppCredentialServiceOp) RemoveApiProduct

func (s *CompanyAppCredentialServiceOp) RemoveApiProduct(companyName string, appName string, consumerKey string, apiProductName string) (*Response, error)

Remove an API product from a company app's consumer key

func (*CompanyAppCredentialServiceOp) Update

func (s *CompanyAppCredentialServiceOp) Update(companyName string, appName string, consumerKey string, companyAppCredential CompanyAppCredential) (*Credential, *Response, error)

Update existing company app's consumer key with new API products or attributes

type CompanyAppService

type CompanyAppService interface {
	Get(string, string) (*CompanyApp, *Response, error)
	Create(string, CompanyApp) (*CompanyApp, *Response, error)
	Delete(string, string) (*Response, error)
	Update(string, CompanyApp) (*CompanyApp, *Response, error)
}

CompanyAppService is an interface for interfacing with the Apigee Edge Admin API dealing with companyApps.

type CompanyAppServiceOp

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

func (*CompanyAppServiceOp) Create

func (s *CompanyAppServiceOp) Create(companyName string, companyApp CompanyApp) (*CompanyApp, *Response, error)

func (*CompanyAppServiceOp) Delete

func (s *CompanyAppServiceOp) Delete(companyName string, name string) (*Response, error)

func (*CompanyAppServiceOp) Get

func (s *CompanyAppServiceOp) Get(companyName string, name string) (*CompanyApp, *Response, error)

func (*CompanyAppServiceOp) Update

func (s *CompanyAppServiceOp) Update(companyName string, companyApp CompanyApp) (*CompanyApp, *Response, error)

type CompanyService

type CompanyService interface {
	Get(string) (*Company, *Response, error)
	Create(Company) (*Company, *Response, error)
	Delete(string) (*Response, error)
	Update(Company) (*Company, *Response, error)
}

CompanyService is an interface for interfacing with the Apigee Edge Admin API dealing with companys.

type CompanyServiceOp

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

func (*CompanyServiceOp) Create

func (s *CompanyServiceOp) Create(company Company) (*Company, *Response, error)

func (*CompanyServiceOp) Delete

func (s *CompanyServiceOp) Delete(name string) (*Response, error)

func (*CompanyServiceOp) Get

func (s *CompanyServiceOp) Get(name string) (*Company, *Response, error)

func (*CompanyServiceOp) Update

func (s *CompanyServiceOp) Update(company Company) (*Company, *Response, error)

type Credential

type Credential struct {
	ApiProducts    []CredentialApiProduct `json:"apiProducts,omitempty"`
	Attributes     []Attribute            `json:"attributes,omitempty"`
	ConsumerKey    string                 `json:"consumerKey,omitempty"`
	ConsumerSecret string                 `json:"consumerSecret,omitempty"`
	ExpiresAt      int                    `json:"expiresAt,omitempty"`
	IssuedAt       int                    `json:"issuedAt,omitempty"`
	Scopes         []string               `json:"scopes,omitempty"`
	Status         string                 `json:"status,omitempty"`
}

type CredentialApiProduct

type CredentialApiProduct struct {
	ApiProduct string `json:"apiproduct,omitempty"`
	Status     string `json:"status,omitempty"`
}

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 DeletedSharedFlowInfo

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

DeletedSharedFlowInfo is a payload that contains very little useful information. This struct deserializes that information.

type Developer

type Developer struct {
	Email       string      `json:"email,omitempty"`
	FirstName   string      `json:"firstName,omitempty"`
	LastName    string      `json:"lastName,omitempty"`
	UserName    string      `json:"userName,omitempty"`
	Attributes  []Attribute `json:"attributes,omitempty"`
	DeveloperId string      `json:"developerId,omitempty"`

	Apps   []string `json:"apps,omitempty"`
	Status string   `json:"status,omitempty"`
}

type DeveloperApp

type DeveloperApp struct {
	Name         string       `json:"name,omitempty"`
	ApiProducts  []string     `json:"apiProducts,omitempty"`
	KeyExpiresIn int          `json:"keyExpiresIn,omitempty"`
	Attributes   []Attribute  `json:"attributes,omitempty"`
	Scopes       []string     `json:"scopes,omitempty"`
	CallbackUrl  string       `json:"callbackUrl,omitempty"`
	Credentials  []Credential `json:"credentials,omitempty"`
	AppId        string       `json:"appId,omitempty"`
	DeveloperId  string       `json:"developerId,omitempty"`
	AppFamily    string       `json:"appFamily,omitempty"`
	Status       string       `json:"status,omitempty"`
}

type DeveloperAppService

type DeveloperAppService interface {
	Get(string, string) (*DeveloperApp, *Response, error)
	Create(string, DeveloperApp) (*DeveloperApp, *Response, error)
	Delete(string, string) (*Response, error)
	Update(string, DeveloperApp) (*DeveloperApp, *Response, error)
}

DeveloperAppService is an interface for interfacing with the Apigee Edge Admin API dealing with developerApps.

type DeveloperAppServiceOp

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

func (*DeveloperAppServiceOp) Create

func (s *DeveloperAppServiceOp) Create(email string, developerApp DeveloperApp) (*DeveloperApp, *Response, error)

func (*DeveloperAppServiceOp) Delete

func (s *DeveloperAppServiceOp) Delete(email string, name string) (*Response, error)

func (*DeveloperAppServiceOp) Get

func (s *DeveloperAppServiceOp) Get(email string, name string) (*DeveloperApp, *Response, error)

func (*DeveloperAppServiceOp) Update

func (s *DeveloperAppServiceOp) Update(email string, developerApp DeveloperApp) (*DeveloperApp, *Response, error)

type DeveloperService

type DeveloperService interface {
	Get(string) (*Developer, *Response, error)
	Create(Developer) (*Developer, *Response, error)
	Delete(string) (*Response, error)
	Update(Developer) (*Developer, *Response, error)
}

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

type DeveloperServiceOp

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

func (*DeveloperServiceOp) Create

func (s *DeveloperServiceOp) Create(developer Developer) (*Developer, *Response, error)

func (*DeveloperServiceOp) Delete

func (s *DeveloperServiceOp) Delete(email string) (*Response, error)

func (*DeveloperServiceOp) Get

func (s *DeveloperServiceOp) Get(email string) (*Developer, *Response, error)

func (*DeveloperServiceOp) Update

func (s *DeveloperServiceOp) Update(developer 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

	// Optional. Access token used for OAuth
	AccessToken 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
	TargetServers         TargetServersService
	Products              ProductsService
	Developers            DeveloperService
	Companies             CompanyService
	CompanyApps           CompanyAppService
	CompanyAppCredentials CompanyAppCredentialService
	DeveloperApps         DeveloperAppService
	SharedFlows           SharedFlowService

	// Account           AccountService
	// Actions           ActionsService
	// Domains           DomainsService
	// DropletActions    DropletActionsService
	// Images            ImagesService
	// ImageActions      ImageActionsService
	KeyValueMap      KeyValueMapService
	KeyValueMapEntry KeyValueMapEntryService
	// 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{}, contentTypeOverride string) (*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 EntryStruct

type EntryStruct struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

EntryStruct Holds the Key value map entry

type EnvironmentDeployment

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

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 KeyValueMap

type KeyValueMap struct {
	Name      string        `json:"name,omitempty"`
	Encrypted bool          `json:"encrypted,omitempty"`
	Entry     []EntryStruct `json:"entry,omitempty"`
}

KeyValueMap Holds the Key value map

type KeyValueMapEntry

type KeyValueMapEntry struct {
	KVMName string                 `json:"kvmName,omitempty"`
	Entry   []KeyValueMapEntryKeys `json:"entry,omitempty"`
}

KeyValueMapEntry Holds the Key value map

type KeyValueMapEntryKeys

type KeyValueMapEntryKeys struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

KeyValueMapEntryKeys to update

type KeyValueMapEntryService

KeyValueMapEntryService is an interface for interfacing with the Apigee Edge Admin API dealing with KeyValueMapEntry.

type KeyValueMapEntryServiceOp

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

KeyValueMapEntryServiceOp holds creds

func (*KeyValueMapEntryServiceOp) Create

func (s *KeyValueMapEntryServiceOp) Create(keyValueMapName string, keyValueMapEntry KeyValueMapEntryKeys, env string) (*KeyValueMapEntry, *Response, error)

Create a new key value map entry

func (*KeyValueMapEntryServiceOp) Delete

func (s *KeyValueMapEntryServiceOp) Delete(keyValueMapEntry string, keyValueMapName string, env string) (*Response, error)

Delete an existing key value map entry

func (*KeyValueMapEntryServiceOp) Get

func (s *KeyValueMapEntryServiceOp) Get(keyValueMapName string, env string, keyValueMapEntry string) (*KeyValueMapEntry, *Response, error)

Get the key value map entry

func (*KeyValueMapEntryServiceOp) Update

func (s *KeyValueMapEntryServiceOp) Update(keyValueMapName string, keyValueMapEntry KeyValueMapEntryKeys, env string) (*KeyValueMapEntry, *Response, error)

Update an existing key value map entry

type KeyValueMapService

type KeyValueMapService interface {
	Get(string, string) (*KeyValueMap, *Response, error)
	Create(KeyValueMap, string) (*KeyValueMap, *Response, error)
	Delete(string, string) (*Response, error)
	//The API is being deprectated do to the migration for Hybrid/ApigeeX.See KeyValueEntry if you use Hybrid.
	Update(KeyValueMap, string) (*KeyValueMap, *Response, error)
}

KeyValueMapService is an interface for interfacing with the Apigee Edge Admin API dealing with KeyValueMap.

type KeyValueMapServiceOp

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

KeyValueMapServiceOp holds creds

func (*KeyValueMapServiceOp) Create

func (s *KeyValueMapServiceOp) Create(keyValueMap KeyValueMap, env string) (*KeyValueMap, *Response, error)

Create a new key value map

func (*KeyValueMapServiceOp) Delete

func (s *KeyValueMapServiceOp) Delete(name string, env string) (*Response, error)

Delete an existing key value map

func (*KeyValueMapServiceOp) Get

func (s *KeyValueMapServiceOp) Get(name string, env string) (*KeyValueMap, *Response, error)

Get the Keyvaluemap

func (*KeyValueMapServiceOp) Update

func (s *KeyValueMapServiceOp) Update(keyValueMap KeyValueMap, env string) (*KeyValueMap, *Response, error)

Update an existing key value map

type ListOptions

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

ListOptions holds optional parameters to various List methods

type Product

type Product struct {
	Name          string      `json:"name,omitempty"`
	DisplayName   string      `json:"displayName,omitempty"`
	ApprovalType  string      `json:"approvalType,omitempty"` //manual or auto
	Attributes    []Attribute `json:"attributes,omitempty"`
	Description   string      `json:"description,omitempty"`
	ApiResources  []string    `json:"apiResources,omitempty"`
	Proxies       []string    `json:"proxies,omitempty"`
	Quota         string      `json:"quota,omitempty"`
	QuotaInterval string      `json:"quotaInterval,omitempty"`
	QuotaTimeUnit string      `json:"quotaTimeUnit,omitempty"`
	Scopes        []string    `json:"scopes,omitempty"`
	Environments  []string    `json:"environments,omitempty"`
}

type ProductsService

type ProductsService interface {
	Get(string) (*Product, *Response, error)
	Create(Product) (*Product, *Response, error)
	Delete(string) (*Response, error)
	Update(Product) (*Product, *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 Product) (*Product, *Response, error)

func (*ProductsServiceOp) Delete

func (s *ProductsServiceOp) Delete(name string) (*Response, error)

func (*ProductsServiceOp) Get

func (s *ProductsServiceOp) Get(name string) (*Product, *Response, error)

func (*ProductsServiceOp) Update

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

type ProxiesService

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, delay int, override bool) (*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) ReDeploy

func (s *ProxiesServiceOp) ReDeploy(proxyName, env string, rev Revision, delay int, override bool) (*ProxyRevisionDeployments, *Response, error)

isn't is nice that the return data structure changes on the second revision deployment?! NO!

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.

func (*ProxiesServiceOp) Update

func (s *ProxiesServiceOp) Update(proxyName string, rev string, source string) (*ProxyRevisionUpdate, *Response, error)

Update an API proxy revision that already exists. 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.

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 ProxyRevisionDeployments

type ProxyRevisionDeployments struct {
	Name         string                    `json:"aPIProxy,omitempty"`
	Environments []ProxyRevisionDeployment `json:"environment,omitempty"`
	Organization string                    `json:"organization,omitempty"`
}

ProxyRevisionDeployment holds information about the deployment state of a single revision of an API Proxy.

type ProxyRevisionUpdate

type ProxyRevisionUpdate struct {
	Revision Revision `json:"revision,omitempty"`
}

ProxyRevisionUpdate only returns the updated revision.

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 SSLInfo

type SSLInfo struct {
	SSLEnabled             string   `json:"enabled,omitempty"`
	ClientAuthEnabled      string   `json:"clientAuthEnabled,omitempty"`
	KeyStore               string   `json:"keyStore,omitempty"`
	TrustStore             string   `json:"trustStore,omitempty"`
	KeyAlias               string   `json:"keyAlias,omitempty"`
	Ciphers                []string `json:"ciphers,omitempty"`
	IgnoreValidationErrors bool     `json:"ignoreValidationErrors"`
	Protocols              []string `json:"protocols,omitempty"`
}

For some reason Apigee returns SOME bools as strings and others a bools.

type SharedFlow

type SharedFlow struct {
	Revisions []Revision         `json:"revision,omitempty"`
	Name      string             `json:"name,omitempty"`
	MetaData  SharedFlowMetadata `json:"metaData,omitempty"`
}

type SharedFlowDeployment

type SharedFlowDeployment struct {
	Environments []EnvironmentDeployment `json:"environment,omitempty"`
	Name         string                  `json:"name,omitempty"`
	Organization string                  `json:"organization,omitempty"`
}

SharedFlowDeployment holds information about the deployment state of all revisions of a shared flow

type SharedFlowMetadata

type SharedFlowMetadata struct {
	LastModifiedBy string    `json:"lastModifiedBy,omitempty"`
	CreatedBy      string    `json:"createdBy,omitempty"`
	LastModifiedAt Timestamp `json:"lastModifiedAt,omitempty"`
	CreatedAt      Timestamp `json:"createdAt,omitempty"`
}

SharedFlowMetadata contains information related to the creation and last modified time and actor for a shared flow within an organization.

type SharedFlowRevision

type SharedFlowRevision 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"`
	Policies        []string  `json:"policies,omitempty"`
	Type            string    `json:"type,omitempty"`
}

SharedFlowRevision holds information about a revision of a shared flow.

type SharedFlowRevisionDeployment

type SharedFlowRevisionDeployment struct {
	Name         string       `json:",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"`
}

SharedFlowRevisionDeployment holds information about the deployment state of a single revision of a shared flow.

type SharedFlowRevisionDeployments

type SharedFlowRevisionDeployments struct {
	Name         string                         `json:"name,omitempty"`
	Environments []SharedFlowRevisionDeployment `json:"environment,omitempty"`
	Organization string                         `json:"organization,omitempty"`
}

SharedFlowRevisionDeployments holds information about the deployment state of a single revision of a shared flow across environments

type SharedFlowService

SharedFlowService is an interface for interfacing with the Apigee Edge Admin API dealing with shardFlows.

type SharedFlowServiceOp

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

func (*SharedFlowServiceOp) Delete

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

func (*SharedFlowServiceOp) Deploy

func (s *SharedFlowServiceOp) Deploy(name, env string, rev Revision, delay int, override bool) (*SharedFlowRevisionDeployment, *Response, error)

Deploy a revision of a ShareFlow to a specific environment within an organization.

func (*SharedFlowServiceOp) Get

func (s *SharedFlowServiceOp) Get(name string) (*SharedFlow, *Response, error)

Get retrieves the information about a SharedFlow in an organization, information including the list of available revisions, and the created and last modified dates and actors.

func (*SharedFlowServiceOp) GetDeployments

func (s *SharedFlowServiceOp) GetDeployments(name string) (*SharedFlowDeployment, *Response, error)

GetDeployments retrieves the information about deployments of a shared flow in an organization, including the environment names and revision numbers.

func (*SharedFlowServiceOp) Import

func (s *SharedFlowServiceOp) Import(name string, source string) (*SharedFlowRevision, *Response, error)

Import an SharedFlow into an organization, creating a new shared flow revision. The sharedflow 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 shared flow bundle, OR the path of a zip file containing an SharedFlow bundle. Returns the shared flow revision information. This method does not deploy the imported shared flow. See the Deploy method.

func (*SharedFlowServiceOp) List

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

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

func (*SharedFlowServiceOp) ReDeploy

func (s *SharedFlowServiceOp) ReDeploy(sharedFlowName, env string, rev Revision, delay int, override bool) (*SharedFlowRevisionDeployments, *Response, error)

func (*SharedFlowServiceOp) Undeploy

func (s *SharedFlowServiceOp) Undeploy(sharedFlowName, env string, rev Revision) (*SharedFlowRevisionDeployment, *Response, error)

Undeploy a specific revision of a shared flow from a particular environment within an Edge organization.

type TargetServer

type TargetServer struct {
	Name    string   `json:"name,omitempty"`
	Host    string   `json:"host,omitempty"`
	Enabled bool     `json:"isEnabled"`
	Port    int      `json:"port,omitempty"`
	SSLInfo *SSLInfo `json:"sSLInfo,omitempty"`
}

type TargetServersService

type TargetServersService interface {
	Get(string, string) (*TargetServer, *Response, error)
	Create(TargetServer, string) (*TargetServer, *Response, error)
	Delete(string, string) (*Response, error)
	Update(TargetServer, string) (*TargetServer, *Response, error)
}

TargetServersService is an interface for interfacing with the Apigee Edge Admin API dealing with target servers.

type TargetServersServiceOp

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

func (*TargetServersServiceOp) Create

func (s *TargetServersServiceOp) Create(targetServer TargetServer, env string) (*TargetServer, *Response, error)

func (*TargetServersServiceOp) Delete

func (s *TargetServersServiceOp) Delete(name string, env string) (*Response, error)

func (*TargetServersServiceOp) Get

func (*TargetServersServiceOp) Update

func (s *TargetServersServiceOp) Update(targetServer TargetServer, env string) (*TargetServer, *Response, error)

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