Search in sources :

Example 1 with Project

use of com.google.api.services.cloudresourcemanager.v3.model.Project in project uPMT by coco35700.

the class Main method start.

public void start(Stage primaryStage) throws IOException {
    loadProperties();
    initProjects();
    createBasicSchema();
    /*if(!projects.isEmpty()){
			currentProject = projects.getFirst();
			//System.out.println(currentProject.getSchemaProjet());
		}
		else {
			currentProject = new Projet("projetTMP", new Schema("SchemaTemporaire"));
		}*/
    currentProject = new Project("--emptyProject--", new Schema("SchemaTemporaire"));
    this.primaryStage = primaryStage;
    this.primaryStage.setTitle(_langBundle.getString("main_title"));
    // Launching layouts
    initRootLayout();
    showLaunchingScreen();
}
Also used : Project(model.Project) Schema(model.Schema)

Example 2 with Project

use of com.google.api.services.cloudresourcemanager.v3.model.Project in project uPMT by coco35700.

the class Main method initProjects.

/**
 * Method used to load all the projects
 */
private void initProjects() {
    this.projects = new LinkedList<Project>();
    LoadDataProjects dc = LoadDataProjects.instance();
    dc.setProjets(projects);
    if (Utils.checkRecovery()) {
        this.mainViewController.alertRecovery();
    }
    Utils.loadProjects(projects, this);
}
Also used : Project(model.Project) LoadDataProjects(utils.LoadDataProjects)

Example 3 with Project

use of com.google.api.services.cloudresourcemanager.v3.model.Project in project uPMT by coco35700.

the class Utils method loadProjects.

public static void loadProjects(LinkedList<Project> projects, Main main) {
    HashSet<String> projectNames = loadProjectsNames();
    if (projectNames.isEmpty()) {
    // For debug purposes
    // System.out.println("No projects to load");
    } else {
        System.out.println("Loading projects");
        for (String s : projectNames) {
            if (s.contains(Project.FORMAT)) {
                // projects.add(Projet.load(s));
                Project p = Project.loadData(s);
                if (p == null) {
                    Alert alert = new Alert(AlertType.CONFIRMATION);
                    // alert.setTitle("Error, version conflict");
                    alert.setTitle(main._langBundle.getString("error_version"));
                    // alert.setHeaderText("Your saves are in conflict with this new version.");
                    alert.setHeaderText(main._langBundle.getString("error_version_text_alarm"));
                    // alert.setContentText("Please contact us in the github repository.");
                    alert.setContentText(main._langBundle.getString("error_version_text_contact"));
                    Optional<ButtonType> result = alert.showAndWait();
                    if (result.get() == ButtonType.OK) {
                        alert.close();
                    } else {
                        alert.close();
                    }
                } else
                    projects.add(p);
            }
        }
    }
}
Also used : Project(model.Project) Alert(javafx.scene.control.Alert) ButtonType(javafx.scene.control.ButtonType)

Example 4 with Project

use of com.google.api.services.cloudresourcemanager.v3.model.Project in project java-docs-samples by GoogleCloudPlatform.

the class TestPermissions method testPermissions.

// Tests if the caller has the listed permissions.
public static void testPermissions(String projectId) {
    // projectId = "my-project-id"
    CloudResourceManager service = null;
    try {
        service = createCloudResourceManagerService();
    } catch (IOException | GeneralSecurityException e) {
        System.out.println("Unable to initialize service: \n" + e.toString());
        return;
    }
    List<String> permissionsList = Arrays.asList("resourcemanager.projects.get", "resourcemanager.projects.delete");
    TestIamPermissionsRequest requestBody = new TestIamPermissionsRequest().setPermissions(permissionsList);
    try {
        TestIamPermissionsResponse testIamPermissionsResponse = service.projects().testIamPermissions(projectId, requestBody).execute();
        System.out.println("Of the permissions listed in the request, the caller has the following: " + testIamPermissionsResponse.getPermissions().toString());
    } catch (IOException e) {
        System.out.println("Unable to test permissions: \n" + e.toString());
    }
}
Also used : CloudResourceManager(com.google.api.services.cloudresourcemanager.v3.CloudResourceManager) TestIamPermissionsRequest(com.google.api.services.cloudresourcemanager.v3.model.TestIamPermissionsRequest) TestIamPermissionsResponse(com.google.api.services.cloudresourcemanager.v3.model.TestIamPermissionsResponse) GeneralSecurityException(java.security.GeneralSecurityException) IOException(java.io.IOException)

Example 5 with Project

use of com.google.api.services.cloudresourcemanager.v3.model.Project in project java-docs-samples by GoogleCloudPlatform.

the class AddMember method addMember.

// Adds a member to a preexisting role.
public static void addMember(Policy policy) {
    // policy = service.Projects.GetIAmPolicy(new GetIamPolicyRequest(), your-project-id).Execute();
    String role = "roles/existing-role";
    String member = "user:member-to-add@example.com";
    List<Binding> bindings = policy.getBindings();
    for (Binding b : bindings) {
        if (b.getRole().equals(role)) {
            b.getMembers().add(member);
            System.out.println("Member " + member + " added to role " + role);
            return;
        }
    }
    System.out.println("Role not found in policy; member not added");
}
Also used : Binding(com.google.api.services.cloudresourcemanager.v3.model.Binding)

Aggregations

Project (com.google.api.services.cloudresourcemanager.v3.model.Project)37 Test (org.junit.jupiter.api.Test)28 BaseIntegrationTest (bio.terra.buffer.common.BaseIntegrationTest)15 Pool (bio.terra.buffer.common.Pool)15 ResourceId (bio.terra.buffer.common.ResourceId)15 IntegrationUtils.preparePool (bio.terra.buffer.integration.IntegrationUtils.preparePool)15 FlightManager (bio.terra.buffer.service.resource.FlightManager)15 IOException (java.io.IOException)14 Binding (com.google.api.services.cloudresourcemanager.v3.model.Binding)10 StepStatus (bio.terra.stairway.StepStatus)9 BaseConnectedTest (bio.terra.workspace.common.BaseConnectedTest)8 DisabledIfEnvironmentVariable (org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable)8 FlightDebugInfo (bio.terra.stairway.FlightDebugInfo)7 FlightState (bio.terra.stairway.FlightState)7 AuthenticatedUserRequest (bio.terra.workspace.service.iam.AuthenticatedUserRequest)7 GetIamPolicyRequest (com.google.api.services.cloudresourcemanager.v3.model.GetIamPolicyRequest)7 FlightMap (bio.terra.stairway.FlightMap)6 Policy (com.google.api.services.cloudresourcemanager.v3.model.Policy)6 ArrayList (java.util.ArrayList)6 UUID (java.util.UUID)6