formationmapping

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: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FormationIDParam is formation URL path parameter placeholder
	FormationIDParam = "ucl-formation-id"
	// FormationAssignmentIDParam is formation assignment URL path parameter placeholder
	FormationAssignmentIDParam = "ucl-assignment-id"
	// ClientIDFromCertificateHeader contains the name of the header containing the client id from the certificate
	ClientIDFromCertificateHeader = "Client-Id-From-Certificate"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationRepository

type ApplicationRepository interface {
	GetByID(ctx context.Context, tenant, id string) (*model.Application, error)
	OwnerExists(ctx context.Context, tenant, id string) (bool, error)
}

ApplicationRepository is responsible for the repo-layer application operations

type ApplicationTemplateRepository

type ApplicationTemplateRepository interface {
	Exists(ctx context.Context, id string) (bool, error)
}

ApplicationTemplateRepository is responsible for the repo-layer application template operations

type Authenticator

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

Authenticator struct containing all dependencies to verify the request authenticity

func NewFormationMappingAuthenticator

func NewFormationMappingAuthenticator(
	transact persistence.Transactioner,
	faService FormationAssignmentService,
	runtimeRepo RuntimeRepository,
	runtimeContextRepo RuntimeContextRepository,
	appRepo ApplicationRepository,
	appTemplateRepo ApplicationTemplateRepository,
	labelRepo LabelRepository,
	formationRepo FormationRepository,
	formationTemplateRepo FormationTemplateRepository,
	tenantRepo TenantRepository,
	globalSubaccountIDLabelKey string,
	uclCertOUSubaccountID string,
) *Authenticator

NewFormationMappingAuthenticator creates a new Authenticator

func (*Authenticator) FormationAssignmentHandler

func (a *Authenticator) FormationAssignmentHandler() func(next http.Handler) http.Handler

FormationAssignmentHandler is a handler middleware that executes authorization check for the formation assignments requests reporting status

func (*Authenticator) FormationHandler

func (a *Authenticator) FormationHandler() func(next http.Handler) http.Handler

FormationHandler is a handler middleware that executes authorization check for the formation requests reporting status

type Config

type Config struct {
	AsyncAPIPathPrefix                             string `envconfig:"APP_FORMATION_MAPPING_API_PATH_PREFIX"`
	AsyncFormationAssignmentStatusAPIEndpoint      string `envconfig:"APP_FORMATION_ASSIGNMENT_ASYNC_STATUS_API_ENDPOINT"`
	AsyncFormationAssignmentStatusResetAPIEndpoint string `envconfig:"APP_FORMATION_ASSIGNMENT_ASYNC_STATUS_RESET_API_ENDPOINT"`
	AsyncFormationStatusAPIEndpoint                string `envconfig:"APP_FORMATION_ASYNC_STATUS_API_ENDPOINT"`
	UCLCertOUSubaccountID                          string `envconfig:"APP_UCL_CERT_OU_SUBACCOUNT_ID"`
}

Config holds the configuration available for the formation mapping

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"error"`
}

ErrorResponse structure used for the JSON encoded response

type FormationAssignmentNotificationService

type FormationAssignmentNotificationService interface {
	GenerateFormationAssignmentPair(ctx context.Context, fa, reverseFA *model.FormationAssignment, operation model.FormationOperation) (*formationassignment.AssignmentMappingPairWithOperation, error)
}

FormationAssignmentNotificationService represents the formation assignment notification service for generating notifications

type FormationAssignmentRequestBody

type FormationAssignmentRequestBody struct {
	State         model.FormationAssignmentState `json:"state,omitempty"`
	Configuration json.RawMessage                `json:"configuration,omitempty"`
	Error         string                         `json:"error,omitempty"`
}

FormationAssignmentRequestBody contains the request input of the formation assignment async status request

func (FormationAssignmentRequestBody) Validate

Validate validates the formation assignment's request body input

type FormationAssignmentService

type FormationAssignmentService interface {
	GetGlobalByIDAndFormationID(ctx context.Context, formationAssignmentID, formationID string) (*model.FormationAssignment, error)
	GetReverseBySourceAndTarget(ctx context.Context, formationID, sourceID, targetID string) (*model.FormationAssignment, error)
	ProcessFormationAssignmentPair(ctx context.Context, mappingPair *formationassignment.AssignmentMappingPairWithOperation) (bool, error)
	Delete(ctx context.Context, id string) error
	ListFormationAssignmentsForObjectID(ctx context.Context, formationID, objectID string) ([]*model.FormationAssignment, error)
	SetAssignmentToErrorState(ctx context.Context, assignment *model.FormationAssignment, errorMessage string, errorCode formationassignment.AssignmentErrorCode, state model.FormationAssignmentState) error
	Update(ctx context.Context, id string, fa *model.FormationAssignment) error
}

FormationAssignmentService is responsible for the service-layer FormationAssignment operations

type FormationRepository

type FormationRepository interface {
	GetGlobalByID(ctx context.Context, id string) (*model.Formation, error)
}

FormationRepository is responsible for the repo-layer formation operations

type FormationRequestBody

type FormationRequestBody struct {
	State model.FormationState `json:"state"`
	Error string               `json:"error,omitempty"`
}

FormationRequestBody contains the request input of the formation async status request

func (FormationRequestBody) Validate

func (b FormationRequestBody) Validate() error

Validate validates the formation's request body input

type FormationTemplateRepository

type FormationTemplateRepository interface {
	Get(ctx context.Context, id string) (*model.FormationTemplate, error)
}

FormationTemplateRepository is responsible for the repo-layer formation template operations

type Handler

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

Handler is the base struct definition of the FormationMappingHandler

func NewFormationMappingHandler

func NewFormationMappingHandler(transact persistence.Transactioner, faService FormationAssignmentService, faStatusService formationAssignmentStatusService, faNotificationService FormationAssignmentNotificationService, formationService formationService, formationStatusService formationStatusService) *Handler

NewFormationMappingHandler creates a formation mapping Handler

func (*Handler) ResetFormationAssignmentStatus

func (h *Handler) ResetFormationAssignmentStatus(w http.ResponseWriter, r *http.Request)

ResetFormationAssignmentStatus handles formation assignment status updates

func (*Handler) UpdateFormationAssignmentStatus

func (h *Handler) UpdateFormationAssignmentStatus(w http.ResponseWriter, r *http.Request)

UpdateFormationAssignmentStatus handles formation assignment status updates

func (*Handler) UpdateFormationStatus

func (h *Handler) UpdateFormationStatus(w http.ResponseWriter, r *http.Request)

UpdateFormationStatus handles formation status updates

type LabelRepository

type LabelRepository interface {
	ListForGlobalObject(ctx context.Context, objectType model.LabelableObject, objectID string) (map[string]*model.Label, error)
}

LabelRepository is responsible for the repo-layer label operations

type RuntimeContextRepository

type RuntimeContextRepository interface {
	GetByID(ctx context.Context, tenant, id string) (*model.RuntimeContext, error)
}

RuntimeContextRepository is responsible for the repo-layer runtime context operations

type RuntimeRepository

type RuntimeRepository interface {
	OwnerExists(ctx context.Context, tenant, id string) (bool, error)
}

RuntimeRepository is responsible for the repo-layer runtime operations

type TenantRepository

type TenantRepository interface {
	Get(ctx context.Context, id string) (*model.BusinessTenantMapping, error)
}

TenantRepository is responsible for the repo-layer tenant operations

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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