Search in sources :

Example 6 with Network

use of com.sequenceiq.cloudbreak.domain.Network in project cloudbreak by hortonworks.

the class NetworkService method delete.

public void delete(String name, IdentityUser user) {
    LOGGER.info("Deleting network with name: {}", name);
    Network network = networkRepository.findByNameInAccount(name, user.getAccount());
    if (network == null) {
        throw new NotFoundException(String.format("Network '%s' not found.", name));
    }
    delete(network);
}
Also used : Network(com.sequenceiq.cloudbreak.domain.Network) NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException)

Example 7 with Network

use of com.sequenceiq.cloudbreak.domain.Network in project cloudbreak by hortonworks.

the class NetworkController method getPrivate.

@Override
public NetworkResponse getPrivate(String name) {
    IdentityUser user = authenticatedUserService.getCbUser();
    Network network = networkService.getPrivateNetwork(name, user);
    return convert(network);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Network(com.sequenceiq.cloudbreak.domain.Network)

Example 8 with Network

use of com.sequenceiq.cloudbreak.domain.Network in project cloudbreak by hortonworks.

the class NetworkController method getPrivates.

@Override
public Set<NetworkResponse> getPrivates() {
    IdentityUser user = authenticatedUserService.getCbUser();
    Set<Network> networks = networkService.retrievePrivateNetworks(user);
    return convert(networks);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Network(com.sequenceiq.cloudbreak.domain.Network)

Example 9 with Network

use of com.sequenceiq.cloudbreak.domain.Network in project cloudbreak by hortonworks.

the class NetworkController method getPublics.

@Override
public Set<NetworkResponse> getPublics() {
    IdentityUser user = authenticatedUserService.getCbUser();
    Set<Network> networks = networkService.retrieveAccountNetworks(user);
    return convert(networks);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Network(com.sequenceiq.cloudbreak.domain.Network)

Example 10 with Network

use of com.sequenceiq.cloudbreak.domain.Network in project cloudbreak by hortonworks.

the class NetworkService method get.

public Network get(Long id) {
    Network network = getById(id);
    authorizationService.hasReadPermission(network);
    return network;
}
Also used : Network(com.sequenceiq.cloudbreak.domain.Network)

Aggregations

Network (com.sequenceiq.cloudbreak.domain.Network)14 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)5 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)2 Credential (com.sequenceiq.cloudbreak.domain.Credential)2 Stack (com.sequenceiq.cloudbreak.domain.Stack)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 SpecialParameters (com.sequenceiq.cloudbreak.api.model.SpecialParameters)1 NotFoundException (com.sequenceiq.cloudbreak.controller.NotFoundException)1 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)1 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)1 FailurePolicy (com.sequenceiq.cloudbreak.domain.FailurePolicy)1 Orchestrator (com.sequenceiq.cloudbreak.domain.Orchestrator)1 Resource (com.sequenceiq.cloudbreak.domain.Resource)1 StackAuthentication (com.sequenceiq.cloudbreak.domain.StackAuthentication)1 Template (com.sequenceiq.cloudbreak.domain.Template)1 Json (com.sequenceiq.cloudbreak.domain.json.Json)1 AccessDeniedException (org.springframework.security.access.AccessDeniedException)1 Transactional (org.springframework.transaction.annotation.Transactional)1