notifier

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: Apache-2.0 Imports: 15 Imported by: 6

Documentation

Index

Constants

View Source
const SES_CONFIG_TYPE = "ses"
View Source
const SLACK_CONFIG_TYPE = "slack"
View Source
const SLACK_URL = "https://hooks.slack.com/"
View Source
const SMTP_CONFIG_TYPE = "smtp"
View Source
const WEBHOOK_CONFIG_TYPE = "webhook"
View Source
const WEBHOOK_URL = "https://"

Variables

This section is empty.

Functions

This section is empty.

Types

type AppResponse

type AppResponse struct {
	Id   *int   `json:"id"`
	Name string `json:"name"`
}

type EnvResponse

type EnvResponse struct {
	Id   *int   `json:"id"`
	Name string `json:"name"`
}

type NSConfig

type NSConfig struct {
	TeamId       []*int            `json:"teamId"`
	AppId        []*int            `json:"appId"`
	EnvId        []*int            `json:"envId"`
	PipelineId   *int              `json:"pipelineId"`
	PipelineType util.PipelineType `json:"pipelineType" validate:"required"`
	EventTypeIds []int             `json:"eventTypeIds" validate:"required"`
	Providers    []*Provider       `json:"providers" validate:"required"`
}

type NSDeleteRequest

type NSDeleteRequest struct {
	Id []*int `json:"id"`
}

type NSViewResponse

type NSViewResponse struct {
	Total                        int                             `json:"total"`
	NotificationSettingsResponse []*NotificationSettingsResponse `json:"settings"`
}

type NotificationChannelAutoResponse

type NotificationChannelAutoResponse struct {
	ConfigName string `json:"configName"`
	Id         int    `json:"id"`
	TeamId     int    `json:"-"`
}

type NotificationConfigBuilder

type NotificationConfigBuilder interface {
	BuildNotificationSettingsConfig(notificationSettingsRequest *NotificationConfigRequest, existingNotificationSettingsConfig *repository.NotificationSettingsView, userId int32) (*repository.NotificationSettingsView, error)
	BuildNewNotificationSettings(notificationSettingsRequest *NotificationConfigRequest, notificationSettingsView *repository.NotificationSettingsView) ([]repository.NotificationSettings, error)
	BuildNotificationSettingWithPipeline(teamId *int, envId *int, appId *int, pipelineId *int, pipelineType util.PipelineType, eventTypeId int, viewId int, providers []*Provider) (repository.NotificationSettings, error)
}

type NotificationConfigBuilderImpl

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

func NewNotificationConfigBuilderImpl

func NewNotificationConfigBuilderImpl(logger *zap.SugaredLogger) *NotificationConfigBuilderImpl

func (NotificationConfigBuilderImpl) BuildNewNotificationSettings

func (impl NotificationConfigBuilderImpl) BuildNewNotificationSettings(notificationSettingsRequest *NotificationConfigRequest, notificationSettingsView *repository.NotificationSettingsView) ([]repository.NotificationSettings, error)

func (NotificationConfigBuilderImpl) BuildNotificationSettingWithPipeline

func (impl NotificationConfigBuilderImpl) BuildNotificationSettingWithPipeline(teamId *int, envId *int, appId *int, pipelineId *int, pipelineType util.PipelineType, eventTypeId int, viewId int, providers []*Provider) (repository.NotificationSettings, error)

func (NotificationConfigBuilderImpl) BuildNotificationSettingsConfig

func (impl NotificationConfigBuilderImpl) BuildNotificationSettingsConfig(notificationSettingsRequest *NotificationConfigRequest, existingNotificationSettingsConfig *repository.NotificationSettingsView, userId int32) (*repository.NotificationSettingsView, error)

type NotificationConfigRequest

type NotificationConfigRequest struct {
	Id           int               `json:"id"`
	TeamId       []*int            `json:"teamId"`
	AppId        []*int            `json:"appId"`
	EnvId        []*int            `json:"envId"`
	PipelineId   *int              `json:"pipelineId"`
	PipelineType util.PipelineType `json:"pipelineType" validate:"required"`
	EventTypeIds []int             `json:"eventTypeIds" validate:"required"`
	Providers    []*Provider       `json:"providers"`
}

