models

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TechnicalContact        = "technical"
	AdministrativeContact   = "administrative"
	LegalContact            = "legal"
	BillingContact          = "billing"
	VerificationTokenLength = 48
)

Variables

View Source
var (
	ErrorAlreadyExists = errors.New("already exists")
	ErrorNotFound      = errors.New("not found")
)
View Source
var (
	CertificateState_name = map[int32]string{
		0: "ISSUED",
		1: "EXPIRED",
		2: "REVOKED",
	}
	CertificateState_value = map[string]int32{
		"ISSUED":  0,
		"EXPIRED": 1,
		"REVOKED": 2,
	}
)

Enum value maps for CertificateState.

View Source
var (
	CertificateRequestState_name = map[int32]string{
		0: "INITIALIZED",
		1: "READY_TO_SUBMIT",
		2: "PROCESSING",
		3: "DOWNLOADING",
		4: "DOWNLOADED",
		5: "COMPLETED",
		6: "CR_REJECTED",
		7: "CR_ERRORED",
	}
	CertificateRequestState_value = map[string]int32{
		"INITIALIZED":     0,
		"READY_TO_SUBMIT": 1,
		"PROCESSING":      2,
		"DOWNLOADING":     3,
		"DOWNLOADED":      4,
		"COMPLETED":       5,
		"CR_REJECTED":     6,
		"CR_ERRORED":      7,
	}
)

Enum value maps for CertificateRequestState.

View Source
var File_gds_models_v1_models_proto protoreflect.FileDescriptor

Functions

func AddContact

func AddContact(vasp *pb.VASP, kind string, contact *pb.Contact) error

Adds a contact on the VASP object.

func AppendAdminEmailLog

func AppendAdminEmailLog(vasp *pb.VASP, reason string, subject string) (err error)

Create and add a new entry to the EmailLog on the extra data on the VASP record.

func AppendAuditLog

func AppendAuditLog(vasp *pb.VASP, entry *AuditLogEntry) (err error)

Append an AuditLogEntry to the extra data on the VASP record.

func AppendCertID

func AppendCertID(vasp *pb.VASP, certID string) (err error)

AppendCertID adds the certificate ID to the VASP if it's not already added.

func AppendCertReqID

func AppendCertReqID(vasp *pb.VASP, certreqID string) (err error)

AppendCertReqID adds the certificate request ID to the VASP if its not already added.

func AppendEmailLog

func AppendEmailLog(contact *pb.Contact, reason, subject string) (err error)

Create and add a new entry to the EmailLog on the extra data on the Contact record.

func ContactFromType

func ContactFromType(contacts *pb.Contacts, kind string) *pb.Contact

Returns the corresponding contact object for the given contact type.

func ContactHasEmail

func ContactHasEmail(contact *pb.Contact) bool

Returns True if a Contact is not nil and has an email address.

func ContactIsVerified

func ContactIsVerified(contact *pb.Contact) (verified bool, err error)

Returns True if a Contact is verified.

func ContactIsZero added in v1.7.0

func ContactIsZero(contact *pb.Contact) bool

Returns True if a Contact is nil or is empty.

func ContactKindIsValid

func ContactKindIsValid(kind string) bool

Returns True if the contact kind is one of the recognized strings.

func ContactVerifications

func ContactVerifications(vasp *pb.VASP) (contacts map[string]bool, errs *multierror.Error)

ContactVerifications returns a map of contact type to verified status, omitting any contacts that do not exist.

func CountSentEmails added in v1.6.2

func CountSentEmails(emailLog []*EmailLogEntry, reason string, timeWindowDays int) (sent int, err error)

Counts emails within the given EmailLogEntry slice for the given reason within the given time frame.

func DeleteCertReqID

func DeleteCertReqID(vasp *pb.VASP, certreqID string) (err error)

DeleteCertReqID removes the certificate request ID from the VASP if it exists.

func DeleteContact

func DeleteContact(vasp *pb.VASP, kind string) error

Deletes a contact on the VASP object by setting it to nil.

func DeleteReviewNote

func DeleteReviewNote(vasp *pb.VASP, id string) (err error)

DeleteReviewNote deletes a specified note on the VASP.

func GetAdminVerificationToken

func GetAdminVerificationToken(vasp *pb.VASP) (_ string, err error)

GetAdminVerificationToken from the extra data on the VASP record.

