use of com.sequenceiq.environment.proxy.domain.ProxyConfig in project cloudbreak by hortonworks.
the class ProxyConfigService method deleteByNameInAccount.
public ProxyConfig deleteByNameInAccount(String name, String accountId) {
ProxyConfig proxyConfig = proxyConfigRepository.findByNameInAccount(name, accountId).orElseThrow(notFound("Proxy config with name:", name));
MDCBuilder.buildMdcContext(proxyConfig);
proxyConfigRepository.delete(proxyConfig);
return proxyConfig;
}
use of com.sequenceiq.environment.proxy.domain.ProxyConfig in project cloudbreak by hortonworks.
the class ProxyConfigService method deleteByCrnInAccount.
public ProxyConfig deleteByCrnInAccount(String crn, String accountId) {
ProxyConfig proxyConfig = proxyConfigRepository.findByResourceCrnInAccount(crn, accountId).orElseThrow(notFound("Proxy config with crn:", crn));
MDCBuilder.buildMdcContext(proxyConfig);
proxyConfigRepository.delete(proxyConfig);
return proxyConfig;
}
use of com.sequenceiq.environment.proxy.domain.ProxyConfig in project cloudbreak by hortonworks.
the class ProxyController method getByResourceCrn.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.POWERUSER_ONLY)
public ProxyResponse getByResourceCrn(@TenantAwareParam String crn) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
ProxyConfig config = proxyConfigService.getByCrnForAccountId(crn, accountId);
return proxyConfigToProxyResponseConverter.convert(config);
}
use of com.sequenceiq.environment.proxy.domain.ProxyConfig in project cloudbreak by hortonworks.
the class ProxyController method getByEnvironmentCrn.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.POWERUSER_ONLY)
public ProxyResponse getByEnvironmentCrn(@TenantAwareParam String environmentCrn) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
ProxyConfig proxyConfig = proxyConfigService.getByEnvironmentCrnAndAccountId(environmentCrn, accountId);
return proxyConfigToProxyResponseConverter.convert(proxyConfig);
}
use of com.sequenceiq.environment.proxy.domain.ProxyConfig in project cloudbreak by hortonworks.
the class ProxyConfigServiceTest method testDeleteMultipleInAccountHasAllResult.
@Test
public void testDeleteMultipleInAccountHasAllResult() {
String name1 = ProxyTestSource.NAME;
String name2 = "another";
Set<String> names = Set.of(name1, name2);
ProxyConfig proxyConfig1 = ProxyTestSource.getProxyConfig();
ProxyConfig proxyConfig2 = ProxyTestSource.getProxyConfig();
proxyConfig2.setName(name2);
proxyConfig2.setId(2L);
Set<ProxyConfig> proxyConfigs = Set.of(proxyConfig2, proxyConfig1);
when(proxyConfigRepository.findByNameOrResourceCrnInAccount(names, ACCOUNT_ID)).thenReturn(proxyConfigs);
Assertions.assertEquals(proxyConfigs, underTestProxyConfigService.deleteMultipleInAccount(names, ACCOUNT_ID));
}
Aggregations