Skip to content

Commit

Permalink
concord-server: explicitly bind org resources
Browse files Browse the repository at this point in the history
  • Loading branch information
ibodrov committed Nov 16, 2023
1 parent 5a01781 commit 55b4fb4
Show file tree
Hide file tree
Showing 23 changed files with 63 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import com.walmartlabs.concord.server.console.ConsoleModule;
import com.walmartlabs.concord.server.events.EventModule;
import com.walmartlabs.concord.server.metrics.MetricModule;
import com.walmartlabs.concord.server.org.secret.SecretModule;
import com.walmartlabs.concord.server.org.OrganizationModule;
import com.walmartlabs.concord.server.org.triggers.TriggersModule;
import com.walmartlabs.concord.server.policy.PolicyModule;
import com.walmartlabs.concord.server.process.ProcessModule;
Expand Down Expand Up @@ -90,11 +90,11 @@ public void configure(Binder binder) {
binder.install(new AuditLogModule());
binder.install(new ConsoleModule());
binder.install(new EventModule());
binder.install(new OrganizationModule());
binder.install(new PolicyModule());
binder.install(new ProcessModule());
binder.install(new RepositoryModule());
binder.install(new RoleModule());
binder.install(new SecretModule());
binder.install(new SecurityModule());
binder.install(new TemplateModule());
binder.install(new TriggersModule());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.walmartlabs.concord.server.org;

import com.google.inject.Binder;
import com.google.inject.Module;
import com.walmartlabs.concord.server.org.inventory.InventoryDataResource;
import com.walmartlabs.concord.server.org.inventory.InventoryQueryResource;
import com.walmartlabs.concord.server.org.inventory.InventoryResource;
import com.walmartlabs.concord.server.org.jsonstore.JsonStoreDataResource;
import com.walmartlabs.concord.server.org.jsonstore.JsonStoreQueryResource;
import com.walmartlabs.concord.server.org.jsonstore.JsonStoreResource;
import com.walmartlabs.concord.server.org.policy.PolicyCheckResource;
import com.walmartlabs.concord.server.org.policy.PolicyResource;
import com.walmartlabs.concord.server.org.project.ProjectResource;
import com.walmartlabs.concord.server.org.project.ProjectResourceV2;
import com.walmartlabs.concord.server.org.project.RepositoryResource;
import com.walmartlabs.concord.server.org.project.RepositoryResourceV2;
import com.walmartlabs.concord.server.org.secret.SecretResource;
import com.walmartlabs.concord.server.org.secret.SecretResourceV2;
import com.walmartlabs.concord.server.org.secret.SecretStoreResource;
import com.walmartlabs.concord.server.org.secret.store.SecretStore;
import com.walmartlabs.concord.server.org.secret.store.concord.ConcordSecretStore;
import com.walmartlabs.concord.server.org.team.TeamResource;
import com.walmartlabs.concord.server.org.triggers.TriggerResource;
import com.walmartlabs.concord.server.org.triggers.TriggerV2Resource;

import static com.google.inject.multibindings.Multibinder.newSetBinder;
import static com.walmartlabs.concord.server.Utils.bindJaxRsResource;

public class OrganizationModule implements Module {

@Override
public void configure(Binder binder) {
bindJaxRsResource(binder, InventoryDataResource.class);
bindJaxRsResource(binder, InventoryQueryResource.class);
bindJaxRsResource(binder, InventoryResource.class);
bindJaxRsResource(binder, JsonStoreDataResource.class);
bindJaxRsResource(binder, JsonStoreQueryResource.class);
bindJaxRsResource(binder, JsonStoreResource.class);
bindJaxRsResource(binder, OrganizationResource.class);
bindJaxRsResource(binder, PolicyCheckResource.class);
bindJaxRsResource(binder, PolicyResource.class);
bindJaxRsResource(binder, ProjectProcessResource.class);
bindJaxRsResource(binder, ProjectResource.class);
bindJaxRsResource(binder, ProjectResourceV2.class);
bindJaxRsResource(binder, RepositoryResource.class);
bindJaxRsResource(binder, RepositoryResourceV2.class);
bindJaxRsResource(binder, TeamResource.class);
bindJaxRsResource(binder, TriggerResource.class);
bindJaxRsResource(binder, TriggerV2Resource.class);

newSetBinder(binder, SecretStore.class).addBinding().to(ConcordSecretStore.class);
bindJaxRsResource(binder, SecretResource.class);
bindJaxRsResource(binder, SecretResourceV2.class);
bindJaxRsResource(binder, SecretStoreResource.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,15 @@
import org.sonatype.siesta.Resource;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.validation.Valid;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
import java.util.UUID;

@Named
@Singleton
@Path("/api/v1/org")
@Tag(name ="Organizations")
@Tag(name = "Organizations")
public class OrganizationResource implements Resource {

private final OrganizationDao orgDao;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
import org.sonatype.siesta.ValidationErrorsException;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
Expand All @@ -64,8 +62,6 @@
import static com.walmartlabs.concord.server.process.state.ProcessStateManager.path;
import static javax.ws.rs.core.Response.Status;

@Named
@Singleton
@Path("/api/v1/org")
@Tag(name = "Project Processes")
public class ProjectProcessResource implements Resource {
Expand Down Expand Up @@ -349,7 +345,7 @@ private UUID getRepoId(UUID projectId, String repoName) {

private Response processFinished(PartialProcessKey processKey) {
return responseTemplates.processFinished(Response.ok(),
Collections.singletonMap("instanceId", processKey.getInstanceId()))
Collections.singletonMap("instanceId", processKey.getInstanceId()))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,13 @@
import org.sonatype.siesta.ValidationErrorsException;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.UUID;

@Named
@Singleton
@Path("/api/v1/org")
@Deprecated
@Tag(name = "Inventory Data")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
import org.sonatype.siesta.Resource;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.validation.Valid;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
Expand All @@ -41,8 +39,6 @@
import java.util.UUID;
import java.util.stream.Collectors;

@Named
@Singleton
@Path("/api/v1/org")
@Deprecated
@Tag(name = "Inventory Queries")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,13 @@
import org.sonatype.siesta.Validate;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.validation.Valid;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;

@Named
@Singleton
@Path("/api/v1/org")
@Deprecated
@Tag(name = "Inventories")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@
import org.sonatype.siesta.Resource;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.List;

@Named
@Singleton
@Path("/api/v1/org")
@Tag(name = "JsonStoreData")
public class JsonStoreDataResource implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,12 @@
import org.sonatype.siesta.ValidationErrorsException;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.validation.Valid;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;

@Named
@Singleton
@Path("/api/v1/org")
@Tag(name = "JsonStoreQuery")
public class JsonStoreQueryResource implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,13 @@
import org.sonatype.siesta.Validate;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.validation.Valid;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.Collection;
import java.util.List;

@Named
@Singleton
@Path("/api/v1/org")
@Tag(name = "JsonStore")
public class JsonStoreResource implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,10 @@
import org.sonatype.siesta.ValidationErrorsException;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.UUID;

@Named
@Singleton
@Path("/api/v1")
@Tag(name = "PolicyCheck")
public class PolicyCheckResource implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
import org.sonatype.siesta.Resource;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.validation.Valid;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
Expand All @@ -56,8 +54,6 @@
import java.util.List;
import java.util.UUID;

@Named
@Singleton
@Path("/api/v2/policy")
@Tag(name = "Policy")
public class PolicyResource implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,13 @@
import org.sonatype.siesta.ValidationErrorsException;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.validation.Valid;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response.Status;
import java.util.*;
import java.util.stream.Collectors;

@Named
@Singleton
@Path("/api/v1/org")
@Tag(name = "Projects")
public class ProjectResource implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,12 @@
import org.sonatype.siesta.Validate;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Named
@Singleton
@Path("/api/v2/org")
@Tag(name = "Projects")
public class ProjectResourceV2 implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,13 @@
import org.sonatype.siesta.Validate;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.validation.Valid;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response.Status;
import java.util.List;
import java.util.UUID;

@Named
@Singleton
@Path("/api/v1/org")
@Tag(name = "Repositories")
public class RepositoryResource implements Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
import org.sonatype.siesta.Resource;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
Expand All @@ -38,8 +36,6 @@
import java.util.List;
import java.util.UUID;

@Named
@Singleton
@Path("/api/v2/repository")
@Tag(name = "RepositoriesV2")
public class RepositoryResourceV2 implements Resource {
Expand Down

This file was deleted.

Loading

0 comments on commit 55b4fb4

Please sign in to comment.