Package io.fathom.cloud.protobuf.CloudModel

Examples of io.fathom.cloud.protobuf.CloudModel.VirtualIpData


        }
        return null;
    }

    private FloatingIp toModel(VirtualIp vip) {
        VirtualIpData data = vip.getData();
        FloatingIp model = new FloatingIp();
        // model.id = vip.getId();
        model.id = toId(vip.getData());
        if (data.hasInstanceId()) {
            model.instanceId = Long.toString(data.getInstanceId());
        }

        InetAddress address = InetAddresses.forString(data.getIp());
        String ip;
        if (address instanceof Inet4Address) {
            ip = InetAddresses.toAddrString(address);
        } else {
            throw new UnsupportedOperationException();
View Full Code Here


    protected Allocation markIpAllocated0(Project project, InetAddress ip) throws CloudException {
        VirtualIpData.Builder addr = VirtualIpData.newBuilder();
        addr.setIp(InetAddresses.toAddrString(ip));
        addr.setProjectId(project.getId());

        VirtualIpData allocated = networkPools.networkStateStore.markIpAllocated(this, addr);
        return new Allocation(allocated);
    }
View Full Code Here

    @Inject
    AsyncTasks asyncTasks;

    public VirtualIp findVirtualIp(Project project, String address) throws CloudException {
        for (VirtualIpPoolData pool : computeRepository.getVirtualIpPools().list()) {
            VirtualIpData vip = computeRepository.getAllocatedVips(pool.getId()).find(address);
            if (vip == null) {
                continue;
            }

            if (vip.getProjectId() != project.getId()) {
                continue;
            }

            return new VirtualIp(pool, vip);
        }
View Full Code Here

            throw new WebApplicationException(Status.CONFLICT);
        }

        VirtualIpData.Builder b = VirtualIpData.newBuilder(vip.getData());
        b.setInstanceId(instance.getId());
        VirtualIpData updated = computeRepository.getAllocatedVips(vip.getPoolData().getId()).update(b);

        asyncTasks.attachFloatingIp(project, instance, new VirtualIp(vip.getPoolData(), updated));
    }
View Full Code Here

        VirtualIp vip = findVirtualIp(project, address);
        if (vip == null) {
            throw new WebApplicationException(Status.NOT_FOUND);
        }

        VirtualIpData vipData = vip.getData();

        if (!vipData.hasInstanceId() || vipData.getInstanceId() != instance.getId()) {
            throw new WebApplicationException(Status.NOT_FOUND);
        }

        VirtualIpData.Builder b = VirtualIpData.newBuilder(vip.getData());
        b.clearInstanceId();
        VirtualIpData updated = computeRepository.getAllocatedVips(vip.getPoolData().getId()).update(b);

        asyncTasks.detachFloatingIp(project, instance, new VirtualIp(vip.getPoolData(), updated));
    }
View Full Code Here

TOP

Related Classes of io.fathom.cloud.protobuf.CloudModel.VirtualIpData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.