helper

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTP_VERBOSE_ENVVAR = "THREESCALE_DEBUG"
)

Variables

This section is empty.

Functions

func BackendList

func BackendList(ns string, cl client.Client, providerAccount *ProviderAccount, logger logr.Logger) ([]capabilitiesv1beta1.Backend, error)

BackendList returns a list of backend custom resources where all elements: - Sync state (ensure remote backend exist and in sync) - Same 3scale provider Account

func PortaClient

func PortaClient(providerAccount *ProviderAccount) (*threescaleapi.ThreeScaleClient, error)

PortaClient instantiate porta_client.ThreeScaleClient from ProviderAccount object

func PortaClientFromURL

func PortaClientFromURL(url *url.URL, token string) (*threescaleapi.ThreeScaleClient, error)

PortaClientFromURL instantiates porta_client.ThreeScaleClient from admin url object

func PortaClientFromURLString

func PortaClientFromURLString(adminURLStr, token string) (*threescaleapi.ThreeScaleClient, error)

func ProductList

func ProductList(ns string, cl client.Client, providerAccount *ProviderAccount, logger logr.Logger) ([]capabilitiesv1beta1.Product, error)

ProductList returns a list of product custom resources where all elements: - Sync state (ensure remote product exist and in sync) - Same 3scale provider Account

func SanitizeBackendSystemName

func SanitizeBackendSystemName(systemName string) string

func SanitizeProductSystemName

func SanitizeProductSystemName(systemName string) string

Types

type ApplicationPlanEntity

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

func (*ApplicationPlanEntity) ApprovalRequired

func (b *ApplicationPlanEntity) ApprovalRequired() bool

func (*ApplicationPlanEntity) CostPerMonth

func (b *ApplicationPlanEntity) CostPerMonth() float64

func (*ApplicationPlanEntity) CreateLimit

func (b *ApplicationPlanEntity) CreateLimit(metricID int64, params threescaleapi.Params) error

func (*ApplicationPlanEntity) CreatePricingRule

func (b *ApplicationPlanEntity) CreatePricingRule(metricID int64, params threescaleapi.Params) error

func (*ApplicationPlanEntity) DeleteLimit

func (b *ApplicationPlanEntity) DeleteLimit(metricID, id int64) error

func (*ApplicationPlanEntity) DeletePricingRule

func (b *ApplicationPlanEntity) DeletePricingRule(metricID, id int64) error

func (*ApplicationPlanEntity) ID

func (b *ApplicationPlanEntity) ID() int64

func (*ApplicationPlanEntity) Limits

func (*ApplicationPlanEntity) Name

func (b *ApplicationPlanEntity) Name() string

func (*ApplicationPlanEntity) PricingRules

func (*ApplicationPlanEntity) SetupFee

func (b *ApplicationPlanEntity) SetupFee() float64

func (*ApplicationPlanEntity) TrialPeriodDays

func (b *ApplicationPlanEntity) TrialPeriodDays() int

func (*ApplicationPlanEntity) Update

func (b *ApplicationPlanEntity) Update(params threescaleapi.Params) error

type BackendAPIEntity

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

func NewBackendAPIEntity

func NewBackendAPIEntity(backendAPIObj *threescaleapi.BackendApi, client *threescaleapi.ThreeScaleClient, logger logr.Logger) *BackendAPIEntity

func (*BackendAPIEntity) CreateMappingRule

func (b *BackendAPIEntity) CreateMappingRule(params threescaleapi.Params) error

func (*BackendAPIEntity) CreateMethod

func (b *BackendAPIEntity) CreateMethod(params threescaleapi.Params) error

func (*BackendAPIEntity) CreateMetric

func (b *BackendAPIEntity) CreateMetric(params threescaleapi.Params) error

func (*BackendAPIEntity) DeleteMappingRule

func (b *BackendAPIEntity) DeleteMappingRule(id int64) error

func (*BackendAPIEntity) DeleteMethod

func (b *BackendAPIEntity) DeleteMethod(id int64) error

func (*BackendAPIEntity) DeleteMetric

func (b *BackendAPIEntity) DeleteMetric(id int64) error

func (*BackendAPIEntity) Description

func (b *BackendAPIEntity) Description() string

func (*BackendAPIEntity) FindMethodMetricIDBySystemName

func (b *BackendAPIEntity) FindMethodMetricIDBySystemName(systemName string) (int64, error)

FindMethodMetricIDBySystemName returns metric or method ID from system name. -1 if metric and method is not found

func (*BackendAPIEntity) ID

func (b *BackendAPIEntity) ID() int64

func (*BackendAPIEntity) MappingRules

func (*BackendAPIEntity) Methods

func (*BackendAPIEntity) Metrics

func (*BackendAPIEntity) MetricsAndMethods

func (b *BackendAPIEntity) MetricsAndMethods() (*threescaleapi.MetricJSONList, error)

func (*BackendAPIEntity) Name

func (b *BackendAPIEntity) Name() string

func (*BackendAPIEntity) PrivateEndpoint

func (b *BackendAPIEntity) PrivateEndpoint() string

func (*BackendAPIEntity) SystemName

func (b *BackendAPIEntity) SystemName() string

func (*BackendAPIEntity) Update

func (b *BackendAPIEntity) Update(params threescaleapi.Params) error

func (*BackendAPIEntity) UpdateMappingRule

func (b *BackendAPIEntity) UpdateMappingRule(id int64, params threescaleapi.Params) error

func (*BackendAPIEntity) UpdateMethod

func (b *BackendAPIEntity) UpdateMethod(id int64, params threescaleapi.Params) error

func (*BackendAPIEntity) UpdateMetric