func GetCertID added in v1.7.0

func GetCertID(identityCert *pb.Certificate) string

String encode the SerialNumber of a certificate

func GetCertIDs

func GetCertIDs(vasp *pb.VASP) (_ []string, err error)

GetCertIDs returns the list of associated Certificate IDs for the VASP record.

func GetCertReqIDs

func GetCertReqIDs(vasp *pb.VASP) (_ []string, err error)

GetCertReqIDs returns the list of associated CertificateRequest IDs for the VASP record.

func GetCertificateRequestParams

func GetCertificateRequestParams(request *CertificateRequest, profile string) (params map[string]string, err error)

NOTE: This method may update the certificate request but it is up to the caller to persist the changes back to the database.

func GetContactVerification

func GetContactVerification(contact *pb.Contact) (_ string, _ bool, err error)

GetContactVerification token and verified status from the extra data field on the Contact.

func GetLatestCertReqID

func GetLatestCertReqID(vasp *pb.VASP) (_ string, err error)

GetLatestCertReqID returns the latest CertificateRequest ID for the VASP record. TODO: This relies on the assumption that IDs can only be appended to the list.

func GetReviewNotes

func GetReviewNotes(vasp *pb.VASP) (_ map[string]*ReviewNote, err error)

GetReviewNotes returns all of the review notes for a VASP as a map.

func IsTraveler

func IsTraveler(vasp *pb.VASP) bool

IsTraveler returns true if the VASP common name ends in traveler.ciphertrace.com

func NormalizeEmail added in v1.7.0

func NormalizeEmail(email string) string

Normalize the email and convert to bytes

func SetAdminVerificationToken

func SetAdminVerificationToken(vasp *pb.VASP, token string) (err error)

SetAdminVerificationToken on the extra data on the VASP record.

func SetContactVerification

func SetContactVerification(contact *pb.Contact, token string, verified bool) (err error)

SetContactVerification token and verified status on the Contact record.

func UpdateCertificateRequestParams

func UpdateCertificateRequestParams(request *CertificateRequest, key, val string)

UpdateCertificateRequestParams updates the params map on the certificate request, adding the key value pair and overwriting the key if it already exists. NOTE: it is up to the caller to persist the request back to the database.

func UpdateCertificateRequestStatus

func UpdateCertificateRequestStatus(request *CertificateRequest, state CertificateRequestState, description string, source string) (err error)

UpdateCertificateRequestStatus changes the status of a CertificateRequest and appends an entry to the audit log.

func UpdateVerificationStatus

func UpdateVerificationStatus(vasp *pb.VASP, state pb.VerificationState, description string, source string) error

UpdateVerificationStatus changes the verification state of a VASP and appends a new entry to the audit log on the extra.

func VASPSignature added in v1.5.4

func VASPSignature(vasp *pb.VASP) (_ []byte, err error)

VASPSignature returns a SHA512 hash of the protocol buffer bytes that represents the current data in the VASP. This signature can be used to compare two VASP records for equality or to detect if a VASP record has been changed.

func ValidateCertificateRequestParams

func ValidateCertificateRequestParams(params map[string]string, profile string) (err error)

ValidateCertificateRequestParams ensures that the parameters about to be sent to Sectigo are valid; e.g. that they contain only the required parameters for the profile and that all parameter values are populated.

func ValidateVASP

func ValidateVASP(vasp *pb.VASP, partial bool) (err error)

ValidateVASP checks if a VASP model is valid using the method from the TRISA codebase and returns an error if it is not. If partial is true, "partial" validation is performed which allows for some fields such as timestamps and IDs to be empty.

func VerifiedContacts

func VerifiedContacts(vasp *pb.VASP) (contacts map[string]string)

VerifiedContacts returns a map of contact type to email address for all verified contacts, omitting any contacts that are not verified or do not exist.

Types

type AuditLogEntry

