You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Andrea Turli <no...@github.com> on 2017/01/03 15:12:20 UTC
[jclouds/jclouds-labs] [JCLOUDS-1219] initial commit for Packet.net
API (#337)
This is the first PR for Packet API, to simplify the review process, and it only adds the pom.xml and the domain objects, based on https://www.packet.net/developers/api/
Those are the minimum set needed to support the jclouds abstraction.
You can view, comment on, or merge this pull request online at:
https://github.com/jclouds/jclouds-labs/pull/337
-- Commit Summary --
* initial commit for Packet.net API
-- File Changes --
A packet/README.md (1)
A packet/pom.xml (145)
A packet/src/main/java/domain/ActionType.java (39)
A packet/src/main/java/domain/BillingCycle.java (59)
A packet/src/main/java/domain/Device.java (107)
A packet/src/main/java/domain/Distribution.java (71)
A packet/src/main/java/domain/Facility.java (45)
A packet/src/main/java/domain/Href.java (34)
A packet/src/main/java/domain/IpAddress.java (59)
A packet/src/main/java/domain/OperatingSystem.java (48)
A packet/src/main/java/domain/Plan.java (56)
A packet/src/main/java/domain/Pricing.java (34)
A packet/src/main/java/domain/Project.java (42)
A packet/src/main/java/domain/Region.java (96)
A packet/src/main/java/domain/Specs.java (128)
A packet/src/main/java/domain/SshKey.java (53)
M pom.xml (1)
-- Patch Links --
https://github.com/jclouds/jclouds-labs/pull/337.patch
https://github.com/jclouds/jclouds-labs/pull/337.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/337
Re: [jclouds/jclouds-labs] [JCLOUDS-1219] initial commit for
Packet.net API (#337)
Posted by Andrea Turli <no...@github.com>.
merged at [master](http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/cb3ab1ca)
--
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/337#issuecomment-271420829
Re: [jclouds/jclouds-labs] [JCLOUDS-1219] initial commit for
Packet.net API (#337)
Posted by Andrea Turli <no...@github.com>.
ok I will open up the next PR with what you suggested. merging now
--
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/337#issuecomment-271419271
Re: [jclouds/jclouds-labs] [JCLOUDS-1219] initial commit for
Packet.net API (#337)
Posted by Ignasi Barrera <no...@github.com>.
nacx requested changes on this pull request.
Thanks @andreaturli!
Can't wait to have this provider :)
Just some minor comments and general considerations about using primitives where we have Numbers and Boolean variables that are non-nullable.
> + * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package domain;
Change packages to `org.jclouds.packet`
> + checkArgument(state.isPresent(), "Expected one of %s but was %s", Joiner.on(',').join(State.values()), value);
+ return state.get();
+ }
+ }
+
+ public abstract String id();
+ public abstract String shortId();
+ public abstract String hostname();
+ @Nullable
+ public abstract String description();
+ public abstract State state();
+ public abstract List<String> tags();
+ public abstract String billingCycle();
+ public abstract String user();
+ public abstract String iqn();
+ public abstract Boolean locked();
Can this be a primitive type? Is this ever null?
> +
+@AutoValue
+public abstract class IpAddress {
+
+ public abstract String id();
+ public abstract Integer addressFamily();
+ public abstract String netmask();
+ public abstract Boolean publicAddress();
+ public abstract Integer cidr();
+ public abstract Boolean management();
+ public abstract Boolean manageable();
+ public abstract Href assignedTo();
+ public abstract String network();
+ public abstract String address();
+ public abstract String gateway();
+ public abstract String href();
Are all the integer and boolean fields here nullable? Can we change them to primitives?
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package domain;
+
+import java.util.Set;
+
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * {"id":"06e21644-a769-11e6-80f5-76304dec7eb7","slug":"alpine_3","name":"Alpine 3","distro":"alpine","version":"3","provisionable_on":[]}
+ */
This json an easily become outdated as the API evolves. Remove it from the javadoc? (also apply to the other classes).
> +import java.security.PublicKey;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
+
+import com.google.auto.value.AutoValue;
+
+@AutoValue
+public abstract class Project {
+
+ public abstract String id();
+ public abstract String name();
+ @Nullable
+ public abstract String fingerprint();
+ @Nullable
+ public abstract PublicKey publicKey();
You will probably need a custom adapter to be able to serialize/deserialize a PublicKey object. Consider adding it to a parser module like in the [DigitalOcean2 provider](https://github.com/jclouds/jclouds/blob/master/providers/digitalocean2/src/main/java/org/jclouds/digitalocean2/config/DigitalOceanParserModule.java#L66).
--
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/337#pullrequestreview-14947791
Re: [jclouds/jclouds-labs] [JCLOUDS-1219] initial commit for
Packet.net API (#337)
Posted by Andrea Turli <no...@github.com>.
thx @nacx
--
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/337#issuecomment-271420887
Re: [jclouds/jclouds-labs] [JCLOUDS-1219] initial commit for
Packet.net API (#337)
Posted by Andrea Turli <no...@github.com>.
Closed #337.
--
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/337#event-916645302
Re: [jclouds/jclouds-labs] [JCLOUDS-1219] initial commit for
Packet.net API (#337)
Posted by Andrea Turli <no...@github.com>.
andreaturli commented on this pull request.
> +
+@AutoValue
+public abstract class IpAddress {
+
+ public abstract String id();
+ public abstract Integer addressFamily();
+ public abstract String netmask();
+ public abstract Boolean publicAddress();
+ public abstract Integer cidr();
+ public abstract Boolean management();
+ public abstract Boolean manageable();
+ public abstract Href assignedTo();
+ public abstract String network();
+ public abstract String address();
+ public abstract String gateway();
+ public abstract String href();
not sure I'd prefer to leave them as objects for more flexibility
--
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/337
Re: [jclouds/jclouds-labs] [JCLOUDS-1219] initial commit for
Packet.net API (#337)
Posted by Andrea Turli <no...@github.com>.
@andreaturli pushed 1 commit.
947df3e clean up domain objects
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/337/files/57019f3c36af2ebadc07b0633aff62e062a670ca..947df3e8ce4c315aaba458b9489385612a051913
Re: [jclouds/jclouds-labs] [JCLOUDS-1219] initial commit for
Packet.net API (#337)
Posted by Andrea Turli <no...@github.com>.
andreaturli commented on this pull request.
> + * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package domain;
wtf! sorry I'll fix that right away
--
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/337
Re: [jclouds/jclouds-labs] [JCLOUDS-1219] initial commit for
Packet.net API (#337)
Posted by Ignasi Barrera <no...@github.com>.
Yes it does :) What about the public key adapter? I'd add it early,as soon as the ApiMetadata and the corresponding HttpModule are created, so we have all the model related stuff in place. 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/337#issuecomment-271302030
Re: [jclouds/jclouds-labs] [JCLOUDS-1219] initial commit for
Packet.net API (#337)
Posted by Andrea Turli <no...@github.com>.
looks better, @nacx ?
--
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/337#issuecomment-270927225