@pimenas pushed 1 commit.
a9a9d30 Merge remote-tracking branch 'jclouds/master' into
new/openstack-token-based-auth
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds/pull
@gaul I'll check it during the weekend!
--
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/pull/433#issuecomment-332757167
I'll work on it.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/433#issuecomment-85900114
Did a rebase because it has been a long time and there were merge conflicts.
Also @jdaggett you had a comment about ParseAccessTest that I had a question
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/433#issuecomment-59185690
Sorry for the delayed response, I did a rebase and implemented your feedback,
except the ones that I don't yet understand :).
One of the feedback I couldn't understand is @jdaggett 's suggestion to use
ParseAccessTest, to which I commented the following:
*... I can't find a way to get an Acces
> @@ -87,6 +87,41 @@ public HttpRequest
> initialAuthWithAccessKeyAndSecretKeyAndTenantId(String access
> accessKey, secretKey,
> getTenantId()), "application/json")).build();
> }
>
> + public HttpRequest initialAuthWithTokenAndTenantName(
> @@ -31,6 +32,11 @@ public void testCredentialTypeOfWhenValid() {
> "password")), CredentialTypes.PASSWORD_CREDENTIALS);
> }
>
> + public void testCredentialTypeOfWhenValidToken() {
> +
> assertEquals(CredentialTypes.credentialTypeOf(TokenCredentials.createWithToken("
> +
> +import com.google.common.base.Optional;
> +
> +@CredentialType(CredentialTypes.TOKEN_CREDENTIALS)
> +@Singleton
> +public class AuthenticateTokenCredentials extends
> BaseAuthenticator {
> + protected final AuthenticationApi api;
> +
> + @Inject
> + public AuthenticateTokenCredentials
> @@ -32,6 +32,8 @@
>
> public static final String PASSWORD_CREDENTIALS = "passwordCredentials";
>
> + public static final String TOKEN_CREDENTIALS = "token";
In that case I should make changes to `BindAuthToJsonPayload` because this
value is used to create the `token` JSONt field.
Wh
> @@ -99,4 +100,33 @@ Access authenticateWithTenantNameAndCredentials(@Nullable
> @PayloadParam("tenantN
> @MapBinder(BindAuthToJsonPayload.class)
> Access authenticateWithTenantIdAndCredentials(@Nullable
> @PayloadParam("tenantId") String tenantId,
> ApiAccessKeyCredentials api
> @@ -42,6 +42,18 @@ public void testGetApiMetaData() {
>assertEquals(metadata, new ParseRackspaceApiMetadataTest().expected());
> }
>
> + public void testGetApiMetaDataWithTokenCredentialsAuth() {
> + KeystoneApi api = requestsSendResponses(
> +keystoneAuthWithToke
Should I close this?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/433#issuecomment-48984007
Hi @jdaggett . I had a quick look on the openstack-common, I wasn't aware of
this. To tell you the truth I did not find how to use this authentication
method with openstack-common, but I didn't gave it much time either.
I'm working with version 2.0
(http://developer.openstack.org/api-ref-identit
@jdaggett I updated the first comment with more information!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/433#issuecomment-47954217
This PR adds support for token based authentication in openstack-keystone.
You can merge this Pull Request by running:
git pull https://github.com/pimenas/jclouds new/openstack-token-based-auth
Or you can view, comment on it, or merge it online at:
https://github.com/jclouds/jclouds/pull
:) You're all very welcome and thank you also!!! It's been a very learning
experience for me.
@everett-toews indeed its [me](https://twitter.com/pimenas) on twitter :)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/339#issuecomment-47831452
I did the rebase and also squashed the change to 1 commit, so it should be
ready for merging!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/339#issuecomment-47446294
Actually I have one more thing to do, rebasing, never done this before so I
have to read a little.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/339#issuecomment-47437937
Hello! I've implemented all the suggestions, removed the expect style tests,
and updated the MockWebStyle and live tests.
I also merged with the latest master branch, so it's ready for merging!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/339#issu
Hi!
Sorry for the late response, but I couldn't find time... As @demobox pointed
out we need
* different implementation of fromValue(). Already done that, haven't pushed
the changes yet.
* use MockWebServer style tests instead of expect tests. I'll remove the expect
tests and implement them usi
> + }
> +
> + /**
> + * Used from jclouds builtin deserializer.
> + */
> + public static Type fromValue(String type) {
> + if (type != null) {
> + for (Type value : Type.values()) {
> +if (type.equals(value.type)) {
> +
> + }
> +
> + /**
> + * Used from jclouds builtin deserializer.
> + */
> + public static Type fromValue(String type) {
> + if (type != null) {
> + for (Type value : Type.values()) {
> +if (type.equals(value.type)) {
> +
> +
> .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/";
> + + "servers/" + serverId + "/action")
> + .build();
> +
> + HttpResponse getConsoleResponse =
> HttpResponse.builder().statusCode(200)
> + .message("HTTP/1.1 200 OK")
> +
> + private final String type;
> +
> + Type(String type) {
> + this.type = type;
> + }
> +
> + public String type() {
> + return type;
> + }
> +
> + /**
> + * Used from jclouds builtin deserializer.
> + */
> + public static Type fromVal
> + private final String type;
> +
> + Type(String type) {
> + this.type = type;
> + }
> +
> + public String type() {
> + return type;
> + }
> +
> + /**
> + * Used from jclouds builtin deserializer.
> + */
> + public static Type fromVal
> +
> + Console.Type type = (Console.Type) postParams.get("type");
> +
> + switch (type) {
> + case NOVNC:
> + case XVPVNC:
> +action = "os-getVNCConsole";
> +break;
> + case SPICE_HTML5:
> +action = "os-getSPICEConsole";
> +
> +
> .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/";
> + + "servers/" + serverId + "/action")
> + .build();
> +
> + HttpResponse getConsoleResponse =
> HttpResponse.builder().statusCode(200)
> + .message("HTTP/1.1 200 OK")
> +
> +
> + private final String type;
> +
> + Type(String type) {
> + this.type = type;
> + }
> +
> + public String type() {
> + return type;
> + }
> +
> + /**
> + * Used from jclouds builtin deserializer.
> + */
> + public static Type fro
> +
> + Console.Type type = (Console.Type) postParams.get("type");
> +
> + switch (type) {
> + case NOVNC:
> + case XVPVNC:
> +action = "os-getVNCConsole";
> +break;
> + case SPICE_HTML5:
> +action = "os-getSPICEConsole";
> +
I plan to add tests for all types, after all they are tested in a similar way.
The reason I haven't done it yet, is that I want you guys to review the test
code (especialy the mockwebserver style tests) and tell me if I should
change/add/remove something.
---
Reply to this email directly or vie
> +@Test(groups = "live", testName = "ConsolesApiLiveTest")
> +public class ConsolesApiLiveTest extends BaseNovaApiLiveTest {
> +
> +@Test
> +public void testGetVNCConsole() {
> +for (String zoneId : api.getConfiguredZones()) {
> +Optional apiOption =
> api.getConsolesE
> + */
> +@Test(groups = "live", testName = "ConsolesApiLiveTest")
> +public class ConsolesApiLiveTest extends BaseNovaApiLiveTest {
> +
> +@Test
> +public void testGetVNCConsole() {
> +for (String zoneId : api.getConfiguredZones()) {
> +Optional apiOption =
> api.getCo
> +@Test
> +public void testGetVNCConsole() {
> +for (String zoneId : api.getConfiguredZones()) {
> +Optional apiOption =
> api.getConsolesExtensionForZone(zoneId);
> +if (!apiOption.isPresent())
> +continue;
> +
> +ConsolesApi ap
> +
> .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/";
> + + "servers/" + serverId + "/action")
> + .build();
> +
> + HttpResponse getConsoleResponse =
> HttpResponse.builder().statusCode(200)
> + .message("HTTP/1.1 200 OK")
> +
> +import org.jclouds.openstack.v2_0.ServiceType;
> +import org.jclouds.openstack.v2_0.services.Extension;
> +
> +import com.google.common.annotations.Beta;
> +
> +/**
> + * Provides synchronous access to Consoles.
> + *
> + *
> + * @see ConsoleAsyncApi
> + */
> +@Beta
> +@Extension(of = ServiceTy
> + private final String type;
> +
> + Type(String type) {
> + this.type = type;
> + }
> +
> + public String type() {
> + return type;
> + }
> +
> + /**
> + * Used from jclouds builtin deserializer.
> + */
> + public static Type fromVal
> +
> + private final String type;
> +
> + Type(String type) {
> + this.type = type;
> + }
> +
> + public String type() {
> + return type;
> + }
> +
> + /**
> + * Used from jclouds builtin deserializer.
> + */
> + public static Type fro
> + switch (type) {
> + case NOVNC:
> + case XVPVNC:
> +action = "os-getVNCConsole";
> +break;
> + case SPICE_HTML5:
> +action = "os-getSPICEConsole";
> +break;
> + case RDP_HTML5:
> +action = "os-getRD
> +import org.jclouds.rest.binders.BindToJsonPayload;
> +
> +import com.google.common.collect.ImmutableMap;
> +import com.google.common.collect.ImmutableSortedMap;
> +
> +@Singleton
> +public class BindConsoleToJsonPayload extends BindToJsonPayload {
> +
> + @Inject
> + public BindConsoleToJson
> +
> + Console.Type type = (Console.Type) postParams.get("type");
> +
> + switch (type) {
> + case NOVNC:
> + case XVPVNC:
> +action = "os-getVNCConsole";
> +break;
> + case SPICE_HTML5:
> +action = "os-getSPICEConsole";
> +
I pushed the change in Console.Type enum suggested by @zack-shoylev in comments
above.
Any suggestions on the ConsolesApiMockTest.java, ConsolesApiLiveTest.java?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/339#issuecomment-44114247
> + * Server Console Connection structure.
> + *
> + * @author Epi Vou
> + * @see http://api.openstack.org/api-ref-compute-v2-ext.html"; />
> + */
> +public class Console {
> + public enum Type {
> + NOVNC("novnc"),
> + XVPVNC("xvpvnc"),
> + SPICE_HTML5("spice-html5"),
> + RDP
Is this a real failure?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/339#issuecomment-44089879
> +@Extension(of = ServiceType.COMPUTE, namespace =
> ExtensionNamespaces.CONSOLES)
> +@RequestFilters(AuthenticateRequest.class)
> +public interface ConsolesAsyncApi {
> + /**
> +* @see ConsolesApi#getConsole
> +*/
> + @Named("server:console")
> + @POST
> + @Path("/servers/{server
> + * Server Console Connection structure.
> + *
> + * @author Epi Vou
> + * @see http://api.openstack.org/api-ref-compute-v2-ext.html"; />
> + */
> +public class Console {
> + public enum Type {
> + NOVNC("novnc"),
> + XVPVNC("xvpvnc"),
> + SPICE_HTML5("spice-html5"),
> + RDP
> + *
> + * @author Epi Vou
> + */
> +@Singleton
> +public class BindConsoleToJsonPayload extends BindToJsonPayload {
> +
> + @Inject
> + public BindConsoleToJsonPayload(Json jsonBinder) {
> + super(jsonBinder);
> + }
> +
> + @Override
> + public R bindToRequest(R request, Map Obje
Hi!
I pushed the changes, I also added a mockstyle test, but I would like some
feedback on this.
many thanks for all the help so far!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/339#issuecomment-41887119
> + .addHeader("X-Auth-Token", authToken)
> + .payload(payloadFromStringWithContentType(
> + "{\"os-getVNCConsole\":{\"type\":\"novnc\"}}",
> + "application/json"))
> +
> .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/34
> + .addHeader("X-Auth-Token", authToken)
> + .payload(payloadFromStringWithContentType(
> + "{\"os-getVNCConsole\":{\"type\":\"novnc\"}}",
> + "application/json"))
> +
> .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/34
> + .addHeader("X-Auth-Token", authToken)
> + .payload(payloadFromStringWithContentType(
> + "{\"os-getVNCConsole\":{\"type\":\"novnc\"}}",
> + "application/json"))
> +
> .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/34
Hi all,
I'm currently proceeding with the changes, and I stumbled upon the switching to
one `getConsole()` function.
In `ConsolesAsyncApi.java` the `@Payload` annotation needs an extra parameter,
that is related to the console type parameter. Any ideas on how to pass the
correct os-getVNCConso
I'll proceed with the fixes, and I would also like to replace `getRDPConsole`,
`getSPICEConsole` and `getRDPConsole` with a single `getConsole`. Any
objections on that?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/339#issuecomment-40431161
> +
> + /**
> +* Get SPICE Console
> +* @param serverId Server id
> +* @param type Only "spice-html5" is supported
> +* @return a Console object containing the console url and type.
> +*/
> + Console getSPICEConsole(String serverId, Console.Type type);
> +
> + /**
> +*
> + }
> +
> + private final String type;
> +
> + Type(String type) {
> + this.type = type;
> + }
> +
> + public String type() {
> + return type;
> + }
> +
> + /**
> + * Used from jclouds builtin deserializer.
> + */
> + public stat
> + * Server Console Connection structure.
> + *
> + * @author Epi Vou
> + * @see http://api.openstack.org/api-ref-compute-v2-ext.html"; />
> + */
> +public class Console {
> + public enum Type {
> + NOVNC("novnc"),
> + XVPVNC("xvpvnc"),
> + SPICE_HTML5("spice-html5"),
> + RDP
Just uploaded my changes which include switching to URI for console url and
enum for console type.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/339#issuecomment-40316074
Thanks, that will work!
Epimenidis Voutsakis
Electronics & Computer Engineer
pime...@gmail.com
+30 695 720 6307 (Mobile, Greece)
On Sun, Apr 13, 2014 at 3:40 PM, Ignasi Barrera wrote:
> Jclouds already has a built-in enum deserializer. It will use the
> valueOfmethod, but will fallback to a
>
Is there a simple way to provide a custom deserialization adapter for the
underlying gson? I need this in order to change the console type field to an
enum type field.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/339#issuecomment-40304858
Ok, I'll get on to it. In the mean-time you can all have a look of the how the
code looks now.
I decided to provide three different functions, in accordance with the
openstack consoles api.
These are getVNCConsole(), getSPICEConsole() and getRDPConsole().
---
Reply to this email directly or view
Hi @jdaggett, @everett-toews!
I'll make the changes and add a "live" test as well. A question that I have
is if you think that the Console class,
is good as it is, or if for example I should change the url to URI type,
and make the type an enum. What do you think?
Epimenidis Voutsakis
Electroni
Hi @demobox! It's my first attempt to contribute!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/339#issuecomment-39817198
> +
> + public void testGetConsoleWhenResponseIs404NotFound() throws Exception {
> + String serverId = "d3aae414-9dc9-46d1-a51b-e9b7071a84b7";
> + String type = "novnc";
> +
> + HttpRequest getConsole = HttpRequest
> + .builder()
> + .method("POST")
> + .addHea
> +
> + public void testGetConsoleWhenResponseIs401NotAuthorized() throws
> Exception {
> + String serverId = "d3aae414-9dc9-46d1-a51b-e9b7071a84b7";
> + String type = "novnc";
> +
> + HttpRequest getConsole = HttpRequest
> + .builder()
> + .method("POST")
> +
> +
> + public void testGetConsoleWhenResponseIs2xx() throws Exception {
> + String serverId = "123";
> + String type = "novnc";
> +
> + HttpRequest getConsole = HttpRequest
> + .builder()
> + .method("POST")
> + .addHeader("Accept", "application/json")
> +
> + */
> +public class ParseServerConsole implements Function {
> +
> +private final ParseJson>> parser;
> +
> +@Inject
> +public ParseServerConsole(ParseJson>>
> parser) {
> +this.parser = parser;
> +}
> +
> +@Override
> +public Console apply(HttpResponse response)
> +import java.beans.ConstructorProperties;
> +
> +import com.google.common.base.Objects;
> +import com.google.common.base.Objects.ToStringHelper;
> +
> +import static com.google.common.base.Preconditions.checkNotNull;
> +
> +/**
> + * Connection information to connect to a server using VNC.
> + *
I've extended NovaApi.java and NovaAsyncApi.java to support method
getConsole() which returns the vnc access url.
You can merge this Pull Request by running:
git pull https://github.com/pimenas/jclouds master
Or you can view, comment on it, or merge it online at:
https://github.com/jc
67 matches
Mail list logo