-
Notifications
You must be signed in to change notification settings - Fork 4
2.4 Managing groups
This section overviews group management features available in the SDK. Note that in all examples groupService
refers to the new ClcSdk().groupService()
variable.
To create a group, you need to specify GroupConfig
. The available properties are listed in the table below.
Name | Type | Description | Required |
---|---|---|---|
name | string | The name of the group to be created | Yes |
description | string | A user-defined description of this group | No |
parentGroup | Group | A parent group reference | Yes |
To modify a group, you need to specify GroupConfig
. The list of available properties can be found in the table in the "Creating Groups" section (above). See this example:
OperationFuture<Group> future =
groupService
.modify(groupRef, new GroupConfig()
.name(groupName)
.description(groupDescription)
.parentGroup(Group.refById()
.dataCenter(DataCenter.DE_FRANKFURT)
.id(parentGroupId)
)
)
.waitUntilComplete();
It is possible to modify multiple groups specified by references or by a group filter.
OperationFuture<List<Group>> future =
groupService
.modify(asList(groupRef1, groupRef2), new GroupConfig()
.name(groupName)
.description(groupDescription)
.parentGroup(Group.refById()
.dataCenter(DataCenter.DE_FRANKFURT)
.id(parentGroupId)
)
)
.waitUntilComplete();
OperationFuture<List<Group>> future =
groupService
.modify(new GroupFilter().name("MyGroup"), new GroupConfig()
.name(groupName)
.description(groupDescription)
)
.waitUntilComplete();
You may delete a group by reference or by some search criteria, like this:
groupService.delete(groupRef);
groupService.delete(groupRef1, groupRef2);
groupService.delete(new GroupFilter().name("MyGroup"));
It is possible to search groups, using search criteria provided by GroupFilter
.
- Data center references (
dataCenters(dataCenter1, dataCenter2)
) - Group IDs (
id("groupId1", "groupId2")
) - A group name, ignoring the case (
nameContains("MyGroup")
) - A predicate (
dataCentersWhere(d -> d.getGroup().getName().equals("groupName")
)
Here is an example:
groupService.find(
new GroupFilter()
.dataCenters(dataCenter1, dataCenter2)
.dataCentersWhere(d -> d.getGroup().equals("groupId"))
.id("groupId1", "groupId2")
.nameContains("MyGroup")
);
Groups can also be searched by a full group name match.
groupService.find(
new GroupFilter()
.dataCenters(dataCenter1, dataCenter2)
.name("MyGroup")
);
- [Getting Started] (./1.-Getting-started)
- User Guide - Basic Functions
- Server management
- Server actions
- Managing groups
- Group actions
- Searching templates
- Searching data centers
- Invoice statistics
- SDK configuration
- User Guide - Advanced Functions
- Configuring remote servers over SSH
- Defining a group hierarchy
- Billing statistics
- Server monitoring statistics
- Policies management
- Shared load balancers management
- User Guide - Framework adapters