type AuditLogEntry struct {

	// RFC3339 timestamp
	Timestamp string `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// Previous verification state (handled internally) and current verification state
	PreviousState v1beta1.VerificationState `` /* 149-byte string literal not displayed */
	CurrentState  v1beta1.VerificationState `` /* 146-byte string literal not displayed */
	// Description which can be supplied by the Admin when making a state change
	// (e.g., "resent emails")
	Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
	// Email address of the Admin who made the state change, "automated" if the state
	// change happened automatically
	Source string `protobuf:"bytes,5,opt,name=source,proto3" json:"source,omitempty"`
	// contains filtered or unexported fields
}

AuditLogEntry contains information about an event relevant to a VASP (e.g., verification state changes).

func GetAuditLog

func GetAuditLog(vasp *pb.VASP) (_ []*AuditLogEntry, err error)

GetAuditLog from the extra data on the VASP record.

func (*AuditLogEntry) Descriptor deprecated

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

Deprecated: Use AuditLogEntry.ProtoReflect.Descriptor instead.

func (*AuditLogEntry) GetCurrentState

func (x *AuditLogEntry) GetCurrentState() v1beta1.VerificationState

func (*AuditLogEntry) GetDescription

func (x *AuditLogEntry) GetDescription() string

func (*AuditLogEntry) GetPreviousState

func (x *AuditLogEntry) GetPreviousState() v1beta1.VerificationState

func (*AuditLogEntry) GetSource

func (x *AuditLogEntry) GetSource() string

func (*AuditLogEntry) GetTimestamp

func (x *AuditLogEntry) GetTimestamp() string

func (*AuditLogEntry) ProtoMessage

func (*AuditLogEntry) ProtoMessage()

func (*AuditLogEntry) ProtoReflect

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

func (*AuditLogEntry) Reset

func (x *AuditLogEntry) Reset()

func (*AuditLogEntry) String

func (x *AuditLogEntry) String() string

type Certificate

type Certificate struct {

	// A unique identifier generated by the directory service for storage
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// CertificateRequest that this certificate is associated with
	Request string `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"`
	// VASP that this certificate belongs to
	Vasp string `protobuf:"bytes,3,opt,name=vasp,proto3" json:"vasp,omitempty"`
	// Current status of the certificate
	Status CertificateState `protobuf:"varint,4,opt,name=status,proto3,enum=gds.models.v1.CertificateState" json:"status,omitempty"`
	// Certificate details
	Details *v1beta1.Certificate `protobuf:"bytes,5,opt,name=details,proto3" json:"details,omitempty"`
	// contains filtered or unexported fields
}

Certificate embeds a TRISA Certificate into a record that can be stored in the database for certificate management.

func NewCertificate

func NewCertificate(vasp *pb.VASP, certRequest *CertificateRequest, data *pb.Certificate) (cert *Certificate, err error)

NewCertificate creates and returns a certificate associated with a VASP.

func (*Certificate) Descriptor deprecated

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

Deprecated: Use Certificate.ProtoReflect.Descriptor instead.

func (*Certificate) GetDetails

func (x *Certificate) GetDetails() *v1beta1.Certificate

func (*Certificate) GetId

func (x *Certificate) GetId() string

func (*Certificate) GetRequest

func (x *Certificate) GetRequest() string

func (*Certificate) GetStatus

func (x *Certificate) GetStatus() CertificateState

func (*Certificate) GetVasp

func (x *Certificate) GetVasp() string

func (*Certificate) ProtoMessage

func (*Certificate) ProtoMessage()

func (*Certificate) ProtoReflect

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

func (*Certificate) Reset

func (x *Certificate) Reset()

func (*Certificate) String

func (x *Certificate) String() string

type CertificateRequest

