product

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 18 Imported by: 4

Documentation

Index

Constants

View Source
const TargetsAttr = "apigee-remote-service-targets"

TargetsAttr is the name of the Product attribute that lists the targets (apis) it binds to (comma delim)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIProduct

type APIProduct struct {
	Attributes       []Attribute     `json:"attributes,omitempty"`
	Description      string          `json:"description,omitempty"`
	DisplayName      string          `json:"displayName,omitempty"`
	Environments     []string        `json:"environments,omitempty"`
	Name             string          `json:"name,omitempty"`
	OperationGroup   *OperationGroup `json:"operationGroup,omitempty"`
	Proxies          []string        `json:"proxies"`
	QuotaLimit       string          `json:"quota,omitempty"`
	QuotaInterval    string          `json:"quotaInterval,omitempty"`
	QuotaTimeUnit    string          `json:"quotaTimeUnit,omitempty"`
	Resources        []string        `json:"apiResources"`
	Scopes           []string        `json:"scopes"`
	APIs             []string
	EnvironmentMap   map[string]struct{}
	QuotaLimitInt    int64
	QuotaIntervalInt int64
	// contains filtered or unexported fields
}

An APIProduct is an Apigee API product. See the Apigee docs for details: https://docs.apigee.com/api-platform/publish/what-api-product

func (*APIProduct) GetBoundAPIs

func (p *APIProduct) GetBoundAPIs() []string

GetBoundAPIs returns an array of api names bound to this product

func (*APIProduct) UnmarshalJSON

func (p *APIProduct) UnmarshalJSON(data []byte) error

type APIResponse

type APIResponse struct {
	APIProducts []APIProduct `json:"apiProduct"`
}

APIResponse is the response from the Apigee products API

type Attribute

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

An Attribute is a name-value-pair attribute of an API product.

type AuthorizedOperation

type AuthorizedOperation struct {
	ID            string
	QuotaLimit    int64
	QuotaInterval int64
	QuotaTimeUnit string
}

AuthorizedOperation is the result of Authorize including Quotas

type Manager

type Manager interface {
	Products() ProductsNameMap
	Authorize(authContext *auth.Context, api, path, method string) []AuthorizedOperation
	Close()
}

A Manager wraps all things related to a set of API products.

func NewManager

func NewManager(options Options) (Manager, error)

NewManager creates a new product.Manager. Call Close() when done.

type Operation

type Operation struct {
	Methods  []string `json:"methods"`
	Resource string   `json:"resource"`
}

An Operation represents methods on a Resource

type OperationConfig

type OperationConfig struct {
	ID         string      `json:"-"`
	APISource  string      `json:"apiSource"`
	Attributes []Attribute `json:"attributes,omitempty"`
	Operations []Operation `json:"operations"`
	Quota      *Quota      `json:"quota"`
	// contains filtered or unexported fields
}

An OperationConfig is a group of Operations

func (*OperationConfig) UnmarshalJSON

func (oc *OperationConfig) UnmarshalJSON(data []byte) error

type OperationGroup

type OperationGroup struct {
	OperationConfigType string            `json:"operationConfigType"`
	OperationConfigs    []OperationConfig `json:"operationConfigs,omitempty"`
}

An OperationGroup holds OperationConfigs

type Options

type Options struct {
	// Client is a configured HTTPClient
	Client *http.Client
	// BaseURL of the Apigee runtime service proxy
	BaseURL *url.URL
	// RefreshRate determines how often the products are refreshed
	RefreshRate time.Duration
	// Org is organization
	Org string
	// Env is environment, "*" means multi-tenant
	Env string
}

Options allows us to specify options for how this product manager will run.

type ProductsNameMap

type ProductsNameMap map[string]*APIProduct

ProductsNameMap is a map of API Product name to API Product

type Quota

type Quota struct {
	Interval    string `json:"interval,omitempty"`
	Limit       string `json:"limit,omitempty"`
	TimeUnit    string `json:"timeUnit,omitempty"`
	IntervalInt int64
	LimitInt    int64
}

A Quota is attached to an OperationConfig

func (*Quota) UnmarshalJSON

func (q *Quota) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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