models

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PostDateLayout = "2006-01-02"
	MonthLayout    = "2006-01"
)

Variables

View Source
var (
	AttentionSeverity_name = map[int32]string{
		0: "SUCCESS",
		1: "INFO",
		2: "WARNING",
		3: "ALERT",
	}
	AttentionSeverity_value = map[string]int32{
		"SUCCESS": 0,
		"INFO":    1,
		"WARNING": 2,
		"ALERT":   3,
	}
)

Enum value maps for AttentionSeverity.

View Source
var (
	AttentionAction_name = map[int32]string{
		0: "NO_ACTION",
		1: "START_REGISTRATION",
		2: "COMPLETE_REGISTRATION",
		3: "SUBMIT_TESTNET",
		4: "SUBMIT_MAINNET",
		5: "VERIFY_EMAILS",
		6: "RENEW_CERTIFICATE",
		7: "CONTACT_SUPPORT",
	}
	AttentionAction_value = map[string]int32{
		"NO_ACTION":             0,
		"START_REGISTRATION":    1,
		"COMPLETE_REGISTRATION": 2,
		"SUBMIT_TESTNET":        3,
		"SUBMIT_MAINNET":        4,
		"VERIFY_EMAILS":         5,
		"RENEW_CERTIFICATE":     6,
		"CONTACT_SUPPORT":       7,
	}
)

Enum value maps for AttentionAction.

View Source
var (
	ErrInvalidOrgID = errors.New("invalid organization id")
)
View Source
var File_bff_models_v1_models_proto protoreflect.FileDescriptor

Functions

func ParseOrgID

func ParseOrgID(orgID interface{}) (uuid.UUID, error)

Types

type Announcement

type Announcement struct {
	Id       string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Title    string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
	Body     string `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"`
	PostDate string `protobuf:"bytes,4,opt,name=post_date,json=postDate,proto3" json:"post_date,omitempty"`
	Author   string `protobuf:"bytes,5,opt,name=author,proto3" json:"author,omitempty"`
	// Metadata as RFC3339Nano Timestamps
	Created  string `protobuf:"bytes,14,opt,name=created,proto3" json:"created,omitempty"`
	Modified string `protobuf:"bytes,15,opt,name=modified,proto3" json:"modified,omitempty"`
	// contains filtered or unexported fields
}

Announcements are made by network administrators to inform all TRISA members of important events, maintenance, or milestones. These are broadcast from the BFF so that all members receive the same announcement.

func (*Announcement) Descriptor deprecated

func (*Announcement) Descriptor() ([]byte, []int)

Deprecated: Use Announcement.ProtoReflect.Descriptor instead.

func (*Announcement) GetAuthor

func (x *Announcement) GetAuthor() string

func (*Announcement) GetBody

func (x *Announcement) GetBody() string

func (*Announcement) GetCreated

func (x *Announcement) GetCreated() string

func (*Announcement) GetId

func (x *Announcement) GetId() string

func (*Announcement) GetModified

func (x *Announcement) GetModified() string

func (*Announcement) GetPostDate

func (x *Announcement) GetPostDate() string

func (*Announcement) GetTitle

func (x *Announcement) GetTitle() string

func (*Announcement) Month

func (a *Announcement) Month() (_ string, err error)

Month returns the postdate month in the form YYYY-MM to determine which AnnouncementsMonth the announcement should belong in.

func (*Announcement) ParsePostDate

func (a *Announcement) ParsePostDate() (time.Time, error)

Return the timestamp from the post date.

func (*Announcement) ProtoMessage

func (*Announcement) ProtoMessage()

func (*Announcement) ProtoReflect

func (x *Announcement) ProtoReflect() protoreflect.Message

func (*Announcement) Reset

func (x *Announcement) Reset()

func (*Announcement) String

func (x *Announcement) String() string

type AnnouncementMonth

type AnnouncementMonth struct {
	Date          string          `protobuf:"bytes,1,opt,name=date,proto3" json:"date,omitempty"`
	Announcements []*Announcement `protobuf:"bytes,2,rep,name=announcements,proto3" json:"announcements,omitempty"`
	// Metadata as RFC3339Nano Timestamps
	Created  string `protobuf:"bytes,14,opt,name=created,proto3" json:"created,omitempty"`
	Modified string `protobuf:"bytes,15,opt,name=modified,proto3" json:"modified,omitempty"`
	// contains filtered or unexported fields
}

