You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by yk...@apache.org on 2021/01/12 08:35:57 UTC
[incubator-datalab] branch DATALAB-2217 created (now f030f58)
This is an automated email from the ASF dual-hosted git repository.
ykinash pushed a change to branch DATALAB-2217
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git.
at f030f58 [DATALAB-2217] - Added all groups for all roles. (Check off all roles)
This branch includes the following new commits:
new f030f58 [DATALAB-2217] - Added all groups for all roles. (Check off all roles)
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org
[incubator-datalab] 01/01: [DATALAB-2217] - Added all groups for
all roles. (Check off all roles)
Posted by yk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ykinash pushed a commit to branch DATALAB-2217
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
commit f030f58e630ecfdef03ec2717dddcbaf316ba23d
Author: KinashYurii <ur...@gmail.com>
AuthorDate: Tue Jan 12 10:35:21 2021 +0200
[DATALAB-2217] - Added all groups for all roles. (Check off all roles)
---
.../datalab/backendapi/dao/UserRoleDAOImpl.java | 25 ++++++++--------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/services/self-service/src/main/java/com/epam/datalab/backendapi/dao/UserRoleDAOImpl.java b/services/self-service/src/main/java/com/epam/datalab/backendapi/dao/UserRoleDAOImpl.java
index b2a7d97..1081dee 100644
--- a/services/self-service/src/main/java/com/epam/datalab/backendapi/dao/UserRoleDAOImpl.java
+++ b/services/self-service/src/main/java/com/epam/datalab/backendapi/dao/UserRoleDAOImpl.java
@@ -39,6 +39,7 @@ import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Set;
+import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -57,9 +58,6 @@ import static java.util.stream.Collectors.toList;
@Slf4j
public class UserRoleDAOImpl extends BaseDAO implements UserRoleDAO {
private static final ObjectMapper MAPPER = new ObjectMapper();
- private static final String[] DEFAULT_AWS_SHAPES = {"nbShapes_t2.medium_fetching", "compShapes_c4.xlarge_fetching"};
- private static final String[] DEFAULT_GCP_SHAPES = {"compShapes_n1-standard-2_fetching", "nbShapes_n1-standard-2_fetching"};
- private static final String[] DEFAULT_AZURE_SHAPES = {"nbShapes_Standard_E4s_v3_fetching", "compShapes_Standard_E4s_v3_fetching"};
private static final String ROLES_FILE_FORMAT = "/mongo/%s/mongo_roles.json";
private static final String USERS_FIELD = "users";
private static final String GROUPS_FIELD = "groups";
@@ -114,7 +112,14 @@ public class UserRoleDAOImpl extends BaseDAO implements UserRoleDAO {
.stream()
.map(UserGroupDto::getGroup)
.collect(Collectors.toSet()),
- getDefaultShapes(cloudProvider));
+ getAll(cloudProvider));
+ }
+
+ private Set<String> getAll(CloudProvider cloudProvider) {
+ return getUserRoleFromFile(cloudProvider)
+ .stream()
+ .map(UserRoleDTO::getId)
+ .collect(Collectors.toSet());
}
@Override
@@ -184,18 +189,6 @@ public class UserRoleDAOImpl extends BaseDAO implements UserRoleDAO {
}
}
- private Set<String> getDefaultShapes(CloudProvider cloudProvider) {
- if (cloudProvider == CloudProvider.AWS) {
- return Stream.of(DEFAULT_AWS_SHAPES).collect(Collectors.toSet());
- } else if (cloudProvider == CloudProvider.GCP) {
- return Stream.of(DEFAULT_GCP_SHAPES).collect(Collectors.toSet());
- } else if (cloudProvider == CloudProvider.AZURE) {
- return Stream.of(DEFAULT_AZURE_SHAPES).collect(Collectors.toSet());
- } else {
- throw new DatalabException("Unsupported cloud provider " + cloudProvider);
- }
- }
-
private Document roleDocument() {
return new Document().append(ID, "$" + ID)
.append(DESCRIPTION, "$" + DESCRIPTION)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org