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.baremetal.v1 import _common
14from openstack import resource
15
16
17class VolumeTarget(_common.ListMixin, resource.Resource):
18
19    resources_key = 'targets'
20    base_path = '/volume/targets'
21
22    # capabilities
23    allow_create = True
24    allow_fetch = True
25    allow_commit = True
26    allow_delete = True
27    allow_list = True
28    allow_patch = True
29    commit_method = 'PATCH'
30    commit_jsonpatch = True
31
32    _query_mapping = resource.QueryParameters(
33        'node', 'detail',
34        fields={'type': _common.fields_type},
35    )
36
37    # Volume Targets is available since 1.32
38    _max_microversion = '1.32'
39
40    #: The boot index of the Volume target. “0” indicates that this volume is
41    # used as a boot volume.
42    boot_index = resource.Body('boot_index')
43    #: Timestamp at which the port was created.
44    created_at = resource.Body('created_at')
45    #: A set of one or more arbitrary metadata key and value pairs.
46    extra = resource.Body('extra')
47    #: A list of relative links. Includes the self and bookmark links.
48    links = resource.Body('links', type=list)
49    #: The UUID of the Node this resource belongs to.
50    node_id = resource.Body('node_uuid')
51    #: A set of physical information of the volume.
52    properties = resource.Body('properties')
53    #: Timestamp at which the port was last updated.
54    updated_at = resource.Body('updated_at')
55    #: The UUID of the resource.
56    id = resource.Body('uuid', alternate_id=True)
57    #: The identifier of the volume.
58    volume_id = resource.Body('volume_id')
59    #: The type of Volume target.
60    volume_type = resource.Body('volume_type')
61