-
Notifications
You must be signed in to change notification settings - Fork 4
2.8 Searching data centers
This section overviews data center search features available in the SDK. Note that in all examples, dataCenterService
refers to the new ClcSdk().dataCenterService()
variable.
It is possible to find data centers using DataCenterFilter
, where you can specify any search criteria, like this:
List<DataCenterMetadata> results =
dataCenterService
.find(new DataCenterFilter()
.dataCenters(dataCenterRef)
.id("va1", "ca1")
.nameContains("FrankFurt")
.where(d -> d.getGroup().getName().equals("groupName"))
);
Here is the list of available search criteria:
- Data center references (
dataCenters(dataCenterRef)
) - Data center IDs (
id("va1", "ca1")
- Data center name, ignoring cases (
nameContains("FrankFurt")
) - A predicate (
where(d -> d.getGroup().getName().equals("groupName")
)
AND/OR conditions can also be applied to DataCenterFilter
:
dataCenterFilter1.and(dataCenterFilter2)
dataCenterFilter1.or(dataCenterFilter2)
You can search for a specific data center by its DataCenter
reference. The list of predefined data center references can be found at: com.centurylink.cloud.sdk.common.management.services.domain.datacenters.refs.DataCenter
.
Here is a sample search query:
DataCenterMetadata dataCenter = dataCenterService.findByRef(DataCenter.DE_FRANKFURT);
There are two types of DataCenter
references—ID (DataCenterByIdRef
) and name (DataCenterByNameRef
).
DataCenterMetadata dataCenterById = dataCenterService.findByRef(new DataCenterByIdRef("de1"));
DataCenterMetadata dataCenterByName = dataCenterService.findByRef(new DataCenterByNameRef("FrankFurt"));
To find all available data centers, use:
List<DataCenterMetadata> dataCenters = dataCenterService.findAll();
- [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