internal

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovalMsgObj

type ApprovalMsgObj struct {
	Ts      string `json:"ts"`
	Channel string `json:"channel"`
}

type AuditObject

type AuditObject struct {
	UserId           string              `json:"userId"`
	RequestId        string              `json:"requestId"`
	Description      string              `json:"description"`
	RequestTime      time.Time           `json:"requestTime"`
	ApprovingUser    string              `json:"approvingUser"`
	ApprovalMessages []ApprovalMsgObj    `json:"approvalMessages"`
	CloudUserId      string              `json:"cloudUserId"`
	LoginRole        string              `json:"loginRole"`
	AccountRole      string              `json:"accountRole"`
	AccountId        string              `json:"accountId"`
	Duration         string              `json:"duration"`
	Services         []string            `json:"services"`
	Actions          map[string][]string `json:"actions"`
	Resources        map[string][]string `json:"resources"`
}

type Cloud

type Cloud interface {
	ResourceFinder(service string, accountName string) ([]string, bool)
	ValidateResourcesFormat(resources []string) []string
}

type CloudIdentityManager

type CloudIdentityManager interface {
	IsPolicyExpired(policy string) (bool, error)
	GeneratePolicyFromAuditObj(curTime time.Time, object AuditObject, tmpls, tmplFieldNmaes map[string]string) ([]byte, error)

	GetCloudUserId(accountName string, roleName string) (string, error)
	PutPolicy(accountName, roleName, policyName, policy string) error
	FindPolicysForRole(accountName, roleName string) (map[string]string, error)
	DeletePolicys(accountName, roleName string, policysNames []string) error
}

type IdentityData

type IdentityData interface {
	GetResourceTmplDetails(service string) (string, string)
	GetActionsForService(serviceName string) map[string]string
	FindActionsById(ids []string) []string
	GetIamServices() []string
}

type Messenger

type Messenger interface {
	PostSimpleMessage(channelId string, msgText string, requestId string) error
	PostBlockMessage(channelId string, msgContents []slack.Block, requestId string) (string, string, error)
	GetUserIdsFromGroup(groups []string) ([]string, error)
	UpdateMessageFromMessageObj(requestId string, approvalMsgObj []ApprovalMsgObj, msgContents []slack.Block) error
	GenerateModal(modalType string, Accounts, LoginRoles []string, hasResourceFinder bool, privateMetadata string, selectedService string) (slack.ModalViewRequest, error)
}

type Repo

type Repo interface {
	QueryAuditObjs(UserID string) ([]AuditObject, error)
	GetAuditObj(UserID, RequestId string) (AuditObject, error)
	SetAuditObj(requestObj AuditObject) error
	UpdateApprovingUser(UserID, RequestId, approvingUser string) error
}

type Service

type Service struct {
	Cloud                Cloud
	Messenger            Messenger
	Repo                 Repo
	CloudIdentityManager CloudIdentityManager
	IdentityData         IdentityData
}

func NewService

func NewService(cloud Cloud, repo Repo, cim CloudIdentityManager, identitydata IdentityData, messenger Messenger) *Service

func (*Service) FindExpiredPermissions

func (s *Service) FindExpiredPermissions(accountName, role string, delete bool)

func (*Service) FindSelectedCloudResoucesNames

func (s *Service) FindSelectedCloudResoucesNames(service, accountname string, selected []string) []string

func (*Service) GeneratePolicyFromAuditObj

func (s *Service) GeneratePolicyFromAuditObj(object AuditObject) ([]byte, error)

func (*Service) GetActionsWithFilter

func (s *Service) GetActionsWithFilter(service string, filter string) map[string]string

GetActionsWithFilter Gets Actions for a selected service with a filter. Returns a map[string]string the key is the service name while the value is a unique id for each action. Will return an empty map[string]string if there is nothing found.

func (*Service) GetAuditObj

func (s *Service) GetAuditObj(UserId, RequestID string) (AuditObject, error)

GetAuditObj Gets the Audit & Message data in the repository based on the inputted UserId and RequestId

func (*Service) GetCloudResourcesForService

func (s *Service) GetCloudResourcesForService(filter, service, accountname string) (map[string]string, bool)

GetCloudResourcesForService Overwrite account used by client in the individuals clients to keep the functions ordered and as simple as possible in the service interface

func (*Service) GetCloudUserId

func (s *Service) GetCloudUserId(accountName string, roleName string) (string, error)

func (*Service) GetServicesWithFilter

func (s *Service) GetServicesWithFilter(filter string) []string

GetServicesWithFilter Gets Services with a filter and returns them as a list. Will return an empty []string if nothing is found.

func (*Service) SetAuditObj

func (s *Service) SetAuditObj(object AuditObject) error

SetAuditObj Sets the Audit & Message data in the repository

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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