use of org.ovirt.engine.api.model.OpenStackNetworkProvider in project ovirt-engine by oVirt.
the class BackendOpenStackNetworkResource method addParents.
@Override
protected OpenStackNetwork addParents(OpenStackNetwork network) {
OpenStackNetworkProvider provider = new OpenStackNetworkProvider();
provider.setId(providerId);
network.setOpenstackNetworkProvider(provider);
return super.addParents(network);
}
use of org.ovirt.engine.api.model.OpenStackNetworkProvider in project ovirt-engine by oVirt.
the class BackendOpenStackNetworksResource method addParents.
@Override
protected OpenStackNetwork addParents(OpenStackNetwork image) {
OpenStackNetworkProvider provider = new OpenStackNetworkProvider();
provider.setId(providerId);
image.setOpenstackNetworkProvider(provider);
return super.addParents(image);
}
use of org.ovirt.engine.api.model.OpenStackNetworkProvider in project ovirt-engine by oVirt.
the class BackendOpenStackSubnetResource method addParents.
@Override
protected OpenStackSubnet addParents(OpenStackSubnet subnet) {
OpenStackNetworkProvider provider = new OpenStackNetworkProvider();
provider.setId(providerId);
OpenStackNetwork network = new OpenStackNetwork();
network.setId(networkId);
network.setOpenstackNetworkProvider(provider);
subnet.setOpenstackNetwork(network);
return super.addParents(subnet);
}
use of org.ovirt.engine.api.model.OpenStackNetworkProvider in project ovirt-engine by oVirt.
the class BackendOpenStackSubnetsResource method addParents.
@Override
protected OpenStackSubnet addParents(OpenStackSubnet subnet) {
OpenStackNetworkProvider provider = new OpenStackNetworkProvider();
provider.setId(providerId);
OpenStackNetwork network = new OpenStackNetwork();
network.setId(networkId);
network.setOpenstackNetworkProvider(provider);
subnet.setOpenstackNetwork(network);
return super.addParents(subnet);
}
use of org.ovirt.engine.api.model.OpenStackNetworkProvider in project ovirt-engine by oVirt.
the class OpenStackNetworkProviderMapper method map.
@Mapping(from = Provider.class, to = OpenStackNetworkProvider.class)
public static OpenStackNetworkProvider map(Provider<OpenstackNetworkProviderProperties> entity, OpenStackNetworkProvider template) {
OpenStackNetworkProvider model = template != null ? template : new OpenStackNetworkProvider();
model.setType(mapProviderType(entity.getType()));
if (entity.getId() != null) {
model.setId(entity.getId().toString());
}
if (entity.getName() != null) {
model.setName(entity.getName());
}
if (entity.getDescription() != null) {
model.setDescription(entity.getDescription());
}
if (entity.getUrl() != null) {
model.setUrl(entity.getUrl());
}
if (entity.getAuthUrl() != null) {
model.setAuthenticationUrl(entity.getAuthUrl());
}
model.setUnmanaged(entity.getIsUnmanaged());
model.setRequiresAuthentication(entity.isRequiringAuthentication());
if (entity.getUsername() != null) {
model.setUsername(entity.getUsername());
}
// The password isn't mapped for security reasons.
// if (entity.getPassword() != null) {
// model.setPassword(entity.getPassword());
// }
Map<String, String> customProperties = entity.getCustomProperties();
if (customProperties != null) {
Properties properties = new Properties();
for (Map.Entry<String, String> entry : customProperties.entrySet()) {
Property property = new Property();
property.setName(entry.getKey());
property.setValue(entry.getValue());
properties.getProperties().add(property);
}
model.setProperties(properties);
}
OpenstackNetworkProviderProperties additionalProperties = entity.getAdditionalProperties();
if (additionalProperties != null) {
if (additionalProperties.getTenantName() != null) {
model.setTenantName(additionalProperties.getTenantName());
}
String pluginType = additionalProperties.getPluginType();
if (pluginType != null) {
// for backwards compatibility, and should be removed in version 5 of the API.
if (entity.getType() == ProviderType.OPENSTACK_NETWORK && OpenstackNetworkPluginType.OPEN_VSWITCH.name().equalsIgnoreCase(pluginType)) {
model.setPluginType(NetworkPluginType.OPEN_VSWITCH);
}
model.setExternalPluginType(additionalProperties.getPluginType());
}
if (additionalProperties.getAgentConfiguration() != null) {
model.setAgentConfiguration(map(additionalProperties.getAgentConfiguration(), null));
}
model.setReadOnly(additionalProperties.getReadOnly());
model.setAutoSync(additionalProperties.getAutoSync());
}
return model;
}
Aggregations