rsd-lib/rsd_lib/resources/v2_1/system/simple_storage.py
Lin Yang f98599c640 Fix wrong ReferenceableMemberField resource class
Change-Id: I935c9e78e33432202bdbf25b495e4e82edb5f3f1
2019-05-15 15:21:30 -07:00

68 lines
2.1 KiB
Python

# Copyright 2019 Intel, Inc.
# All Rights Reserved.
#
# 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 sushy.resources import base
from rsd_lib import base as rsd_lib_base
from rsd_lib import utils as rsd_lib_utils
class DeviceCollectionField(base.ListField):
name = base.Field("Name")
"""The name of the resource or array element."""
status = rsd_lib_base.StatusField("Status")
"""This indicates the known state of the resource, such as if it is
enabled.
"""
manufacturer = base.Field("Manufacturer")
"""The name of the manufacturer of this device"""
model = base.Field("Model")
"""The product model number of this device"""
capacity_bytes = base.Field(
"CapacityBytes", adapter=rsd_lib_utils.num_or_none
)
"""The size of the storage device."""
class SimpleStorage(rsd_lib_base.ResourceBase):
"""SimpleStorage resource class
This is the schema definition for the Simple Storage resource. It
represents the properties of a storage controller and its
directly-attached devices.
"""
uefi_device_path = base.Field("UefiDevicePath")
"""The UEFI device path used to access this storage controller."""
devices = DeviceCollectionField("Devices")
"""The storage devices associated with this resource"""
status = rsd_lib_base.StatusField("Status")
"""This indicates the known state of the resource, such as if it is
enabled.
"""
class SimpleStorageCollection(rsd_lib_base.ResourceCollectionBase):
@property
def _resource_type(self):
return SimpleStorage