Documentation
¶
Index ¶
- func Init(ctx context.Context)
- func IsValid(email string) bool
- func SendJITApprovalEmail(grant *schema.JITGrant, request *schema.JITRequest, network *schema.Network) error
- func SendJITDeniedEmail(request *schema.JITRequest, network *schema.Network) error
- func SendJITExpirationEmail(grant *schema.JITGrant, request *schema.JITRequest, network *schema.Network, ...) error
- func SendJITRequestEmails(ctx context.Context, request *schema.JITRequest, network *schema.Network) error
- type EmailBodyBuilder
- type EmailBodyBuilderWithH1HeadlineAndImage
- func (b *EmailBodyBuilderWithH1HeadlineAndImage) Build() string
- func (b *EmailBodyBuilderWithH1HeadlineAndImage) WithHeadline(text string) EmailBodyBuilder
- func (b *EmailBodyBuilderWithH1HeadlineAndImage) WithHtml(text string) EmailBodyBuilder
- func (b *EmailBodyBuilderWithH1HeadlineAndImage) WithParagraph(text string) EmailBodyBuilder
- func (b *EmailBodyBuilderWithH1HeadlineAndImage) WithSignature() EmailBodyBuilder
- type EmailSender
- type EmailSenderType
- type EmailValidationMail
- type JITApprovedMail
- type JITDeniedMail
- type JITExpiredMail
- type JITRequestMail
- type Mail
- type Notification
- type SmtpSender
- type UserInvitedMail
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendJITApprovalEmail ¶
func SendJITApprovalEmail(grant *schema.JITGrant, request *schema.JITRequest, network *schema.Network) error
SendJITApprovalEmail - sends email notification to user when JIT request is approved
func SendJITDeniedEmail ¶
func SendJITDeniedEmail(request *schema.JITRequest, network *schema.Network) error
SendJITDeniedEmail - sends email notification to user when JIT request is denied
func SendJITExpirationEmail ¶
func SendJITExpirationEmail(grant *schema.JITGrant, request *schema.JITRequest, network *schema.Network, isRevoked bool, revokedBy string) error
SendJITExpirationEmail - sends email notification to user when JIT grant expires or is revoked revokedBy is the username of the admin who revoked the grant; empty when grant expired naturally
func SendJITRequestEmails ¶
func SendJITRequestEmails(ctx context.Context, request *schema.JITRequest, network *schema.Network) error
SendJITRequestEmails - sends email notifications to network admins about JIT requests
Types ¶
type EmailBodyBuilder ¶
type EmailBodyBuilder interface {
WithHeadline(text string) EmailBodyBuilder
WithParagraph(text string) EmailBodyBuilder
WithHtml(text string) EmailBodyBuilder
WithSignature() EmailBodyBuilder
Build() string
}
type EmailBodyBuilderWithH1HeadlineAndImage ¶
type EmailBodyBuilderWithH1HeadlineAndImage struct {
// contains filtered or unexported fields
}
func (*EmailBodyBuilderWithH1HeadlineAndImage) Build ¶
func (b *EmailBodyBuilderWithH1HeadlineAndImage) Build() string
func (*EmailBodyBuilderWithH1HeadlineAndImage) WithHeadline ¶
func (b *EmailBodyBuilderWithH1HeadlineAndImage) WithHeadline(text string) EmailBodyBuilder
func (*EmailBodyBuilderWithH1HeadlineAndImage) WithHtml ¶
func (b *EmailBodyBuilderWithH1HeadlineAndImage) WithHtml(text string) EmailBodyBuilder
func (*EmailBodyBuilderWithH1HeadlineAndImage) WithParagraph ¶
func (b *EmailBodyBuilderWithH1HeadlineAndImage) WithParagraph(text string) EmailBodyBuilder
func (*EmailBodyBuilderWithH1HeadlineAndImage) WithSignature ¶
func (b *EmailBodyBuilderWithH1HeadlineAndImage) WithSignature() EmailBodyBuilder
type EmailSender ¶
type EmailSender interface {
// SendEmail - sends an email based on a context, notification and mail template
SendEmail(ctx context.Context, notification Notification, email Mail) error
}
EmailSender - an interface for sending emails based on notifications and mail templates
func GetClient ¶
func GetClient() (e EmailSender)
type EmailSenderType ¶
type EmailSenderType string
const ( Smtp EmailSenderType = "smtp" Resend EmailSenderType = "resend" )
type EmailValidationMail ¶ added in v1.7.0
type EmailValidationMail struct {
BodyBuilder EmailBodyBuilder
ValidateURL string
}
EmailValidationMail - mail sent to a user to verify ownership of their email/username.
func (EmailValidationMail) GetBody ¶ added in v1.7.0
func (m EmailValidationMail) GetBody(info Notification) string
GetBody - gets the body of the email
func (EmailValidationMail) GetSubject ¶ added in v1.7.0
func (EmailValidationMail) GetSubject(info Notification) string
GetSubject - gets the subject of the email
type JITApprovedMail ¶
type JITApprovedMail struct {
BodyBuilder EmailBodyBuilder
Grant *schema.JITGrant
Request *schema.JITRequest
Network *schema.Network
}
JITApprovedMail - mail for notifying users when their JIT request is approved
func (JITApprovedMail) GetBody ¶
func (mail JITApprovedMail) GetBody(info Notification) string
GetBody - gets the body of the email
func (JITApprovedMail) GetSubject ¶
func (mail JITApprovedMail) GetSubject(info Notification) string
GetSubject - gets the subject of the email
type JITDeniedMail ¶
type JITDeniedMail struct {
BodyBuilder EmailBodyBuilder
Request *schema.JITRequest
Network *schema.Network
}
JITDeniedMail - mail for notifying users when their JIT request is denied
func (JITDeniedMail) GetBody ¶
func (mail JITDeniedMail) GetBody(info Notification) string
GetBody - gets the body of the email
func (JITDeniedMail) GetSubject ¶
func (mail JITDeniedMail) GetSubject(info Notification) string
GetSubject - gets the subject of the email
type JITExpiredMail ¶
type JITExpiredMail struct {
BodyBuilder EmailBodyBuilder
Grant *schema.JITGrant
Request *schema.JITRequest
Network *schema.Network
IsRevoked bool
RevokedBy string // set when IsRevoked is true
}
JITExpiredMail - mail for notifying users when their JIT grant expires or is revoked
func (JITExpiredMail) GetBody ¶
func (mail JITExpiredMail) GetBody(info Notification) string
GetBody - gets the body of the email
func (JITExpiredMail) GetSubject ¶
func (mail JITExpiredMail) GetSubject(info Notification) string
GetSubject - gets the subject of the email
type JITRequestMail ¶
type JITRequestMail struct {
BodyBuilder EmailBodyBuilder
Request *schema.JITRequest
Network *schema.Network
}
JITRequestMail - mail for notifying admins of JIT access requests
func (JITRequestMail) GetBody ¶
func (mail JITRequestMail) GetBody(info Notification) string
GetBody - gets the body of the email
func (JITRequestMail) GetSubject ¶
func (mail JITRequestMail) GetSubject(info Notification) string
GetSubject - gets the subject of the email
type Mail ¶
type Mail interface {
GetBody(info Notification) string
GetSubject(info Notification) string
}
type Notification ¶
Notification - struct for notification details
type SmtpSender ¶
type SmtpSender struct {
SmtpHost string
SmtpPort int
SenderEmail string
SendUser string
SenderPass string
SkipVerify bool
}
func (*SmtpSender) SendEmail ¶
func (s *SmtpSender) SendEmail(ctx context.Context, n Notification, e Mail) error
type UserInvitedMail ¶
type UserInvitedMail struct {
BodyBuilder EmailBodyBuilder
InviteURL string
PlatformRoleID string
}
UserInvitedMail - mail for users that are invited to a tenant
func (UserInvitedMail) GetBody ¶
func (invite UserInvitedMail) GetBody(info Notification) string
GetBody - gets the body of the email
func (UserInvitedMail) GetSubject ¶
func (UserInvitedMail) GetSubject(info Notification) string
GetSubject - gets the subject of the email