use of com.att.cdp.openstack.OpenStackContext in project AJSC by att.
the class AbstractOpenStackIdentityService method createKeyPair.
/**
* @see com.att.cdp.zones.IdentityService#createKeyPair(com.att.cdp.zones.model.KeyPair)
*/
@SuppressWarnings("nls")
@Override
public KeyPair createKeyPair(KeyPair keyPair) throws ZoneException {
trackRequest();
RequestState.put(RequestState.KEYPAIR, keyPair.getName());
Context context = getContext();
if (context.isLoggedIn()) {
NovaConnector connector = ((OpenStackContext) context).getNovaConnector();
com.woorea.openstack.nova.model.KeyPair pair;
try {
pair = connector.getClient().keyPairs().create(keyPair.getName()).execute();
} catch (OpenStackConnectException e) {
throw new ContextConnectionException(EELFResourceManager.format(OSMsg.PAL_OS_CONNECTION_FAILED, "Compute", connector.getEndpoint()), e);
} catch (OpenStackResponseException e) {
String reason = null;
if (e.getResponse() != null && e.getResponse().getInputStream() != null) {
try {
reason = IOUtils.toString(e.getResponse().getInputStream(), "UTF-8");
} catch (IOException e1) {
}
throw new ZoneException(EELFResourceManager.format(OSMsg.PAL_OS_REQUEST_FAILURE, "create key-pair " + keyPair.getName() + " " + reason), e);
}
throw new ZoneException(EELFResourceManager.format(OSMsg.PAL_OS_REQUEST_FAILURE, "create key-pair " + keyPair.getName()), e);
}
return new OpenStackKeyPair(context, pair);
}
throw new ZoneException("Unable to create key-pairs when the context has not been logged in and authenticated");
}
use of com.att.cdp.openstack.OpenStackContext in project AJSC by att.
the class AbstractOpenStackIdentityService method deleteKeyPair.
/**
* @see com.att.cdp.zones.IdentityService#deleteKeyPair(com.att.cdp.zones.model.KeyPair)
*/
@SuppressWarnings("nls")
@Override
public void deleteKeyPair(KeyPair keyPair) throws ZoneException {
trackRequest();
RequestState.put(RequestState.KEYPAIR, keyPair.getName());
Context context = getContext();
if (context.isLoggedIn()) {
NovaConnector connector = ((OpenStackContext) context).getNovaConnector();
try {
connector.getClient().keyPairs().delete(keyPair.getName()).execute();
} catch (OpenStackConnectException e) {
throw new ContextConnectionException(EELFResourceManager.format(OSMsg.PAL_OS_CONNECTION_FAILED, "Compute", connector.getEndpoint()), e);
} catch (OpenStackResponseException e) {
throw new ZoneException(EELFResourceManager.format(OSMsg.PAL_OS_REQUEST_FAILURE, "delete key-pair " + keyPair.getName()), e);
}
return;
}
throw new ZoneException("Unable to delete key-pairs when the context has not been logged in and authenticated");
}
use of com.att.cdp.openstack.OpenStackContext in project AJSC by att.
the class TestCinderConnector method testCinderConnector.
@Test
@Ignore
public void testCinderConnector() throws ZoneException {
OpenStackContext context = login();
CinderConnector connector = context.getCinderConnector();
assertNotNull(connector);
Access access = connector.getAccess();
assertNotNull(access);
Cinder client = connector.getClient();
assertNotNull(client);
logout(context);
}
use of com.att.cdp.openstack.OpenStackContext in project AJSC by att.
the class TestGlanceConnector method testGlanceConnector.
@Test
@Ignore
public void testGlanceConnector() throws ZoneException {
OpenStackContext context = login();
GlanceConnector connector = context.getGlanceConnector();
assertNotNull(connector);
Access access = connector.getAccess();
assertNotNull(access);
Glance client = connector.getClient();
assertNotNull(client);
logout(context);
}
use of com.att.cdp.openstack.OpenStackContext in project AJSC by att.
the class TestHeatConnector method testGlanceConnector.
@Test
@Ignore
public void testGlanceConnector() throws ZoneException {
OpenStackContext context = login();
HeatConnector connector = context.getHeatConnector();
assertNotNull(connector);
Access access = connector.getAccess();
assertNotNull(access);
Heat client = connector.getClient();
assertNotNull(client);
logout(context);
}
Aggregations