operators

package
v0.0.0-...-6d13c91 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AsynchronousFlowControlOperator represents the asynchronous flow control operator
	AsynchronousFlowControlOperator = "AsynchronousFlowControl"
)
View Source
const (
	// ConfigMutatorOperator represents the ConfigMutator operator
	ConfigMutatorOperator = "ConfigMutator"
)
View Source
const (
	// ContainsScenarioGroupsOperator represents the ContainsScenarioGroups operator
	ContainsScenarioGroupsOperator = "ContainsScenarioGroups"
)
View Source
const (
	// DestinationCreatorOperator represents the destination creator operator
	DestinationCreatorOperator = "DestinationCreator"
)
View Source
const (
	// DoNotGenerateFormationAssignmentNotificationForLoopsOperator represents the DoNotGenerateFormationAssignmentNotificationForLoops operator
	DoNotGenerateFormationAssignmentNotificationForLoopsOperator = "DoNotGenerateFormationAssignmentNotificationForLoops"
)
View Source
const (
	// DoNotGenerateFormationAssignmentNotificationOperator represents the DoNotGenerateFormationAssignmentNotification operator
	DoNotGenerateFormationAssignmentNotificationOperator = "DoNotGenerateFormationAssignmentNotification"
)
View Source
const (
	// DoesNotContainResourceOfSubtypeOperator represents the DoesNotContainResourceOfSubtype operator
	DoesNotContainResourceOfSubtypeOperator = "DoesNotContainResourceOfSubtype"
)
View Source
const (
	// IsNotAssignedToAnyFormationOfTypeOperator represents the IsNotAssignedToAnyFormationOfType operator
	IsNotAssignedToAnyFormationOfTypeOperator = "IsNotAssignedToAnyFormationOfType"
)
View Source
const (
	// RedirectNotificationOperator represents the redirect notification operator
	RedirectNotificationOperator = "RedirectNotification"
)

Variables

This section is empty.

Functions

func RetrieveFormationAssignmentPointer

func RetrieveFormationAssignmentPointer(ctx context.Context, joinPointDetailsAssignmentMemoryAddress uintptr) (*model.FormationAssignment, error)

RetrieveFormationAssignmentPointer converts the provided memory address in form of an integer back to the model.FormationAssignment pointer structure It's important the provided memory address to stores information about model.FormationAssignment entity, otherwise the result could be very abnormal

func RetrieveNotificationStatusReportPointer

func RetrieveNotificationStatusReportPointer(ctx context.Context, notificationStatusReportMemoryAddress uintptr) (*statusreport.NotificationStatusReport, error)

RetrieveNotificationStatusReportPointer converts the provided memory address in form of an integer back to the statusreport.NotificationStatusReport pointer structure It's important the provided memory address to stores information about model.FormationAssignment entity, otherwise the result could be very abnormal

func RetrieveWebhookPointerFromMemoryAddress

func RetrieveWebhookPointerFromMemoryAddress(ctx context.Context, webhookMemoryAddress uintptr) (*graphql.Webhook, error)

RetrieveWebhookPointerFromMemoryAddress converts the provided uninterpreted memory address in form of an integer back to the model.Webhook pointer structure It's important the provided memory address to stores information about model.Webhook entity, otherwise the result could be very abnormal

Types

type AdditionalProperties

type AdditionalProperties []json.RawMessage

AdditionalProperties is an alias for slice of `json.RawMessage` elements

type BasicAuthentication

type BasicAuthentication struct {
	URL            string   `json:"url"`
	Username       string   `json:"username"`
	Password       string   `json:"password"`
	CorrelationIds []string `json:"correlationIds,omitempty"`
}

BasicAuthentication represents outbound communication with basic authentication

type CertificateData

type CertificateData struct {
	FileName         string `json:"fileName"`
	CommonName       string `json:"commonName"`
	CertificateChain string `json:"certificateChain"`
}

CertificateData contains the data for the certificate resource from the destination creator component

type ClientCertAuthentication

type ClientCertAuthentication struct {
	URL            string   `json:"url"`
	CorrelationIds []string `json:"correlationIds,omitempty"`
}

ClientCertAuthentication represents outbound communication with client certificate authentication

type Configuration

