Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHandlers ¶
Types ¶
type Organization ¶
type Organization struct {
mongo_entity.Organization
}
type OrganizationCreationRequest ¶
type OrganizationCreationRequest struct {
Identifier string `json:"identifier" bson:"identifier"`
DisplayName string `json:"display_name" bson:"display_name"`
API_KEY string `json:"api_key" bson:"api_key"`
Resources []mongo_entity.Resource `json:"resources,omitempty" bson:"resources"`
Users []mongo_entity.User `json:"users,omitempty" bson:"users"`
Roles []mongo_entity.Role `json:"roles,omitempty" bson:"roles"`
Groups []mongo_entity.Group `json:"groups,omitempty" bson:"groups"`
Polices []mongo_entity.Policy `json:"policies,omitempty" bson:"policies"`
}
func (OrganizationCreationRequest) Validate ¶
func (m OrganizationCreationRequest) Validate() error
type Repository ¶
type Repository interface {
Get(ctx context.Context, id string) (*mongo_entity.Organization, error)
GetIdByIdentifier(ctx context.Context, identifier string) (string, error)
Query(ctx context.Context) ([]mongo_entity.Organization, error)
Create(ctx context.Context, organization mongo_entity.Organization) (string, error)
Delete(ctx context.Context, id string) error
RefreshAPIKey(ctx context.Context, apiKey string, id string) error
CheckOrgExistById(ctx context.Context, id string) (bool, error)
CheckOrgExistByIdentifier(ctx context.Context, identifier string) (bool, error)
}
func NewRepository ¶
func NewRepository(mongodb *db.MongoDB) Repository
type Service ¶
type Service interface {
Get(ctx context.Context, id string) (Organization, error)
GetIdByIdentifier(ctx context.Context, identifier string) (string, error)
Query(ctx context.Context) ([]Organization, error)
Create(ctx context.Context, req OrganizationCreationRequest) (Organization, error)
RegenerateAPIKey(ctx context.Context, id string) (Organization, error)
Delete(ctx context.Context, id string) (Organization, error)
CheckOrgExistByIdentifier(ctx context.Context, identifier string) (bool, error)
}
func NewService ¶
func NewService(repo Repository, logger *zap.Logger) Service
Click to show internal directories.
Click to hide internal directories.