type NotificationConfigService

type NotificationConfigService interface {
	CreateOrUpdateNotificationSettings(notificationSettingsRequest *NotificationRequest, userId int32) (int, error)
	FindAll(offset int, size int) ([]*repository.NotificationSettingsViewWithAppEnv, int, error)
	BuildNotificationSettingsResponse(notificationSettings []*repository.NotificationSettingsViewWithAppEnv) ([]*NotificationSettingsResponse, int, error)
	DeleteNotificationSettings(request NSDeleteRequest) error
	FindNotificationSettingOptions(request *repository.SearchRequest) ([]*SearchFilterResponse, error)

	UpdateNotificationSettings(notificationSettingsRequest *NotificationUpdateRequest, userId int32) (int, error)
	FetchNSViewByIds(ids []*int) ([]*NSConfig, error)
}

type NotificationConfigServiceImpl

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

func NewNotificationConfigServiceImpl

func NewNotificationConfigServiceImpl(logger *zap.SugaredLogger, notificationSettingsRepository repository.NotificationSettingsRepository, notificationConfigBuilder NotificationConfigBuilder, ciPipelineRepository pipelineConfig.CiPipelineRepository,
	pipelineRepository pipelineConfig.PipelineRepository, slackRepository repository.SlackNotificationRepository, webhookRepository repository.WebhookNotificationRepository,
	sesRepository repository.SESNotificationRepository, smtpRepository repository.SMTPNotificationRepository,
	teamRepository repository2.TeamRepository,
	environmentRepository repository3.EnvironmentRepository, appRepository app.AppRepository,
	userRepository repository4.UserRepository, ciPipelineMaterialRepository pipelineConfig.CiPipelineMaterialRepository) *NotificationConfigServiceImpl

func (*NotificationConfigServiceImpl) BuildNotificationSettingsResponse

func (impl *NotificationConfigServiceImpl) BuildNotificationSettingsResponse(notificationSettingViews []*repository.NotificationSettingsViewWithAppEnv) ([]*NotificationSettingsResponse, int, error)

func (*NotificationConfigServiceImpl) CreateOrUpdateNotificationSettings

func (impl *NotificationConfigServiceImpl) CreateOrUpdateNotificationSettings(notificationSettingsRequest *NotificationRequest, userId int32) (int, error)

func (*NotificationConfigServiceImpl) DeleteNotificationSettings

func (impl *NotificationConfigServiceImpl) DeleteNotificationSettings(request NSDeleteRequest) error

func (*NotificationConfigServiceImpl) FetchNSViewByIds

func (impl *NotificationConfigServiceImpl) FetchNSViewByIds(ids []*int) ([]*NSConfig, error)

func (*NotificationConfigServiceImpl) FindAll

func (*NotificationConfigServiceImpl) FindNotificationSettingOptions

func (impl *NotificationConfigServiceImpl) FindNotificationSettingOptions(settingRequest *repository.SearchRequest) ([]*SearchFilterResponse, error)

func (*NotificationConfigServiceImpl) UpdateNotificationSettings

func (impl *NotificationConfigServiceImpl) UpdateNotificationSettings(notificationSettingsRequest *NotificationUpdateRequest, userId int32) (int, error)

type NotificationRecipientListingResponse

type NotificationRecipientListingResponse struct {
	Dest      util2.Channel `json:"dest"`
	ConfigId  int           `json:"configId"`
	Recipient string        `json:"recipient"`
}

type NotificationRequest

type NotificationRequest struct {
	UpdateType                util.UpdateType              `json:"updateType,omitempty"`
	SesConfigId               int                          `json:"sesConfigId,omitempty"`
	Providers                 []*Provider                  `json:"providers"`
	NotificationConfigRequest []*NotificationConfigRequest `json:"notificationConfigRequest" validate:"required"`
}