type CertificateRequest struct {

	// A unique identifier generated by the directory service, should be a globally
	// unique identifier generated by the replica specified in requesting_replica.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// VASP information for the request
	Vasp       string `protobuf:"bytes,2,opt,name=vasp,proto3" json:"vasp,omitempty"`
	CommonName string `protobuf:"bytes,3,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty"`
	// Request pipeline status
	Status CertificateRequestState `protobuf:"varint,4,opt,name=status,proto3,enum=gds.models.v1.CertificateRequestState" json:"status,omitempty"`
	// Sectigo create single certificate batch metadata
	AuthorityId  int64  `protobuf:"varint,5,opt,name=authority_id,json=authorityId,proto3" json:"authority_id,omitempty"`
	BatchId      int64  `protobuf:"varint,6,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"`
	BatchName    string `protobuf:"bytes,7,opt,name=batch_name,json=batchName,proto3" json:"batch_name,omitempty"`
	BatchStatus  string `protobuf:"bytes,8,opt,name=batch_status,json=batchStatus,proto3" json:"batch_status,omitempty"`
	OrderNumber  int64  `protobuf:"varint,9,opt,name=order_number,json=orderNumber,proto3" json:"order_number,omitempty"`
	CreationDate string `protobuf:"bytes,10,opt,name=creation_date,json=creationDate,proto3" json:"creation_date,omitempty"`
	Profile      string `protobuf:"bytes,11,opt,name=profile,proto3" json:"profile,omitempty"`
	RejectReason string `protobuf:"bytes,12,opt,name=reject_reason,json=rejectReason,proto3" json:"reject_reason,omitempty"`
	// Generic parameters used for making requests to certificate issuing services
	Params map[string]string `` /* 154-byte string literal not displayed */
	// Optional list of alternate dns names in addition to the common name
	DnsNames []string `protobuf:"bytes,14,rep,name=dns_names,json=dnsNames,proto3" json:"dns_names,omitempty"`
	// Logging information timestamps
	Created  string `protobuf:"bytes,15,opt,name=created,proto3" json:"created,omitempty"`
	Modified string `protobuf:"bytes,16,opt,name=modified,proto3" json:"modified,omitempty"`
	// Log of historical request states
	AuditLog []*CertificateRequestLogEntry `protobuf:"bytes,17,rep,name=audit_log,json=auditLog,proto3" json:"audit_log,omitempty"`
	// The certificate ID downloaded from the request, if completed successfully
	Certificate string `protobuf:"bytes,18,opt,name=certificate,proto3" json:"certificate,omitempty"`
	// Webhook for certificate delivery
	Webhook string `protobuf:"bytes,19,opt,name=webhook,proto3" json:"webhook,omitempty"`
	// Don't deliver certificates by email
	NoEmailDelivery bool `protobuf:"varint,20,opt,name=no_email_delivery,json=noEmailDelivery,proto3" json:"no_email_delivery,omitempty"`
	// contains filtered or unexported fields
}

Certificate requests are maintained separately from the VASP record since they should not be replicated. E.g. every directory process is responsible for certificate issuance and only public keys and certificate metadata should be exchanged between directories.

func NewCertificateRequest

func NewCertificateRequest(vasp *pb.VASP) (certRequest *CertificateRequest, err error)

NewCertificateRequest creates and returns a new certificate request to be associated with a VASP.

func (*CertificateRequest) Descriptor deprecated

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

Deprecated: Use CertificateRequest.ProtoReflect.Descriptor instead.

func (*CertificateRequest) GetAuditLog

func (x *CertificateRequest) GetAuditLog() []*CertificateRequestLogEntry

func (*CertificateRequest) GetAuthorityId

func (x *CertificateRequest) GetAuthorityId() int64

func (*CertificateRequest) GetBatchId

func (x *CertificateRequest) GetBatchId() int64

func (*CertificateRequest) GetBatchName

func (x *CertificateRequest) GetBatchName() string

func (*CertificateRequest) GetBatchStatus

func (x *CertificateRequest) GetBatchStatus() string

func (*CertificateRequest) GetCertificate

func (x *CertificateRequest) GetCertificate() string

func (*CertificateRequest) GetCommonName

func (x *CertificateRequest) GetCommonName() string

func (*CertificateRequest) GetCreated

func (x *CertificateRequest) GetCreated() string

func (*CertificateRequest) GetCreationDate

func (x *CertificateRequest) GetCreationDate() string

func (*CertificateRequest) GetDnsNames

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

func (*CertificateRequest) GetId

func (x *CertificateRequest) GetId() string

func (*CertificateRequest) GetModified

func (x *CertificateRequest) GetModified() string

func (*CertificateRequest) GetNoEmailDelivery added in v1.7.6

func (x *CertificateRequest) GetNoEmailDelivery() bool

func (*CertificateRequest) GetOrderNumber

func (x *CertificateRequest) GetOrderNumber() int64

func (*CertificateRequest) GetParams

func (x *CertificateRequest) GetParams() map[string]string

func (*CertificateRequest) GetProfile

func (x *CertificateRequest) GetProfile() string

func (*CertificateRequest) GetRejectReason

func (x *CertificateRequest) GetRejectReason() string

func (*CertificateRequest) GetStatus

func (*CertificateRequest) GetVasp

func (x *CertificateRequest) GetVasp() string

func (*CertificateRequest) GetWebhook added in v1.7.6

func (x *CertificateRequest) GetWebhook() string

func (*CertificateRequest) ProtoMessage

