import java.util.Map;
import java.util.Optional;
+
+import org.openecomp.mso.cloud.CloudConfigFactory;
import org.openecomp.mso.cloud.CloudIdentity;
import org.openecomp.mso.cloud.CloudSite;
import org.openecomp.mso.logger.MsoAlarmLogger;
private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
String msoPropID;
- public MsoKeystoneUtils (String msoPropID) {
- super(msoPropID);
+ public MsoKeystoneUtils(String msoPropID, CloudConfigFactory cloudConfigFactory) {
+ super(msoPropID, cloudConfigFactory);
this.msoPropID = msoPropID;
LOGGER.debug("MsoKeyStoneUtils:" + msoPropID);
}
Map <String, String> metadata,
boolean backout) throws MsoException {
// Obtain the cloud site information where we will create the tenant
- Optional<CloudSite> cloudSiteOpt = cloudConfig.getCloudSite(cloudSiteId);
+ Optional<CloudSite> cloudSiteOpt = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId);
if (!cloudSiteOpt.isPresent()) {
LOGGER.error(MessageEnum.RA_CREATE_TENANT_ERR, "MSOCloudSite not found", "", "", MsoLogger.ErrorCode.DataError, "MSOCloudSite not found");
throw new MsoCloudSiteNotFound (cloudSiteId);
*/
public MsoTenant queryTenant (String tenantId, String cloudSiteId) throws MsoException {
// Obtain the cloud site information where we will query the tenant
- CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(
+ CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow(
() -> new MsoCloudSiteNotFound(cloudSiteId));
Keystone keystoneAdminClient = getKeystoneAdminClient (cloudSite);
*/
public MsoTenant queryTenantByName (String tenantName, String cloudSiteId) throws MsoException {
// Obtain the cloud site information where we will query the tenant
- CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(
+ CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow(
() -> new MsoCloudSiteNotFound(cloudSiteId));
Keystone keystoneAdminClient = getKeystoneAdminClient (cloudSite);
*/
public boolean deleteTenant (String tenantId, String cloudSiteId) throws MsoException {
// Obtain the cloud site information where we will query the tenant
- CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(
+ CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow(
() -> new MsoCloudSiteNotFound(cloudSiteId));
Keystone keystoneAdminClient = getKeystoneAdminClient (cloudSite);
}
public boolean isExpired () {
- return expires == null || System.currentTimeMillis() > expires.getTimeInMillis();
+ // adding arbitrary guard timer of 5 minutes
+ return expires == null || System.currentTimeMillis() > (expires.getTimeInMillis() - 300000);
}
}