use of bio.terra.service.resourcemanagement.google.GoogleBucketRequest in project jade-data-repo by DataBiosphere.
the class BucketResourceTest method buildBucketRequest.
private GoogleBucketRequest buildBucketRequest(String bucketName) throws Exception {
// build project request
String role = "roles/bigquery.jobUser";
String stewardsGroupEmail = "group:JadeStewards-dev@dev.test.firecloud.org";
List<String> stewardsGroupEmailList = Lists.newArrayList();
stewardsGroupEmailList.add(stewardsGroupEmail);
Map<String, List<String>> roleToStewardMap = new HashMap();
roleToStewardMap.put(role, stewardsGroupEmailList);
GoogleProjectRequest projectRequest = new GoogleProjectRequest().projectId(resourceConfiguration.getProjectId() + "-data").profileId(UUID.fromString(profile.getId())).serviceIds(DataLocationService.DATA_PROJECT_SERVICE_IDS).roleIdentityMapping(roleToStewardMap);
// create project metadata
GoogleProjectResource projectResource = resourceService.getOrCreateProject(projectRequest);
// create the bucket request
BillingProfile billingProfile = profileService.getProfileById(UUID.fromString(profile.getId()));
GoogleBucketRequest googleBucketRequest = new GoogleBucketRequest().googleProjectResource(projectResource).bucketName(bucketName).profileId(billingProfile.getId()).region(billingProfile.getGcsRegion());
return googleBucketRequest;
}
Aggregations