type NotificationSettingRequest

type NotificationSettingRequest struct {
	Id     int  `json:"id"`
	TeamId int  `json:"teamId"`
	AppId  *int `json:"appId"`
	EnvId  *int `json:"envId"`
	//Pipelines    []int             `json:"pipelineIds"`
	PipelineType util.PipelineType `json:"pipelineType" validate:"required"`
	EventTypeIds []int             `json:"eventTypeIds" validate:"required"`
	Providers    []Provider        `json:"providers" validate:"required"`
}

type NotificationSettingsResponse

type NotificationSettingsResponse struct {
	Id               int                `json:"id"`
	ConfigName       string             `json:"configName"`
	TeamResponse     []*TeamResponse    `json:"team"`
	AppResponse      []*AppResponse     `json:"app"`
	EnvResponse      []*EnvResponse     `json:"environment"`
	PipelineResponse *PipelineResponse  `json:"pipeline"`
	PipelineType     string             `json:"pipelineType"`
	ProvidersConfig  []*ProvidersConfig `json:"providerConfigs"`
	EventTypes       []int              `json:"eventTypes"`
}

type NotificationUpdateRequest

type NotificationUpdateRequest struct {
	UpdateType                util.UpdateType              `json:"updateType,omitempty"`
	NotificationConfigRequest []*NotificationConfigRequest `json:"notificationConfigRequest" validate:"required"`
}

type PipelineResponse

type PipelineResponse struct {
	Id              *int     `json:"id"`
	Name            string   `json:"name"`
	EnvironmentName string   `json:"environmentName,omitempty"`
	AppName         string   `json:"appName,omitempty"`
	Branches        []string `json:"branches,omitempty"`
}

type Provider

type Provider struct {
	Destination util.Channel `json:"dest"`
	Rule        string       `json:"rule"`
	ConfigId    int          `json:"configId"`
	Recipient   string       `json:"recipient"`
}

type Providers

type Providers struct {
	Providers []Provider `json:"providers"`
}

type ProvidersConfig

type ProvidersConfig struct {
	Id         int    `json:"id"`
	Dest       string `json:"dest"`
	ConfigName string `json:"name"`
	Recipient  string `json:"recipient"`
}

type SESChannelConfig

type SESChannelConfig struct {
	Channel       util2.Channel   `json:"channel" validate:"required"`
	SESConfigDtos []*SESConfigDto `json:"configs"`
}

type SESConfigDto

type SESConfigDto struct {
	OwnerId      int32  `json:"userId" validate:"number"`
	TeamId       int    `json:"teamId" validate:"number"`
	Region       string `json:"region" validate:"required"`
	AccessKey    string `json:"accessKey" validate:"required"`
	SecretKey    string `json:"secretKey" validate:"required"`
	FromEmail    string `json:"fromEmail" validate:"email,required"`
	ToEmail      string `json:"toEmail"`
	SessionToken string `json:"sessionToken"`
	ConfigName   string `json:"configName" validate:"required"`
	Description  string `json:"description"`
	Id           int    `json:"id" validate:"number"`
	Default      bool   `json:"default,notnull"`
}

type SESNotificationService

type SESNotificationService interface {
	SaveOrEditNotificationConfig(channelReq []*SESConfigDto, userId int32) ([]int, error)
	FetchSESNotificationConfigById(id int) (*SESConfigDto, error)
	FetchAllSESNotificationConfig() ([]*SESConfigDto, error)
	FetchAllSESNotificationConfigAutocomplete() ([]*NotificationChannelAutoResponse, error)
	DeleteNotificationConfig(channelReq *SESConfigDto, userId int32) error
}

type SESNotificationServiceImpl

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

func NewSESNotificationServiceImpl

func NewSESNotificationServiceImpl(logger *zap.SugaredLogger, sesRepository repository.SESNotificationRepository,
	teamService team.TeamService, notificationSettingsRepository repository.NotificationSettingsRepository) *SESNotificationServiceImpl