func (*CertificateRequest) ProtoMessage()

func (*CertificateRequest) ProtoReflect

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

func (*CertificateRequest) Reset

func (x *CertificateRequest) Reset()

func (*CertificateRequest) String

func (x *CertificateRequest) String() string

type CertificateRequestLogEntry

type CertificateRequestLogEntry struct {

	// RFC3339 timestamp
	Timestamp string `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// Previous request state (handled internally) and current request state
	PreviousState CertificateRequestState `` /* 144-byte string literal not displayed */
	CurrentState  CertificateRequestState `` /* 141-byte string literal not displayed */
	// Description of the current state of the certificate request
	Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
	// Email address of the Admin who made the state change, "automated" if the state
	// change happened automatically
	Source string `protobuf:"bytes,5,opt,name=source,proto3" json:"source,omitempty"`
	// contains filtered or unexported fields
}

CertificateRequestLogEntry contains information about the state of a certificate request.

func (*CertificateRequestLogEntry) Descriptor deprecated

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

Deprecated: Use CertificateRequestLogEntry.ProtoReflect.Descriptor instead.

func (*CertificateRequestLogEntry) GetCurrentState

func (*CertificateRequestLogEntry) GetDescription

func (x *CertificateRequestLogEntry) GetDescription() string

func (*CertificateRequestLogEntry) GetPreviousState

func (*CertificateRequestLogEntry) GetSource

func (x *CertificateRequestLogEntry) GetSource() string

func (*CertificateRequestLogEntry) GetTimestamp

func (x *CertificateRequestLogEntry) GetTimestamp() string

func (*CertificateRequestLogEntry) ProtoMessage

func (*CertificateRequestLogEntry) ProtoMessage()

func (*CertificateRequestLogEntry) ProtoReflect

func (*CertificateRequestLogEntry) Reset

func (x *CertificateRequestLogEntry) Reset()

func (*CertificateRequestLogEntry) String

func (x *CertificateRequestLogEntry) String() string

type CertificateRequestState

type CertificateRequestState int32
const (
	CertificateRequestState_INITIALIZED     CertificateRequestState = 0
	CertificateRequestState_READY_TO_SUBMIT CertificateRequestState = 1
	CertificateRequestState_PROCESSING      CertificateRequestState = 2
	CertificateRequestState_DOWNLOADING     CertificateRequestState = 3
	CertificateRequestState_DOWNLOADED      CertificateRequestState = 4
	CertificateRequestState_COMPLETED       CertificateRequestState = 5
	CertificateRequestState_CR_REJECTED     CertificateRequestState = 6
	CertificateRequestState_CR_ERRORED      CertificateRequestState = 7
)

func (CertificateRequestState) Descriptor

func (CertificateRequestState) Enum

func (CertificateRequestState) EnumDescriptor deprecated

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

Deprecated: Use CertificateRequestState.Descriptor instead.

func (CertificateRequestState) Number

func (CertificateRequestState) String

func (x CertificateRequestState) String() string

func (CertificateRequestState) Type

type CertificateState

type CertificateState int32
const (
	CertificateState_ISSUED  CertificateState = 0
	CertificateState_EXPIRED CertificateState = 1
	CertificateState_REVOKED CertificateState = 2
)

func (CertificateState) Descriptor

func (CertificateState) Enum

func (CertificateState) EnumDescriptor deprecated

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

Deprecated: Use CertificateState.Descriptor instead.

func (CertificateState) Number

func (CertificateState) String

func (x CertificateState) String() string

func (CertificateState) Type

type Contact added in v1.7.0

type Contact struct {

	// Unique email address for this contact
	Email string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
	Name  string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // used to address the email
	// List of VASPs that the contact is included in
	Vasps []string `protobuf:"bytes,3,rep,name=vasps,proto3" json:"vasps,omitempty"`
	// Token for email verification
	Verified bool   `protobuf:"varint,4,opt,name=verified,proto3" json:"verified,omitempty"`
	Token    string `protobuf:"bytes,5,opt,name=token,proto3" json:"token,omitempty"`
	// Email audit log
	EmailLog []*EmailLogEntry `protobuf:"bytes,6,rep,name=email_log,json=emailLog,proto3" json:"email_log,omitempty"`
	// RFC3339 Timestamp for when the contact was verified
	VerifiedOn string `protobuf:"bytes,7,opt,name=verified_on,json=verifiedOn,proto3" json:"verified_on,omitempty"`
	// Logging information timestamps
	Created  string `protobuf:"bytes,8,opt,name=created,proto3" json:"created,omitempty"`
	Modified string `protobuf:"bytes,9,opt,name=modified,proto3" json:"modified,omitempty"`
	// contains filtered or unexported fields
}

Contact contains a unique email address and information about a TRISA member.

func (*Contact) AppendEmailLog added in v1.7.0

func (c *Contact) AppendEmailLog(reason, subject string)

Create and add a new entry to the EmailLog on the extra data on the Contact record.

func (*Contact) Descriptor deprecated added in v1.7.0

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

Deprecated: Use Contact.ProtoReflect.Descriptor instead.

func (*Contact) GetCreated added in v1.7.0

func (x *Contact) GetCreated() string

func (*Contact) GetEmail added in v1.7.0

func (x *Contact) GetEmail() string

func (*Contact) GetEmailLog added in v1.7.0

func (x *Contact) GetEmailLog() []*EmailLogEntry

func (*Contact) GetModified added in v1.7.0

func (x *Contact) GetModified() string

func (*Contact) GetName added in v1.7.0

func (x *Contact) GetName() string

func (*Contact) GetToken added in v1.7.0

func (x *Contact) GetToken() string

func (*Contact) GetVasps added in v1.7.0

func (x *Contact) GetVasps() []string

func (*Contact) GetVerified added in v1.7.0

func (x *Contact) GetVerified() bool

func (*Contact) GetVerifiedOn added in v1.7.0

func (x *Contact) GetVerifiedOn() string

func (*Contact) ProtoMessage added in v1.7.0

func (*Contact) ProtoMessage()

func (*Contact) ProtoReflect added in v1.7.0

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

func (*Contact) Reset added in v1.7.0

func (x *Contact) Reset()

func (*Contact) String added in v1.7.0

func (x *Contact) String() string

type ContactIterOption added in v1.7.1

type ContactIterOption func(c *ContactIterator)

ContactIterOptions are used to configure iterator behavior

func SkipDuplicates added in v1.7.1

func SkipDuplicates() ContactIterOption

Skip contacts with duplicate email addresses, e.g. if the technical contact is the same as the administrative contact then only the technical contact will be returned in the iteration.

func SkipNoEmail added in v1.7.1

func SkipNoEmail() ContactIterOption

Skip contacts with no email address

func SkipUnverified added in v1.7.1

func SkipUnverified() ContactIterOption

Skip contacts that are not verified

type ContactIterator

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

func NewContactIterator

func NewContactIterator(contacts *pb.Contacts, opts ...ContactIterOption) *ContactIterator

Returns a new ContactIterator which has Next() and Value() methods that can be used to iterate over contacts in a Contacts object. By default, the iterator will return each contact which is non-zero. SkipNoEmail(), SkipUnverified(), and SkipDuplicates() can be used to filter contacts returned by the iterator.

func (*ContactIterator) Error

func (i *ContactIterator) Error() (err error)

Error returns a multi-error that describes any errors that occurred during iteration for any contact. This will allow us to log all errors once.

func (*ContactIterator) Next

func (i *ContactIterator) Next() bool

Moves the ContactIterator to the next existing contact and returns true if there is one, false if the iteration is complete.

func (*ContactIterator) Value

func (i *ContactIterator) Value() (*pb.Contact, string)

type EmailLogEntry

type EmailLogEntry struct {

	// RFC3339 timestamp
	Timestamp string `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// Reason why the email was sent
	Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"`
	// Subject line of the email
	Subject string `protobuf:"bytes,3,opt,name=subject,proto3" json:"subject,omitempty"`
	// Email address of the recipient
	Recipient string `protobuf:"bytes,4,opt,name=recipient,proto3" json:"recipient,omitempty"`
	// contains filtered or unexported fields
}

