connect.groups
connect.groups
Group resources.
Classes
Name | Description |
---|---|
Group | |
GroupMembers | |
Groups | Groups resource. |
Group
connect.groups.Group(self, ctx, **kwargs)
Attributes
Name | Description |
---|---|
members | Get the group members. |
Methods
Name | Description |
---|---|
delete | Delete the group. |
delete
connect.groups.Group.delete()
Delete the group.
Examples
from posit.connect import Client
= Client("https://posit.example.com", "API_KEY")
client
= client.groups.get("GROUP_GUID_HERE")
group
# Delete the group
group.delete()
GroupMembers
connect.groups.GroupMembers(self, ctx, group_guid)
Methods
Name | Description |
---|---|
add | Add a user to the group. |
count | Count the number of group members. |
delete | Remove a user from the group. |
find | Find group members. |
add
connect.groups.GroupMembers.add(user=None, /, *, user_guid=None)
Add a user to the group.
Parameters
Name | Type | Description | Default |
---|---|---|---|
user | User | User object to add to the group. Only one of user= or user_guid= can be provided. |
None |
user_guid | str | The user GUID. | None |
Examples
from posit.connect import Client
= Client("https://posit.example.com", "API_KEY")
client
= client.groups.get("GROUP_GUID_HERE")
group = client.users.get("USER_GUID_HERE")
user
# Add a user to the group
group.members.add(user)
# Add multiple users to the group
= client.users.find()
users for user in users:
group.members.add(user)
# Add a user to the group by GUID
="USER_GUID_HERE") group.members.add(user_guid
See Also
- https://docs.posit.co/connect/api/#post-/v1/groups/-group_guid-/members
count
connect.groups.GroupMembers.count()
Count the number of group members.
Returns
Name | Type | Description |
---|---|---|
int |
Examples
from posit.connect import Client
= Client("https://posit.example.com", "API_KEY")
client
= client.groups.get("GROUP_GUID_HERE")
group
# Get count of group members
= group.members.count() group_user_count
See Also
- https://docs.posit.co/connect/api/#get-/v1/groups/-group_guid-/members
delete
connect.groups.GroupMembers.delete(user=None, /, *, user_guid=None)
Remove a user from the group.
Parameters
Name | Type | Description | Default |
---|---|---|---|
user | User | User object to add to the group. Only one of user= or user_guid= can be provided. |
None |
user_guid | str | The user GUID. | None |
Examples
from posit.connect import Client
= Client("https://posit.example.com", "API_KEY")
client
= client.groups.get("GROUP_GUID_HERE")
group
# Remove a user from the group
= group.members.find()[0]
first_user
group.members.delete(first_user)
# Remove multiple users from the group
= group.members.find()[:2]
group_users for group_user in group_users:
group.members.delete(group_user)
# Remove a user from the group by GUID
="USER_GUID_HERE") group.members.delete(user_guid
See Also
- https://docs.posit.co/connect/api/#delete-/v1/groups/-group_guid-/members/-user_guid-
find
connect.groups.GroupMembers.find()
Find group members.
Returns
Name | Type | Description |
---|---|---|
list[User] | All the users in the group. |
Examples
from posit.connect import Client
= Client("https://posit.example.com", "API_KEY")
client
= client.groups.get("GROUP_GUID_HERE")
group
# Find all users in the group
= group.members.find() group_users
See Also
- https://docs.posit.co/connect/api/#get-/v1/groups/-group_guid-/members
Groups
connect.groups.Groups(self, ctx)
Groups resource.
Methods
Name | Description |
---|---|
count | Count the number of groups. |
create | Create a group. |
find | Find groups. |
find_one | Find one group. |
get | Get group. |
count
connect.groups.Groups.count()
Count the number of groups.
Returns
Name | Type | Description |
---|---|---|
int |
See Also
- https://docs.posit.co/connect/api/#get-/v1/groups
create
connect.groups.Groups.create(**kwargs)
Create a group.
Parameters
Name | Type | Description | Default |
---|---|---|---|
name | required | ||
unique_id | required |
Returns
Name | Type | Description |
---|---|---|
Group |
find
connect.groups.Groups.find(**kwargs)
Find groups.
Parameters
Name | Type | Description | Default |
---|---|---|---|
prefix | Filter by group name prefix. Casing is ignored. | required |
Returns
Name | Type | Description |
---|---|---|
List[Group] |
See Also
- https://docs.posit.co/connect/api/#get-/v1/groups
find_one
connect.groups.Groups.find_one(**kwargs)
Find one group.
Parameters
Name | Type | Description | Default |
---|---|---|---|
prefix | Filter by group name prefix. Casing is ignored. | required |
Returns
Name | Type | Description |
---|---|---|
Group | None |
See Also
- https://docs.posit.co/connect/api/#get-/v1/groups
get
connect.groups.Groups.get(guid)
Get group.
Parameters
Name | Type | Description | Default |
---|---|---|---|
guid | str | required |
Returns
Name | Type | Description |
---|---|---|
Group |
See Also
- https://docs.posit.co/connect/api/#get-/v1/groups