Search in sources :

Example 6 with UnauthorizedException

use of com.emc.storageos.svcs.errorhandling.resources.UnauthorizedException in project coprhd-controller by CoprHD.

the class GeoServiceClient method syncVdcConfig.

/**
 * Send the VDC config list to a remote VDC.
 *
 * @param vdcConfigList the merged list of VDC config
 * @throws Exception
 */
public void syncVdcConfig(VdcConfigSyncParam vdcConfigList, String vdcName) throws GeoException {
    WebResource rRoot = createRequest(VDCCONFIG_URI);
    rRoot.accept(MediaType.APPLICATION_XML);
    try {
        addSignature(rRoot).put(vdcConfigList);
    } catch (UnauthorizedException e) {
        log.error("Failed to sync VDC : 401 Unauthorized, " + vdcName, e);
        throw GeoException.fatals.remoteVdcAuthorizationFailed(vdcName, e);
    } catch (GeoException e) {
        throw e;
    } catch (Exception e) {
        log.error("Failed to sync VDC : " + vdcName, e);
        throw GeoException.fatals.failedToSyncConfigurationForVdc(vdcName, e);
    }
}
Also used : UnauthorizedException(com.emc.storageos.svcs.errorhandling.resources.UnauthorizedException) WebResource(com.sun.jersey.api.client.WebResource) UnauthorizedException(com.emc.storageos.svcs.errorhandling.resources.UnauthorizedException)

Example 7 with UnauthorizedException

use of com.emc.storageos.svcs.errorhandling.resources.UnauthorizedException in project coprhd-controller by CoprHD.

the class GeoServiceClient method syncVdcConfigPreCheck.

/**
 * Retrieve the VDC config info from a remote VDC.
 * 1. For adding a new vdc, the target vdc should be in ISOLATED status and is a fresh installation.
 * 2. For updating an existing vdc, the target vdc should be in CONNECTED status.
 *
 * @param checkParam
 * @throws Exception
 */
public VdcPreCheckResponse syncVdcConfigPreCheck(VdcPreCheckParam checkParam, String vdcName) throws GeoException {
    WebResource rRoot;
    rRoot = createRequest(VDCCONFIG_PRECHECK_URI);
    rRoot.accept(MediaType.APPLICATION_XML);
    try {
        return addSignature(rRoot).post(VdcPreCheckResponse.class, checkParam);
    } catch (UnauthorizedException e) {
        throw GeoException.fatals.remoteVdcAuthorizationFailed(vdcName, e);
    } catch (GeoException e) {
        throw e;
    } catch (Exception e) {
        throw GeoException.fatals.failedToSendPreCheckRequest(vdcName, e);
    }
}
Also used : UnauthorizedException(com.emc.storageos.svcs.errorhandling.resources.UnauthorizedException) WebResource(com.sun.jersey.api.client.WebResource) UnauthorizedException(com.emc.storageos.svcs.errorhandling.resources.UnauthorizedException)

Example 8 with UnauthorizedException

use of com.emc.storageos.svcs.errorhandling.resources.UnauthorizedException in project coprhd-controller by CoprHD.

the class GeoServiceClient method checkDependencies.

/**
 * Query the dependencies of a DataObject resource
 *
 * @param clazz the resource type to be queried
 * @param id the resource object ID
 * @param activeOnly
 * @return the type name of the dependency, otherwise return null
 * @throws Exception
 */
public <T extends DataObject> String checkDependencies(Class<T> clazz, URI id, boolean activeOnly) {
    WebResource rRoot = createRequest(DEPENDENCIES_URI + clazz.getName() + "/" + id).queryParam("active_only", Boolean.toString(activeOnly));
    rRoot.accept(MediaType.APPLICATION_XML);
    try {
        return addSignature(rRoot).get(String.class);
    } catch (UnauthorizedException e) {
        throw GeoException.fatals.remoteVdcAuthorizationFailed(endPoint, e);
    } catch (GeoException e) {
        throw e;
    } catch (Exception e) {
        throw GeoException.fatals.unableConnect(endPoint, e);
    }
}
Also used : UnauthorizedException(com.emc.storageos.svcs.errorhandling.resources.UnauthorizedException) WebResource(com.sun.jersey.api.client.WebResource) UnauthorizedException(com.emc.storageos.svcs.errorhandling.resources.UnauthorizedException)

