fb1ea0c1a8
This change includes the necessary refactoring to make the Image v2 service use the newer resource and proxy classes. Additionally, it rearranged some of the structure of the Image resource in order to work more logically on the surface of the proxy. 1. What was known as the Tag resource is now served by methods on the Image resource, as tags are specific to an Image and not well served to be thought of as their own thing. The behavior and tests have been moved under Image, and at the proxy layer the calls were name "add_tag" and "remove tag" 2. Image now supports the "deactivate" and "reactivate" actions. 3. The upload_image call was restructured slightly and is now helpfully strict on the arguments it requires, as it takes two separate REST calls in order to complete the operation. 4. download_image was added, and it verifies the checksum of the image before returning the raw data. We previously converged on download_<resource> as the naming convention of data being downloaded, but we hadn't figured out what should be returned. A comment was added to download_object in object_store as it currently tries to work with writing to a file, which it should not do. That will be handled in that service's refactor. Change-Id: I22739d8a5b6c13552c9bdd980af0c2d62a66668d
28 lines
982 B
Python
28 lines
982 B
Python
# 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.
|
|
|
|
from openstack import service_filter
|
|
|
|
|
|
class ImageService(service_filter.ServiceFilter):
|
|
"""The image service."""
|
|
|
|
valid_versions = [
|
|
service_filter.ValidVersion('v2'),
|
|
service_filter.ValidVersion('v1')
|
|
]
|
|
|
|
def __init__(self, version=None):
|
|
"""Create an image service."""
|
|
super(ImageService, self).__init__(service_type='image',
|
|
version=version)
|