Documentation
¶
Index ¶
- Constants
- func AssertPlanCreateInputEqual(t *testing.T, i CreatePlanInput, p Plan)
- func AssertPlanEqual(t *testing.T, expected, actual Plan)
- func AssertPlanPhaseEqual[E interface{ ... }](t *testing.T, in E, actual Phase)
- func AssertPlanPhasesEqual[E interface{ ... }](t *testing.T, expected []E, actual []Phase)
- func AssertPlanRateCardsEqual(t *testing.T, r1, r2 productcatalog.RateCards)
- func AssertPlanUpdateInputEqual(t *testing.T, i UpdatePlanInput, p Plan)
- func AssertRateCardEqual(t *testing.T, r1, r2 productcatalog.RateCard)
- func IsNotFound(err error) bool
- type ArchivePlanInput
- type CreatePlanInput
- type DeletePlanInput
- type GetPlanInput
- type ListPlansInput
- type ListPlansStatusFilter
- type ManagedPhase
- type ManagedRateCard
- type NextPlanInput
- type NotFoundError
- type NotFoundErrorParams
- type OrderBy
- type Phase
- type PhaseManagedFields
- type Plan
- type PlanArchiveEvent
- type PlanCreateEvent
- type PlanDeleteEvent
- type PlanPublishEvent
- type PlanUpdateEvent
- type PublishPlanInput
- type RateCard
- type RateCardManagedFields
- type Repository
- type Service
- type UpdatePlanInput
Constants ¶
const ( PlanEventSubsystem metadata.EventSubsystem = "plan" PlanCreateEventName metadata.EventName = "plan.created" PlanUpdateEventName metadata.EventName = "plan.updated" PlanDeleteEventName metadata.EventName = "plan.deleted" PlanPublishEventName metadata.EventName = "plan.published" PlanArchiveEventName metadata.EventName = "plan.archived" )
const ( OrderAsc = sortx.OrderAsc OrderDesc = sortx.OrderDesc )
Variables ¶
This section is empty.
Functions ¶
func AssertPlanCreateInputEqual ¶
func AssertPlanCreateInputEqual(t *testing.T, i CreatePlanInput, p Plan)
func AssertPlanEqual ¶
func AssertPlanPhaseEqual ¶
func AssertPlanPhasesEqual ¶
func AssertPlanRateCardsEqual ¶
func AssertPlanRateCardsEqual(t *testing.T, r1, r2 productcatalog.RateCards)
func AssertPlanUpdateInputEqual ¶
func AssertPlanUpdateInputEqual(t *testing.T, i UpdatePlanInput, p Plan)
func AssertRateCardEqual ¶
func AssertRateCardEqual(t *testing.T, r1, r2 productcatalog.RateCard)
func IsNotFound ¶
Types ¶
type ArchivePlanInput ¶
type ArchivePlanInput struct {
// NamespacedID
models.NamespacedID
// EffectiveFrom defines the time from the Plan is going to be unpublished.
EffectiveTo time.Time `json:"effectiveTo,omitempty"`
}
func (ArchivePlanInput) Validate ¶
func (i ArchivePlanInput) Validate() error
type CreatePlanInput ¶
type CreatePlanInput struct {
models.NamespacedModel
productcatalog.Plan
}
func (CreatePlanInput) Validate ¶
func (i CreatePlanInput) Validate() error
type DeletePlanInput ¶
type DeletePlanInput struct {
models.NamespacedID
}
func (DeletePlanInput) Validate ¶
func (i DeletePlanInput) Validate() error
type GetPlanInput ¶
type GetPlanInput struct {
models.NamespacedID
// Key is the unique key for Plan.
Key string `json:"key,omitempty"`
// Version is the version of the Plan.
// If not set the latest version is assumed.
Version int `json:"version,omitempty"`
// IncludeLatest defines whether return the latest version regardless of its PlanStatus or with ActiveStatus only if
// Version is not set.
IncludeLatest bool `json:"includeLatest,omitempty"`
}
func (GetPlanInput) Validate ¶
func (i GetPlanInput) Validate() error
type ListPlansInput ¶
type ListPlansInput struct {
// Page is the pagination parameters.
// TODO: make it optional.
pagination.Page
// OrderBy is the field to order by.
OrderBy OrderBy
// Order is the order direction.
Order sortx.Order
// Namespaces is the list of namespaces to filter by.
Namespaces []string
// IDs is the list of IDs to filter by.
IDs []string
// Keys is the list of keys to filter by.
Keys []string
// KeyVersions is the map of keys to versions to filter by.
KeyVersions map[string][]int
// IncludeDeleted defines whether to include deleted Plans.
IncludeDeleted bool
// Status filter
Status []productcatalog.PlanStatus
// Currencies is the list of currencies to filter by.
Currencies []string
}
func (ListPlansInput) Validate ¶
func (i ListPlansInput) Validate() error
type ListPlansStatusFilter ¶
type ManagedPhase ¶
type ManagedPhase interface {
ManagedFields() PhaseManagedFields
}
type ManagedRateCard ¶
type ManagedRateCard interface {
ManagedFields() RateCardManagedFields
}
type NextPlanInput ¶
type NextPlanInput struct {
// NamespacedID
models.NamespacedID
// Key is the unique key for Plan.
Key string `json:"key,omitempty"`
// Version is the version of the Plan.
// If not set the latest version is assumed.
Version int `json:"version,omitempty"`
}
func (NextPlanInput) Validate ¶
func (i NextPlanInput) Validate() error
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
func NewNotFoundError ¶
func NewNotFoundError(e NotFoundErrorParams) *NotFoundError
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
func (*NotFoundError) Unwrap ¶
func (e *NotFoundError) Unwrap() error
type NotFoundErrorParams ¶
type Phase ¶
type Phase struct {
PhaseManagedFields
productcatalog.Phase
}
func (Phase) AsProductCatalogPhase ¶
func (p Phase) AsProductCatalogPhase() productcatalog.Phase
type PhaseManagedFields ¶
type PhaseManagedFields struct {
models.ManagedModel
models.NamespacedID
// PlanID
PlanID string `json:"planId"`
}
func (PhaseManagedFields) Equal ¶
func (m PhaseManagedFields) Equal(v PhaseManagedFields) bool
func (PhaseManagedFields) Validate ¶
func (m PhaseManagedFields) Validate() error
type Plan ¶
type Plan struct {
models.NamespacedID
models.ManagedModel
productcatalog.PlanMeta
// Phases
Phases []Phase `json:"phases"`
}
func (Plan) AsProductCatalogPlan ¶
func (Plan) MarshalJSON ¶
MarshalJSON implements json.Marshaler
func (*Plan) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler
type PlanArchiveEvent ¶
PlanArchiveEvent is an event that is emitted when a plan is archived
func NewPlanArchiveEvent ¶
func NewPlanArchiveEvent(ctx context.Context, plan *Plan) PlanArchiveEvent
NewPlanArchiveEvent creates a new plan archive event
func (PlanArchiveEvent) EventMetadata ¶
func (e PlanArchiveEvent) EventMetadata() metadata.EventMetadata
func (PlanArchiveEvent) EventName ¶
func (e PlanArchiveEvent) EventName() string
func (PlanArchiveEvent) Validate ¶
func (e PlanArchiveEvent) Validate() error
type PlanCreateEvent ¶
PlanCreateEvent is an event that is emitted when a plan is created
func NewPlanCreateEvent ¶
func NewPlanCreateEvent(ctx context.Context, plan *Plan) PlanCreateEvent
NewPlanCreateEvent creates a new plan create event
func (PlanCreateEvent) EventMetadata ¶
func (e PlanCreateEvent) EventMetadata() metadata.EventMetadata
func (PlanCreateEvent) EventName ¶
func (e PlanCreateEvent) EventName() string
func (PlanCreateEvent) Validate ¶
func (e PlanCreateEvent) Validate() error
type PlanDeleteEvent ¶
PlanDeleteEvent is an event that is emitted when a plan is deleted
func NewPlanDeleteEvent ¶
func NewPlanDeleteEvent(ctx context.Context, plan *Plan) PlanDeleteEvent
NewPlanDeleteEvent creates a new plan delete event
func (PlanDeleteEvent) EventMetadata ¶
func (e PlanDeleteEvent) EventMetadata() metadata.EventMetadata
func (PlanDeleteEvent) EventName ¶
func (e PlanDeleteEvent) EventName() string
func (PlanDeleteEvent) Validate ¶
func (e PlanDeleteEvent) Validate() error
type PlanPublishEvent ¶
PlanPublishEvent is an event that is emitted when a plan is published
func NewPlanPublishEvent ¶
func NewPlanPublishEvent(ctx context.Context, plan *Plan) PlanPublishEvent
NewPlanPublishEvent creates a new plan publish event
func (PlanPublishEvent) EventMetadata ¶
func (e PlanPublishEvent) EventMetadata() metadata.EventMetadata
func (PlanPublishEvent) EventName ¶
func (e PlanPublishEvent) EventName() string
func (PlanPublishEvent) Validate ¶
func (e PlanPublishEvent) Validate() error
type PlanUpdateEvent ¶
PlanUpdateEvent is an event that is emitted when a plan is updated
func NewPlanUpdateEvent ¶
func NewPlanUpdateEvent(ctx context.Context, plan *Plan) PlanUpdateEvent
NewPlanUpdateEvent creates a new plan update event
func (PlanUpdateEvent) EventMetadata ¶
func (e PlanUpdateEvent) EventMetadata() metadata.EventMetadata
func (PlanUpdateEvent) EventName ¶
func (e PlanUpdateEvent) EventName() string
func (PlanUpdateEvent) Validate ¶
func (e PlanUpdateEvent) Validate() error
type PublishPlanInput ¶
type PublishPlanInput struct {
models.NamespacedID
// EffectivePeriod
productcatalog.EffectivePeriod
}
func (PublishPlanInput) Validate ¶
func (i PublishPlanInput) Validate() error
type RateCard ¶
type RateCard struct {
productcatalog.RateCard
RateCardManagedFields
}
func (*RateCard) ManagedFields ¶
func (r *RateCard) ManagedFields() RateCardManagedFields
func (*RateCard) MarshalJSON ¶
func (*RateCard) UnmarshalJSON ¶
type RateCardManagedFields ¶
type RateCardManagedFields struct {
models.ManagedModel
models.NamespacedID
// PhaseID
PhaseID string `json:"phaseId"`
}
func (RateCardManagedFields) Equal ¶
func (m RateCardManagedFields) Equal(v RateCardManagedFields) bool
func (RateCardManagedFields) Validate ¶
func (m RateCardManagedFields) Validate() error
type Repository ¶
type Repository interface {
entutils.TxCreator
ListPlans(ctx context.Context, params ListPlansInput) (pagination.PagedResponse[Plan], error)
CreatePlan(ctx context.Context, params CreatePlanInput) (*Plan, error)
DeletePlan(ctx context.Context, params DeletePlanInput) error
GetPlan(ctx context.Context, params GetPlanInput) (*Plan, error)
UpdatePlan(ctx context.Context, params UpdatePlanInput) (*Plan, error)
}
type Service ¶
type Service interface {
ListPlans(ctx context.Context, params ListPlansInput) (pagination.PagedResponse[Plan], error)
CreatePlan(ctx context.Context, params CreatePlanInput) (*Plan, error)
DeletePlan(ctx context.Context, params DeletePlanInput) error
GetPlan(ctx context.Context, params GetPlanInput) (*Plan, error)
UpdatePlan(ctx context.Context, params UpdatePlanInput) (*Plan, error)
PublishPlan(ctx context.Context, params PublishPlanInput) (*Plan, error)
ArchivePlan(ctx context.Context, params ArchivePlanInput) (*Plan, error)
NextPlan(ctx context.Context, params NextPlanInput) (*Plan, error)
}
type UpdatePlanInput ¶
type UpdatePlanInput struct {
models.NamespacedID
// EffectivePeriod
productcatalog.EffectivePeriod
// Name
Name *string `json:"name"`
// Description
Description *string `json:"description,omitempty"`
// Metadata
Metadata *models.Metadata `json:"metadata,omitempty"`
// Phases
Phases *[]productcatalog.Phase `json:"phases"`
// Alignment
productcatalog.AlignmentUpdate
}
func (UpdatePlanInput) Equal ¶
func (i UpdatePlanInput) Equal(p Plan) bool
func (UpdatePlanInput) Validate ¶
func (i UpdatePlanInput) Validate() error