type Configuration struct {
	Destinations         []DestinationRaw     `json:"destinations"`
	Credentials          Credentials          `json:"credentials"`
	AdditionalProperties AdditionalProperties `json:"additionalProperties"`
}

Configuration represents a formation assignment (or reverse formation assignment) configuration

type ConstraintEngine

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

ConstraintEngine determines which constraints are applicable to the reached join point and enforces them

func NewConstraintEngine

func NewConstraintEngine(transact persistence.Transactioner, constraintSvc formationConstraintSvc, tenantSvc tenantService, asaSvc automaticScenarioAssignmentService, destinationSvc destinationService, destinationCreatorSvc destinationCreatorService, systemAuthSvc systemAuthService, formationRepo formationRepository, labelRepo labelRepository, labelService labelService, applicationRepository applicationRepository, runtimeContextRepo runtimeContextRepo, formationTemplateRepo formationTemplateRepo, formationAssignmentRepo formationAssignmentRepository, formationAssignmentService formationAssignmentService, formationAssignmentNotificationSvc formationAssignmentNotificationService, runtimeTypeLabelKey string, applicationTypeLabelKey string) *ConstraintEngine

NewConstraintEngine returns new ConstraintEngine

func (*ConstraintEngine) AsynchronousFlowControlOperator

func (e *ConstraintEngine) AsynchronousFlowControlOperator(ctx context.Context, input OperatorInput) (bool, error)

AsynchronousFlowControlOperator is an operator that based on different conditions behaves like the redirect operator, it redirects the formation assignment notification. In other cases it mutates the state, in order to control the flow of the engine, so that the assignment doesn't get deleted too early, and it resends the notification to the redirection endpoint, so that it can finish the cleanup. It introduces new deleting states.

func (*ConstraintEngine) ContainsScenarioGroups

func (e *ConstraintEngine) ContainsScenarioGroups(ctx context.Context, input OperatorInput) (bool, error)

ContainsScenarioGroups is a constraint operator. It checks if the resource from the OperatorInput contains any of the scenario groups.

func (*ConstraintEngine) DestinationCreator

func (e *ConstraintEngine) DestinationCreator(ctx context.Context, input OperatorInput) (bool, error)

DestinationCreator is an operator that handles destination creations

func (*ConstraintEngine) DoNotGenerateFormationAssignmentNotification

func (e *ConstraintEngine) DoNotGenerateFormationAssignmentNotification(ctx context.Context, input OperatorInput) (bool, error)

DoNotGenerateFormationAssignmentNotification is a constraint operator. It skips the generation of formation assignment notifications

func (*ConstraintEngine) DoNotGenerateFormationAssignmentNotificationForLoops

func (e *ConstraintEngine) DoNotGenerateFormationAssignmentNotificationForLoops(ctx context.Context, input OperatorInput) (bool, error)

DoNotGenerateFormationAssignmentNotificationForLoops is a constraint operator. It skips the generation of formation assignment notifications for loops

func (*ConstraintEngine) DoesNotContainResourceOfSubtype

func (e *ConstraintEngine) DoesNotContainResourceOfSubtype(ctx context.Context, input OperatorInput) (bool, error)

DoesNotContainResourceOfSubtype is a constraint operator. It checks if the formation contains resource with the same subtype as the resource subtype from the OperatorInput

func (*ConstraintEngine) EnforceConstraints

func (e *ConstraintEngine) EnforceConstraints(ctx context.Context, location formationconstraintpkg.JoinPointLocation, details formationconstraintpkg.JoinPointDetails, formationTemplateID string) error

EnforceConstraints finds all the applicable constraints based on JoinPointLocation and JoinPointDetails. Checks for each constraint if it is satisfied. If any constraint is not satisfied this information is stored and the engine proceeds with enforcing the next constraint if such exists. In the end if any constraint was not satisfied an error is returned.

func (*ConstraintEngine) IsNotAssignedToAnyFormationOfType

func (e *ConstraintEngine) IsNotAssignedToAnyFormationOfType(ctx context.Context, input OperatorInput) (bool, error)

IsNotAssignedToAnyFormationOfType is a constraint operator. It checks if the resource from the OperatorInput is already part of formation of the type that the operator is associated with

