Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) CreateDBRole(ctx context.Context, dbName string, newRole NewRole) (Role, error)
- func (c *Client) CreateDBUser(ctx context.Context, dbName string, newUser NewUser) (User, error)
- func (c *Client) DeleteDBRole(ctx context.Context, dbName, roleName string) error
- func (c *Client) DeleteDBUser(ctx context.Context, dbName, userName string) error
- func (c *Client) GetDBRole(ctx context.Context, dbName, roleName string) (Role, error)
- func (c *Client) GetDBUser(ctx context.Context, dbName, userName string) (User, error)
- func (c *Client) ListAllUsers(ctx context.Context, filter any) ([]User, error)
- func (c *Client) ListDBRoles(ctx context.Context, dbName string) ([]Role, error)
- func (c *Client) ListDBUsers(ctx context.Context, dbName string, filter any) ([]User, error)
- func (c *Client) UpdateDBRole(ctx context.Context, dbName string, update UpdateRole) (Role, error)
- func (c *Client) UpdateDBUser(ctx context.Context, dbName string, update UpdateUser) (User, error)
- type CommandResponse
- type Credentials
- type Mechanism
- type NewRole
- type NewUser
- type Privilege
- type Resource
- type ResourceAny
- type ResourceCluster
- type ResourceCollection
- type ResourceSystemBuckets
- type ResourceWrapper
- type Role
- type RoleDBRef
- type RoleRef
- type RoleSameDBRef
- type UpdateRole
- type UpdateUser
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("not found") ErrNotOK = errors.New("not ok") AppName = "terraform-provider-mongodb-driver" )
View Source
var Mechanisms = []Mechanism{ MechanismSCRAMSHA1, MechanismSCRAMSHA256, MechanismMONGODBX509, MechanismPLAIN, MechanismGSSAPI, }
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
func New(uri string, cred Credentials) *Client
func (*Client) CreateDBRole ¶ added in v0.2.0
func (*Client) CreateDBUser ¶
func (*Client) DeleteDBRole ¶ added in v0.2.0
func (*Client) DeleteDBUser ¶
func (*Client) ListAllUsers ¶
func (*Client) ListDBRoles ¶ added in v0.2.0
func (*Client) ListDBUsers ¶
func (*Client) UpdateDBRole ¶ added in v0.2.0
func (*Client) UpdateDBUser ¶
type CommandResponse ¶
type Credentials ¶
type Mechanism ¶
type Mechanism string
Mechanism is the mechanism for user authentication.
const ( // MechanismSCRAMSHA1 is the SCRAM mechanism for creating SCRAM user credentials. // // RFC 5802 standard Salted Challenge Response Authentication Mechanism using the SHA-1 hash function. // // - Uses the SHA-1 hashing function. // // [https://www.mongodb.com/docs/manual/core/security-scram/#std-label-authentication-scram-sha-1] MechanismSCRAMSHA1 Mechanism = "SCRAM-SHA-1" // MechanismSCRAMSHA256 is the SCRAM mechanism for creating SCRAM user credentials. // // RFC 7677 standard Salted Challenge Response Authentication Mechanism using the SHA-256 hash function. // // - Uses the SHA-256 hashing function. // - Requires featureCompatibilityVersion set to 4.0. // - Requires digestPassword to be true. // // [https://www.mongodb.com/docs/manual/core/security-scram/#std-label-authentication-scram-sha-256] MechanismSCRAMSHA256 Mechanism = "SCRAM-SHA-256" // MechanismMONGODBX509 is the mechanism for MongoDB TLS/SSL certificate authentication. // // [https://www.mongodb.com/docs/manual/core/security-x.509/#std-label-security-auth-x509] MechanismMONGODBX509 Mechanism = "MONGODB-X509" // MechanismPLAIN is the mechanism for external authentication using LDAP. // You can also use PLAIN for authenticating in-database users. // PLAIN transmits passwords in plain text. // This mechanism is available only in MongoDB Enterprise. // // [https://www.mongodb.com/docs/manual/core/authentication/#std-label-security-auth-ldap] MechanismPLAIN Mechanism = "PLAIN" // MechanismGSSAPI is the mechanism for external authentication using Kerberos. // This mechanism is available only in MongoDB Enterprise. // // [https://www.mongodb.com/docs/manual/core/authentication/#std-label-security-auth-kerberos] MechanismGSSAPI Mechanism = "GSSAPI" )
type Privilege ¶ added in v0.2.0
type Privilege struct { Resource ResourceWrapper `bson:"resource"` Actions []string `bson:"actions"` }
type Resource ¶ added in v0.2.0
type Resource interface {
// contains filtered or unexported methods
}
type ResourceAny ¶ added in v0.2.0
type ResourceAny struct {
AnyResource bool `bson:"anyResource"`
}
type ResourceCluster ¶ added in v0.2.0
type ResourceCluster struct {
Cluster bool `bson:"cluster"`
}
type ResourceCollection ¶ added in v0.2.0
type ResourceSystemBuckets ¶ added in v0.2.0
type ResourceSystemBuckets struct {
SystemBuckets string `bson:"system_buckets"`
}
type ResourceWrapper ¶ added in v0.2.0
type ResourceWrapper struct {
Union Resource
}
func (*ResourceWrapper) MarshalBSONValue ¶ added in v0.2.0
func (r *ResourceWrapper) MarshalBSONValue() (bsontype.Type, []byte, error)
MarshalBSONValue implements bson.ValueMarshaler.
func (*ResourceWrapper) UnmarshalBSONValue ¶ added in v0.2.0
func (r *ResourceWrapper) UnmarshalBSONValue(t bsontype.Type, data []byte) error
UnmarshalBSONValue implements bson.ValueUnmarshaler.
type Role ¶ added in v0.2.0
type Role struct { ID string `bson:"_id"` Role string `bson:"role"` DB string `bson:"db"` Privileges []Privilege `bson:"privileges"` IsBuiltin bool `bson:"isBuiltin"` Roles []RoleDBRef `bson:"roles"` InheritedRoles []RoleDBRef `bson:"inheritedRoles"` InheritedPrivileges []Privilege `bson:"inheritedPrivileges"` }
type RoleSameDBRef ¶
type RoleSameDBRef string
RoleSameDBRef is a RoleRef that points to a role in the same database.
type UpdateRole ¶ added in v0.2.0
type UpdateUser ¶
Click to show internal directories.
Click to hide internal directories.