func (b *BackendAPIEntity) UpdateMetric(id int64, params threescaleapi.Params) error

type BackendAPIRemoteIndex

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

func NewBackendAPIRemoteIndex

func NewBackendAPIRemoteIndex(client *threescaleapi.ThreeScaleClient, logger logr.Logger) (*BackendAPIRemoteIndex, error)

func (*BackendAPIRemoteIndex) CreateBackendAPI

func (b *BackendAPIRemoteIndex) CreateBackendAPI(params threescaleapi.Params) (*BackendAPIEntity, error)

CreateBackendAPI create remote backendAPI

func (*BackendAPIRemoteIndex) FindByID

func (b *BackendAPIRemoteIndex) FindByID(id int64) (*BackendAPIEntity, bool)

FindByID finds remote backendAPI item by ID

func (*BackendAPIRemoteIndex) FindBySystemName

func (b *BackendAPIRemoteIndex) FindBySystemName(systemName string) (*BackendAPIEntity, bool)

FindBySystemName finds remote backendAPI item by SystenName

type ProductEntity

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

func (*ProductEntity) ApplicationPlans

func (b *ProductEntity) ApplicationPlans() (*threescaleapi.ApplicationPlanJSONList, error)

func (*ProductEntity) BackendUsages

func (b *ProductEntity) BackendUsages() (threescaleapi.BackendAPIUsageList, error)

func (*ProductEntity) BackendVersion

func (b *ProductEntity) BackendVersion() string

func (*ProductEntity) CreateApplicationPlan

func (b *ProductEntity) CreateApplicationPlan(params threescaleapi.Params) (*threescaleapi.ApplicationPlan, error)

func (*ProductEntity) CreateBackendUsage

func (b *ProductEntity) CreateBackendUsage(params threescaleapi.Params) error

func (*ProductEntity) CreateMappingRule

func (b *ProductEntity) CreateMappingRule(params threescaleapi.Params) error

func (*ProductEntity) CreateMethod

func (b *ProductEntity) CreateMethod(params threescaleapi.Params) error

func (*ProductEntity) CreateMetric

func (b *ProductEntity) CreateMetric(params threescaleapi.Params) error

func (*ProductEntity) DeleteApplicationPlan

func (b *ProductEntity) DeleteApplicationPlan(id int64) error

func (*ProductEntity) DeleteBackendUsage

func (b *ProductEntity) DeleteBackendUsage(id int64) error

func (*ProductEntity) DeleteMappingRule

func (b *ProductEntity) DeleteMappingRule(id int64) error

func (*ProductEntity) DeleteMethod

func (b *ProductEntity) DeleteMethod(id int64) error

func (*ProductEntity) DeleteMetric

func (b *ProductEntity) DeleteMetric(id int64) error

func (*ProductEntity) DeploymentOption

func (b *ProductEntity) DeploymentOption() string

func (*ProductEntity) Description

func (b *ProductEntity) Description() string

func (*ProductEntity) FindMethodMetricIDBySystemName

func (b *ProductEntity) FindMethodMetricIDBySystemName(systemName string) (int64, error)

FindMethodMetricIDBySystemName returns metric or method ID from system name. -1 if metric and method is not found

func (*ProductEntity) ID

func (b *ProductEntity) ID() int64

func (*ProductEntity) MappingRules

func (b *ProductEntity) MappingRules() (*threescaleapi.MappingRuleJSONList, error)

func (*ProductEntity) Methods

func (b *ProductEntity) Methods() (*threescaleapi.MethodList, error)

func (*ProductEntity) Metrics

func (*ProductEntity) MetricsAndMethods

func (b *ProductEntity) MetricsAndMethods() (*threescaleapi.MetricJSONList, error)

func (*ProductEntity) Name

func (b *ProductEntity) Name() string

func (*ProductEntity) PromoteProxyToStaging

func (b *ProductEntity) PromoteProxyToStaging() error

func (*ProductEntity) Proxy

func (b *ProductEntity) Proxy() (*threescaleapi.ProxyJSON, error)

func (*ProductEntity) State

func (b *ProductEntity) State() string

func (*ProductEntity) Update

func (b *ProductEntity) Update(params threescaleapi.Params) error

func (*ProductEntity) UpdateBackendUsage

func (b *ProductEntity) UpdateBackendUsage(id int64, params threescaleapi.Params) error

func (*ProductEntity) UpdateMappingRule

func (b *ProductEntity) UpdateMappingRule(id int64, params threescaleapi.Params) error

func (*ProductEntity) UpdateMethod

func (b *ProductEntity) UpdateMethod(id int64, params threescaleapi.Params) error

func (*ProductEntity) UpdateMetric

func (b *ProductEntity) UpdateMetric(id int64, params threescaleapi.Params) error

func (*ProductEntity) UpdateProxy

func (b *ProductEntity) UpdateProxy(params threescaleapi.Params) error

type ProviderAccount

type ProviderAccount struct {
	AdminURLStr string
	Token       string
}

func LookupProviderAccount

func LookupProviderAccount(cl client.Client, ns string, providerAccountRef *corev1.LocalObjectReference, logger logr.Logger) (*ProviderAccount, error)

LookupProviderAccount looks up for account provider url and credentials If provider_account_reference is provided, it must exist and required fields must exists If no provider_account_reference is provided, defaul provider account secret with hardcoded name will be looked up in the namespace. If no provider_account_reference is provided AND default provider account secret is not found either, then, 3scale default provider account (3scale-admin) will be looked up using system-seed secret in the current namespace. If nothing is successfully found, return error

Jump to

Keyboard shortcuts

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