jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ignasi Barrera <notificati...@github.com>
Subject Re: [jclouds/jclouds-labs] JCLOUDS-1183 oneandone-monitoringpolicy-api (#325)
Date Tue, 25 Oct 2016 13:18:25 GMT
nacx requested changes on this pull request.

Most are minor comments. Thanks @alibazlamit!

> +
+@AutoValue
+public abstract class MonitoringPolicy {
+
+   public abstract String id();
+
+   public abstract String name();
+
+   @Nullable
+   public abstract String description();
+
+   @Nullable
+   public abstract String state();
+
+   @Nullable
+   public abstract String creationDate();

Change type to `Date`?

> +import org.jclouds.rest.annotations.BinderParam;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.binders.BindToJsonPayload;
+
+@Path("/monitoring_policies")
+@Produces("application/json")
+@Consumes("application/json")
+@RequestFilters(AuthenticateRequest.class)
+public interface MonitoringPolicyApi {
+
+   @Named("monitoringpolicy:list")
+   @GET
+   @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
+   List<MonitoringPolicy> getList();

Renamt to `list()`.

> +
+@Path("/monitoring_policies")
+@Produces("application/json")
+@Consumes("application/json")
+@RequestFilters(AuthenticateRequest.class)
+public interface MonitoringPolicyApi {
+
+   @Named("monitoringpolicy:list")
+   @GET
+   @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
+   List<MonitoringPolicy> getList();
+
+   @Named("monitoringpolicy:list")
+   @GET
+   @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
+   List<MonitoringPolicy> getList(GenericQueryOptions options);

Same here, rename to `list`.

> +   @PUT
+   @Path("/{policyId}")
+   MonitoringPolicy update(@PathParam("policyId") String policyId, @BinderParam(BindToJsonPayload.class)
MonitoringPolicy.UpdatePolicy policy);
+
+   @Named("monitoringpolicy:delete")
+   @DELETE
+   @Path("/{policyId}")
+   @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+   @MapBinder(BindToJsonPayload.class)
+   MonitoringPolicy delete(@PathParam("policyId") String policyId);
+
+   @Named("monitoringpolicy:ports:list")
+   @GET
+   @Path("/{policyId}/ports")
+   @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
+   List<MonitoringPolicy.Port> getPorts(@PathParam("policyId") String policyId);

Rename to `listPorts`

> +   @PUT
+   @Path("/{policyId}/ports/{portId}")
+   MonitoringPolicy updatePort(@PathParam("policyId") String policyId, @PathParam("portId")
String portId, @BinderParam(BindToJsonPayload.class) MonitoringPolicy.Port.UpdatePort port);
+
+   @Named("monitoringpolicy:ports:delete")
+   @DELETE
+   @Path("/{policyId}/ports/{portId}")
+   @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+   @MapBinder(BindToJsonPayload.class)
+   MonitoringPolicy deletePort(@PathParam("policyId") String policyId, @PathParam("portId")
String portId);
+
+   @Named("monitoringpolicy:processes:list")
+   @GET
+   @Path("/{policyId}/processes")
+   @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
+   List<MonitoringPolicy.Process> getProcesses(@PathParam("policyId") String policyId);

Rename to `listProcesses`

> +   @PUT
+   @Path("/{policyId}/processes/{processId}")
+   MonitoringPolicy updateProcess(@PathParam("policyId") String policyId, @PathParam("processId")
String processId, @BinderParam(BindToJsonPayload.class) MonitoringPolicy.Process.UpdateProcess
process);
+
+   @Named("monitoringpolicy:processes:delete")
+   @DELETE
+   @Path("/{policyId}/processes/{processId}")
+   @Fallback(Fallbacks.NullOnNotFoundOr404.class)
+   @MapBinder(BindToJsonPayload.class)
+   MonitoringPolicy deleteProcess(@PathParam("policyId") String policyId, @PathParam("processId")
String processId);
+
+   @Named("monitoringpolicy:servers:list")
+   @GET
+   @Path("/{policyId}/servers")
+   @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
+   List<MonitoringPolicy.Server> getServers(@PathParam("policyId") String policyId);

Rename to `listServers`

> +      MonitoringPolicy updateResult = monitoringPolicyApi().update(currentPolicy.id(),
payload);
+
+      assertNotNull(updateResult);
+      assertEquals(updateResult.name(), updatedName);
+
+   }
+
+   @Test(dependsOnMethods = "testUpdate")
+   public void testAddPort() throws InterruptedException {
+      List<MonitoringPolicy.Port.AddPort> ports = new ArrayList<MonitoringPolicy.Port.AddPort>();
+      MonitoringPolicy.Port.AddPort port = MonitoringPolicy.Port.AddPort.create(80, Types.AlertIfType.RESPONDING,
true, Types.ProtocolType.TCP);
+      ports.add(port);
+      MonitoringPolicy response = monitoringPolicyApi().addPort(currentPolicy.id(), MonitoringPolicy.Port.CreatePort.create(ports));
+      currentPort = response.ports().get(0);
+
+      assertNotNull(response);

Assert before reading the first port

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/325#pullrequestreview-5643212
Mime
View raw message