EmailLogEntry contains information about a single email message that was sent.

func GetAdminEmailLog

func GetAdminEmailLog(vasp *pb.VASP) (_ []*EmailLogEntry, err error)

GetAdminEmailLog from the extra data on the VASP record.

func GetEmailLog

func GetEmailLog(contact *pb.Contact) (_ []*EmailLogEntry, err error)

GetEmailLog from the extra data on the Contact record.

func GetVASPEmailLog added in v1.6.0

func GetVASPEmailLog(vasp *pb.VASP) (emails []*EmailLogEntry, err error)

GetVASPEmailLog computes a unified email log which is a time ordered representation of all the emails sent to a VASP's contacts.

func (*EmailLogEntry) Descriptor deprecated

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

Deprecated: Use EmailLogEntry.ProtoReflect.Descriptor instead.

func (*EmailLogEntry) GetReason

func (x *EmailLogEntry) GetReason() string

func (*EmailLogEntry) GetRecipient added in v1.6.2

func (x *EmailLogEntry) GetRecipient() string

func (*EmailLogEntry) GetSubject

func (x *EmailLogEntry) GetSubject() string

func (*EmailLogEntry) GetTimestamp

func (x *EmailLogEntry) GetTimestamp() string

func (*EmailLogEntry) ProtoMessage

