Source code for pyds8k.resources.ds8k.v1.cs.flashcopies

##############################################################################
# Copyright 2019 IBM Corp.
#
# 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.
##############################################################################

"""
advanced FlashCopies interface.
"""

from pyds8k.base import ManagerMeta, ResourceMeta
from pyds8k.resources.ds8k.v1.common.base import Base, BaseManager
from pyds8k.resources.ds8k.v1.common.types import DS8K_CS_FLASHCOPY, DS8K_FLASHCOPY
from pyds8k.resources.ds8k.v1.volumes import Volume, VolumeManager


[docs]class FlashCopy(Base, metaclass=ResourceMeta): resource_type = DS8K_CS_FLASHCOPY _template = { 'id': None, 'persistent': None, 'recording': None, 'backgroundcopy': None, 'state': None, 'options': [], 'volume_pairs': [], } related_resource = { '_volume_pairs': [ { 'source_volume': (Volume, VolumeManager), 'target_volume': (Volume, VolumeManager), } ] } def __repr__(self): return f"<FlashCopy: {self._get_id()}>" def _add_details(self, info, force=False): super()._add_details(info, force=force) if DS8K_FLASHCOPY in info: self._id = info[DS8K_FLASHCOPY][0]['id']
[docs]class FlashCopyManager(BaseManager, metaclass=ManagerMeta): """ Manage advanced FlashCopies resources. """ resource_class = FlashCopy resource_type = DS8K_CS_FLASHCOPY
[docs] def get(self, resource_id='', url='', obj_class=None, **kwargs): return self._get( resource_id=resource_id, url=url, obj_class=obj_class, **kwargs )
[docs] def list(self, url='', obj_class=None, body=None, **kwargs): return self._list(url=url, obj_class=obj_class, body=body, **kwargs)
[docs] def posta(self, url='', body=None): return self._posta(url=url, body=body)
[docs] def delete(self, url=''): return self._delete(url=url)