Re: SwiftApi ObjectApi.put behavior on 4xx/5xx responses

2014-12-10 Thread Everett Toews
Enable logging to see the full request/response and the status codes.

http://jclouds.apache.org/reference/logging/

Everett


On Dec 10, 2014, at 7:58 AM, Daniel Hsueh 
daniel.hs...@seagate.commailto:daniel.hs...@seagate.com wrote:

Hello,

Using the new openstack-swift API, I believe the ObjectApi.put() call always 
returns an etag, or null, if a response is received.  There seems no way to get 
an HttpResponseException to see a 4xx/5xx response code, yes?

--
Daniel Hsueh -- mailto:daniel.hs...@seagate.com tel:+1-905-287-2167



Re: SwiftApi ObjectApi.put behavior on 4xx/5xx responses

2014-12-10 Thread Everett Toews
I’m not exactly sure what feature you’re requesting at this point. From reading 
your original question I’d think that the following code would handle it.

HttpResponseException.getResponse().getStatusCode()

If you’d like to request a feature, you can head over to JIRA [1] and create an 
issue. Please include example code of how you’d like the feature to work.

If you’d like to contribute a feature, read over How to Contribute [2].

Regards,
Everett

[1] https://issues.apache.org/jira/browse/JCLOUDS
[2] https://cwiki.apache.org/confluence/display/JCLOUDS/How+to+Contribute


On Dec 10, 2014, at 9:33 AM, Daniel Hsueh 
daniel.hs...@seagate.commailto:daniel.hs...@seagate.com wrote:

I'm aware of using logging to see the full exchange.

What I was more interested in was programatically determining what a problem is.

Could we request this as a feature?  The HttpResponseException class seems 
perfect for this kind of reporting.

On Wed, Dec 10, 2014 at 9:55 AM, Everett Toews 
everett.to...@rackspace.commailto:everett.to...@rackspace.com wrote:
Enable logging to see the full request/response and the status codes.

http://jclouds.apache.org/reference/logging/https://urldefense.proofpoint.com/v2/url?u=http-3A__jclouds.apache.org_reference_logging_d=AwMFAgc=IGDlg0lD0b-nebmJJ0Kp8Ar=LuGmq_BGW1Ye0sNeKcnpg4MzQroKFmLPkrt9SlpYRVkm=RoxYMb4RWWSV-q5ifKV_4PUly-QOCAVgAZteMC-Puios=JNLt4k7RuFqTcf3vh4fJNrMGq5oZLI0zmdvZ7begIU0e=

Everett


On Dec 10, 2014, at 7:58 AM, Daniel Hsueh 
daniel.hs...@seagate.commailto:daniel.hs...@seagate.com wrote:

Hello,

Using the new openstack-swift API, I believe the ObjectApi.put() call always 
returns an etag, or null, if a response is received.  There seems no way to get 
an HttpResponseException to see a 4xx/5xx response code, yes?

--
Daniel Hsueh -- mailto:daniel.hs...@seagate.com 
tel:+1-905-287-2167tel:%2B1-905-287-2167




--
Daniel Hsueh -- mailto:daniel.hs...@seagate.com tel:+1-905-287-2167



Re: SwiftApi ObjectApi.put behavior on 4xx/5xx responses

2014-12-10 Thread Ignasi Barrera
I see what you say, Daniel.

The returned value has changed. Old swift API was using the
ParseETagHeader class [1] to parse the response for the putObject
request, but the new one is using the ETagHeader class [2] for that
purpose. The former threw an exception if the etag wasn't present but
the latter just silently returns null.

I don't know if that behavior change is intentional or not. Perhaps
some more afmiliar with the Swift API than me can give some light
here. Jeremy?


Thanks for sharing!

Ignasi


[1] 
https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/http/functions/ParseETagHeader.java
[2] 
https://github.com/jclouds/jclouds/blob/master/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/functions/ETagHeader.java

On 10 December 2014 at 17:10, Everett Toews everett.to...@rackspace.com wrote:
 I’m not exactly sure what feature you’re requesting at this point. From
 reading your original question I’d think that the following code would
 handle it.

 HttpResponseException.getResponse().getStatusCode()

 If you’d like to request a feature, you can head over to JIRA [1] and create
 an issue. Please include example code of how you’d like the feature to work.

 If you’d like to contribute a feature, read over How to Contribute [2].

 Regards,
 Everett

 [1] https://issues.apache.org/jira/browse/JCLOUDS
 [2] https://cwiki.apache.org/confluence/display/JCLOUDS/How+to+Contribute


 On Dec 10, 2014, at 9:33 AM, Daniel Hsueh daniel.hs...@seagate.com wrote:

 I'm aware of using logging to see the full exchange.

 What I was more interested in was programatically determining what a problem
 is.

 Could we request this as a feature?  The HttpResponseException class seems
 perfect for this kind of reporting.

 On Wed, Dec 10, 2014 at 9:55 AM, Everett Toews everett.to...@rackspace.com
 wrote:

 Enable logging to see the full request/response and the status codes.

 http://jclouds.apache.org/reference/logging/

 Everett


 On Dec 10, 2014, at 7:58 AM, Daniel Hsueh daniel.hs...@seagate.com
 wrote:

 Hello,

 Using the new openstack-swift API, I believe the ObjectApi.put() call
 always returns an etag, or null, if a response is received.  There seems no
 way to get an HttpResponseException to see a 4xx/5xx response code, yes?

 --
 Daniel Hsueh -- mailto:daniel.hs...@seagate.com tel:+1-905-287-2167





 --
 Daniel Hsueh -- mailto:daniel.hs...@seagate.com tel:+1-905-287-2167




