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

org.openstack4j.openstack.networking.internal.SecurityGroupServiceImpl Maven / Gradle / Ivy

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

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

import java.util.List;

import org.openstack4j.api.networking.SecurityGroupService;
import org.openstack4j.model.compute.ActionResponse;
import org.openstack4j.model.network.SecurityGroup;
import org.openstack4j.openstack.networking.domain.NeutronSecurityGroup;
import org.openstack4j.openstack.networking.domain.NeutronSecurityGroup.SecurityGroups;

/**
 * FloatingIPService implementation that provides Neutron Floating-IP based Service Operations.
 *
 * @author Nathan Anderson
 */
public class SecurityGroupServiceImpl extends BaseNetworkingServices implements SecurityGroupService {
  
  /**
   * {@inheritDoc}
   */
  @Override
  public SecurityGroup get(String id) {
    checkNotNull(id);
    return get(NeutronSecurityGroup.class, uri("/security-groups/%s", id)).execute();
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public ActionResponse delete(String groupId) {
    checkNotNull(groupId);
    return deleteWithResponse(uri("/security-groups/%s", groupId)).execute();
  }
  
  /**
   * {@inheritDoc}
   */
  @Override
  public SecurityGroup create(SecurityGroup securityGroup) {
    checkNotNull(securityGroup);
    return post(NeutronSecurityGroup.class, uri("/security-groups")).entity(securityGroup).execute();
  }

  /**
	 * {@inheritDoc}
	 */
	@Override
	public List list() {
		return get(SecurityGroups.class, uri("/security-groups")).execute().getList();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy