Search in sources :

Example 1 with Network

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

the class StackToStackResponseConverterTest method createSource.

@Override
public Stack createSource() {
    Stack stack = TestUtil.stack();
    Cluster cluster = TestUtil.cluster(TestUtil.blueprint(), stack, 1L);
    stack.setCluster(cluster);
    stack.setAvailabilityZone("avZone");
    Network network = new Network();
    network.setId(1L);
    stack.setNetwork(network);
    stack.setFailurePolicy(new FailurePolicy());
    Orchestrator orchestrator = new Orchestrator();
    orchestrator.setId(1L);
    orchestrator.setApiEndpoint("endpoint");
    orchestrator.setType("type");
    stack.setOrchestrator(orchestrator);
    stack.setParameters(new HashMap<>());
    stack.setCloudPlatform("OPENSTACK");
    stack.setGatewayPort(9443);
    stack.setCustomDomain("custom.domain");
    stack.setCustomHostname("hostname");
    stack.setStackAuthentication(new StackAuthentication());
    stack.getStackAuthentication().setPublicKey("rsakey");
    stack.getStackAuthentication().setLoginUserName("cloudbreak");
    stack.setHostgroupNameAsHostname(false);
    stack.setClusterNameAsSubdomain(false);
    Resource s3ArnResource = new Resource(ResourceType.S3_ACCESS_ROLE_ARN, "s3Arn", stack);
    stack.setResources(Collections.singleton(s3ArnResource));
    return stack;
}
Also used : StackAuthentication(com.sequenceiq.cloudbreak.domain.StackAuthentication) Network(com.sequenceiq.cloudbreak.domain.Network) Resource(com.sequenceiq.cloudbreak.domain.Resource) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) FailurePolicy(com.sequenceiq.cloudbreak.domain.FailurePolicy) Orchestrator(com.sequenceiq.cloudbreak.domain.Orchestrator) Stack(com.sequenceiq.cloudbreak.domain.Stack)

Example 2 with Network

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

the class NetworkController method convert.

private Network convert(NetworkRequest networkRequest, boolean publicInAccount) {
    Network network = conversionService.convert(networkRequest, Network.class);
    network.setPublicInAccount(publicInAccount);
    return network;
}
Also used : Network(com.sequenceiq.cloudbreak.domain.Network)

Example 3 with Network

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

the class NetworkController method getPublic.

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

Example 4 with Network

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

the class NetworkController method createNetwork.

private NetworkResponse createNetwork(IdentityUser user, NetworkRequest networkRequest, boolean publicInAccount) {
    Network network = convert(networkRequest, publicInAccount);
    network = networkService.create(user, network);
    notify(user, ResourceEvent.NETWORK_CREATED);
    return conversionService.convert(network, NetworkResponse.class);
}
Also used : Network(com.sequenceiq.cloudbreak.domain.Network)

Example 5 with Network

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

the class TestUtil method network.

public static Network network(String subnet) {
    Network network = new Network();
    network.setSubnetCIDR(subnet);
    // network.setAddressPrefixCIDR(DUMMY_ADDRESS_PREFIX_CIDR);
    network.setId(1L);
    network.setName(DUMMY_NAME);
    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