func (*SESNotificationServiceImpl) DeleteNotificationConfig added in v0.3.15

func (impl *SESNotificationServiceImpl) DeleteNotificationConfig(deleteReq *SESConfigDto, userId int32) error

func (*SESNotificationServiceImpl) FetchAllSESNotificationConfig

func (impl *SESNotificationServiceImpl) FetchAllSESNotificationConfig() ([]*SESConfigDto, error)

func (*SESNotificationServiceImpl) FetchAllSESNotificationConfigAutocomplete

func (impl *SESNotificationServiceImpl) FetchAllSESNotificationConfigAutocomplete() ([]*NotificationChannelAutoResponse, error)

func (*SESNotificationServiceImpl) FetchSESNotificationConfigById

func (impl *SESNotificationServiceImpl) FetchSESNotificationConfigById(id int) (*SESConfigDto, error)

func (*SESNotificationServiceImpl) SaveOrEditNotificationConfig

func (impl *SESNotificationServiceImpl) SaveOrEditNotificationConfig(channelReq []*SESConfigDto, userId int32) ([]int, error)

type SMTPChannelConfig added in v0.4.24

type SMTPChannelConfig struct {
	Channel        util2.Channel    `json:"channel" validate:"required"`
	SMTPConfigDtos []*SMTPConfigDto `json:"configs"`
}

type SMTPConfigDto added in v0.4.24

type SMTPConfigDto struct {
	Id           int    `json:"id"`
	Port         string `json:"port"`
	Host         string `json:"host"`
	AuthType     string `json:"authType"`
	AuthUser     string `json:"authUser"`
	AuthPassword string `json:"authPassword"`
	FromEmail    string `json:"fromEmail"`
	ConfigName   string `json:"configName"`
	Description  string `json:"description"`
	OwnerId      int32  `json:"ownerId"`
	Default      bool   `json:"default"`
	Deleted      bool   `json:"deleted"`
}

type SMTPNotificationService added in v0.4.24

type SMTPNotificationService interface {
	SaveOrEditNotificationConfig(channelReq []*SMTPConfigDto, userId int32) ([]int, error)
	FetchSMTPNotificationConfigById(id int) (*SMTPConfigDto, error)
	FetchAllSMTPNotificationConfig() ([]*SMTPConfigDto, error)
	FetchAllSMTPNotificationConfigAutocomplete() ([]*NotificationChannelAutoResponse, error)
	DeleteNotificationConfig(channelReq *SMTPConfigDto, userId int32) error
}

type SMTPNotificationServiceImpl added in v0.4.24

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

func NewSMTPNotificationServiceImpl added in v0.4.24

func NewSMTPNotificationServiceImpl(logger *zap.SugaredLogger, smtpRepository repository.SMTPNotificationRepository,
	teamService team.TeamService, notificationSettingsRepository repository.NotificationSettingsRepository) *SMTPNotificationServiceImpl

func (*SMTPNotificationServiceImpl) DeleteNotificationConfig added in v0.4.24

func (impl *SMTPNotificationServiceImpl) DeleteNotificationConfig(deleteReq *SMTPConfigDto, userId int32) error

func (*SMTPNotificationServiceImpl) FetchAllSMTPNotificationConfig added in v0.4.24

func (impl *SMTPNotificationServiceImpl) FetchAllSMTPNotificationConfig() ([]*SMTPConfigDto, error)

func (*SMTPNotificationServiceImpl) FetchAllSMTPNotificationConfigAutocomplete added in v0.4.24

func (impl *SMTPNotificationServiceImpl) FetchAllSMTPNotificationConfigAutocomplete() ([]*NotificationChannelAutoResponse, error)

func (*SMTPNotificationServiceImpl) FetchSMTPNotificationConfigById added in v0.4.24

func (impl *SMTPNotificationServiceImpl) FetchSMTPNotificationConfigById(id int) (*SMTPConfigDto, error)

func (*SMTPNotificationServiceImpl) SaveOrEditNotificationConfig added in v0.4.24