func (*ConstraintEngine) MutateConfig

func (e *ConstraintEngine) MutateConfig(ctx context.Context, input OperatorInput) (bool, error)

MutateConfig is a constraint operator. It mutates the Formation assignment state and configuration based on the provided input

func (*ConstraintEngine) RedirectNotification

func (e *ConstraintEngine) RedirectNotification(ctx context.Context, input OperatorInput) (bool, error)

RedirectNotification is an operator that based on different condition could redirect the formation assignment notification

func (*ConstraintEngine) SetFormationAssignmentNotificationService

func (e *ConstraintEngine) SetFormationAssignmentNotificationService(formationAssignmentNotificationSvc formationAssignmentNotificationService)

SetFormationAssignmentNotificationService sets the formation assignment notification service of the constraint engine

func (*ConstraintEngine) SetFormationAssignmentService

func (e *ConstraintEngine) SetFormationAssignmentService(formationAssignmentService formationAssignmentService)

SetFormationAssignmentService sets the formation assignment service of the constraint engine

type Credentials

type Credentials struct {
	OutboundCommunicationCredentials *OutboundCommunicationCredentials `json:"outboundCommunication,omitempty"`
	InboundCommunicationDetails      *InboundCommunicationDetails      `json:"inboundCommunication,omitempty"`
}

Credentials represent a different type of credentials configuration - inbound, outbound

type Destination

type Destination struct {
	Name                 string          `json:"name"`
	Type                 string          `json:"type,omitempty"`
	Description          string          `json:"description,omitempty"`
	ProxyType            string          `json:"proxyType,omitempty"`
	Authentication       string          `json:"authentication,omitempty"`
	URL                  string          `json:"url,omitempty"`
	SubaccountID         string          `json:"subaccountId,omitempty"`
	InstanceID           string          `json:"instanceId,omitempty"`
	AdditionalProperties json.RawMessage `json:"additionalProperties,omitempty"`
	TokenServiceURLType  string          `json:"tokenServiceURLType,omitempty"`
}

Destination holds different destination types properties

type DestinationRaw

type DestinationRaw struct {
	Destination json.RawMessage
}

DestinationRaw represents the destination provided by the customer

func (*DestinationRaw) GetInstanceID

func (d *DestinationRaw) GetInstanceID() string

GetInstanceID returns the instance ID of the destination

func (*DestinationRaw) GetName

func (d *DestinationRaw) GetName() string

GetName returns the name of the destination

func (*DestinationRaw) GetSubaccountID

func (d *DestinationRaw) GetSubaccountID() string

GetSubaccountID returns the subaccount ID of the destination

func (*DestinationRaw) SetSubaccountID

func (d *DestinationRaw) SetSubaccountID(subaccountID string) error

SetSubaccountID sets the subaccountID field of the destination to subaccountID

func (*DestinationRaw) StripInternalFields

func (d *DestinationRaw) StripInternalFields() (*DestinationRaw, error)

StripInternalFields removes the fields meant for internal usage from the destination

func (*DestinationRaw) ToModelDestination

func (d *DestinationRaw) ToModelDestination(id, subaccountID, formationAssignmentID string) (*model.Destination, error)

ToModelDestination converts to model.Destination

func (*DestinationRaw) UnmarshalJSON

func (d *DestinationRaw) UnmarshalJSON(data []byte) error

UnmarshalJSON is the DestinationRaw's implementation of Unmarshaler

func (*DestinationRaw) Validate

func (d *DestinationRaw) Validate() error

Validate validates the DestinationRaw object against a predefined set of rules

type InboundBasicAuthenticationDetails

type InboundBasicAuthenticationDetails struct {
	CorrelationIDs []string      `json:"correlationIds"`
	Destinations   []Destination `json:"destinations"`
}

InboundBasicAuthenticationDetails represents inbound communication configuration details for basic authentication

type InboundClientCertAuthenticationDetails

type InboundClientCertAuthenticationDetails struct {
	CorrelationIDs []string      `json:"correlationIds"`
	Destinations   []Destination `json:"destinations"`
	Certificate    *string       `json:"certificate,omitempty"`
}

InboundClientCertAuthenticationDetails represents inbound communication configuration details for client certificate authentication