Announcements are stored in months to enable fast retrieval of the latest announcements in a specific time range without a reversal traversal of time-ordered anncouncement objects. Note that the annoucements are stored in a slice instead of a map to reduce data storage overhead. Accessing a specific announcement requires iterating over the annoucements, but the number of annoucements in a month should not be unbounded, so this cost is acceptable for data storage performance.

func (*AnnouncementMonth) Add

func (m *AnnouncementMonth) Add(a *Announcement)

Add an announcement ensuring that they are stored sorted by post date. NOTE: can sort postdate strings in the YYYY-MM-DD format without parsing them, however the post date must be validated before adding it to the month.

func (*AnnouncementMonth) Descriptor deprecated

func (*AnnouncementMonth) Descriptor() ([]byte, []int)

Deprecated: Use AnnouncementMonth.ProtoReflect.Descriptor instead.

func (*AnnouncementMonth) GetAnnouncements

func (x *AnnouncementMonth) GetAnnouncements() []*Announcement

func (*AnnouncementMonth) GetCreated

func (x *AnnouncementMonth) GetCreated() string

func (*AnnouncementMonth) GetDate

func (x *AnnouncementMonth) GetDate() string

func (*AnnouncementMonth) GetModified

func (x *AnnouncementMonth) GetModified() string

func (*AnnouncementMonth) Key

func (m *AnnouncementMonth) Key() (_ []byte, err error)

Return the key associated with the announcement month: the byte array of the string date in YYYY-MM form. This method also validates the Date is correct.

func (*AnnouncementMonth) ProtoMessage

func (*AnnouncementMonth) ProtoMessage()

func (*AnnouncementMonth) ProtoReflect

func (x *AnnouncementMonth) ProtoReflect() protoreflect.Message

func (*AnnouncementMonth) Reset

func (x *AnnouncementMonth) Reset()

func (*AnnouncementMonth) String

func (x *AnnouncementMonth) String() string

type AttentionAction

type AttentionAction int32

AttentionAction is used to indicate the action that should be taken by the user in response to an attention message.

const (
	AttentionAction_NO_ACTION             AttentionAction = 0
	AttentionAction_START_REGISTRATION    AttentionAction = 1
	AttentionAction_COMPLETE_REGISTRATION AttentionAction = 2
	AttentionAction_SUBMIT_TESTNET        AttentionAction = 3
	AttentionAction_SUBMIT_MAINNET        AttentionAction = 4
	AttentionAction_VERIFY_EMAILS         AttentionAction = 5
	AttentionAction_RENEW_CERTIFICATE     AttentionAction = 6
	AttentionAction_CONTACT_SUPPORT       AttentionAction = 7
)

func (AttentionAction) Descriptor

func (AttentionAction) Enum

func (x AttentionAction) Enum() *AttentionAction

func (AttentionAction) EnumDescriptor deprecated

func (AttentionAction) EnumDescriptor() ([]byte, []int)

Deprecated: Use AttentionAction.Descriptor instead.

func (AttentionAction) Number

func (AttentionAction) String

func (x AttentionAction) String() string

func (AttentionAction) Type

type AttentionSeverity

type AttentionSeverity int32

AttentionSeverity is used to indicate the importance of an attention message

const (
	AttentionSeverity_SUCCESS AttentionSeverity = 0
	AttentionSeverity_INFO    AttentionSeverity = 1
	AttentionSeverity_WARNING AttentionSeverity = 2
	AttentionSeverity_ALERT   AttentionSeverity = 3
)

func (AttentionSeverity) Descriptor

func (AttentionSeverity) Enum

func (AttentionSeverity) EnumDescriptor deprecated

func (AttentionSeverity) EnumDescriptor() ([]byte, []int)

Deprecated: Use AttentionSeverity.Descriptor instead.

func (AttentionSeverity) Number

func (AttentionSeverity) String

func (x AttentionSeverity) String() string

func (AttentionSeverity) Type

