All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.narcissujsk.openstackjsk.openstack.compute.internal.ServicesServiceImpl Maven / Gradle / Ivy

The newest version!
package com.github.narcissujsk.openstackjsk.openstack.compute.internal;

import static com.google.common.base.Preconditions.checkNotNull;

import java.util.List;
import java.util.Map;

import com.github.narcissujsk.openstackjsk.api.compute.ext.ServicesService;
import com.github.narcissujsk.openstackjsk.model.compute.ext.Service;
import com.github.narcissujsk.openstackjsk.openstack.compute.domain.ext.ExtService;
import com.github.narcissujsk.openstackjsk.openstack.compute.domain.ext.ExtService.Services;
import com.github.narcissujsk.openstackjsk.openstack.manila.domain.actions.ServiceAction;

/**
 * Compute Services service provides CRUD capabilities for nova service(s).
 *
 * @author Stephan Latour
 */
public class ServicesServiceImpl extends BaseComputeServices implements ServicesService {

    /**
     * {@inheritDoc}
     */
    @Override
    public List list() {
        return get(Services.class, uri("/os-services")).execute().getList();
    }
    
    /**
	 * Returns list of compute services filtered by parameters.
	 * 

Author:Wang Ting/王婷

* @Title: list * @param filteringParams * @return * @see com.github.narcissujsk.openstackjsk.api.compute.ServicesService#list(java.util.Map) */ @Override public List list(Map filteringParams) { Invocation req = get(Services.class, uri("/os-services")); if (filteringParams != null) { for (Map.Entry entry : filteringParams.entrySet()) { req = req.param(entry.getKey(), entry.getValue()); } } return req.execute().getList(); } /** * Enables a compute services. *

Author:Wang Ting/王婷

* @Title: enableService * @param binary * @param host * @return * @see com.github.narcissujsk.openstackjsk.api.compute.ServicesService#enableService(java.lang.String, java.lang.String) */ @Override public ExtService enableService(String binary, String host) { checkNotNull(binary); checkNotNull(host); return put(ExtService.class, uri("/os-services/enable")).entity(ServiceAction.enable(binary, host)).execute(); } /** * Disables a compute service. *

Author:Wang Ting/王婷

* @Title: disableService * @param binary * @param host * @return * @see com.github.narcissujsk.openstackjsk.api.compute.ServicesService#disableService(java.lang.String, java.lang.String) */ @Override public ExtService disableService(String binary, String host) { checkNotNull(binary); checkNotNull(host); return put(ExtService.class, uri("/os-services/disable")).entity(ServiceAction.disable(binary, host)).execute(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy