subscription

package
v1.1.9-alpha1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: Apache-2.0 Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProvisioner added in v1.1.5

func NewProvisioner(client MuleSubscriptionClient, log logrus.FieldLogger) prov.Provisioning

NewProvisioner creates a type to implement the SDK Provisioning methods for handling subscriptions

func NewSLATierContractSchemaMP added in v1.1.5

func NewSLATierContractSchemaMP(name string, tierNames []string) prov.SchemaBuilder

Types

type Manager

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

Manager stores subscription schemas and handles subscription state changes

func NewManager added in v1.1.5

func NewManager(
	log logrus.FieldLogger, muleSubscription MuleSubscriptionClient, schemas ...SubSchema,
) *Manager

NewManager creates a SubscriptionManager

func (*Manager) GetSubscriptionSchemaName

func (sm *Manager) GetSubscriptionSchemaName(pd common.PolicyDetail) string

GetSubscriptionSchemaName returns the appropriate subscription schema name given a policy

func (*Manager) ProcessSubscribe

func (sm *Manager) ProcessSubscribe(subscription apic.Subscription)

ProcessSubscribe moves a subscription from Approved to Active.

func (*Manager) ProcessUnsubscribe

func (sm *Manager) ProcessUnsubscribe(subscription apic.Subscription)

ProcessUnsubscribe moves a subscription from Unsubscribe Initiated to Unsubscribed.

func (*Manager) RegisterNewSchema

func (sm *Manager) RegisterNewSchema(schema SubSchema)

RegisterNewSchema registers a schema to represent a Mulesoft policy that can be subscribed to in the Unified Catalog.

func (*Manager) Subscribe added in v1.1.5

func (sm *Manager) Subscribe(sub apic.Subscription) error

Subscribe creates an application and a contract in Mulesoft, and updates the subscription state in central.

func (*Manager) Unsubscribe added in v1.1.5

func (sm *Manager) Unsubscribe(sub apic.Subscription) error

Unsubscribe deletes an application in Mulesoft

func (*Manager) ValidateSubscription

func (sm *Manager) ValidateSubscription(subscription apic.Subscription) bool

ValidateSubscription checks if a subscription should be processed or not. If a subscription is already marked as active, then false is returned

type MockMuleSubscriptionClient added in v1.1.5

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

func (*MockMuleSubscriptionClient) CreateApp added in v1.1.5

func (m *MockMuleSubscriptionClient) CreateApp(appName, apiID, description string) (*anypoint.Application, error)

func (*MockMuleSubscriptionClient) CreateContract added in v1.1.5

func (m *MockMuleSubscriptionClient) CreateContract(apiID, tier string, appID int64) (*anypoint.Contract, error)

func (*MockMuleSubscriptionClient) DeleteApp added in v1.1.5

func (m *MockMuleSubscriptionClient) DeleteApp(appName int64) error

func (*MockMuleSubscriptionClient) DeleteContract added in v1.1.5

func (m *MockMuleSubscriptionClient) DeleteContract(apiID, contractID string) error

func (*MockMuleSubscriptionClient) GetApp added in v1.1.5

func (*MockMuleSubscriptionClient) ResetAppSecret added in v1.1.9

func (m *MockMuleSubscriptionClient) ResetAppSecret(appID int64) (*anypoint.Application, error)

type MuleSubscriptionClient added in v1.1.5

type MuleSubscriptionClient interface {
	CreateApp(appName, apiID, description string) (*anypoint.Application, error)
	CreateContract(apiID, tier string, appID int64) (*anypoint.Contract, error)
	DeleteApp(appID int64) error
	DeleteContract(apiID, contractID string) error
	GetApp(id string) (*anypoint.Application, error)
	ResetAppSecret(appID int64) (*anypoint.Application, error)
}

MuleSubscriptionClient interface for managing mulesoft subscriptions

func NewMuleSubscriptionClient added in v1.1.5

func NewMuleSubscriptionClient(client anypoint.Client) MuleSubscriptionClient

NewMuleSubscriptionClient creates a MuleSubscriptionClient

type SchemaStore added in v1.1.5

type SchemaStore interface {
	// GetSubscriptionSchemaName returns the name of a schema for the provided policy if the schema is found
	GetSubscriptionSchemaName(pd common.PolicyDetail) string
	// RegisterNewSchema saves a schema to the store
	RegisterNewSchema(schema SubSchema)
}

SchemaStore interface for saving and retrieving subscription schemas

type SubSchema

type SubSchema interface {
	// Schema is the Unified Catalog Subscription Schema
	Schema() apic.SubscriptionSchema
	// Name of the Subscription Schema based on the policy type, such as client-id
	Name() string
	// IsApplicable returns true if the provided policy matches the schema
	IsApplicable(policy common.PolicyDetail) bool
}

SubSchema the subscription schema to represent the policy in the Unified Catalog.

func NewClientIDContract added in v1.1.5

func NewClientIDContract() SubSchema

NewClientIDContract creates a new client ID schema

func NewSLATierContractSchemaUC added in v1.1.5

func NewSLATierContractSchemaUC(name string, tierNames []string) SubSchema

NewSLATierContractSchemaUC creates a new subscribable sla-tier policy

Jump to

Keyboard shortcuts

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