Example 9 with UnauthorizedException

use of com.emc.storageos.svcs.errorhandling.resources.UnauthorizedException in project coprhd-controller by CoprHD.

the class GeoServiceClient method vdcNatCheck.

public VdcNatCheckResponse vdcNatCheck(VdcNatCheckParam checkParam) {
    WebResource rRoot = createRequest(VDCCONFIG_NETCHECK_URI);
    rRoot.accept(MediaType.APPLICATION_XML);
    try {
        return addSignature(rRoot).post(VdcNatCheckResponse.class, checkParam);
    } catch (UnauthorizedException e) {
        log.error("Failed to perform NAT check", e);
        throw GeoException.fatals.remoteVdcAuthorizationFailed(endPoint, e);
    } catch (GeoException e) {
        log.error("Failed to perform NAT check", e);
        throw e;
    } catch (Exception e) {
        log.error("Failed to perform NAT check", e);
        throw GeoException.fatals.unableConnect(endPoint, e);
    }
}
Also used : UnauthorizedException(com.emc.storageos.svcs.errorhandling.resources.UnauthorizedException) WebResource(com.sun.jersey.api.client.WebResource) UnauthorizedException(com.emc.storageos.svcs.errorhandling.resources.UnauthorizedException)

Example 10 with UnauthorizedException

use of com.emc.storageos.svcs.errorhandling.resources.UnauthorizedException in project coprhd-controller by CoprHD.

the class GeoServiceClient method vdcNodeCheck.

/**
 * check all nodes are visible
 *
 * @param checkParam
 * @throws Exception
 */
public VdcNodeCheckResponse vdcNodeCheck(VdcNodeCheckParam checkParam) {
    WebResource rRoot;
    rRoot = createRequest(VDCCONFIG_NODECHECK_URI);
    rRoot.accept(MediaType.APPLICATION_XML);
    try {
        return addSignature(rRoot).post(VdcNodeCheckResponse.class, checkParam);
    } catch (UnauthorizedException e) {
        throw GeoException.fatals.remoteVdcAuthorizationFailed(endPoint, e);
    } catch (GeoException e) {
        throw e;
    } catch (Exception e) {
        throw GeoException.fatals.unableConnect(endPoint, e);
    }
}
Also used : UnauthorizedException(com.emc.storageos.svcs.errorhandling.resources.UnauthorizedException) WebResource(com.sun.jersey.api.client.WebResource) UnauthorizedException(com.emc.storageos.svcs.errorhandling.resources.UnauthorizedException)

Aggregations

UnauthorizedException (com.emc.storageos.svcs.errorhandling.resources.UnauthorizedException)15 WebResource (com.sun.jersey.api.client.WebResource)11 StorageOSUserDAO (com.emc.storageos.db.client.model.StorageOSUserDAO)4 TokenOnWire (com.emc.storageos.security.authentication.TokenOnWire)4 Test (org.junit.Test)4 SignedToken (com.emc.storageos.security.authentication.Base64TokenEncoder.SignedToken)3 CassandraTokenManager (com.emc.storageos.auth.impl.CassandraTokenManager)2 CoordinatorClient (com.emc.storageos.coordinator.client.service.CoordinatorClient)2 DbClient (com.emc.storageos.db.client.DbClient)2 BaseToken (com.emc.storageos.db.client.model.BaseToken)2 ProxyToken (com.emc.storageos.db.client.model.ProxyToken)2 Token (com.emc.storageos.db.client.model.Token)2 Base64TokenEncoder (com.emc.storageos.security.authentication.Base64TokenEncoder)2 TokenKeyGenerator (com.emc.storageos.security.authentication.TokenKeyGenerator)2 TokenMaxLifeValuesHolder (com.emc.storageos.security.authentication.TokenMaxLifeValuesHolder)2 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)1 ContainmentConstraint (com.emc.storageos.db.client.constraint.ContainmentConstraint)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 StringSet (com.emc.storageos.db.client.model.StringSet)1 IOException (java.io.IOException)1