Documentation
¶
Index ¶
- Constants
- func AssertAddonCreateInputEqual(t *testing.T, i CreateAddonInput, a Addon)
- func AssertAddonEqual(t *testing.T, expected, actual Addon)
- func AssertAddonRateCardsEqual(t *testing.T, r1, r2 productcatalog.RateCards)
- func AssertAddonUpdateInputEqual(t *testing.T, i UpdateAddonInput, a Addon)
- func AssertRateCardEqual(t *testing.T, r1, r2 productcatalog.RateCard)
- func HasAddonStatus(statuses ...productcatalog.AddonStatus) models.ValidatorFunc[Addon]
- func IsAddonDeleted(at time.Time) models.ValidatorFunc[Addon]
- func IsNotFound(err error) bool
- type Addon
- type AddonArchiveEvent
- type AddonCreateEvent
- type AddonDeleteEvent
- type AddonPublishEvent
- type AddonUpdateEvent
- type ArchiveAddonInput
- type CreateAddonInput
- type DeleteAddonInput
- type ExpandFields
- type GetAddonInput
- type ListAddonsInput
- type ListAddonsStatusFilter
- type ManagedRateCard
- type NextAddonInput
- type NotFoundError
- type NotFoundErrorParams
- type OrderBy
- type Plan
- type PublishAddonInput
- type RateCard
- type RateCardManagedFields
- type RateCards
- type Repository
- type Service
- type UpdateAddonInput
Constants ¶
const ( AddonEventSubsystem metadata.EventSubsystem = "addon" AddonCreateEventName metadata.EventName = "addon.created" AddonUpdateEventName metadata.EventName = "addon.updated" AddonDeleteEventName metadata.EventName = "addon.deleted" AddonPublishEventName metadata.EventName = "addon.published" AddonArchiveEventName metadata.EventName = "addon.archived" )
const ( OrderAsc = sortx.OrderAsc OrderDesc = sortx.OrderDesc )
Variables ¶
This section is empty.
Functions ¶
func AssertAddonCreateInputEqual ¶
func AssertAddonCreateInputEqual(t *testing.T, i CreateAddonInput, a Addon)
func AssertAddonEqual ¶
func AssertAddonRateCardsEqual ¶
func AssertAddonRateCardsEqual(t *testing.T, r1, r2 productcatalog.RateCards)
func AssertAddonUpdateInputEqual ¶
func AssertAddonUpdateInputEqual(t *testing.T, i UpdateAddonInput, a Addon)
func AssertRateCardEqual ¶
func AssertRateCardEqual(t *testing.T, r1, r2 productcatalog.RateCard)
func HasAddonStatus ¶
func HasAddonStatus(statuses ...productcatalog.AddonStatus) models.ValidatorFunc[Addon]
func IsAddonDeleted ¶
func IsAddonDeleted(at time.Time) models.ValidatorFunc[Addon]
func IsNotFound ¶
Types ¶
type Addon ¶
type Addon struct {
models.NamespacedID
models.ManagedModel
productcatalog.AddonMeta
// RateCards
RateCards RateCards `json:"rateCards"`
// Plans contains the list of Plans assigned to this Addon. It is only provided if the Addon was fetched
// with Plans being expanded.
Plans *[]Plan `json:"plans,omitempty"`
}
func (Addon) AsProductCatalogAddon ¶
func (a Addon) AsProductCatalogAddon() productcatalog.Addon
func (Addon) ValidateWith ¶
func (a Addon) ValidateWith(validators ...models.ValidatorFunc[Addon]) error
type AddonArchiveEvent ¶
type AddonArchiveEvent struct {
Addon *Addon `json:"addon"`
UserID *string `json:"userId,omitempty"`
}
AddonArchiveEvent is an event that is emitted when an Addon is archived
func NewAddonArchiveEvent ¶
func NewAddonArchiveEvent(ctx context.Context, Addon *Addon) AddonArchiveEvent
NewAddonArchiveEvent creates a new Addon archive event
func (AddonArchiveEvent) EventMetadata ¶
func (e AddonArchiveEvent) EventMetadata() metadata.EventMetadata
func (AddonArchiveEvent) EventName ¶
func (e AddonArchiveEvent) EventName() string
func (AddonArchiveEvent) Validate ¶
func (e AddonArchiveEvent) Validate() error
type AddonCreateEvent ¶
type AddonCreateEvent struct {
Addon *Addon `json:"addon"`
UserID *string `json:"userId,omitempty"`
}
AddonCreateEvent is an event that is emitted when an Addon is created
func NewAddonCreateEvent ¶
func NewAddonCreateEvent(ctx context.Context, addon *Addon) AddonCreateEvent
NewAddonCreateEvent creates a new Addon create event
func (AddonCreateEvent) EventMetadata ¶
func (e AddonCreateEvent) EventMetadata() metadata.EventMetadata
func (AddonCreateEvent) EventName ¶
func (e AddonCreateEvent) EventName() string
func (AddonCreateEvent) Validate ¶
func (e AddonCreateEvent) Validate() error
type AddonDeleteEvent ¶
type AddonDeleteEvent struct {
Addon *Addon `json:"addon"`
UserID *string `json:"userId,omitempty"`
}
AddonDeleteEvent is an event that is emitted when an Addon is deleted
func NewAddonDeleteEvent ¶
func NewAddonDeleteEvent(ctx context.Context, addon *Addon) AddonDeleteEvent
NewAddonDeleteEvent creates a new Addon delete event
func (AddonDeleteEvent) EventMetadata ¶
func (e AddonDeleteEvent) EventMetadata() metadata.EventMetadata
func (AddonDeleteEvent) EventName ¶
func (e AddonDeleteEvent) EventName() string
func (AddonDeleteEvent) Validate ¶
func (e AddonDeleteEvent) Validate() error
type AddonPublishEvent ¶
type AddonPublishEvent struct {
Addon *Addon `json:"addon"`
UserID *string `json:"userId,omitempty"`
}
AddonPublishEvent is an event that is emitted when an Addon is published
func NewAddonPublishEvent ¶
func NewAddonPublishEvent(ctx context.Context, Addon *Addon) AddonPublishEvent
NewAddonPublishEvent creates a new Addon publish event
func (AddonPublishEvent) EventMetadata ¶
func (e AddonPublishEvent) EventMetadata() metadata.EventMetadata
func (AddonPublishEvent) EventName ¶
func (e AddonPublishEvent) EventName() string
func (AddonPublishEvent) Validate ¶
func (e AddonPublishEvent) Validate() error
type AddonUpdateEvent ¶
type AddonUpdateEvent struct {
Addon *Addon `json:"addon"`
UserID *string `json:"userId,omitempty"`
}
AddonUpdateEvent is an event that is emitted when an Addon is updated
func NewAddonUpdateEvent ¶
func NewAddonUpdateEvent(ctx context.Context, addon *Addon) AddonUpdateEvent
NewAddonUpdateEvent creates a new Addon update event
func (AddonUpdateEvent) EventMetadata ¶
func (e AddonUpdateEvent) EventMetadata() metadata.EventMetadata
func (AddonUpdateEvent) EventName ¶
func (e AddonUpdateEvent) EventName() string
func (AddonUpdateEvent) Validate ¶
func (e AddonUpdateEvent) Validate() error
type ArchiveAddonInput ¶
type ArchiveAddonInput struct {
// NamespacedID
models.NamespacedID
// EffectiveFrom defines the time from the Addon is going to be unpublished.
EffectiveTo time.Time `json:"effectiveTo,omitempty"`
// RejectUnitConfig rejects the operation when the target add-on carries a unit_config
// conversion. The v1 API cannot represent it, so v1 handlers set this; v3 leaves it false.
RejectUnitConfig bool
}
func (ArchiveAddonInput) Validate ¶
func (i ArchiveAddonInput) Validate() error
type CreateAddonInput ¶
type CreateAddonInput struct {
models.NamespacedModel
productcatalog.Addon
// contains filtered or unexported fields
}
func (CreateAddonInput) Validate ¶
func (i CreateAddonInput) Validate() error
type DeleteAddonInput ¶
type DeleteAddonInput struct {
models.NamespacedID
}
func (DeleteAddonInput) Validate ¶
func (i DeleteAddonInput) Validate() error
type ExpandFields ¶
type ExpandFields struct {
PlanAddons bool `json:"plans,omitempty"`
}
type GetAddonInput ¶
type GetAddonInput struct {
models.NamespacedID
// Key is the unique key for Addon.
Key string `json:"key,omitempty"`
// Version is the version of the Addon.
// If not set the latest version is assumed.
Version int `json:"version,omitempty"`
// IncludeLatest defines whether return the latest version regardless of its AddonStatus or with ActiveStatus only if
// Version is not set.
IncludeLatest bool `json:"includeLatest,omitempty"`
Expand ExpandFields `json:"expand,omitempty"`
}
func (GetAddonInput) Validate ¶
func (i GetAddonInput) Validate() error
type ListAddonsInput ¶
type ListAddonsInput 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
// KeyVersions is the map of keys to versions to filter by.
KeyVersions map[string][]int
// IncludeDeleted defines whether to include deleted Addons.
IncludeDeleted bool
// Status filter
Status []productcatalog.AddonStatus
// Filters
ID *filter.FilterULID
Key *filter.FilterString
Name *filter.FilterString
Currency *filter.FilterString
// ExcludeUnitConfig omits add-ons carrying a unit_config conversion on any of their rate cards.
ExcludeUnitConfig bool
}
func (ListAddonsInput) Validate ¶
func (i ListAddonsInput) Validate() error
type ListAddonsStatusFilter ¶
type ManagedRateCard ¶
type ManagedRateCard interface {
ManagedFields() RateCardManagedFields
}
type NextAddonInput ¶
type NextAddonInput struct {
// NamespacedID
models.NamespacedID
// Key is the unique key for Addon.
Key string `json:"key,omitempty"`
// Version is the version of the Addon.
// If not set the latest version is assumed.
Version int `json:"version,omitempty"`
}
func (NextAddonInput) Validate ¶
func (i NextAddonInput) 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 Plan ¶
type Plan struct {
models.NamespacedID
models.ManagedModel
productcatalog.PlanAddonMeta
productcatalog.Plan
}
Plan stores the Addon specific representation of planaddon.PlanAddon.
type PublishAddonInput ¶
type PublishAddonInput struct {
models.NamespacedID
// AddonEffectivePeriod
productcatalog.EffectivePeriod
// RejectUnitConfig rejects the operation when the target add-on carries a unit_config
// conversion. The v1 API cannot represent it, so v1 handlers set this; v3 leaves it false.
RejectUnitConfig bool
}
func (PublishAddonInput) Validate ¶
func (i PublishAddonInput) 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
// AddonID defines the Addon the RateCard assigned to.
AddonID string `json:"addonId"`
}
func (RateCardManagedFields) Equal ¶
func (m RateCardManagedFields) Equal(v RateCardManagedFields) bool
func (RateCardManagedFields) Validate ¶
func (m RateCardManagedFields) Validate() error
type RateCards ¶
type RateCards []RateCard
func (RateCards) AsProductCatalogRateCards ¶
func (c RateCards) AsProductCatalogRateCards() productcatalog.RateCards
func (RateCards) SingleBillingCadence ¶
type Repository ¶
type Repository interface {
entutils.TxCreator
ListAddons(ctx context.Context, params ListAddonsInput) (pagination.Result[Addon], error)
CreateAddon(ctx context.Context, params CreateAddonInput) (*Addon, error)
DeleteAddon(ctx context.Context, params DeleteAddonInput) error
GetAddon(ctx context.Context, params GetAddonInput) (*Addon, error)
UpdateAddon(ctx context.Context, params UpdateAddonInput) (*Addon, error)
}
type Service ¶
type Service interface {
ListAddons(ctx context.Context, params ListAddonsInput) (pagination.Result[Addon], error)
CreateAddon(ctx context.Context, params CreateAddonInput) (*Addon, error)
DeleteAddon(ctx context.Context, params DeleteAddonInput) error
GetAddon(ctx context.Context, params GetAddonInput) (*Addon, error)
UpdateAddon(ctx context.Context, params UpdateAddonInput) (*Addon, error)
PublishAddon(ctx context.Context, params PublishAddonInput) (*Addon, error)
ArchiveAddon(ctx context.Context, params ArchiveAddonInput) (*Addon, error)
NextAddon(ctx context.Context, params NextAddonInput) (*Addon, error)
}
type UpdateAddonInput ¶
type UpdateAddonInput struct {
models.NamespacedID
// EffectivePeriod
productcatalog.EffectivePeriod
// Name
Name *string `json:"name"`
// Description
Description *string `json:"description,omitempty"`
// Metadata
Metadata *models.Metadata `json:"metadata,omitempty"`
// Metadata
Annotations *models.Annotations `json:"annotations,omitempty"`
// InstanceType
InstanceType *productcatalog.AddonInstanceType `json:"instanceType,omitempty"`
// RateCards
RateCards *productcatalog.RateCards `json:"rateCards,omitempty"`
// RejectUnitConfig makes mutation validation reject an add-on that carries a unit_config
// conversion on any rate card. The v1 API cannot represent unit_config, and v1 update
// rewrites rate cards from a body that has no such field, so proceeding would silently
// drop the conversion. v1 handlers set this; v3 leaves it false.
RejectUnitConfig bool
// contains filtered or unexported fields
}
func (UpdateAddonInput) Equal ¶
func (i UpdateAddonInput) Equal(p Addon) bool
func (UpdateAddonInput) Validate ¶
func (i UpdateAddonInput) Validate() error