You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by alibazlamit <no...@github.com> on 2016/09/28 16:20:26 UTC

[jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

@nacx Ready for review, Thanks.
You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds-labs/pull/322

-- Commit Summary --

  * JCLOUDS-1183 - oneandone-monitoringcenter-api

-- File Changes --

    M oneandone/src/main/java/org/apache/jclouds/oneandone/rest/OneAndOneApi.java (11)
    A oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/MonitoringCenter.java (208)
    M oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/Types.java (16)
    A oneandone/src/main/java/org/apache/jclouds/oneandone/rest/domain/options/GenericDateQueryOptions.java (54)
    A oneandone/src/main/java/org/apache/jclouds/oneandone/rest/features/MonitoringCenterApi.java (55)
    A oneandone/src/test/java/org/apache/jclouds/oneandone/rest/features/MonitoringCenterApiLiveTest.java (83)
    A oneandone/src/test/java/org/apache/jclouds/oneandone/rest/features/MonitoringCenterApiMockTest.java (156)
    M oneandone/src/test/java/org/apache/jclouds/oneandone/rest/internal/BaseOneAndOneLiveTest.java (15)
    A oneandone/src/test/resources/monitoringcenters/get.json (165)
    A oneandone/src/test/resources/monitoringcenters/list.json (98)
    A oneandone/src/test/resources/monitoringcenters/list.options.json (98)

-- Patch Links --

https://github.com/jclouds/jclouds-labs/pull/322.patch
https://github.com/jclouds/jclouds-labs/pull/322.diff

-- 
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/322

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by alibazlamit <no...@github.com>.
@nacx Could we close [this ](https://github.com/jclouds/jclouds-labs/pull/325) one first, i would need to merge it with this one, we've talked about this above.

Thanks

-- 
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/322#issuecomment-254795409

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

94fbad5  build fix


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/322/files/b8f9595a2dcd929b754a2178f37d7589841701a0..94fbad55eedd22788350a6c03b786a8bff02b40a

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by Ignasi Barrera <no...@github.com>.
nacx approved this pull request.





-- 
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/322#pullrequestreview-11830116

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

b8f9595  update


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/322/files/0bd6b86833346c85b71dc13ecd01fda98c0e2f83..b8f9595a2dcd929b754a2178f37d7589841701a0

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by Ignasi Barrera <no...@github.com>.
nacx requested changes on this pull request.

Thanks @alibazlamit!

> +        @SerializedNames({"resources", "ports", "process"})
+        public static Alerts create(Resources resources, Ports ports, Process process) {
+            return new AutoValue_MonitoringCenter_Alerts(resources, ports, process);
+        }
+    }
+
+    @AutoValue
+    public abstract static class Agent {
+
+        public abstract boolean agentinstalled();
+
+        public abstract boolean monitoringNeedsAgent();
+
+        public abstract boolean missingAgentAlert();
+
+        @SerializedNames({"agent_installed", "monitoring_needs_agent", "missingAgentAlert"})

Last parameter should be `missing_agent_alert` according tot he docs.

> +
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+import org.apache.jclouds.oneandone.rest.domain.Types.CustomPeriodType;
+import org.apache.jclouds.oneandone.rest.domain.Types.PeriodType;
+import org.jclouds.http.options.BaseHttpRequestOptions;
+
+public class GenericDateQueryOptions extends BaseHttpRequestOptions {
+
+    public static final String PERIOD = "period";
+    public static final String STARTDATE = "start_date";
+    public static final String ENDDATE = "end_date";
+
+    public GenericDateQueryOptions CustomPeriod(Date startDate, Date endDate) {

Method names should start lowercase

> +        queryParameters.put(ENDDATE, FormatDateToISO8601(endDate));
+        return this;
+    }
+
+    public GenericDateQueryOptions FixedPeriods(PeriodType period) {
+
+        queryParameters.put(PERIOD, period.toString());
+        return this;
+    }
+
+    private String FormatDateToISO8601(Date date) {
+        TimeZone tz = TimeZone.getTimeZone("UTC");
+        DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+        df.setTimeZone(tz);
+        return df.format(date).concat("Z");
+    }

It would be better to use the jclouds [DateService](https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/date/DateService.java) to format the dates.

> +import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+@Test(groups = "live", testName = "MonitoringCenterApiLiveTest")
+public class MonitoringCenterApiLiveTest extends BaseOneAndOneLiveTest {
+
+   private Server currentServer;
+
+   private MonitoringCenterApi monitoringCenterApi() {
+
+      return api.monitoringCenterApi();
+   }
+
+   @BeforeClass
+   public void setupTest() throws InterruptedException {
+      currentServer = GetRandomServerWithMonitoringPolicy();

This method can return null. It would be better to throw a `SkipException` here to avoid running the tests in this class if no server is available.
Would it make more sense to just create one server with the needed info, and runt he tests with that one?

> +   private MonitoringCenterApi monitoringCenterApi() {
+
+      return api.monitoringCenterApi();
+   }
+
+   @BeforeClass
+   public void setupTest() throws InterruptedException {
+      currentServer = GetRandomServerWithMonitoringPolicy();
+      assertNodeAvailable(currentServer);
+   }
+
+   @Test
+   public void testList() {
+      List<MonitoringCenter> result = monitoringCenterApi().list();
+
+      assertNotNull(result);

Verify that at least returns one element?

> +   }
+
+   @Test
+   public void testList() {
+      List<MonitoringCenter> result = monitoringCenterApi().list();
+
+      assertNotNull(result);
+   }
+
+   @Test
+   public void testListWithOption() {
+      GenericQueryOptions options = new GenericQueryOptions();
+      options.options(1, 1, null, null, null);
+      List<MonitoringCenter> resultWithQuery = monitoringCenterApi().list(options);
+
+      assertNotNull(resultWithQuery);

Same here, verify that at least one element is returned?

> @@ -202,4 +202,20 @@ public static VPNType fromValue(String v) {
          return Enums.getIfPresent(VPNType.class, v).or(UNRECOGNIZED);
       }
    }
+
+   public enum PeriodType {
+      LAST_HOUR, LAST_24H, LAST_7D, LAST_30D, LAST_365D, UNRECOGNIZED;
+
+      public static PeriodType fromValue(String v) {
+         return Enums.getIfPresent(PeriodType.class, v).or(UNRECOGNIZED);
+      }
+   }
+
+   public enum CustomPeriodType {
+      CUSTOM, UNRECOGNIZED;

Wouldn't it make more sense to have the `CUSTOM` value being part of the `PeriodType` enum, and remove this one?

> +   public void testGetCustomPeriod() throws InterruptedException, ParseException {
+      server.enqueue(
+              new MockResponse().setBody(stringFromResource("/monitoringcenters/get.json"))
+      );
+      GenericDateQueryOptions options = new GenericDateQueryOptions();
+      String startStr = "11-11-2012";
+      String endStr = "11-11-2013";
+      DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
+      Date end = dateFormat.parse(endStr);
+      Date start = dateFormat.parse(startStr);
+      options.CustomPeriod(start, end);
+      MonitoringCenter result = monitoringCenterApi().get("serverId", options);
+
+      assertNotNull(result);
+      assertEquals(server.getRequestCount(), 1);
+      assertSent(server, "GET", "/monitoring_center/serverId?period=CUSTOM&start_date=" + URLEncoder.encode(FormatDateToISO8601(start)) + "&end_date=" + URLEncoder.encode(FormatDateToISO8601(end)));

Put the expected date as a string literal, to make sure we are serializing the date as expected.

> +
+   public void testGetCustomPeriod404() throws InterruptedException, ParseException {
+      server.enqueue(
+              new MockResponse().setResponseCode(404));
+      GenericDateQueryOptions options = new GenericDateQueryOptions();
+      String startStr = "11-11-2012";
+      String endStr = "11-11-2013";
+      DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
+      Date end = dateFormat.parse(endStr);
+      Date start = dateFormat.parse(startStr);
+      options.CustomPeriod(start, end);
+      MonitoringCenter result = monitoringCenterApi().get("serverId", options);
+
+      assertEquals(result, null);
+      assertEquals(server.getRequestCount(), 1);
+      assertSent(server, "GET", "/monitoring_center/serverId?period=CUSTOM&start_date=" + URLEncoder.encode(FormatDateToISO8601(start)) + "&end_date=" + URLEncoder.encode(FormatDateToISO8601(end)));

Same here about expected dates.

> @@ -107,4 +111,11 @@ protected RecordedRequest assertSent(MockWebServer server, String method, String
       assertEquals(parser.parse(new String(request.getBody(), Charsets.UTF_8)), parser.parse(json));
       return request;
    }
+
+   protected String FormatDateToISO8601(Date date) {
+      TimeZone tz = TimeZone.getTimeZone("UTC");
+      DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+      df.setTimeZone(tz);
+      return df.format(date).concat("Z");
+   }

Same as before, better use the DateService. You can get it from the Guice injector.

> @@ -143,4 +143,17 @@ protected Server turnOnServer(String serverId) {
    protected Server turnOFFServer(String serverId) {
       return api.serverApi().updateStatus(serverId, Server.UpdateStatus.create(Types.ServerAction.POWER_OFF, Types.ServerActionMethod.SOFTWARE));
    }
+
+   protected Server GetRandomServerWithMonitoringPolicy() throws InterruptedException {
+      List<Server> result = api.serverApi().list();
+      for (Server server : result) {
+         Thread.sleep(2000);

Is this sleep really needed?

> @@ -143,4 +143,17 @@ protected Server turnOnServer(String serverId) {
    protected Server turnOFFServer(String serverId) {
       return api.serverApi().updateStatus(serverId, Server.UpdateStatus.create(Types.ServerAction.POWER_OFF, Types.ServerActionMethod.SOFTWARE));
    }
+
+   protected Server GetRandomServerWithMonitoringPolicy() throws InterruptedException {
+      List<Server> result = api.serverApi().list();
+      for (Server server : result) {
+         Thread.sleep(2000);
+         server = api.serverApi().get(server.id());
+         if (server.monitoringPolicy() != null) {
+            return server;
+         }
+      }
+
+      return null;

If no server can be found, just create one for this testing? Or change the test class to always create one for it.

-- 
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/322#pullrequestreview-3286571

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by Ignasi Barrera <no...@github.com>.
I'm not sure why the checks fail, but a local build succeeds. Mind squashing and rebasing so I can cleanly merge it?

-- 
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/322#issuecomment-254762081

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by alibazlamit <no...@github.com>.
@nacx i have re-based and fixed a few problems with the sharedstorages test , now the build works fine.
Thanks.

-- 
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/322#issuecomment-264489115

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 2 commits.

c3298ce  JCLOUDS-1183 oneandone-monitoringpolicy-api
afcac05  Merge branch 'oneandone-monitoringpolicy-api' into oneandone-monitoringcenter-api


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/322/files/c28a75b79f8f3e509dee01b0ee1335ff149581ab..afcac05eeddf934b3c1387075694cb31b3c1633c

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

c28a75b  Review changes


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/322/files/5727c54041414d3defc43f6750df2c37f886d005..c28a75b79f8f3e509dee01b0ee1335ff149581ab

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by Ignasi Barrera <no...@github.com>.
Running the build on your branch all tests pass, but rebasing it to the latest version of master I still have test failures. Mind rebasing the PR to the latest version of master and make sure tests pass there?
Thanks!

-- 
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/322#issuecomment-264463942

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

f51346d  Added the missing files with the correct folder name


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/322/files/9cae8368e9ee05fe8125f96be880ccada771ddf3..f51346d47f470822a4c3114e423af90eb72155e4

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by Ignasi Barrera <no...@github.com>.
Pushed to [master](http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/8bd83980) and [2.0.x](http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/bc1a7eb6).
Thanks @alibazlamit!

-- 
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/322#issuecomment-265487124

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by Ignasi Barrera <no...@github.com>.
Closed #322.

-- 
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/322#event-885450767

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

9cae836  removing bad named files


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/322/files/94fbad55eedd22788350a6c03b786a8bff02b40a..9cae8368e9ee05fe8125f96be880ccada771ddf3

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by Ignasi Barrera <no...@github.com>.
Reopened #322.

-- 
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/322#event-879750406

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by alibazlamit <no...@github.com>.
@nacx a friendly reminder can we move on with this PR, Thanks.

-- 
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/322#issuecomment-264226707

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

9c841b6  minor change in mock tests


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/322/files/a8d4f7506e1e1c47a0343030f8deccb48a7775a0..9c841b62561498d85e06293144f9047667c7d0b1

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by alibazlamit <no...@github.com>.
alibazlamit commented on this pull request.



> @@ -143,4 +143,17 @@ protected Server turnOnServer(String serverId) {
    protected Server turnOFFServer(String serverId) {
       return api.serverApi().updateStatus(serverId, Server.UpdateStatus.create(Types.ServerAction.POWER_OFF, Types.ServerActionMethod.SOFTWARE));
    }
+
+   protected Server GetRandomServerWithMonitoringPolicy() throws InterruptedException {
+      List<Server> result = api.serverApi().list();
+      for (Server server : result) {
+         Thread.sleep(2000);
+         server = api.serverApi().get(server.id());
+         if (server.monitoringPolicy() != null) {
+            return server;
+         }
+      }
+
+      return null;

Creating a server is not enough since i will need to create a monitoring policy on that server too, that is the next PR, maybe open the next PR and then merge it into this one to be able to create the policy, i am following the order of the API documentation for the PR'S WDYT?

-- 
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/322

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

aca7df7  removed test code


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/322/files/9c841b62561498d85e06293144f9047667c7d0b1..aca7df70084a65595429a154da481f7146f9fb7e

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by alibazlamit <no...@github.com>.
alibazlamit commented on this pull request.



> @@ -143,4 +143,17 @@ protected Server turnOnServer(String serverId) {
    protected Server turnOFFServer(String serverId) {
       return api.serverApi().updateStatus(serverId, Server.UpdateStatus.create(Types.ServerAction.POWER_OFF, Types.ServerActionMethod.SOFTWARE));
    }
+
+   protected Server GetRandomServerWithMonitoringPolicy() throws InterruptedException {
+      List<Server> result = api.serverApi().list();
+      for (Server server : result) {
+         Thread.sleep(2000);
+         server = api.serverApi().get(server.id());
+         if (server.monitoringPolicy() != null) {
+            return server;
+         }
+      }
+
+      return null;

This has been fixed and updated with the latest changes.

-- 
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/322

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

ab90772  Minor change


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/322/files/afd2e66b30b5e91743146e49136554612e637bfe..ab907727b17778f92d7ea796579e6ee951b2f8ec

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by alibazlamit <no...@github.com>.
@nacx I have updated this branch with the latest changes.
Thanks

-- 
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/322#issuecomment-259499893

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by Ignasi Barrera <no...@github.com>.
nacx commented on this pull request.



> @@ -143,4 +143,17 @@ protected Server turnOnServer(String serverId) {
    protected Server turnOFFServer(String serverId) {
       return api.serverApi().updateStatus(serverId, Server.UpdateStatus.create(Types.ServerAction.POWER_OFF, Types.ServerActionMethod.SOFTWARE));
    }
+
+   protected Server GetRandomServerWithMonitoringPolicy() throws InterruptedException {
+      List<Server> result = api.serverApi().list();
+      for (Server server : result) {
+         Thread.sleep(2000);
+         server = api.serverApi().get(server.id());
+         if (server.monitoringPolicy() != null) {
+            return server;
+         }
+      }
+
+      return null;

+1

-- 
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/322

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by alibazlamit <no...@github.com>.
alibazlamit commented on this pull request.



> @@ -202,4 +202,20 @@ public static VPNType fromValue(String v) {
          return Enums.getIfPresent(VPNType.class, v).or(UNRECOGNIZED);
       }
    }
+
+   public enum PeriodType {
+      LAST_HOUR, LAST_24H, LAST_7D, LAST_30D, LAST_365D, UNRECOGNIZED;
+
+      public static PeriodType fromValue(String v) {
+         return Enums.getIfPresent(PeriodType.class, v).or(UNRECOGNIZED);
+      }
+   }
+
+   public enum CustomPeriodType {
+      CUSTOM, UNRECOGNIZED;

i intentionally separated them, when you choose CUSTOM you must provide start and end date all the other types do not require that, easier for users. 

-- 
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/322

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by Ignasi Barrera <no...@github.com>.
Apologies for the delay. I'm having some issues running the tests once rebased. Let me trigger a new CI build: rebuild please

-- 
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/322#issuecomment-264415735

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by Ignasi Barrera <no...@github.com>.
nacx commented on this pull request.



> @@ -202,4 +202,20 @@ public static VPNType fromValue(String v) {
          return Enums.getIfPresent(VPNType.class, v).or(UNRECOGNIZED);
       }
    }
+
+   public enum PeriodType {
+      LAST_HOUR, LAST_24H, LAST_7D, LAST_30D, LAST_365D, UNRECOGNIZED;
+
+      public static PeriodType fromValue(String v) {
+         return Enums.getIfPresent(PeriodType.class, v).or(UNRECOGNIZED);
+      }
+   }
+
+   public enum CustomPeriodType {
+      CUSTOM, UNRECOGNIZED;

Oh, I see. This way you avoid users calling the `FixedPeriods` options method with the wrong type. Thanks for clarifying!

-- 
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/322

Re: [jclouds/jclouds-labs] JCLOUDS-1183 - oneandone-monitoringcenter-api (#322)

Posted by Ignasi Barrera <no...@github.com>.
Closed #322.

-- 
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/322#event-879750390