eqixiacEquinix Infrastructure as Code

Projects

Read-only listing of the Resource Manager projects a credential can see.

Scope#

The Projects domain has one resource, which lists the projects from resourceManager/v2 that the credential can see. A project is the unit that Fabric resources, Network Edge devices and role assignments are grouped under, and most create builders take a projectId.

Java
import com.eqixiac.equinix.projects.model.Project;

for (Project project : projects.projects().list()) {
    System.out.println(project.getProjectId() + " " + project.getProjectName());
}

projects.projects().list(true, false);     // includePermissions, includeInbox

list() returns a PaginatedList<Project>. The two-argument form adds the permissions of the caller on each project and the inbox flag.

Example#

Resolve a project name to its identifier and pass it to a builder:

Java
import com.eqixiac.equinix.fabric.enums.GatewayPackageCode;
import com.eqixiac.equinix.fabric.enums.NotificationType;

String production = projects.projects().list().loadAll().stream()
    .filter(p -> "production-network".equals(p.getProjectName()))
    .map(Project::getProjectId)
    .findFirst()
    .orElseThrow(() -> new IllegalStateException("project production-network is not visible to this credential"));

fabric.cloudRouters().define()
    .name("fcr-dc-prod")
    .inMetro("DC")
    .withPackage(GatewayPackageCode.STANDARD)
    .projectId(production)
    .notification(NotificationType.ALL, List.of("noc@example.com"))
    .dryRun()
    .create();

The SDK has no operations that create, rename or delete a project. Those are done in the Equinix portal.

Three classes are named Project: projects.model.Project (this domain), fabric.model.Project (the project reference inside Fabric models) and fabric.beta.model.Project. Each call needs the class from its own package.