func (impl *SMTPNotificationServiceImpl) SaveOrEditNotificationConfig(channelReq []*SMTPConfigDto, userId int32) ([]int, error)

type SearchFilterResponse

type SearchFilterResponse struct {
	TeamResponse     []*TeamResponse   `json:"team"`
	AppResponse      []*AppResponse    `json:"app"`
	EnvResponse      []*EnvResponse    `json:"environment"`
	PipelineResponse *PipelineResponse `json:"pipeline"`
	PipelineType     string            `json:"pipelineType"`
}

type SlackChannelConfig

type SlackChannelConfig struct {
	Channel         util2.Channel    `json:"channel" validate:"required"`
	SlackConfigDtos []SlackConfigDto `json:"configs"`
}

type SlackConfigDto

type SlackConfigDto struct {
	OwnerId     int32  `json:"userId" validate:"number"`
	TeamId      int    `json:"teamId" validate:"required"`
	WebhookUrl  string `json:"webhookUrl" validate:"required"`
	ConfigName  string `json:"configName" validate:"required"`
	Description string `json:"description"`
	Id          int    `json:"id" validate:"number"`
}

type SlackNotificationService

type SlackNotificationService interface {
	SaveOrEditNotificationConfig(channelReq []SlackConfigDto, userId int32) ([]int, error)
	FetchSlackNotificationConfigById(id int) (*SlackConfigDto, error)
	FetchAllSlackNotificationConfig() ([]*SlackConfigDto, error)
	FetchAllSlackNotificationConfigAutocomplete() ([]*NotificationChannelAutoResponse, error)
	RecipientListingSuggestion(value string) ([]*NotificationRecipientListingResponse, error)
	DeleteNotificationConfig(deleteReq *SlackConfigDto, userId int32) error
}

type SlackNotificationServiceImpl

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

func NewSlackNotificationServiceImpl

func NewSlackNotificationServiceImpl(logger *zap.SugaredLogger, slackRepository repository.SlackNotificationRepository, webhookRepository repository.WebhookNotificationRepository, teamService team.TeamService,
	userRepository repository2.UserRepository, notificationSettingsRepository repository.NotificationSettingsRepository) *SlackNotificationServiceImpl

func (*SlackNotificationServiceImpl) DeleteNotificationConfig added in v0.3.15

func (impl *SlackNotificationServiceImpl) DeleteNotificationConfig(deleteReq *SlackConfigDto, userId int32) error

func (*SlackNotificationServiceImpl) FetchAllSlackNotificationConfig

func (impl *SlackNotificationServiceImpl) FetchAllSlackNotificationConfig() ([]*SlackConfigDto, error)

func (*SlackNotificationServiceImpl) FetchAllSlackNotificationConfigAutocomplete

func (impl *SlackNotificationServiceImpl) FetchAllSlackNotificationConfigAutocomplete() ([]*NotificationChannelAutoResponse, error)

func (*SlackNotificationServiceImpl) FetchSlackNotificationConfigById

func (impl *SlackNotificationServiceImpl) FetchSlackNotificationConfigById(id int) (*SlackConfigDto, error)

func (*SlackNotificationServiceImpl) RecipientListingSuggestion

func (impl *SlackNotificationServiceImpl) RecipientListingSuggestion(value string) ([]*NotificationRecipientListingResponse, error)

func (*SlackNotificationServiceImpl) SaveOrEditNotificationConfig

func (impl *SlackNotificationServiceImpl) SaveOrEditNotificationConfig(channelReq []SlackConfigDto, userId int32) ([]int, error)

type TeamResponse

type TeamResponse struct {
	Id   *int   `json:"id"`
	Name string `json:"name"`
}

type WebhookChannelConfig added in v0.6.18

type WebhookChannelConfig struct {
	Channel           util2.Channel       `json:"channel" validate:"required"`
	WebhookConfigDtos *[]WebhookConfigDto `json:"configs"`
}

type WebhookConfigDto added in v0.6.18

