Search in sources :

Example 1 with SecurityGroup

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

the class OpenStackComputeService method getAccessControlList.

/**
 * @see com.att.cdp.zones.ComputeService#getAccessControlList(java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public ACL getAccessControlList(String id) throws ZoneException {
    checkArg(id, "id");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    try {
        SecurityGroup group = nova.getClient().securityGroups().showSecurityGroup(id).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) SecurityGroup(com.woorea.openstack.nova.model.SecurityGroup) OpenStackACL(com.att.cdp.openstack.model.OpenStackACL)

Example 2 with SecurityGroup

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

the class TestOpenStackACL method testCtorACL.

@Test
@Ignore
public void testCtorACL() throws ZoneException {
    OpenStackContext context = login();
    SecurityGroup group = new SecurityGroup();
    logout(context);
}
Also used : OpenStackContext(com.att.cdp.openstack.OpenStackContext) SecurityGroup(com.woorea.openstack.nova.model.SecurityGroup) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with SecurityGroup

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

the class OpenStackComputeService method getAccessControlList.

/**
 * @see com.att.cdp.zones.ComputeService#getAccessControlList(java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public ACL getAccessControlList(String id) throws ZoneException {
    checkArg(id, "id");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    try {
        SecurityGroup group = nova.getClient().securityGroups().showSecurityGroup(id).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) SecurityGroup(com.woorea.openstack.nova.model.SecurityGroup) OpenStackACL(com.att.cdp.openstack.model.OpenStackACL)

Example 4 with SecurityGroup

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

the class OpenStackComputeService method addACLRule.

/**
 * @see com.att.cdp.zones.ComputeService#addACLRule(java.lang.String, com.att.cdp.zones.model.Rule)
 */
@SuppressWarnings("nls")
@Override
public Rule addACLRule(String aclId, Rule rule) throws ZoneException {
    checkArg(aclId, "aclId");
    checkArg(rule, "rule");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    try {
        SecurityGroup group = nova.getClient().securityGroups().showSecurityGroup(aclId).execute();
        if (group != null) {
            com.woorea.openstack.nova.model.SecurityGroup.Rule createdRule = nova.getClient().securityGroups().createSecurityGroupRule(aclId, rule.getProtocol().toString(), rule.getFromPort(), rule.getToPort(), rule.getSourceIpRange()).execute();
            return new OpenStackRule(context, createdRule);
        }
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
    return null;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackRule(com.att.cdp.openstack.model.OpenStackRule) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) SecurityGroup(com.woorea.openstack.nova.model.SecurityGroup)

Example 5 with SecurityGroup

use of com.woorea.openstack.nova.model.SecurityGroup 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)9 SecurityGroup (com.woorea.openstack.nova.model.SecurityGroup)9 Context (com.att.cdp.zones.Context)8 OpenStackBaseException (com.woorea.openstack.base.client.OpenStackBaseException)8 OpenStackACL (com.att.cdp.openstack.model.OpenStackACL)6 OpenStackRule (com.att.cdp.openstack.model.OpenStackRule)2 ACL (com.att.cdp.zones.model.ACL)2 SecurityGroupForCreate (com.woorea.openstack.nova.model.SecurityGroupForCreate)2 ArrayList (java.util.ArrayList)2 RequestState (com.att.cdp.zones.spi.RequestState)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1