diff --git a/content-api/content-service/conf/application.conf b/content-api/content-service/conf/application.conf index bcee84d2d..eab5cbede 100644 --- a/content-api/content-service/conf/application.conf +++ b/content-api/content-service/conf/application.conf @@ -765,6 +765,11 @@ cloud_storage_container="" cloud_storage_endpoint="" cloud_storage_dial_container="" +#GCP Specific Credentials +cloud_storage_client_id="" +cloud_storage_private_key_id="" +cloud_storage_project_id="" + cloudstorage.metadata.replace_absolute_path=false cloudstorage.relative_path_prefix= "CONTENT_STORAGE_BASE_PATH" cloudstorage.read_base_path="https://sunbirddev.blob.core.windows.net" diff --git a/platform-modules/mimetype-manager/pom.xml b/platform-modules/mimetype-manager/pom.xml index 5cbf36557..9ca1f4715 100644 --- a/platform-modules/mimetype-manager/pom.xml +++ b/platform-modules/mimetype-manager/pom.xml @@ -93,6 +93,16 @@ commons-validator 1.6 + + com.google.guava + guava + 23.0 + + + com.google.api-client + google-api-client + 1.35.2 + org.sunbird url-manager diff --git a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/cloudstore/StorageService.scala b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/cloudstore/StorageService.scala index 753f298ae..3dfdaeaa5 100644 --- a/platform-modules/mimetype-manager/src/main/scala/org/sunbird/cloudstore/StorageService.scala +++ b/platform-modules/mimetype-manager/src/main/scala/org/sunbird/cloudstore/StorageService.scala @@ -79,7 +79,17 @@ class StorageService { } def getSignedURL(key: String, ttl: Option[Int], permission: Option[String]): String = { - getService.getPutSignedURL(getContainerName, key, ttl, permission, Option.apply(getMimeType(key))) + if(storageType == "gcloud") + { + val additionalParams: Map[String, String] = Map("clientId" -> (if (Platform.config.hasPath("cloud_storage_client_id")) Platform.config.getString("cloud_storage_client_id") else ""), + "privateKeyIds" -> (if (Platform.config.hasPath("cloud_storage_private_key_id")) Platform.config.getString("cloud_storage_private_key_id") else ""), + "projectId" -> (if (Platform.config.hasPath("cloud_storage_project_id")) Platform.config.getString("cloud_storage_project_id") else ""), + "privateKeyPkcs8" -> (if (Platform.config.hasPath("cloud_storage_secret")) Platform.config.getString("cloud_storage_secret") else ""), + "clientEmail" -> (if (Platform.config.hasPath("cloud_storage_key")) Platform.config.getString("cloud_storage_key") else "") + ) + getService.getPutSignedURL(getContainerName, key, ttl, permission, additionalParams = Option.apply(additionalParams)) + } + else getService.getPutSignedURL(getContainerName, key, ttl, permission) } def getUri(key: String): String = { diff --git a/platform-modules/url-manager/pom.xml b/platform-modules/url-manager/pom.xml index 158a47121..5d02c9939 100644 --- a/platform-modules/url-manager/pom.xml +++ b/platform-modules/url-manager/pom.xml @@ -25,13 +25,7 @@ com.google.apis google-api-services-youtube - v3-rev182-1.22.0 - - - com.google.guava - guava-jdk5 - - + v3-rev222-1.25.0 com.google.api-client @@ -43,17 +37,6 @@ google-api-services-drive v3-rev136-1.25.0 - - com.google.oauth-client - google-oauth-client-jetty - 1.22.0 - - - com.google.http-client - google-http-client - 1.22.0 - compile -