type WebhookConfigDto struct {
	OwnerId     int32                  `json:"userId" validate:"number"`
	WebhookUrl  string                 `json:"webhookUrl" validate:"required"`
	ConfigName  string                 `json:"configName" validate:"required"`
	Header      map[string]interface{} `json:"header"`
	Payload     string                 `json:"payload"`
	Description string                 `json:"description"`
	Id          int                    `json:"id" validate:"number"`
}

type WebhookNotificationService added in v0.6.18

type WebhookNotificationService interface {
	SaveOrEditNotificationConfig(channelReq []WebhookConfigDto, userId int32) ([]int, error)
	FetchWebhookNotificationConfigById(id int) (*WebhookConfigDto, error)
	GetWebhookVariables() (map[string]WebhookVariable, error)
	FetchAllWebhookNotificationConfig() ([]*WebhookConfigDto, error)
	FetchAllWebhookNotificationConfigAutocomplete() ([]*NotificationChannelAutoResponse, error)
	DeleteNotificationConfig(deleteReq *WebhookConfigDto, userId int32) error
}

type WebhookNotificationServiceImpl added in v0.6.18

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

func NewWebhookNotificationServiceImpl added in v0.6.18

func NewWebhookNotificationServiceImpl(logger *zap.SugaredLogger, webhookRepository repository.WebhookNotificationRepository, teamService team.TeamService,
	userRepository repository2.UserRepository, notificationSettingsRepository repository.NotificationSettingsRepository) *WebhookNotificationServiceImpl

func (*WebhookNotificationServiceImpl) DeleteNotificationConfig added in v0.6.18

func (impl *WebhookNotificationServiceImpl) DeleteNotificationConfig(deleteReq *WebhookConfigDto, userId int32) error

func (*WebhookNotificationServiceImpl) FetchAllWebhookNotificationConfig added in v0.6.18

func (impl *WebhookNotificationServiceImpl) FetchAllWebhookNotificationConfig() ([]*WebhookConfigDto, error)

func (*WebhookNotificationServiceImpl) FetchAllWebhookNotificationConfigAutocomplete added in v0.6.18

func (impl *WebhookNotificationServiceImpl) FetchAllWebhookNotificationConfigAutocomplete() ([]*NotificationChannelAutoResponse, error)

func (*WebhookNotificationServiceImpl) FetchWebhookNotificationConfigById added in v0.6.18

func (impl *WebhookNotificationServiceImpl) FetchWebhookNotificationConfigById(id int) (*WebhookConfigDto, error)

func (*WebhookNotificationServiceImpl) GetWebhookVariables added in v0.6.18

func (impl *WebhookNotificationServiceImpl) GetWebhookVariables() (map[string]WebhookVariable, error)

func (*WebhookNotificationServiceImpl) SaveOrEditNotificationConfig added in v0.6.18

func (impl *WebhookNotificationServiceImpl) SaveOrEditNotificationConfig(channelReq []WebhookConfigDto, userId int32) ([]int, error)

type WebhookVariable added in v0.6.18

type WebhookVariable string
const (
	// these fields will be configurable in future
	DevtronContainerImageTag  WebhookVariable = "{{devtronContainerImageTag}}"
	DevtronContainerImageRepo WebhookVariable = "{{devtronContainerImageRepo}}"
	DevtronAppName            WebhookVariable = "{{devtronAppName}}"
	DevtronAppId              WebhookVariable = "{{devtronAppId}}"
	DevtronEnvName            WebhookVariable = "{{devtronEnvName}}"
	DevtronEnvId              WebhookVariable = "{{devtronEnvId}}"
	DevtronCiPipelineId       WebhookVariable = "{{devtronCiPipelineId}}"
	DevtronCdPipelineId       WebhookVariable = "{{devtronCdPipelineId}}"
	DevtronTriggeredByEmail   WebhookVariable = "{{devtronTriggeredByEmail}}"
	EventType                 WebhookVariable = "{{eventType}}"
)

Jump to

Keyboard shortcuts

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