use of com.sequenceiq.cloudbreak.api.model.SecurityGroupResponse in project cloudbreak by hortonworks.
the class SecurityGroupToSecurityGroupResponseConverterTest method testConvert.
@Test
public void testConvert() {
// GIVEN
given(conversionService.convert(any(Object.class), any(TypeDescriptor.class), any(TypeDescriptor.class))).willReturn(new ArrayList<SecurityRuleRequest>());
// WHEN
SecurityGroupResponse result = underTest.convert(getSource());
// THEN
assertAllFieldsNotNull(result, Arrays.asList("owner", "account"));
}
use of com.sequenceiq.cloudbreak.api.model.SecurityGroupResponse in project cloudbreak by hortonworks.
the class CleanupService method deleteSecurityGroup.
public void deleteSecurityGroup(CloudbreakClient cloudbreakClient, String securityGroupId) {
if (securityGroupId != null) {
SecurityGroupEndpoint securityGroupEndpoint = cloudbreakClient.securityGroupEndpoint();
SecurityGroupResponse securityGroupResponse = securityGroupEndpoint.get(Long.valueOf(securityGroupId));
if (!itProps.isDefaultSecurityGroup(securityGroupResponse.getName())) {
securityGroupEndpoint.delete(Long.valueOf(securityGroupId));
}
}
}
use of com.sequenceiq.cloudbreak.api.model.SecurityGroupResponse in project cloudbreak by hortonworks.
the class SecurityGroupToSecurityGroupResponseConverter method convert.
@Override
public SecurityGroupResponse convert(SecurityGroup source) {
SecurityGroupResponse json = new SecurityGroupResponse();
json.setId(source.getId());
json.setName(source.getName());
json.setDescription(source.getDescription());
json.setAccount(source.getAccount());
json.setOwner(source.getOwner());
json.setPublicInAccount(source.isPublicInAccount());
json.setSecurityRules(convertSecurityRules(source.getSecurityRules()));
json.setSecurityGroupId(source.getSecurityGroupId());
json.setCloudPlatform(source.getCloudPlatform());
return json;
}
Aggregations