Package io.fathom.cloud.protobuf.CloudModel

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


    }

    @DELETE
    @Path("{key}")
    public ServerMetadata deleteMetadataKey(@PathParam("key") String key) throws CloudException {
        InstanceData instance = getInstance();

        InstanceData updated = metadataServices.replaceMetadataKey(getProject(), instance.getId(), key, null);

        return buildResponse(updated);
    }
View Full Code Here


    }

    @PUT
    @Path("{key}")
    public ServerMetadata setMetadataKey(@PathParam("key") String key, ServerMetadata metadata) throws CloudException {
        InstanceData instance = getInstance();

        if (metadata.metadata == null) {
            metadata.metadata = metadata.meta;
        }

        if (metadata.metadata == null) {
            throw new IllegalArgumentException();
        }

        Map<String, String> model = metadata.metadata;

        for (Entry<String, String> entry : model.entrySet()) {
            if (key.equals(entry.getKey())) {
                instance = metadataServices.replaceMetadataKey(getProject(), instance.getId(), key, entry.getValue());
            } else {
                throw new IllegalArgumentException();
            }
        }
View Full Code Here

            throw new IllegalArgumentException();
        }

        Map<String, String> model = metadata.metadata;

        InstanceData instance = getInstance();

        InstanceData updated = metadataServices.replaceMetadata(getProject(), instance.getId(), model, replace);

        return buildResponse(updated);

    }
View Full Code Here

        return buildResponse(updated);

    }

    private InstanceData getInstance() throws CloudException {
        InstanceData instance = computeServices.findInstance(getProject().getId(), instanceId);
        notFoundIfNull(instance);
        return instance;
    }
View Full Code Here

    public InstanceData findInstance(long projectId, long instanceId) throws CloudException {
        return computeRepository.getInstances(projectId).find(instanceId);
    }

    public byte[] getSecret(long projectId, long instanceId, String key) throws CloudException {
        InstanceData instance = findInstance(projectId, instanceId);
        if (instance == null) {
            return null;
        }

        SchedulerHost host = scheduler.findHost(instance.getHostId());
        if (host == null) {
            return null;
        }

        String hostCookie = instance.getHostCookie();
        UUID containerId = UUID.fromString(hostCookie);

        byte[] secretData;
        try {
            secretData = host.getSecret(containerId, key);
View Full Code Here

        long instanceId = addressInfo.getInstanceId();
        if (projectId == 0 || instanceId == 0) {
            return null;
        }

        InstanceData instance = computeRepository.getInstances(projectId).find(instanceId);
        if (instance == null) {
            return null;
        }

        return instance;
View Full Code Here

    IpPools ipPools;

    @GET
    @Path("{id}")
    public WrappedServer doServerGet(@PathParam("id") String id) throws CloudException {
        InstanceData instance = getInstance(id);

        WrappedServer response = new WrappedServer();

        ReservationData reservation = getReservation(instance.getReservationId());

        response.server = toModel(reservation, instance, true);
        return response;
    }
View Full Code Here

    }

    @PUT
    @Path("{id}")
    public WrappedServer doServerPut(@PathParam("id") String id, WrappedServer request) throws CloudException {
        InstanceData instance = getInstance(id);

        if (request.server == null) {
            request.server = new Server();
        }

        if (request.server.name != null && !Objects.equal(instance.getName(), request.server.name)) {
            instance = instances.updateInstance(getProject(), instance.getId(), request.server.name);
        }

        WrappedServer response = new WrappedServer();

        ReservationData reservation = getReservation(instance.getReservationId());

        response.server = toModel(reservation, instance, true);
        return response;
    }
View Full Code Here

    }

    @POST
    @Path("{id}/action")
    public Response doAction(@PathParam("id") String id, JsonObject jsonRequest) throws CloudException, IOException {
        InstanceData instance = getInstance(id);

        for (Entry<String, JsonElement> entry : jsonRequest.entrySet()) {
            String key = entry.getKey();
            if (key.equals("addFloatingIp")) {
                AddFloatingIpRequest request = gson.fromJson(entry.getValue(), AddFloatingIpRequest.class);
View Full Code Here

    }

    @DELETE
    @Path("{id}")
    public Response shutdownServer(@PathParam("id") String id) throws CloudException {
        InstanceData instance = getInstance(id);

        StopInstancesAction action = stopInstancesActionProvider.get();
        action.project = getProject();
        action.instances = Lists.newArrayList();
        action.instances.add(instance);
View Full Code Here

TOP

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

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.