use of com.sequenceiq.cloudbreak.cloud.model.dns.CloudPrivateDnsZones in project cloudbreak by hortonworks.
the class EnvironmentPlatformResourceController method getPrivateDnsZones.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_ENVIRONMENT)
public PlatformPrivateDnsZonesResponse getPrivateDnsZones(@ResourceCrn String environmentCrn, String platformVariant) {
String accountId = getAccountId();
validateEnvironmentCrnPattern(environmentCrn);
PlatformResourceRequest request = platformParameterService.getPlatformResourceRequestByEnvironment(accountId, environmentCrn, platformVariant, null);
LOGGER.debug("Get /platform_resources/private_dns_zones, request: {}", request);
CloudPrivateDnsZones privateDnsZones = platformParameterService.getPrivateDnsZones(request);
List<PlatformPrivateDnsZoneResponse> platformPrivateDnsZones = privateDnsZones.getPrivateDnsZones().stream().map(pdz -> new PlatformPrivateDnsZoneResponse(pdz.getPrivateDnsZoneId())).collect(Collectors.toList());
PlatformPrivateDnsZonesResponse response = new PlatformPrivateDnsZonesResponse(platformPrivateDnsZones);
LOGGER.debug("Resp /platform_resources/private_dns_zones, request: {}, privateDnsZones: {}, response: {}", request, privateDnsZones, response);
return response;
}
use of com.sequenceiq.cloudbreak.cloud.model.dns.CloudPrivateDnsZones in project cloudbreak by hortonworks.
the class CredentialPlatformResourceController method getPrivateDnsZones.
@Override
@CustomPermissionCheck
public PlatformPrivateDnsZonesResponse getPrivateDnsZones(String credentialName, String credentialCrn, String platformVariant) {
customCheckUtil.run(() -> permissionCheckByCredential(credentialName, credentialCrn));
String accountId = getAccountId();
PlatformResourceRequest request = platformParameterService.getPlatformResourceRequest(accountId, credentialName, credentialCrn, platformVariant, CdpResourceType.DEFAULT);
LOGGER.debug("Get /platform_resources/private_dns_zones, request: {}", request);
CloudPrivateDnsZones privateDnsZones = platformParameterService.getPrivateDnsZones(request);
List<PlatformPrivateDnsZoneResponse> platformPrivateDnsZones = privateDnsZones.getPrivateDnsZones().stream().map(pdz -> new PlatformPrivateDnsZoneResponse(pdz.getPrivateDnsZoneId())).collect(Collectors.toList());
PlatformPrivateDnsZonesResponse response = new PlatformPrivateDnsZonesResponse(platformPrivateDnsZones);
LOGGER.debug("Resp /platform_resources/private_dns_zones, request: {}, privateDnsZones: {}, response: {}", request, privateDnsZones, response);
return response;
}
use of com.sequenceiq.cloudbreak.cloud.model.dns.CloudPrivateDnsZones in project cloudbreak by hortonworks.
the class GetPlatformPrivateDnsZonesHandler method accept.
@Override
public void accept(Event<GetPlatformPrivateDnsZonesRequest> event) {
LOGGER.debug("Received event to retrieve private DNS zones: {}", event);
GetPlatformPrivateDnsZonesRequest request = event.getData();
try {
CloudPlatformVariant cloudPlatformVariant = new CloudPlatformVariant(Platform.platform(request.getExtendedCloudCredential().getCloudPlatform()), Variant.variant(request.getVariant()));
CloudPrivateDnsZones privateDnsZones = cloudPlatformConnectors.get(cloudPlatformVariant).platformResources().privateDnsZones(request.getExtendedCloudCredential(), request.getFilters());
GetPlatformPrivateDnsZonesResult result = new GetPlatformPrivateDnsZonesResult(request.getResourceId(), privateDnsZones);
request.getResult().onNext(result);
LOGGER.debug("Query platform private DNS zones finished.");
} catch (RuntimeException e) {
request.getResult().onNext(new GetPlatformPrivateDnsZonesResult(e.getMessage(), e, request.getResourceId()));
}
}
Aggregations