Search in sources :

Example 1 with SecurityGroupForCreate

use of com.woorea.openstack.nova.model.SecurityGroupForCreate in project AJSC by att.

the class OpenStackComputeService method createAccessControlList.

/**
 * @see com.att.cdp.zones.ComputeService#createAccessControlList(com.att.cdp.zones.model.ACL)
 */
@SuppressWarnings("nls")
@Override
public ACL createAccessControlList(ACL model) throws ZoneException {
    checkArg(model, "model");
    checkArg(model.getName(), "name");
    checkArg(model.getDescription(), "description");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    SecurityGroupForCreate create = new SecurityGroupForCreate();
    create.setName(model.getName());
    create.setDescription(model.getDescription());
    try {
        SecurityGroup group = nova.getClient().securityGroups().createSecurityGroup(create).execute();
        return new OpenStackACL(context, group);
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
    return null;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) SecurityGroupForCreate(com.woorea.openstack.nova.model.SecurityGroupForCreate) SecurityGroup(com.woorea.openstack.nova.model.SecurityGroup) OpenStackACL(com.att.cdp.openstack.model.OpenStackACL)

Example 2 with SecurityGroupForCreate

use of com.woorea.openstack.nova.model.SecurityGroupForCreate in project AJSC by att.

the class OpenStackComputeService method createAccessControlList.

/**
 * @see com.att.cdp.zones.ComputeService#createAccessControlList(com.att.cdp.zones.model.ACL)
 */
@SuppressWarnings("nls")
@Override
public ACL createAccessControlList(ACL model) throws ZoneException {
    checkArg(model, "model");
    checkArg(model.getName(), "name");
    checkArg(model.getDescription(), "description");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    SecurityGroupForCreate create = new SecurityGroupForCreate();
    create.setName(model.getName());
    create.setDescription(model.getDescription());
    try {
        SecurityGroup group = nova.getClient().securityGroups().createSecurityGroup(create).execute();
        return new OpenStackACL(context, group);
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
    return null;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) SecurityGroupForCreate(com.woorea.openstack.nova.model.SecurityGroupForCreate) SecurityGroup(com.woorea.openstack.nova.model.SecurityGroup) OpenStackACL(com.att.cdp.openstack.model.OpenStackACL)

Aggregations

OpenStackContext (com.att.cdp.openstack.OpenStackContext)2 OpenStackACL (com.att.cdp.openstack.model.OpenStackACL)2 Context (com.att.cdp.zones.Context)2 OpenStackBaseException (com.woorea.openstack.base.client.OpenStackBaseException)2 SecurityGroup (com.woorea.openstack.nova.model.SecurityGroup)2 SecurityGroupForCreate (com.woorea.openstack.nova.model.SecurityGroupForCreate)2