use of com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureResourceGroup in project cloudbreak by hortonworks.
the class StackToCloudStackConverter method buildCloudStackParameters.
private Map<String, String> buildCloudStackParameters(String environmentCrn) {
Map<String, String> params = new HashMap<>();
params.put(CLOUD_STACK_TYPE_PARAMETER, FREEIPA_STACK_TYPE);
Optional<AzureResourceGroup> resourceGroupOptional = getAzureResourceGroup(environmentCrn);
if (resourceGroupOptional.isPresent() && !ResourceGroupUsage.MULTIPLE.equals(resourceGroupOptional.get().getResourceGroupUsage())) {
AzureResourceGroup resourceGroup = resourceGroupOptional.get();
String resourceGroupName = resourceGroup.getName();
ResourceGroupUsage resourceGroupUsage = resourceGroup.getResourceGroupUsage();
params.put(RESOURCE_GROUP_NAME_PARAMETER, resourceGroupName);
params.put(RESOURCE_GROUP_USAGE_PARAMETER, resourceGroupUsage.name());
}
return params;
}
use of com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureResourceGroup in project cloudbreak by hortonworks.
the class StackToCloudStackConverter method buildCloudInstanceParameters.
public Map<String, Object> buildCloudInstanceParameters(DetailedEnvironmentResponse environment, InstanceMetaData instanceMetaData, CloudPlatform platform) {
Map<String, Object> params = new HashMap<>();
putIfPresent(params, CloudInstance.DISCOVERY_NAME, getIfNotNull(instanceMetaData, InstanceMetaData::getShortHostname));
putIfPresent(params, SUBNET_ID, getIfNotNull(instanceMetaData, InstanceMetaData::getSubnetId));
putIfPresent(params, CloudInstance.INSTANCE_NAME, getIfNotNull(instanceMetaData, InstanceMetaData::getInstanceName));
putIfPresent(params, CloudInstance.FQDN, getIfNotNull(instanceMetaData, InstanceMetaData::getDiscoveryFQDN));
Optional<AzureResourceGroup> resourceGroupOptional = getAzureResourceGroup(environment, platform);
if (resourceGroupOptional.isPresent() && !ResourceGroupUsage.MULTIPLE.equals(resourceGroupOptional.get().getResourceGroupUsage())) {
AzureResourceGroup resourceGroup = resourceGroupOptional.get();
String resourceGroupName = resourceGroup.getName();
ResourceGroupUsage resourceGroupUsage = resourceGroup.getResourceGroupUsage();
params.put(RESOURCE_GROUP_NAME_PARAMETER, resourceGroupName);
params.put(RESOURCE_GROUP_USAGE_PARAMETER, resourceGroupUsage.name());
}
return params;
}
use of com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureResourceGroup in project cloudbreak by hortonworks.
the class StackToCloudStackConverter method buildCloudStackParameters.
private Map<String, String> buildCloudStackParameters(Stack stack, DetailedEnvironmentResponse environment) {
Map<String, String> params = new HashMap<>(stack.getParameters());
Optional<AzureResourceGroup> resourceGroupOptional = getAzureResourceGroup(environment, CloudPlatform.valueOf(stack.getCloudPlatform()));
if (resourceGroupOptional.isPresent() && !ResourceGroupUsage.MULTIPLE.equals(resourceGroupOptional.get().getResourceGroupUsage())) {
AzureResourceGroup resourceGroup = resourceGroupOptional.get();
String resourceGroupName = resourceGroup.getName();
ResourceGroupUsage resourceGroupUsage = resourceGroup.getResourceGroupUsage();
params.put(RESOURCE_GROUP_NAME_PARAMETER, resourceGroupName);
params.put(RESOURCE_GROUP_USAGE_PARAMETER, resourceGroupUsage.name());
}
params.put(RESOURCE_CRN_PARAMETER, stack.getResourceCrn());
return params;
}
use of com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureResourceGroup in project cloudbreak by hortonworks.
the class StackDecorator method prepareParameters.
private void prepareParameters(Stack subject, DetailedEnvironmentResponse environment) {
Optional<AzureResourceGroup> resourceGroupOptional = getResourceGroupFromEnv(subject, environment);
if (resourceGroupOptional.isPresent() && !ResourceGroupUsage.MULTIPLE.equals(resourceGroupOptional.get().getResourceGroupUsage())) {
AzureResourceGroup azureResourceGroup = resourceGroupOptional.get();
subject.getParameters().put(PlatformParametersConsts.RESOURCE_GROUP_NAME_PARAMETER, azureResourceGroup.getName());
subject.getParameters().put(PlatformParametersConsts.RESOURCE_GROUP_USAGE_PARAMETER, azureResourceGroup.getResourceGroupUsage().toString());
}
}
use of com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureResourceGroup in project cloudbreak by hortonworks.
the class StackToCloudStackConverter method buildCloudInstanceParameters.
public Map<String, Object> buildCloudInstanceParameters(String environmentCrn, InstanceMetaData instanceMetaData) {
String hostName = instanceMetaData == null ? null : instanceMetaData.getDiscoveryFQDN();
String subnetId = instanceMetaData == null ? null : instanceMetaData.getSubnetId();
String instanceName = instanceMetaData == null ? null : instanceMetaData.getInstanceName();
Map<String, Object> params = new HashMap<>();
if (hostName != null) {
hostName = getFreeIpaHostname(instanceMetaData, hostName);
LOGGER.debug("Setting FreeIPA hostname to {}", hostName);
params.put(CloudInstance.DISCOVERY_NAME, hostName);
}
if (subnetId != null) {
params.put(SUBNET_ID, subnetId);
}
if (instanceName != null) {
params.put(CloudInstance.INSTANCE_NAME, instanceName);
}
Optional<AzureResourceGroup> resourceGroupOptional = getAzureResourceGroup(environmentCrn);
if (resourceGroupOptional.isPresent() && !ResourceGroupUsage.MULTIPLE.equals(resourceGroupOptional.get().getResourceGroupUsage())) {
AzureResourceGroup resourceGroup = resourceGroupOptional.get();
String resourceGroupName = resourceGroup.getName();
ResourceGroupUsage resourceGroupUsage = resourceGroup.getResourceGroupUsage();
params.put(RESOURCE_GROUP_NAME_PARAMETER, resourceGroupName);
params.put(RESOURCE_GROUP_USAGE_PARAMETER, resourceGroupUsage.name());
}
return params;
}
Aggregations