type DirectoryRecord

type DirectoryRecord struct {
	Id                  string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	RegisteredDirectory string `protobuf:"bytes,2,opt,name=registered_directory,json=registeredDirectory,proto3" json:"registered_directory,omitempty"`
	CommonName          string `protobuf:"bytes,3,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty"`
	// RFC 3339 timestamp -- if set, the form has been submitted without error
	Submitted string `protobuf:"bytes,15,opt,name=submitted,proto3" json:"submitted,omitempty"`
	// contains filtered or unexported fields
}

DirectoryRecord contains the information needed to lookup a VASP in a directory service.

func (*DirectoryRecord) Descriptor deprecated

func (*DirectoryRecord) Descriptor() ([]byte, []int)

Deprecated: Use DirectoryRecord.ProtoReflect.Descriptor instead.

func (*DirectoryRecord) GetCommonName

func (x *DirectoryRecord) GetCommonName() string

func (*DirectoryRecord) GetId

func (x *DirectoryRecord) GetId() string

func (*DirectoryRecord) GetRegisteredDirectory

func (x *DirectoryRecord) GetRegisteredDirectory() string

func (*DirectoryRecord) GetSubmitted

func (x *DirectoryRecord) GetSubmitted() string

func (*DirectoryRecord) ProtoMessage

func (*DirectoryRecord) ProtoMessage()

func (*DirectoryRecord) ProtoReflect

func (x *DirectoryRecord) ProtoReflect() protoreflect.Message

func (*DirectoryRecord) Reset

func (x *DirectoryRecord) Reset()

func (*DirectoryRecord) String

func (x *DirectoryRecord) String() string

type FormState

type FormState struct {

	// The current 1-indexed step of the form
	Current int32 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"`
	// If set, the form is completely filled out and ready to be submitted
	ReadyToSubmit bool `protobuf:"varint,2,opt,name=ready_to_submit,json=readyToSubmit,proto3" json:"ready_to_submit,omitempty"`
	// The state of each step in the form
	Steps []*FormStep `protobuf:"bytes,3,rep,name=steps,proto3" json:"steps,omitempty"`
	// RFC 3339 timestamp -- if set, the user has started filling out the form
	Started string `protobuf:"bytes,4,opt,name=started,proto3" json:"started,omitempty"`
	// contains filtered or unexported fields
}

FormState contains the current state of an organization's registration form to enable a consistent user experience across multiple contexts.

func NewFormState

func NewFormState() *FormState

NewFormState returns a new form state with default values.

func (*FormState) Descriptor deprecated

func (*FormState) Descriptor() ([]byte, []int)

Deprecated: Use FormState.ProtoReflect.Descriptor instead.

func (*FormState) GetCurrent

func (x *FormState) GetCurrent() int32

func (*FormState) GetReadyToSubmit

func (x *FormState) GetReadyToSubmit() bool

func (*FormState) GetStarted

func (x *FormState) GetStarted() string

func (*FormState) GetSteps

func (x *FormState) GetSteps() []*FormStep

func (*FormState) ProtoMessage

func (*FormState) ProtoMessage()

func (*FormState) ProtoReflect

func (x *FormState) ProtoReflect() protoreflect.Message

func (*FormState) Reset

func (x *FormState) Reset()

func (*FormState) String

func (x *FormState) String() string

type FormStep

