converge: Index | Files

package group

import ""


Package Files

group.go group_linux.go preparer.go


var ErrUnsupported = fmt.Errorf("group: not supported on this system")

ErrUnsupported is used when a system is not supported

type Group Uses

type Group struct {
    // the configured group ID
    GID string `export:"gid"`

    // the configured group name
    Name string `export:"name"`

    // the desired group name
    NewName string `export:"newname"`

    // the group state
    State State `export:"state"`
    // contains filtered or unexported fields

Group manages user groups

func NewGroup Uses

func NewGroup(system SystemUtils) *Group

NewGroup constructs and returns a new Group

func (*Group) Apply Uses

func (g *Group) Apply(context.Context) (resource.TaskStatus, error)

Apply changes for group

func (*Group) Check Uses

func (g *Group) Check(context.Context, resource.Renderer) (resource.TaskStatus, error)

Check if a user group exists

type ModGroupOptions Uses

type ModGroupOptions struct {
    GID     string
    NewName string

ModGroupOptions are the options specified in the configuration to be used when modifying a group

func SetModGroupOptions Uses

func SetModGroupOptions(g *Group) *ModGroupOptions

SetModGroupOptions returns a ModGroupOptions struct with the options specified in the configuration for modifying a group

type Preparer Uses

type Preparer struct {
    // Gid is the group gid.
    GID *uint32 `hcl:"gid"`

    // Name is the group name.
    Name string `hcl:"name" required:"true" nonempty:"true"`

    // NewName is used when modifying a group.
    // The group Name will be changed to NewName.
    NewName string `hcl:"new_name" nonempty:"true"`

    // State is whether the group should be present.
    // The default value is present.
    State State `hcl:"state" valid_values:"present,absent"`

Preparer for Group

Group renders group data

func (*Preparer) Prepare Uses

func (p *Preparer) Prepare(ctx context.Context, render resource.Renderer) (resource.Task, error)

Prepare a new task

type State Uses

type State string

State type for Group

const (
    // StatePresent indicates the group should be present
    StatePresent State = "present"

    // StateAbsent indicates the group should be absent
    StateAbsent State = "absent"

type System Uses

type System struct{}

System implements SystemUtils

func (*System) AddGroup Uses

func (s *System) AddGroup(groupName, groupID string) error

AddGroup adds a group

func (*System) DelGroup Uses

func (s *System) DelGroup(groupName string) error

DelGroup deletes a group

func (*System) LookupGroup Uses

func (s *System) LookupGroup(groupName string) (*user.Group, error)

LookupGroup looks up a group by name If the group cannot be found an error is returned

func (*System) LookupGroupID Uses

func (s *System) LookupGroupID(groupID string) (*user.Group, error)

LookupGroupID looks up a group by gid If the group cannot be found an error is returned

func (*System) ModGroup Uses

func (s *System) ModGroup(groupName string, options *ModGroupOptions) error

ModGroup modifies a group

type SystemUtils Uses

type SystemUtils interface {
    AddGroup(groupName, groupID string) error
    DelGroup(groupName string) error
    ModGroup(groupName string, options *ModGroupOptions) error
    LookupGroup(groupName string) (*user.Group, error)
    LookupGroupID(groupID string) (*user.Group, error)

SystemUtils provides system utilities for group

Package group imports 8 packages (graph) and is imported by 1 packages. Updated 2017-01-13. Refresh now. Tools for package owners.