Re: SwiftApi ObjectApi.put behavior on 4xx/5xx responses

2014-12-10 Thread Daniel Hsueh
I filed feature request https://issues.apache.org/jira/browse/JCLOUDS-793

Yes, the ParseETagHeader class throws an exception, but this doesn't report
what went wrong; it could be the blobstore is broken and omitted the etag!
(yes, highly unlikely, but a precise response would be much more useful)

thank you


On Wed, Dec 10, 2014 at 11:33 AM, Ignasi Barrera n...@apache.org wrote:

 I see what you say, Daniel.

 The returned value has changed. Old swift API was using the
 ParseETagHeader class [1] to parse the response for the putObject
 request, but the new one is using the ETagHeader class [2] for that
 purpose. The former threw an exception if the etag wasn't present but
 the latter just silently returns null.

 [snip]


-- 
Daniel Hsueh -- mailto:daniel.hs...@seagate.com daniel.hs...@seagate.com
tel:+1-905-287-2167


FW: Error in JCloud KeystoneApi getRoleAdminApi

2014-12-10 Thread Jeremy Daggett
Forwarding to user@Š

Hi Alka!

It could be one of the following scenarios you are running in to:

- the extension is not available in your OpenStack installation
- the user does not have an Admin role to access this specific API

Does the extension show up when executing this code?

  SetExtension extensions = keystoneApi.getExtensionApi().list();
  // iterate through to see what extensions are available...

Please let us know, thanks!

/jd

On 12/9/14, 9:27 PM, Alka Beniwal beniwala...@gmail.com wrote:

Hi,

I am developing a code to retrieve list of roles in OpenStack.

*Code-*
 RoleAdminApi roleAdminApi=  keystoneApi.getRoleAdminApi().get();//error
FluentIterable? extends Role list1 = roleAdminApi.list();

*Error-*
java.lang.IllegalStateException: Optional.get() cannot be called on an
absent value


Any help is appreciated.




--
Thanks,
Regards,
AB



Re: FW: Error in JCloud KeystoneApi getRoleAdminApi

2014-12-10 Thread Ignasi Barrera
Just to complete Jeremy's checklist, also make sure you're connecting to
the admin endpoint; double check the port. IIRC that extension is not
exposed in the default endpoint.
El 10/12/2014 18:35, Jeremy Daggett jeremy.dagg...@rackspace.com
escribió:

 Forwarding to user@Š

 Hi Alka!

 It could be one of the following scenarios you are running in to:

 - the extension is not available in your OpenStack installation
 - the user does not have an Admin role to access this specific API

 Does the extension show up when executing this code?

   SetExtension extensions = keystoneApi.getExtensionApi().list();
   // iterate through to see what extensions are available...

 Please let us know, thanks!

 /jd

 On 12/9/14, 9:27 PM, Alka Beniwal beniwala...@gmail.com wrote:

 Hi,
 
 I am developing a code to retrieve list of roles in OpenStack.
 
 *Code-*
  RoleAdminApi roleAdminApi=  keystoneApi.getRoleAdminApi().get();//error
 FluentIterable? extends Role list1 = roleAdminApi.list();
 
 *Error-*
 java.lang.IllegalStateException: Optional.get() cannot be called on an
 absent value
 
 
 Any help is appreciated.
 
 
 
 
 --
 Thanks,
 Regards,
 AB




Re: Error in JCloud KeystoneApi getRoleAdminApi

2014-12-10 Thread Jeremy Daggett
Hi Alka,

Yes, definitely access the Admin endpoint for this functionality! There is
an example [1] of using the Keystone Admin APIs that you can use as an
additional reference.

Thanks for pointing that out Ignasi!

/jd

[1] 
https://github.com/jclouds/jclouds-examples/blob/master/openstack/src/main/
java/org/jclouds/examples/openstack/identity/CreateTenantAndUser.java


On 12/10/14, 9:45 AM, Ignasi Barrera n...@apache.org wrote:

Just to complete Jeremy's checklist, also make sure you're connecting to
the admin endpoint; double check the port. IIRC that extension is not
exposed in the default endpoint.
El 10/12/2014 18:35, Jeremy Daggett jeremy.dagg...@rackspace.com
escribió:

 Forwarding to user@Š

 Hi Alka!

 It could be one of the following scenarios you are running in to:

 - the extension is not available in your OpenStack installation
 - the user does not have an Admin role to access this specific API

 Does the extension show up when executing this code?

   SetExtension extensions = keystoneApi.getExtensionApi().list();
   // iterate through to see what extensions are available...

 Please let us know, thanks!

 /jd

 On 12/9/14, 9:27 PM, Alka Beniwal beniwala...@gmail.com wrote:

 Hi,
 
 I am developing a code to retrieve list of roles in OpenStack.
 
 *Code-*
  RoleAdminApi roleAdminApi=
keystoneApi.getRoleAdminApi().get();//error
 FluentIterable? extends Role list1 = roleAdminApi.list();
 
 *Error-*
 java.lang.IllegalStateException: Optional.get() cannot be called on an
 absent value
 
 
 Any help is appreciated.
 
 
 
 
 --
 Thanks,
 Regards,
 AB