Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for basic OpenStack API operations and Keystone authentication
Fixes #373 #374 * Add rewrite rules for basic bucket and object operations from OpenStack Object Storage API * Add authentication module for Keystone authentication service * Make URL rewrite module configurable * Refactoring to further decouple API requests and responses from core object store functionality. * Add helper module for JSON processing * Refactor XML handling code * Isolate configuration functions into riak_cs_config module
- Loading branch information
1 parent
6192547
commit 83f6ce7
Showing
42 changed files
with
1,653 additions
and
496 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
%% --------------------------------------------------------------------- | ||
%% | ||
%% Copyright (c) 2007-2013 Basho Technologies, Inc. All Rights Reserved. | ||
%% | ||
%% This file is provided 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. | ||
%% | ||
%% --------------------------------------------------------------------- | ||
|
||
-define(DEFAULT_OS_AUTH_URL, "http://localhost:35357/v2.0/"). | ||
-define(DEFAULT_TOKENS_RESOURCE, "tokens/"). | ||
-define(DEFAULT_S3_TOKENS_RESOURCE, "s3tokens/"). | ||
-define(DEFAULT_OS_USERS_RESOURCE, "users/"). | ||
-define(DEFAULT_OS_ADMIN_TOKEN, "ADMIN"). | ||
-define(DEFAULT_OS_OPERATOR_ROLES, [<<"admin">>, <<"swiftoperator">>]). | ||
|
||
-record(keystone_s3_auth_req_v1, { | ||
access :: binary(), | ||
signature :: binary(), | ||
token :: binary()}). | ||
-type keystone_s3_auth_req() :: #keystone_s3_auth_req_v1{}. | ||
-define(KEYSTONE_S3_AUTH_REQ, #keystone_s3_auth_req_v1). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
%% --------------------------------------------------------------------- | ||
%% | ||
%% Copyright (c) 2007-2013 Basho Technologies, Inc. All Rights Reserved. | ||
%% | ||
%% This file is provided 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. | ||
%% | ||
%% --------------------------------------------------------------------- | ||
|
||
-module(riak_cs_api). | ||
|
||
-export([list_buckets/1, | ||
list_objects/5]). | ||
|
||
-include("riak_cs.hrl"). | ||
-include("riak_cs_api.hrl"). | ||
-include("list_objects.hrl"). | ||
|
||
%% @doc Return a user's buckets. | ||
-spec list_buckets(rcs_user()) -> ?LBRESP{}. | ||
list_buckets(User=?RCS_USER{buckets=Buckets}) -> | ||
?LBRESP{user=User, | ||
buckets=[Bucket || Bucket <- Buckets, | ||
Bucket?RCS_BUCKET.last_action /= deleted]}. | ||
|
||
-type options() :: [{atom(), 'undefined' | binary()}]. | ||
-spec list_objects([string()], binary(), non_neg_integer(), options(), pid()) -> | ||
{ok, ?LORESP{}} | {error, term()}. | ||
list_objects([], _, _, _, _) -> | ||
{error, no_such_bucket}; | ||
list_objects(_UserBuckets, _Bucket, {error, _}=Error, _Options, _RiakPid) -> | ||
Error; | ||
list_objects(_UserBuckets, Bucket, MaxKeys, Options, RiakPid) -> | ||
ListKeysRequest = riak_cs_list_objects:new_request(Bucket, | ||
MaxKeys, | ||
Options), | ||
BinPid = riak_cs_utils:pid_to_binary(self()), | ||
CacheKey = << BinPid/binary, <<":">>/binary, Bucket/binary >>, | ||
UseCache = riak_cs_list_objects_ets_cache:cache_enabled(), | ||
case riak_cs_list_objects_fsm:start_link(RiakPid, | ||
self(), | ||
ListKeysRequest, | ||
CacheKey, | ||
UseCache) of | ||
{ok, ListFSMPid} -> | ||
riak_cs_list_objects_fsm:get_object_list(ListFSMPid); | ||
{error, _}=Error -> | ||
Error | ||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.