func (*EmailLogEntry) ProtoMessage()

func (*EmailLogEntry) ProtoReflect

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

func (*EmailLogEntry) Reset

func (x *EmailLogEntry) Reset()

func (*EmailLogEntry) String

func (x *EmailLogEntry) String() string

type GDSContactExtraData

type GDSContactExtraData struct {

	// Token for email verification
	Verified bool   `protobuf:"varint,1,opt,name=verified,proto3" json:"verified,omitempty"`
	Token    string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
	// Email audit log
	EmailLog []*EmailLogEntry `protobuf:"bytes,3,rep,name=email_log,json=emailLog,proto3" json:"email_log,omitempty"`
	// contains filtered or unexported fields
}

GDSContactExtraData contains all GDS-specific extra data for a Contact record.

func (*GDSContactExtraData) Descriptor deprecated

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

Deprecated: Use GDSContactExtraData.ProtoReflect.Descriptor instead.

func (*GDSContactExtraData) GetEmailLog

func (x *GDSContactExtraData) GetEmailLog() []*EmailLogEntry

func (*GDSContactExtraData) GetToken

func (x *GDSContactExtraData) GetToken() string

func (*GDSContactExtraData) GetVerified

func (x *GDSContactExtraData) GetVerified() bool

func (*GDSContactExtraData) ProtoMessage

func (*GDSContactExtraData) ProtoMessage()

func (*GDSContactExtraData) ProtoReflect

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

func (*GDSContactExtraData) Reset

func (x *GDSContactExtraData) Reset()

func (*GDSContactExtraData) String

func (x *GDSContactExtraData) String() string

type GDSExtraData

type GDSExtraData struct {

	// Temporary: verification token for light weight authentication for verification
	// TODO: replace with admin API that uses authentication
	AdminVerificationToken string `` /* 129-byte string literal not displayed */
	// Audit log which records events relevant to a VASP
	AuditLog []*AuditLogEntry `protobuf:"bytes,2,rep,name=audit_log,json=auditLog,proto3" json:"audit_log,omitempty"`
	// Record of all the review notes associated with this VASP
	ReviewNotes map[string]*ReviewNote `` /* 182-byte string literal not displayed */
	// Certificate requests associated with this VASP
	CertificateRequests []string `protobuf:"bytes,4,rep,name=certificate_requests,json=certificateRequests,proto3" json:"certificate_requests,omitempty"`
	// Certificate IDs associated with this VASP
	Certificates []string `protobuf:"bytes,5,rep,name=certificates,proto3" json:"certificates,omitempty"`
	// Log which records emails sent to the TRISA admins regarding this VASP
	EmailLog []*EmailLogEntry `protobuf:"bytes,6,rep,name=email_log,json=emailLog,proto3" json:"email_log,omitempty"`
	// contains filtered or unexported fields
}

GDSExtraData contains all GDS-specific extra data for a VASP record.

func (*GDSExtraData) Descriptor deprecated

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

Deprecated: Use GDSExtraData.ProtoReflect.Descriptor instead.

func (*GDSExtraData) GetAdminVerificationToken

func (x *GDSExtraData) GetAdminVerificationToken() string

func (*GDSExtraData) GetAuditLog

func (x *GDSExtraData) GetAuditLog() []*AuditLogEntry

func (*GDSExtraData) GetCertificateRequests

func (x *GDSExtraData) GetCertificateRequests() []string

func (*GDSExtraData) GetCertificates

func (x *GDSExtraData) GetCertificates() []string

func (*GDSExtraData) GetEmailLog

