package bio.terra.workspace.service.workspace;

import bio.terra.workspace.service.iam.model.IamRole;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.util.List;

public class CloudSyncRoleMapping {
  public static final ImmutableMap<IamRole, List<String>> cloudSyncRoleMap =
      ImmutableMap.of(
          IamRole.OWNER,
              ImmutableList.of(
                  "roles/viewer",
                  "roles/bigquery.dataEditor",
                  // TODO(wchambers): Revise service account permissions when there are controlled
                  // resources for service accounts.
                  "roles/iam.serviceAccountUser",
                  "roles/lifesciences.editor",
                  // TODO(wchambers): Revise notebooks permissions when there are controlled
                  // resources for notebooks.
                  "roles/notebooks.admin",
                  // TODO(marikomedlock): Revise storage permissions when there are controlled
                  // resources for buckets.
                  "roles/storage.admin"),
          IamRole.WRITER,
              ImmutableList.of(
                  "roles/viewer",
                  "roles/bigquery.dataEditor",
                  // TODO(wchambers): Revise service account permissions when there are controlled
                  // resources for service accounts.
                  "roles/iam.serviceAccountUser",
                  "roles/lifesciences.editor",
                  // TODO(wchambers): Revise notebooks permissions when there are controlled
                  // resources for notebooks.
                  "roles/notebooks.admin",
                  // TODO(marikomedlock): Revise storage permissions when there are controlled
                  // resources for buckets.
                  "roles/storage.admin"),
          IamRole.READER, ImmutableList.of("roles/viewer"));
}

@@ -631,32 +631,56 @@
 ervice accounts.
+ (Also used by NextFlow)
 %0A               
@@ -753,32 +753,93 @@
 iences.editor%22,%0A
+                  %22roles/serviceusage.serviceUsageConsumer%22,%0A
                 
@@ -1475,16 +1475,40 @@
 ccounts.
+ (Also used by NextFlow)
 %0A       
@@ -1589,32 +1589,93 @@
 iences.editor%22,%0A
+                  %22roles/serviceusage.serviceUsageConsumer%22,%0A
                 

Add serviceUsageConsumer role. (#230)