use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformSshKeysResponse in project cloudbreak by hortonworks.
the class CredentialPlatformResourceController method getCloudSshKeys.
@Override
@CustomPermissionCheck
public PlatformSshKeysResponse getCloudSshKeys(String credentialName, String credentialCrn, String region, String platformVariant, String availabilityZone) {
customCheckUtil.run(() -> permissionCheckByCredential(credentialName, credentialCrn));
String accountId = getAccountId();
PlatformResourceRequest request = platformParameterService.getPlatformResourceRequest(accountId, credentialName, credentialCrn, region, platformVariant, availabilityZone);
LOGGER.info("Get /platform_resources/ssh_keys, request: {}", request);
CloudSshKeys sshKeys = platformParameterService.getCloudSshKeys(request);
PlatformSshKeysResponse response = cloudSshKeysToPlatformSshKeysV1ResponseConverter.convert(sshKeys);
LOGGER.info("Resp /platform_resources/ssh_keys, request: {}, sshKeys: {}", request, sshKeys);
return response;
}
use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformSshKeysResponse in project cloudbreak by hortonworks.
the class EnvironmentPlatformResourceController method getCloudSshKeys.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_ENVIRONMENT)
public PlatformSshKeysResponse getCloudSshKeys(@ResourceCrn String environmentCrn, String region, String platformVariant, String availabilityZone) {
String accountId = getAccountId();
validateEnvironmentCrnPattern(environmentCrn);
PlatformResourceRequest request = platformParameterService.getPlatformResourceRequestByEnvironment(accountId, environmentCrn, region, platformVariant, availabilityZone, null);
LOGGER.info("Get /platform_resources/ssh_keys, request: {}", request);
CloudSshKeys sshKeys = platformParameterService.getCloudSshKeys(request);
PlatformSshKeysResponse response = cloudSshKeysToPlatformSshKeysV1ResponseConverter.convert(sshKeys);
LOGGER.info("Resp /platform_resources/ssh_keys, request: {}, sshKeys: {}, response: {}", request, sshKeys, response);
return response;
}
use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformSshKeysResponse in project cloudbreak by hortonworks.
the class CloudSshKeysToPlatformSshKeysV1ResponseConverter method convert.
public PlatformSshKeysResponse convert(CloudSshKeys source) {
Map<String, Set<PlatformSshKeyResponse>> result = new HashMap<>();
for (Entry<String, Set<CloudSshKey>> entry : source.getCloudSshKeysResponses().entrySet()) {
Set<PlatformSshKeyResponse> sshKeyResponses = new HashSet<>();
for (CloudSshKey cloudSshKey : entry.getValue()) {
PlatformSshKeyResponse actual = new PlatformSshKeyResponse(cloudSshKey.getName(), cloudSshKey.getProperties());
sshKeyResponses.add(actual);
}
result.put(entry.getKey(), sshKeyResponses);
}
return new PlatformSshKeysResponse(result);
}
Aggregations