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

org.openstack4j.openstack.compute.internal.ServicesServiceImpl Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
package org.openstack4j.openstack.compute.internal;

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

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

import org.openstack4j.api.compute.ext.ServicesService;
import org.openstack4j.model.compute.ext.Service;
import org.openstack4j.openstack.compute.domain.ext.ExtService;
import org.openstack4j.openstack.compute.domain.ext.ExtService.Services;
import org.openstack4j.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 org.openstack4j.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 org.openstack4j.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 org.openstack4j.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