use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformNoSqlTablesResponse in project cloudbreak by hortonworks.
the class CredentialPlatformResourceController method getNoSqlTables.
@Override
@CustomPermissionCheck
public PlatformNoSqlTablesResponse getNoSqlTables(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/nosql_tables, request: {}", request);
CloudNoSqlTables noSqlTables = platformParameterService.getNoSqlTables(request);
PlatformNoSqlTablesResponse response = cloudNoSqlTablesToPlatformNoSqlTablesV1ResponseConverter.convert(noSqlTables);
LOGGER.info("Resp /platform_resources/nosql_tables, request: {}, noSqlTables: {}, response: {}", request, noSqlTables, response);
return response;
}
use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformNoSqlTablesResponse in project cloudbreak by hortonworks.
the class EnvironmentPlatformResourceController method getNoSqlTables.
@Override
@CheckPermissionByResourceCrn(action = AuthorizationResourceAction.DESCRIBE_ENVIRONMENT)
public PlatformNoSqlTablesResponse getNoSqlTables(@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/nosql_tables, request: {}", request);
CloudNoSqlTables noSqlTables = platformParameterService.getNoSqlTables(request);
PlatformNoSqlTablesResponse response = cloudNoSqlTablesToPlatformNoSqlTablesV1ResponseConverter.convert(noSqlTables);
LOGGER.info("Resp /platform_resources/nosql_tables, request: {}, noSqlTables: {}, response: {}", request, noSqlTables, response);
return response;
}
use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformNoSqlTablesResponse in project cloudbreak by hortonworks.
the class CloudNoSqlTablesToPlatformNoSqlTablesV1ResponseConverterTest method convert.
@Test
void convert() {
List<CloudNoSqlTable> tables = List.of(new CloudNoSqlTable("a"), new CloudNoSqlTable("b"));
CloudNoSqlTables source = new CloudNoSqlTables(tables);
PlatformNoSqlTablesResponse result = underTest.convert(source);
List<PlatformNoSqlTableResponse> noSqlTables = result.getNoSqlTables();
assertNotNull(noSqlTables);
assertEquals(tables.size(), noSqlTables.size());
tables.forEach(t -> {
assertTrue(noSqlTables.stream().anyMatch(s -> t.getName().equals(s.getName())));
});
}
use of com.sequenceiq.environment.api.v1.platformresource.model.PlatformNoSqlTablesResponse in project cloudbreak by hortonworks.
the class CredentialPlatformResourceControllerTest method getNoSqlTables.
@Test
void getNoSqlTables() {
CloudNoSqlTables noSqlTables = new CloudNoSqlTables();
PlatformResourceRequest platformResourceRequest = new PlatformResourceRequest();
PlatformNoSqlTablesResponse response = new PlatformNoSqlTablesResponse();
when(platformParameterService.getPlatformResourceRequest(any(), any(), any(), any(), any(), any())).thenReturn(platformResourceRequest);
when(platformParameterService.getNoSqlTables(any(PlatformResourceRequest.class))).thenReturn(noSqlTables);
when(cloudNoSqlTablesToPlatformNoSqlTablesV1ResponseConverter.convert(noSqlTables)).thenReturn(response);
doNothing().when(commonPermissionCheckingUtils).checkPermissionForUserOnResource(any(), any(), any());
PlatformNoSqlTablesResponse result = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.getNoSqlTables(null, CREDENTIAL_CRN, "region", "aws", "az"));
verify(platformParameterService).getNoSqlTables(platformResourceRequest);
verify(cloudNoSqlTablesToPlatformNoSqlTablesV1ResponseConverter).convert(noSqlTables);
assertEquals(response, result);
}
Aggregations