type FormStep struct {
	Key    int32  `protobuf:"varint,1,opt,name=key,proto3" json:"key,omitempty"`
	Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

FormStep contains the state of a single step in an organization's registration form.

func (*FormStep) Descriptor deprecated

func (*FormStep) Descriptor() ([]byte, []int)

Deprecated: Use FormStep.ProtoReflect.Descriptor instead.

func (*FormStep) GetKey

func (x *FormStep) GetKey() int32

func (*FormStep) GetStatus

func (x *FormStep) GetStatus() string

func (*FormStep) ProtoMessage

func (*FormStep) ProtoMessage()

func (*FormStep) ProtoReflect

func (x *FormStep) ProtoReflect() protoreflect.Message

func (*FormStep) Reset

func (x *FormStep) Reset()

func (*FormStep) String

func (x *FormStep) String() string

type NetworkDetails

type NetworkDetails struct {

	// Certificate request information
	CommonName string   `protobuf:"bytes,1,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty"`
	Endpoint   string   `protobuf:"bytes,2,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
	DnsNames   []string `protobuf:"bytes,3,rep,name=dns_names,json=dnsNames,proto3" json:"dns_names,omitempty"`
	// contains filtered or unexported fields
}

NetworkDetails contains directory-service specific submission information such as the certificate request and information about when the registration form was submitted.

func (*NetworkDetails) Descriptor deprecated

func (*NetworkDetails) Descriptor() ([]byte, []int)

Deprecated: Use NetworkDetails.ProtoReflect.Descriptor instead.

func (*NetworkDetails) GetCommonName

func (x *NetworkDetails) GetCommonName() string

func (*NetworkDetails) GetDnsNames

func (x *NetworkDetails) GetDnsNames() []string

func (*NetworkDetails) GetEndpoint

func (x *NetworkDetails) GetEndpoint() string

func (*NetworkDetails) ProtoMessage

func (*NetworkDetails) ProtoMessage()

func (*NetworkDetails) ProtoReflect

func (x *NetworkDetails) ProtoReflect() protoreflect.Message

func (*NetworkDetails) Reset

func (x *NetworkDetails) Reset()

func (*NetworkDetails) String

func (x *NetworkDetails) String() string

type Organization

type Organization struct {

	// BFF Unique Identifier and Record Information
	Id      string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name    string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	LogoUrl string `protobuf:"bytes,3,opt,name=logo_url,json=logoUrl,proto3" json:"logo_url,omitempty"`
	// Directory Registrations for Lookups
	// TODO: populate these details in the Registration Endpoint
	Testnet *DirectoryRecord `protobuf:"bytes,10,opt,name=testnet,proto3" json:"testnet,omitempty"`
	Mainnet *DirectoryRecord `protobuf:"bytes,11,opt,name=mainnet,proto3" json:"mainnet,omitempty"`
	// Registration Form
	Registration *RegistrationForm `protobuf:"bytes,13,opt,name=registration,proto3" json:"registration,omitempty"`
	// Metadata as RFC3339Nano Timestamps
	Created  string `protobuf:"bytes,14,opt,name=created,proto3" json:"created,omitempty"`
	Modified string `protobuf:"bytes,15,opt,name=modified,proto3" json:"modified,omitempty"`
	// contains filtered or unexported fields
}

The Organization document contains VASP-specific information for a single VASP record in the directory service. This document differs in that it stores information relevant to the BFF and should not be used to duplicate storage in the directory.

func (*Organization) Descriptor deprecated

func (*Organization) Descriptor() ([]byte, []int)

Deprecated: Use Organization.ProtoReflect.Descriptor instead.

func (*Organization) GetCreated

func (x *Organization) GetCreated() string

func (*Organization) GetId

func (x *Organization) GetId() string

func (*Organization) GetLogoUrl

func (x *Organization) GetLogoUrl() string

func (*Organization) GetMainnet

func (x *Organization) GetMainnet() *DirectoryRecord

func (*Organization) GetModified

func (x *Organization) GetModified() string

func (*Organization) GetName

func (x *Organization) GetName() string

func (*Organization) GetRegistration

func (x *Organization) GetRegistration() *RegistrationForm

func (*Organization) GetTestnet

func (x *Organization) GetTestnet() *DirectoryRecord

func (*Organization) Key

func (org *Organization) Key() []byte

func (*Organization) ProtoMessage

func (*Organization) ProtoMessage()

func (*Organization) ProtoReflect

func (x *Organization) ProtoReflect() protoreflect.Message

func (*Organization) Reset

func (x *Organization) Reset()

func (*Organization) String

func (x *Organization) String() string

type RegistrationForm

type RegistrationForm struct {

	// Business information
	Website          string                   `protobuf:"bytes,1,opt,name=website,proto3" json:"website,omitempty"`
	BusinessCategory v1beta1.BusinessCategory `` /* 157-byte string literal not displayed */
	VaspCategories   []string                 `protobuf:"bytes,3,rep,name=vasp_categories,json=vaspCategories,proto3" json:"vasp_categories,omitempty"`
	EstablishedOn    string                   `protobuf:"bytes,4,opt,name=established_on,json=establishedOn,proto3" json:"established_on,omitempty"`
	OrganizationName string                   `protobuf:"bytes,5,opt,name=organization_name,json=organizationName,proto3" json:"organization_name,omitempty"`
	// IVMS 101 Legal Person record
	Entity *ivms101.LegalPerson `protobuf:"bytes,11,opt,name=entity,proto3" json:"entity,omitempty"`
	// Directory Record contacts
	Contacts *v1beta1.Contacts `protobuf:"bytes,12,opt,name=contacts,proto3" json:"contacts,omitempty"`
	// TRIXO Form
	Trixo *v1beta1.TRIXOQuestionnaire `protobuf:"bytes,13,opt,name=trixo,proto3" json:"trixo,omitempty"`
	// Network-specific information and submission details
	Testnet *NetworkDetails `protobuf:"bytes,14,opt,name=testnet,proto3" json:"testnet,omitempty"`
	Mainnet *NetworkDetails `protobuf:"bytes,15,opt,name=mainnet,proto3" json:"mainnet,omitempty"`
	// Current progress of the form for the frontend
	State *FormState `protobuf:"bytes,20,opt,name=state,proto3" json:"state,omitempty"`
	// contains filtered or unexported fields
}

RegistrationForm is an extension of the TRISA GDS RegistrationRequest with BFF fields.

func NewRegisterForm

func NewRegisterForm() *RegistrationForm

NewRegisterForm returns a new registration form with default values.

func (*RegistrationForm) Descriptor deprecated

func (*RegistrationForm) Descriptor() ([]byte, []int)

Deprecated: Use RegistrationForm.ProtoReflect.Descriptor instead.

func (*RegistrationForm) GetBusinessCategory

func (x *RegistrationForm) GetBusinessCategory() v1beta1.BusinessCategory

func (*RegistrationForm) GetContacts

func (x *RegistrationForm) GetContacts() *v1beta1.Contacts

func (*RegistrationForm) GetEntity

func (x *RegistrationForm) GetEntity() *ivms101.LegalPerson

func (*RegistrationForm) GetEstablishedOn

func (x *RegistrationForm) GetEstablishedOn() string

func (*RegistrationForm) GetMainnet

func (x *RegistrationForm) GetMainnet() *NetworkDetails

func (*RegistrationForm) GetOrganizationName

func (x *RegistrationForm) GetOrganizationName() string

func (*RegistrationForm) GetState

func (x *RegistrationForm) GetState() *FormState

func (*RegistrationForm) GetTestnet

func (x *RegistrationForm) GetTestnet() *NetworkDetails

func (*RegistrationForm) GetTrixo

func (*RegistrationForm) GetVaspCategories

func (x *RegistrationForm) GetVaspCategories() []string

func (*RegistrationForm) GetWebsite

func (x *RegistrationForm) GetWebsite() string

func (*RegistrationForm) MarshalJSON

func (r *RegistrationForm) MarshalJSON() ([]byte, error)

MarshalJSON uses protojson with default marshaling options.

func (*RegistrationForm) ProtoMessage

func (*RegistrationForm) ProtoMessage()

func (*RegistrationForm) ProtoReflect

func (x *RegistrationForm) ProtoReflect() protoreflect.Message

func (*RegistrationForm) ReadyToSubmit

func (r *RegistrationForm) ReadyToSubmit(network string) bool

ReadyToSubmit performs very lightweight validation, ensuring that there are non-nil values on the nested data structures so that the request to the GDS does not fail. For data validation (required fields, types, etc.), we should rely on the GDS response to ensure that we're able to submit valid forms and that validation only occurs in one place in the code.

func (*RegistrationForm) Reset

func (x *RegistrationForm) Reset()

func (*RegistrationForm) String

func (x *RegistrationForm) String() string

func (*RegistrationForm) UnmarshalJSON

func (r *RegistrationForm) UnmarshalJSON(data []byte) error

UnmarshalJSON uses protojson with default unmarshaling options.

Jump to

Keyboard shortcuts

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