use of org.ovirt.engine.sdk4.types.User in project ovirt-engine-sdk-java by oVirt.
the class AddAffinityLabel method main.
public static void main(String[] args) throws Exception {
// Create the connection to the server:
Connection connection = connection().url("https://engine40.example.com/ovirt-engine/api").user("admin@internal").password("redhat123").trustStoreFile("truststore.jks").build();
// Get the reference to the affinity labels service:
AffinityLabelsService affinityLabelsService = connection.systemService().affinityLabelsService();
// Use the "add" method to create a affinity label:
affinityLabelsService.add().label(affinityLabel().name("myaffinitylabel")).send();
// Close the connection to the server:
connection.close();
}
use of org.ovirt.engine.sdk4.types.User in project ovirt-engine-sdk-java by oVirt.
the class AddBond method main.
public static void main(String[] args) throws Exception {
// Create the connection to the server:
Connection connection = connection().url("https://engine42.example.com/ovirt-engine/api").user("admin@internal").password("redhat123").insecure(true).build();
// Find the service that manages the collection of hosts:
HostsService hostsService = connection.systemService().hostsService();
// Find the host:
Host host = hostsService.list().search("name=myhost").send().hosts().get(0);
// Find the service that manages the host:
HostService hostService = hostsService.hostService(host.id());
// Configure the host adding a bond with two slaves, and attaching it to a network with an static IP address:
hostService.setupNetworks().modifiedBonds(hostNic().name("bond0").bonding(bonding().options(option().name("mode").value("1"), option().name("miimon").value("100")).slaves(hostNic().name("eth0"), hostNic().name("eth1")))).modifiedNetworkAttachments(networkAttachment().network(network().name("mynetwork")).ipAddressAssignments(ipAddressAssignment().assignmentMethod(BootProtocol.STATIC).ip(ip().address("192.168.122.100").netmask("255.255.255.0")))).send();
// After modifying the network configuration it is very important to make it persistent:
hostService.commitNetConfig().send();
// Close the connection to the server:
connection.close();
}
use of org.ovirt.engine.sdk4.types.User in project ovirt-engine-sdk-java by oVirt.
the class AddCluster method main.
public static void main(String[] args) throws Exception {
// Create the connection to the server:
Connection connection = connection().url("https://engine40.example.com/ovirt-engine/api").user("admin@internal").password("redhat123").trustStoreFile("truststore.jks").build();
// Get the reference to the clusters service:
ClustersService clustersService = connection.systemService().clustersService();
// Use the "add" method to create a new data center:
clustersService.add().cluster(cluster().name("mycluster").description("My cluster").cpu(cpu().architecture(Architecture.X86_64).type("Intel Conroe Family")).dataCenter(dataCenter().name("mydc"))).send();
// Close the connection to the server:
connection.close();
}
use of org.ovirt.engine.sdk4.types.User in project ovirt-engine-sdk-java by oVirt.
the class AddDataCenter method main.
public static void main(String[] args) throws Exception {
// Create the connection to the server:
Connection connection = connection().url("https://engine40.example.com/ovirt-engine/api").user("admin@internal").password("redhat123").trustStoreFile("truststore.jks").build();
// Get the reference to the data centers service:
DataCentersService dcsService = connection.systemService().dataCentersService();
// Use the "add" method to create a new data center:
dcsService.add().dataCenter(dataCenter().name("mydc").description("My data center").local(false)).send();
// Close the connection to the server:
connection.close();
}
use of org.ovirt.engine.sdk4.types.User in project ovirt-engine-sdk-java by oVirt.
the class AddGroup method main.
public static void main(String[] args) throws Exception {
// Create the connection to the server:
Connection connection = connection().url("https://engine40.example.com/ovirt-engine/api").user("admin@internal").password("redhat123").trustStoreFile("truststore.jks").build();
// Get the reference to the groups service:
GroupsService groupsService = connection.systemService().groupsService();
// Use the "add" method to add group from a directory service. Please note that domain name is name of the
// authorization provider:
groupsService.add().group(group().name("Developers").domain(domain().name("internal-authz"))).send();
// Close the connection to the server:
connection.close();
}
Aggregations