-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements data-driven views and extended attributes.
The quantum/api/v2/views.py module is replaced by is_visible properties in the RESOURCE_ATTRIBUTE_MAP defined in quantum/api/v2/attributes.py. Extensions are given the ability to add extended attribute descriptions to this map during initialization, allowing extended attributes to be implemented similarly to core attributes in plugins. Resolves bug 1023111. Change-Id: Ic6e224d5d841b6a1d4d1c762d7306adaf91f7a2d
- Loading branch information
Bob Kukura
committed
Jul 23, 2012
1 parent
73ec08b
commit a01ca27
Showing
7 changed files
with
259 additions
and
85 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
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 was deleted.
Oops, something went wrong.
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,48 @@ | ||
# Copyright (c) 2012 OpenStack, LLC. | ||
# | ||
# Licensed 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. | ||
|
||
EXTENDED_ATTRIBUTES_2_0 = { | ||
'networks': { | ||
'v2attrs:something': {'allow_post': False, | ||
'allow_put': False, | ||
'is_visible': True}, | ||
'v2attrs:something_else': {'allow_post': True, | ||
'allow_put': False, | ||
'is_visible': False}, | ||
} | ||
} | ||
|
||
|
||
class V2attributes(object): | ||
def get_name(self): | ||
return "V2 Extended Attributes Example" | ||
|
||
def get_alias(self): | ||
return "v2attrs" | ||
|
||
def get_description(self): | ||
return "Demonstrates extended attributes on V2 core resources" | ||
|
||
def get_namespace(self): | ||
return "http://docs.openstack.org/ext/examples/v2attributes/api/v1.0" | ||
|
||
def get_updated(self): | ||
return "2012-07-18T10:00:00-00:00" | ||
|
||
def get_extended_attributes(self, version): | ||
if version == "2.0": | ||
return EXTENDED_ATTRIBUTES_2_0 | ||
else: | ||
return {} |
Oops, something went wrong.