type InboundCommunicationDetails

type InboundCommunicationDetails struct {
	BasicAuthenticationDetails             *InboundBasicAuthenticationDetails       `json:"basicAuthentication,omitempty"`
	SAMLAssertionDetails                   *InboundSAMLAssertionDetails             `json:"samlAssertion,omitempty"`
	OAuth2SAMLBearerAssertionDetails       *InboundOAuth2SAMLBearerAssertionDetails `json:"oauth2SamlBearerAssertion,omitempty"`
	ClientCertificateAuthenticationDetails *InboundClientCertAuthenticationDetails  `json:"clientCertificateAuthentication,omitempty"`
	OAuth2ClientCredentialsDetails         *InboundOAuth2ClientCredentialsDetails   `json:"oauth2ClientCredentials,omitempty"`
	OAuth2mTLSAuthenticationDetails        *InboundOAuth2mTLSAuthenticationDetails  `json:"oauth2mtls,omitempty"`
}

InboundCommunicationDetails consists of a different type of inbound communication configuration details

type InboundOAuth2ClientCredentialsDetails

type InboundOAuth2ClientCredentialsDetails struct {
	CorrelationIDs []string      `json:"correlationIds"`
	Destinations   []Destination `json:"destinations"`
}

InboundOAuth2ClientCredentialsDetails represents inbound communication configuration details for oauth2 client credentials authentication

type InboundOAuth2SAMLBearerAssertionDetails

type InboundOAuth2SAMLBearerAssertionDetails struct {
	CorrelationIDs  []string      `json:"correlationIds"`
	Destinations    []Destination `json:"destinations"`
	Certificate     *string       `json:"certificate,omitempty"`
	AssertionIssuer *string       `json:"assertionIssuer,omitempty"`
}

InboundOAuth2SAMLBearerAssertionDetails represents inbound communication configuration details for SAML bearer assertion authentication

type InboundOAuth2mTLSAuthenticationDetails

type InboundOAuth2mTLSAuthenticationDetails struct {
	CorrelationIDs []string      `json:"correlationIds"`
	Destinations   []Destination `json:"destinations"`
	Certificate    *string       `json:"certificate,omitempty"`
}

InboundOAuth2mTLSAuthenticationDetails represents inbound communication configuration details for oauth2 mTLS authentication

type InboundSAMLAssertionDetails

type InboundSAMLAssertionDetails struct {
	CorrelationIDs  []string      `json:"correlationIds"`
	Destinations    []Destination `json:"destinations"`
	Certificate     *string       `json:"certificate,omitempty"`
	AssertionIssuer *string       `json:"assertionIssuer,omitempty"`
}

InboundSAMLAssertionDetails represents inbound communication configuration details for SAML assertion authentication

type NoAuthentication

type NoAuthentication struct {
	URL            string   `json:"url"`
	CorrelationIds []string `json:"correlationIds,omitempty"`
}

NoAuthentication represents outbound communication without any authentication

type OAuth2ClientCredentialsAuthentication

type OAuth2ClientCredentialsAuthentication struct {
	URL             string   `json:"url"`
	TokenServiceURL string   `json:"tokenServiceUrl"`
	ClientID        string   `json:"clientId"`
	ClientSecret    string   `json:"clientSecret"`
	CorrelationIds  []string `json:"correlationIds,omitempty"`
}

OAuth2ClientCredentialsAuthentication represents outbound communication with OAuth 2 client credentials authentication

type OAuth2SAMLBearerAssertionAuthentication

type OAuth2SAMLBearerAssertionAuthentication struct {
	URL             string `json:"url"`
	TokenServiceURL string `json:"tokenServiceUrl"`
	ClientID        string `json:"clientId"`
	ClientSecret    string `json:"clientSecret"`
}

OAuth2SAMLBearerAssertionAuthentication represents outbound communication with OAuth 2 SAML Bearer Assertion authentication

type OAuth2mTLSAuthentication

type OAuth2mTLSAuthentication struct {
	URL             string   `json:"url"`
	TokenServiceURL string   `json:"tokenServiceUrl"`
	ClientID        string   `json:"clientId"`
	CorrelationIds  []string `json:"correlationIds,omitempty"`
}

