[openstack-dev] [Openstack] Accessing object data and metadata in Swift middleware
itamarost at gmail.com
Wed Apr 24 14:27:05 UTC 2013
I looked into the pointers mentioned above,
and the make_pre_authed_request function was exactly what I needed.
resp = make_pre_authed_request(env, 'GET', req.path, agent='MyCall',
and got the requested object in resp, including metadata in the headers and
the actual object body.
On Tue, Apr 23, 2013 at 7:51 AM, Itamar O <itamarost at gmail.com> wrote:
> David, Chmouel,
> Thank you for the pointers!
> I will look into it soon, hoping it solves my needs.
> Sorry for not posting to the dev-list from the beginning. I wasn't aware
> of it...
> - Itamar.
> On Mon, Apr 22, 2013 at 8:06 PM, David Goetz <david.goetz at rackspace.com>wrote:
>> There are examples in swift.common.middleware of doing this.
>> If you want to try changing the metadata on the way out you can look at:
>> it makes use of the WSGIContext class which allows you to make a call
>> down the pipeline and respond to it on the way back out.
>> If you want to just kinda peek at the object before sending the request
>> you can use make_pre_authed_request as done here for containers:
>> that function will take auth out of the environment so you want to be
>> careful about using it. It you want to keep auth you can do something along
>> the lines of:
>> which just makes a sub request using a copy of the current environment.
>> In your case, after you get that response you'd probably just want to let
>> the request continue on the pipeline instead of just completely overriding
>> it like the bulk middleware does.
>> On Apr 21, 2013, at 10:11 AM, Itamar O wrote:
>> > Hello list,
>> > I am new to OpenStack development, and trying to implement a simple
>> Swift middleware.
>> > I was able to successfully manipulate a PUT request for an object,
>> processing the data that was uploaded by the request and storing some
>> information in the object metadata.
>> > But now I am struggling with handling GET requests for objects.
>> > I would like to access the data and metadata of the requested object
>> before it is passed down the pipeline, but I have no clue how to achieve
>> > In case this is not the appropriate mailing list for this question, I
>> apologize, and would appreciate if someone could refer me to the correct
>> > Otherwise, any advice will be much appreciated!
>> > Thanks,
>> > - Itamar.
>> > _______________________________________________
>> > Mailing list: https://launchpad.net/~openstack
>> > Post to : openstack at lists.launchpad.net
>> > Unsubscribe : https://launchpad.net/~openstack
>> > More help : https://help.launchpad.net/ListHelp
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the OpenStack-dev