66 lines
1.4 KiB
Go
66 lines
1.4 KiB
Go
package issuance
|
|
|
|
import (
|
|
"errors"
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
|
|
"git.apinb.com/ops/license/sdk/licence"
|
|
)
|
|
|
|
type IssueInput struct {
|
|
ValidFrom time.Time
|
|
ExpiresOn time.Time
|
|
Quotas licence.Quotas
|
|
}
|
|
|
|
type Record struct {
|
|
ID uuid.UUID
|
|
SubjectID uuid.UUID
|
|
IssuanceType string
|
|
PreviousLicenceID *uuid.UUID
|
|
ValidFrom time.Time
|
|
ExpiresOn time.Time
|
|
Quotas licence.Quotas
|
|
SigningKeyID uuid.UUID
|
|
Payload licence.Claims
|
|
FileContent []byte
|
|
IssuedAt time.Time
|
|
OperatorName string
|
|
}
|
|
|
|
type Filter struct {
|
|
PlatformName string
|
|
Workspace string
|
|
ValidFrom *time.Time
|
|
ExpiresOn *time.Time
|
|
IssuedOn *time.Time
|
|
}
|
|
|
|
type RecordSummary struct {
|
|
ID uuid.UUID
|
|
SubjectID uuid.UUID
|
|
PlatformName string
|
|
Workspace string
|
|
IssuanceType string
|
|
PreviousLicenceID *uuid.UUID
|
|
ValidFrom time.Time
|
|
ExpiresOn time.Time
|
|
IssuedAt time.Time
|
|
}
|
|
|
|
type DownloadMetadata struct {
|
|
ID uuid.UUID
|
|
PlatformName string
|
|
Workspace string
|
|
}
|
|
|
|
var (
|
|
ErrNotFound = errors.New("licence record not found")
|
|
ErrInvalidDates = errors.New("invalid licence dates")
|
|
ErrInvalidQuota = errors.New("invalid licence quota")
|
|
ErrPreviousMismatch = errors.New("previous licence belongs to another subject")
|
|
ErrInvalidInput = errors.New("invalid issuance input")
|
|
)
|