Skip to main content

Group

The groups of the host. osapi dsl behavior get --name group and osapi dsl behavior method get show the same.

Behavior​

Namegroup
DescriptionThe groups of the host
Placementnode
Areasecurity
Internalno
APIyes
CLIyes
Nextno
Platformsdebian, linux, darwin
Sudonone
Runsnone
Writesnone
Keeps stateno
Usesnone
Used bynone

Methods (5)​

NAMEVERBHTTPROUTEPERMISSIONDESCRIPTION
listreadGET/api/node/{hostname}/groupgroup:readList the groups of the host
getreadGET/api/node/{hostname}/group/{name}group:readGet one group
createwritePOST/api/node/{hostname}/groupgroup:writeAdd a group
updatewritePUT/api/node/{hostname}/group/{name}group:writeSet the members of a group
deletewriteDELETE/api/node/{hostname}/group/{name}group:writeRemove a group

Types (5)​

NAMEINPUTOUTPUT
listListInput[]Account { name, gid, members }
getGetInput { name* }Account { name, gid, members }
createCreateInput { name*, gid, system }Result { name, changed }
updateUpdateInput { name*, members }Result { name, changed }
deleteDeleteInput { name* }Result { name, changed }

Settings (0)​

None. Declare them with behavior.Config.

Telemetry​

Spanbehavior.group.<method>
Child spansexec groupadd, exec gpasswd, exec groupdel, exec id, exec dscl
Metricsosapi_behavior_calls_total, osapi_behavior_duration_seconds, osapi_behavior_changes_total
Attributesosapi.behavior.name, osapi.behavior.method, osapi.behavior.verb, osapi.behavior.outcome, osapi.behavior.changed
Recorded inputsname (get, create, update, delete)

Method list​

Namelist
Verbread
DescriptionList the groups of the host
DetailLists each group with its ID and its members, by name, from /etc/group through gohai, on every platform. The members are the users that /etc/group names; a user whose primary group it is is not listed again.
HTTPGET
Route/api/node/{hostname}/group
Permissiongroup:read
Commandosapi client node group list
Input typeListInput
Output type[]Account

Input (0)​

None. The method takes no input; its command needs only --target.

Output (3)​

FIELDTYPEDESCRIPTION
namestringThe group
gidintegerIts numeric group ID
membersarrayThe users it has as members, besides those whose primary group it is

Examples (1)​

EXAMPLEINPUTOUTPUT
A host with a group(none)[gid=1500, members=[alice bob], name=developers] [gid=0, name=root]

Method get​

Nameget
Verbread
DescriptionGet one group
DetailReads one group from the same list. A group that the host does not have is not found.
HTTPGET
Route/api/node/{hostname}/group/{name}
Permissiongroup:read
Commandosapi client node group get
Input typeGetInput
Output typeAccount

Input (1)​

FIELDTYPEREQUIREDCONSTRAINTSDESCRIPTION
namestringyespattern ^[a-z_][a-z0-9_-]*$?$, max length 32The group, such as developers

Output (3)​

FIELDTYPEDESCRIPTION
namestringThe group
gidintegerIts numeric group ID
membersarrayThe users it has as members, besides those whose primary group it is

Examples (1)​

EXAMPLEINPUTOUTPUT
A groupname=developersname=developers, gid=1500, members=[alice bob]

Method create​

Namecreate
Verbwrite
DescriptionAdd a group
DetailAdds the group with groupadd, with the ID when one is given. A group that the host has already does not change and reports changed: false, whatever its ID. It runs on the Debian family only, and elsewhere reports skipped.
HTTPPOST
Route/api/node/{hostname}/group
Permissiongroup:write
Commandosapi client node group create
Input typeCreateInput
Output typeResult

Input (3)​

FIELDTYPEREQUIREDCONSTRAINTSDESCRIPTION
namestringyespattern ^[a-z_][a-z0-9_-]*$?$, max length 32The group to add, such as developers
gidintegernomin 0Its numeric group ID; the system assigns one when it is 0
systembooleannoAdd it as a system group, with an ID from the system range

Output (2)​

FIELDTYPEDESCRIPTION
namestringThe group
changedbooleanWhether the host changed

Examples (3)​

EXAMPLEINPUTOUTPUT
Add a groupname=osapitestname=osapitest, changed=true
Add a system group with its IDname=osapitest, gid=1999, system=truename=osapitest, changed=true
A group that the host hasname=osapitestname=osapitest, changed=false

Method update​

Nameupdate
Verbwrite
DescriptionSet the members of a group
DetailSets the members with gpasswd -M, in place of the members that the group has. The same members, in any order, do not change it and report changed: false. A group that the host does not have is not found. It runs on the Debian family only, and elsewhere reports skipped.
HTTPPUT
Route/api/node/{hostname}/group/{name}
Permissiongroup:write
Commandosapi client node group update
Input typeUpdateInput
Output typeResult

Input (2)​

FIELDTYPEREQUIREDCONSTRAINTSDESCRIPTION
namestringyespattern ^[a-z_][a-z0-9_-]*$?$, max length 32The group, such as developers
membersarraynoIts members, which replace the members it has; none when empty

Output (2)​

FIELDTYPEDESCRIPTION
namestringThe group
changedbooleanWhether the host changed

Examples (2)​

EXAMPLEINPUTOUTPUT
Set the membersname=osapitest, members=[root]name=osapitest, changed=true
The members it hasname=osapitest, members=[root]name=osapitest, changed=false

Method delete​

Namedelete
Verbwrite
DescriptionRemove a group
DetailRemoves the group with groupdel. A group that the host does not have does not change and reports changed: false. It runs on the Debian family only, and elsewhere reports skipped.
HTTPDELETE
Route/api/node/{hostname}/group/{name}
Permissiongroup:write
Commandosapi client node group delete
Input typeDeleteInput
Output typeResult

Input (1)​

FIELDTYPEREQUIREDCONSTRAINTSDESCRIPTION
namestringyespattern ^[a-z_][a-z0-9_-]*$?$, max length 32The group to remove, such as developers

Output (2)​

FIELDTYPEDESCRIPTION
namestringThe group
changedbooleanWhether the host changed

Examples (2)​

EXAMPLEINPUTOUTPUT
Remove a groupname=osapitestname=osapitest, changed=true
A group that the host does not havename=osapitestname=osapitest, changed=false