OAuth2mTLSAuthentication represents outbound communication with OAuth 2 mTLS authentication

type OperatorFunc

type OperatorFunc func(ctx context.Context, input OperatorInput) (bool, error)

OperatorFunc provides an interface for functions implementing constraint operators

type OperatorInput

type OperatorInput interface{}

OperatorInput represents the input needed by the constraint operator

func AsynchronousFlowControlOperatorInput

func AsynchronousFlowControlOperatorInput() OperatorInput

AsynchronousFlowControlOperatorInput is input constructor for AsynchronousFlowControlOperator. It returns empty OperatorInput

func NewConfigMutatorInput

func NewConfigMutatorInput() OperatorInput

NewConfigMutatorInput is input constructor for ConfigMutatorOperator operator. It returns empty OperatorInput.

func NewContainsScenarioGroupsInput

func NewContainsScenarioGroupsInput() OperatorInput

NewContainsScenarioGroupsInput is input constructor for ContainsScenarioGroupsOperator operator. It returns empty OperatorInput.

func NewDestinationCreatorInput

func NewDestinationCreatorInput() OperatorInput

NewDestinationCreatorInput is input constructor for DestinationCreatorOperator. It returns empty OperatorInput

func NewDoNotGenerateFormationAssignmentNotificationForLoopsInput

func NewDoNotGenerateFormationAssignmentNotificationForLoopsInput() OperatorInput

NewDoNotGenerateFormationAssignmentNotificationForLoopsInput is input constructor for DoNotGenerateFormationAssignmentNotificationForLoopsOperator operator. It returns empty OperatorInput

func NewDoNotGenerateFormationAssignmentNotificationInput

func NewDoNotGenerateFormationAssignmentNotificationInput() OperatorInput

NewDoNotGenerateFormationAssignmentNotificationInput is input constructor for DoNotGenerateFormationAssignmentNotificationOperator operator. It returns empty OperatorInput

func NewDoesNotContainResourceOfSubtypeInput

func NewDoesNotContainResourceOfSubtypeInput() OperatorInput

NewDoesNotContainResourceOfSubtypeInput is input constructor for DoesNotContainResourceOfSubtypeOperator operator. It returns empty OperatorInput

func NewIsNotAssignedToAnyFormationOfTypeInput

func NewIsNotAssignedToAnyFormationOfTypeInput() OperatorInput

NewIsNotAssignedToAnyFormationOfTypeInput is input constructor for IsNotAssignedToAnyFormationOfType operator. It returns empty OperatorInput.

func NewRedirectNotificationInput

func NewRedirectNotificationInput() OperatorInput

NewRedirectNotificationInput is input constructor for DestinationCreatorOperator. It returns empty OperatorInput

type OperatorInputConstructor

type OperatorInputConstructor func() OperatorInput

OperatorInputConstructor returns empty OperatorInput for a certain constraint operator

type OperatorName

type OperatorName string

OperatorName represents the constraint operator name

type OutboundCommunicationCredentials

type OutboundCommunicationCredentials struct {
	NoAuthentication                        *NoAuthentication                        `json:"noAuthentication,omitempty"`
	BasicAuthentication                     *BasicAuthentication                     `json:"basicAuthentication,omitempty"`
	SAMLAssertionAuthentication             *SAMLAssertionAuthentication             `json:"samlAssertion,omitempty"`
	OAuth2SAMLBearerAssertionAuthentication *OAuth2SAMLBearerAssertionAuthentication `json:"oauth2SamlBearerAssertion,omitempty"`
	ClientCertAuthentication                *ClientCertAuthentication                `json:"clientCertificateAuthentication,omitempty"`
	OAuth2ClientCredentialsAuthentication   *OAuth2ClientCredentialsAuthentication   `json:"oauth2ClientCredentials,omitempty"`
	OAuth2mTLSAuthentication                *OAuth2mTLSAuthentication                `json:"oauth2mtls,omitempty"`
}

OutboundCommunicationCredentials consists of a different type of outbound authentications

type SAMLAssertionAuthentication

type SAMLAssertionAuthentication struct {
	URL string `json:"url"`
}

SAMLAssertionAuthentication represents outbound communication with SAML Assertion authentication

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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