Documentation
¶
Index ¶
- type Mongo
- func (m *Mongo) AddPolicy(ctx context.Context, policy *models.Policy) (*models.Policy, error)
- func (m *Mongo) Checker(ctx context.Context, state *healthcheck.CheckState) error
- func (m *Mongo) Close(ctx context.Context) error
- func (m *Mongo) DeletePolicy(ctx context.Context, id string) error
- func (m *Mongo) GetAllBundlePolicies(ctx context.Context) ([]*models.BundlePolicy, error)
- func (m *Mongo) GetAllRoles(ctx context.Context) ([]*models.Role, error)
- func (m *Mongo) GetPolicy(ctx context.Context, id string) (*models.Policy, error)
- func (m *Mongo) GetRole(ctx context.Context, id string) (*models.Role, error)
- func (m *Mongo) GetRoles(ctx context.Context, offset, limit int) (*models.Roles, error)
- func (m *Mongo) Init(mongoConf config.MongoDB) error
- func (m *Mongo) UpdatePolicy(ctx context.Context, policy *models.Policy) (*models.UpdateResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mongo ¶
type Mongo struct {
Database string
RolesCollection string
PoliciesCollection string
Connection *dpMongodb.MongoConnection
// contains filtered or unexported fields
}
Mongo represents a simplistic MongoDB configuration, with session and health client
func (*Mongo) Checker ¶
func (m *Mongo) Checker(ctx context.Context, state *healthcheck.CheckState) error
Checker is called by the healthcheck library to check the health state of this mongoDB instance
func (*Mongo) DeletePolicy ¶ added in v0.8.0
func (*Mongo) GetAllBundlePolicies ¶ added in v0.5.0
GetAllBundlePolicies returns all policy documents for a permissions bundle, without pagination
func (*Mongo) GetAllRoles ¶ added in v0.5.0
GetAllRoles returns all role documents, without pagination
func (*Mongo) GetRoles ¶ added in v0.4.0
GetRoles retrieves all role documents from Mongo, according to the provided limit and offset. Offset and limit need to be positive or zero. Zero limit is equivalent to no limit and all items starting at the offset will be returned.
func (*Mongo) Init ¶
Init creates a new mongoConnection with a strong consistency and a write mode of "majority"