func (x *GDSExtraData) GetEmailLog() []*EmailLogEntry

func (*GDSExtraData) GetReviewNotes

func (x *GDSExtraData) GetReviewNotes() map[string]*ReviewNote

func (*GDSExtraData) ProtoMessage

func (*GDSExtraData) ProtoMessage()

func (*GDSExtraData) ProtoReflect

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

func (*GDSExtraData) Reset

func (x *GDSExtraData) Reset()

func (*GDSExtraData) String

func (x *GDSExtraData) String() string

type PageCursor

type PageCursor struct {
	PageSize int32  `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // the number of results returned on each iteration.
	NextVasp string `protobuf:"bytes,2,opt,name=next_vasp,json=nextVasp,proto3" json:"next_vasp,omitempty"`  // the VASP id to start the iteration from
	// contains filtered or unexported fields
}

Implements a protocol buffer struct for state managed pagination. This struct will be marshaled into a url-safe base64 encoded string and sent to the user as the next_page_token. The server should decode this struct to determine where to continue iteration for the next page. Note that the server should check to make sure the page size in the cursor matches the page size in the request. See https://cloud.google.com/apis/design/design_patterns#list_pagination for more.

func (*PageCursor) Descriptor deprecated

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

Deprecated: Use PageCursor.ProtoReflect.Descriptor instead.

func (*PageCursor) Dump

func (pc *PageCursor) Dump() (token string, err error)

Dump a PageCursor into a page_token string. This is very similar code to trtl.internal but decoupled so Trtl and GDS aren't dependent on each other.

func (*PageCursor) GetNextVasp

func (x *PageCursor) GetNextVasp() string

func (*PageCursor) GetPageSize

func (x *PageCursor) GetPageSize() int32

func (*PageCursor) Load

func (pc *PageCursor) Load(token string) (err error)

Load a PageCursor from a page_token string. This is very similar code to trtl.internal but decoupled so Trtl and GDS aren't dependent on each other.

func (*PageCursor) ProtoMessage

func (*PageCursor) ProtoMessage()

func (*PageCursor) ProtoReflect

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

func (*PageCursor) Reset

func (x *PageCursor) Reset()

func (*PageCursor) String

func (x *PageCursor) String() string

type ReviewNote

type ReviewNote struct {

	// Unique identifier of the note
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// RFC3339 timestamps representing when the note was created, modified
	Created  string `protobuf:"bytes,2,opt,name=created,proto3" json:"created,omitempty"`
	Modified string `protobuf:"bytes,3,opt,name=modified,proto3" json:"modified,omitempty"`
	// Email address of the author and the last editor
	Author string `protobuf:"bytes,4,opt,name=author,proto3" json:"author,omitempty"`
	Editor string `protobuf:"bytes,5,opt,name=editor,proto3" json:"editor,omitempty"`
	// Actual text in the note
	Text string `protobuf:"bytes,6,opt,name=text,proto3" json:"text,omitempty"`
	// contains filtered or unexported fields
}

func CreateReviewNote

func CreateReviewNote(vasp *pb.VASP, id string, author string, text string) (note *ReviewNote, err error)

CreateReviewNote creates a note on the VASP given the specified note id.

func UpdateReviewNote

func UpdateReviewNote(vasp *pb.VASP, id string, editor string, text string) (note *ReviewNote, err error)

UpdateReviewNote updates a specified note on the VASP.

func (*ReviewNote) Descriptor deprecated

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

Deprecated: Use ReviewNote.ProtoReflect.Descriptor instead.

func (*ReviewNote) GetAuthor

func (x *ReviewNote) GetAuthor() string

func (*ReviewNote) GetCreated

func (x *ReviewNote) GetCreated() string

func (*ReviewNote) GetEditor

func (x *ReviewNote) GetEditor() string

func (*ReviewNote) GetId

func (x *ReviewNote) GetId() string

func (*ReviewNote) GetModified

func (x *ReviewNote) GetModified() string

func (*ReviewNote) GetText

func (x *ReviewNote) GetText() string

func (*ReviewNote) ProtoMessage

func (*ReviewNote) ProtoMessage()

func (*ReviewNote) ProtoReflect

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

func (*ReviewNote) Reset

func (x *ReviewNote) Reset()

func (*ReviewNote) String

func (x *ReviewNote) String() string

Jump to

Keyboard shortcuts

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