Merged to master as
[02bc515d](https://git1-us-west.apache.org/repos/asf?p=jclouds-labs.git;a=commit;h=02bc515d).
Thanks @cdancy!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/116#issuecomment-75785235
Closed #116.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/116#event-241014934
> + * 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 L
> +import javax.ws.rs.GET;
> +import javax.ws.rs.Path;
> +import javax.ws.rs.core.MediaType;
> +
> +import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
> +import org.jclouds.rest.annotations.EndpointParam;
> +import org.jclouds.rest.annotations.Fallback;
> +import org.jclouds.shipyard.domain.ima
> +import javax.ws.rs.GET;
> +import javax.ws.rs.Path;
> +import javax.ws.rs.core.MediaType;
> +
> +import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
> +import org.jclouds.rest.annotations.EndpointParam;
> +import org.jclouds.rest.annotations.Fallback;
> +import org.jclouds.shipyard.domain.ima
Just two minors left. Nice job @cdancy! Can you fix them and squash again? Then
I'll merge the PR.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/116#issuecomment-75772204
> + * 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 L
@nacx rebased against master. All is working well now ;)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/116#issuecomment-75597979
rebuild please
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/116#issuecomment-75572002
The squashed commit removes the .gitignore and the pom.xml file (causing the
build failure). Can you fix that?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/116#issuecomment-75572501
This is a good start with the Mock tests. But there are a couple things you
have to address in all them:
* Add tests for failed responses (404, etc), for all methods where you
explicitly define a `@Fallback`. Mock tests also have to verify that the
fallback takes place when needed.
* In all tes
@nacx thoughts on latest commit? Want to get the Ok with this latest round so
that I can then push live tests so we can close this PR and work on the next
set of commits for fleshing out Shipyard API (in a subsequent PR of course).
---
Reply to this email directly or view it on GitHub:
https://g
Very good. Been on vacation, not to mention a new baby, and just getting back
into the swing of things. I'll look into getting those tests submitted now that
this initial set of files is in good shape.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs
> + @Override
> + public Builder toBuilder() {
> + return new Builder().fromApiMetadata(this);
> + }
> +
> + public ShipyardApiMetadata() {
> + this(new Builder());
> + }
> +
> + protected ShipyardApiMetadata(Builder builder) {
> + super(builder);
> + }
> +
> + public
Just a couple comments, and the code looks good. Once the tests mentioned in my
previous comment are added, this will be good to go. Thanks @cdancy!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/116#issuecomment-69407759
> + @Override
> + public Builder toBuilder() {
> + return new Builder().fromApiMetadata(this);
> + }
> +
> + public ShipyardApiMetadata() {
> + this(new Builder());
> + }
> +
> + protected ShipyardApiMetadata(Builder builder) {
> + super(builder);
> + }
> +
> + public
> +case 402:
> + exception = new IllegalStateException(message, exception);
> + break;
> +case 404:
> + if
> (!command.getCurrentRequest().getMethod().equals("DELETE")) {
> + exception = new ResourceNotFoundExceptio
> + *
> + * @see http://en.wikipedia.org/wiki/Basic_access_authentication";
> />
> + */
> +@Singleton
> +public class ServiceKeyAuthentication implements HttpRequestFilter {
> + private final Supplier creds;
> +
> + @Inject
> + public ServiceKeyAuthentication(@Provider Supplier creds) {
> +
> +case 402:
> + exception = new IllegalStateException(message, exception);
> + break;
> +case 404:
> + if
> (!command.getCurrentRequest().getMethod().equals("DELETE")) {
> + exception = new ResourceNotFoundExceptio
> +case 402:
> + exception = new IllegalStateException(message, exception);
> + break;
> +case 404:
> + if
> (!command.getCurrentRequest().getMethod().equals("DELETE")) {
> + exception = new ResourceNotFoundExceptio
> +case 402:
> + exception = new IllegalStateException(message, exception);
> + break;
> +case 404:
> + if
> (!command.getCurrentRequest().getMethod().equals("DELETE")) {
> + exception = new ResourceNotFoundExceptio
> +case 402:
> + exception = new IllegalStateException(message, exception);
> + break;
> +case 404:
> + if
> (!command.getCurrentRequest().getMethod().equals("DELETE")) {
> + exception = new ResourceNotFoundExceptio
> + *
> + * @see http://en.wikipedia.org/wiki/Basic_access_authentication";
> />
> + */
> +@Singleton
> +public class ServiceKeyAuthentication implements HttpRequestFilter {
> + private final Supplier creds;
> +
> + @Inject
> + public ServiceKeyAuthentication(@Provider Supplier creds) {
> +
> +import org.jclouds.location.Provider;
> +import org.jclouds.rest.AuthorizationException;
> +
> +import com.google.common.base.Supplier;
> +
> +/**
> + * Shipyard remote API authentication is made via the HTTP header
> 'X-Service-Key' which in turns
> + * has it's value as an encoded string (Shi
> +public interface ContainersApi {
> +
> + @Named("containers:list")
> + @GET
> + @Fallback(EmptyListOnNotFoundOr404.class)
> + List listContainers();
> +
> + @Named("containers:info")
> + @GET
> + @Path("/{id}")
> + ContainerInfo getContainer(@PathParam("id") String id);
> +
> +
> + @Nullable public abstract String name();
> +
> + public abstract Map environment();
> +
> + public abstract List entryPoint();
> +
> + public abstract String hostName();
> +
> + public abstract List bindPorts();
> +
> + public abstract List volumes();
> +
>
> + @SerializedNames({ "name", "environment", "entrypoint", "hostname",
> "bind_ports", "volumes", "restart_policy", "publish", "network_mode" })
> + public static ContainerImageInfo create(String name, Map
> environment, List entryPoint,
> + String
> + }
> +
> + public static class Builder extends
> BaseHttpApiMetadata.Builder {
> +
> + protected Builder() {
> + super(ShipyardApi.class);
> + id("shipyard")
> + .name("Shipyard Remote Docker Management API")
> + .identityName("")
> + .cred
Great! I'll wait for that and have a look once the build is green again :)
Thanks!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/116#issuecomment-67895679
@nacx I've believe I've addressed all issues you noted with latest commit. Let
me add that tester I removed back in.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/116#issuecomment-67895294
> +package org.jclouds.shipyard;
> +
> +import static org.testng.Assert.assertEquals;
> +import static org.testng.Assert.assertNotNull;
> +import static org.testng.Assert.assertTrue;
> +
> +import org.jclouds.apis.ApiMetadata;
> +import org.jclouds.apis.Apis;
> +import org.jclouds.compute.internal.
> +package org.jclouds.shipyard;
> +
> +import static org.testng.Assert.assertEquals;
> +import static org.testng.Assert.assertNotNull;
> +import static org.testng.Assert.assertTrue;
> +
> +import org.jclouds.apis.ApiMetadata;
> +import org.jclouds.apis.Apis;
> +import org.jclouds.compute.internal.
> + @GET
> + @Path("/api/containers")
> + @Fallback(EmptyListOnNotFoundOr404.class)
> + List listContainers();
> +
> + @Named("containers:info")
> + @GET
> + @Path("/api/containers/{id}")
> + @Fallback(NullOn500.class)
> + ContainerInfo getContainer(@PathParam("id") String id);
> +
> +
> + com.google.auto.value
> + auto-value
> + provided
> +
> +
> + org.apache.jclouds.driver
> + jclouds-slf4j
> + ${project.version}
> +
> +
> + org.apache.jclouds.driver
> + jclouds-okhttp
> + ${project.version}
> +
> + exception = new AuthorizationException(message, exception);
> + break;
> +case 402:
> + exception = new IllegalStateException(message, exception);
> + break;
> +case 404:
> + if
> (!command.getCurrent
> +import org.jclouds.rest.AuthorizationException;
> +
> +import com.google.common.base.Supplier;
> +
> +/**
> + * Shipyard remote API authentication is made via the HTTP header
> 'X-Service-Key' which in turns
> + * has it's value as an encoded string (Shipyard-cli generates this for you).
> + *
> + void deleteContainer(@PathParam("id") String id);
> +
> + @Named("containers:stop")
> + @GET
> + @Path("/api/containers/{id}/stop")
> + void stopContainer(@PathParam("id") String id);
> +
> + @Named("containers:restart")
> + @GET
> + @Path("/api/containers/{id}/restart")
>
> +import org.jclouds.shipyard.filters.ServiceKeyAuthentication;
> +
> +@Consumes(MediaType.APPLICATION_JSON)
> +@RequestFilters({ ServiceKeyAuthentication.class })
> +public interface ContainersApi {
> +
> + @Named("containers:list")
> + @GET
> + @Path("/api/containers")
> + @Fallback(Empt
> + @GET
> + @Path("/api/containers")
> + @Fallback(EmptyListOnNotFoundOr404.class)
> + List listContainers();
> +
> + @Named("containers:info")
> + @GET
> + @Path("/api/containers/{id}")
> + @Fallback(NullOn500.class)
> + ContainerInfo getContainer(@PathParam("id") String id);
> +
> +
> + com.google.auto.value
> + auto-value
> + provided
> +
> +
> + org.apache.jclouds.driver
> + jclouds-slf4j
> + ${project.version}
> +
> +
> + org.apache.jclouds.driver
> + jclouds-okhttp
> + ${project.version}
> +
> + live
> +
> +
> +
> + org.codehaus.mojo
> + rat-maven-plugin
> +
> +
> + .apt_generated/**/*
> + target/**/*
> + .settings/**/*
> + .project
> + .factorypath
>
Thanks @cdancy! This is a great starting PR. Code looks pretty good!
Once the initial comments are addressed, and before being able to merge it,
unit tests must be added:
* MockWebserver tests for each Api method.
* Unit tests for the Authentication filter.
* Unit tests for the custom fallback cl
> +package org.jclouds.shipyard;
> +
> +import static org.testng.Assert.assertEquals;
> +import static org.testng.Assert.assertNotNull;
> +import static org.testng.Assert.assertTrue;
> +
> +import org.jclouds.apis.ApiMetadata;
> +import org.jclouds.apis.Apis;
> +import org.jclouds.compute.internal.
> + return properties;
> + }
> +
> + public static class Builder extends
> BaseHttpApiMetadata.Builder {
> +
> + protected Builder() {
> + super(ShipyardApi.class);
> + id("shipyard")
> + .name("Shipyard Remote Docker Management API")
> + .identity
> + }
> + break;
> +case 405:
> + exception = new IllegalArgumentException(message, exception);
> + break;
> +case 409:
> + exception = new IllegalStateException(message, exception);
> + brea
> + exception = new AuthorizationException(message, exception);
> + break;
> +case 402:
> + exception = new IllegalStateException(message, exception);
> + break;
> +case 404:
> + if
> (!command.getCurrent
> + *
> + * @see http://en.wikipedia.org/wiki/Basic_access_authentication";
> />
> + */
> +@Singleton
> +public class ServiceKeyAuthentication implements HttpRequestFilter {
> + private final Supplier creds;
> +
> + @Inject
> + public ServiceKeyAuthentication(@Provider Supplier creds) {
> +
> +import org.jclouds.rest.AuthorizationException;
> +
> +import com.google.common.base.Supplier;
> +
> +/**
> + * Shipyard remote API authentication is made via the HTTP header
> 'X-Service-Key' which in turns
> + * has it's value as an encoded string (Shipyard-cli generates this for you).
> + *
> + void deleteContainer(@PathParam("id") String id);
> +
> + @Named("containers:stop")
> + @GET
> + @Path("/api/containers/{id}/stop")
> + void stopContainer(@PathParam("id") String id);
> +
> + @Named("containers:restart")
> + @GET
> + @Path("/api/containers/{id}/restart")
>
> +import javax.inject.Singleton;
> +
> +import org.jclouds.domain.Credentials;
> +import org.jclouds.http.HttpException;
> +import org.jclouds.http.HttpRequest;
> +import org.jclouds.http.HttpRequestFilter;
> +import org.jclouds.location.Provider;
> +import org.jclouds.rest.AuthorizationException;
> + @GET
> + @Path("/api/containers")
> + @Fallback(EmptyListOnNotFoundOr404.class)
> + List listContainers();
> +
> + @Named("containers:info")
> + @GET
> + @Path("/api/containers/{id}")
> + @Fallback(NullOn500.class)
> + ContainerInfo getContainer(@PathParam("id") String id);
> +import org.jclouds.shipyard.filters.ServiceKeyAuthentication;
> +
> +@Consumes(MediaType.APPLICATION_JSON)
> +@RequestFilters({ ServiceKeyAuthentication.class })
> +public interface ContainersApi {
> +
> + @Named("containers:list")
> + @GET
> + @Path("/api/containers")
> + @Fallback(Empt
> +import javax.ws.rs.core.MediaType;
> +
> +import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
> +import org.jclouds.rest.annotations.Fallback;
> +import org.jclouds.rest.annotations.RequestFilters;
> +import org.jclouds.shipyard.domain.containers.ContainerInfo;
> +import org.jclouds.shipyard.
> + * limitations under the License.
> + */
> +package org.jclouds.shipyard.domain.images;
> +
> +import java.util.List;
> +
> +import org.jclouds.domain.Location;
> +import org.jclouds.javax.annotation.Nullable;
> +import org.jclouds.json.SerializedNames;
> +
> +import com.google.auto.value.AutoVa
> +import org.jclouds.shipyard.domain.images.ImagePortsInfo;
> +
> +import com.google.auto.value.AutoValue;
> +
> +@AutoValue
> +public abstract class ContainerImageInfo {
> +
> + @Nullable public abstract String name();
> +
> + @Nullable public abstract Map environment();
> +
> + @N
> +import org.jclouds.shipyard.domain.images.ImagePortsInfo;
> +
> +import com.google.auto.value.AutoValue;
> +
> +@AutoValue
> +public abstract class ContainerImageInfo {
> +
> + @Nullable public abstract String name();
> +
> + @Nullable public abstract Map environment();
> +
> + @N
> +@AutoValue
> +public abstract class ContainerImageInfo {
> +
> + @Nullable public abstract String name();
> +
> + @Nullable public abstract Map environment();
> +
> + @Nullable public abstract List entrypoint();
> +
> + public abstract String hostname();
> +
> + @Nullabl
> + * 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 L
> + public Builder toBuilder() {
> + return new Builder().fromApiMetadata(this);
> + }
> +
> + public ShipyardApiMetadata() {
> + this(new Builder());
> + }
> +
> + protected ShipyardApiMetadata(Builder builder) {
> + super(builder);
> + }
> +
> + public static Properti
> + * 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 L
> +
> + public static class Builder extends
> BaseHttpApiMetadata.Builder {
> +
> + protected Builder() {
> + super(ShipyardApi.class);
> + id("shipyard")
> + .name("Shipyard Remote Docker Management API")
> + .identityName("")
> + .credentialNa
> +
> + public static Properties defaultProperties() {
> + Properties properties = BaseHttpApiMetadata.defaultProperties();
> + properties.setProperty(Constants.PROPERTY_MAX_RETRIES, "5");
> + properties.setProperty(ShipyardProperties.SHIPYARD_CREDENTIAL,
> "");
> + return pr
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +package org.jclouds.shipyard;
> +
> +import org.jclouds.rest.annotations.Delegate;
> +import org.jclouds.shipyard.features.ContainersApi;
> +import org.jclouds.shipyard.features.
> + live
> +
> +
> +
> + org.codehaus.mojo
> + rat-maven-plugin
> +
> +
> + .apt_generated/**/*
> + target/**/*
> + .settings/**/*
> + .project
> + .factorypath
>
> +
> +org.apache.maven.plugins
> +maven-surefire-plugin
> +
> +
> +integration
> +integration-test
> +
> + test
> +
> +
> +
> + mockwebserver
> + test
> +
> +
> +
> + org.bouncycastle
> + bcprov-jdk15on
> +
> +
> +
> +
> + org.jboss.shrinkwrap
> + shrinkwrap-depchain
> + 1.2.2
> + pom
> + test
What is this dependency used f
> + provided
> +
> +
> + org.apache.jclouds.driver
> + jclouds-slf4j
> + ${project.version}
> +
> +
> + org.apache.jclouds.driver
> + jclouds-okhttp
> + ${project.version}
> +
> +
> + ch.qos.logback
> + logback-classic
> +
A
> +
> +
> + com.google.auto.value
> + auto-value
> + provided
> +
> +
> + org.apache.jclouds.driver
> + jclouds-slf4j
> + ${project.version}
> +
> +
> + org.apache.jclouds.driver
> + jclouds-okhttp
> + ${project.version}
> +
> +
> +
> + org.apache.jclouds
> + jclouds-compute
> + ${project.version}
> +
> +
> + com.google.auto.value
> + auto-value
> + provided
> +
> +
> + org.apache.jclouds.driver
> + jclouds-slf4j
> + ${project.version}
> +
Don't
> +# Shipyard as a local cloud provider
> +
> +##Setup
> +TODO
> +
> +#How it works
> +TODO
> +
> +##Components
> +TODO
> +
> +#Notes:
> +TODO
> +
> +#Troubleshooting
> +TODO
Add some content, or remove the file :)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/
Thanks @nacx and yes it does. I've trimmed the file count down from 60 to 24.
Entire compute package has been removed. All features (minus ContainersApi,
ImagesApi, and EnginesApi) have been removed. You noted to keep only a single
feature, which I chose to be ContainersApi as that is the real w
Thanks @cdancy! And thanks for submitting the PR before having the entire
provider :)
I'd like to suggest, though, that you reduce the scope of the PR. If you have a
look at other similar pull requests ([Orion
BlobStore](https://github.com/jclouds/jclouds-labs/pull/45),
[Profitbricks](https://
Initial commit for shipyard provider. My intent was to have the entire provider
coded and in something like "good working shape" before I submitted a PR but
@nacx strongly suggested I not do this.
This code base is a fork of the work @andreaturli is doing with docker so there
may be more than a
73 matches
Mail list logo