1# Licensed under the Apache License, Version 2.0 (the "License"); you may 2# not use this file except in compliance with the License. You may obtain 3# a copy of the License at 4# 5# http://www.apache.org/licenses/LICENSE-2.0 6# 7# Unless required by applicable law or agreed to in writing, software 8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10# License for the specific language governing permissions and limitations 11# under the License. 12 13from openstack import format 14from openstack import resource 15 16 17class Snapshot(resource.Resource): 18 resource_key = "snapshot" 19 resources_key = "snapshots" 20 base_path = "/snapshots" 21 22 _query_mapping = resource.QueryParameters( 23 'name', 'status', 'volume_id', 24 'project_id', all_projects='all_tenants') 25 26 # capabilities 27 allow_fetch = True 28 allow_create = True 29 allow_delete = True 30 allow_commit = True 31 allow_list = True 32 33 # Properties 34 #: A ID representing this snapshot. 35 id = resource.Body("id") 36 #: Name of the snapshot. Default is None. 37 name = resource.Body("name") 38 39 #: The current status of this snapshot. Potential values are creating, 40 #: available, deleting, error, and error_deleting. 41 status = resource.Body("status") 42 #: Description of snapshot. Default is None. 43 description = resource.Body("description") 44 #: The timestamp of this snapshot creation. 45 created_at = resource.Body("created_at") 46 #: Metadata associated with this snapshot. 47 metadata = resource.Body("metadata", type=dict) 48 #: The ID of the volume this snapshot was taken of. 49 volume_id = resource.Body("volume_id") 50 #: The size of the volume, in GBs. 51 size = resource.Body("size", type=int) 52 #: Indicate whether to create snapshot, even if the volume is attached. 53 #: Default is ``False``. *Type: bool* 54 is_forced = resource.Body("force", type=format.BoolStr) 55 #: The percentage of completeness the snapshot is currently at. 56 progress = resource.Body("os-extended-snapshot-attributes:progress") 57 #: The project ID this snapshot is associated with. 58 project_id = resource.Body("os-extended-snapshot-attributes:project_id") 59 60 61SnapshotDetail = Snapshot 62