def modify(self, is_read_only=None, is_ace_enabled=None, add_ace=None, delete_ace=None, is_encryption_enabled=None, is_con_avail_enabled=None, is_abe_enabled=None, is_branch_cache_enabled=None, offline_availability=None, umask=None, description=None): if self.type == CIFSTypeEnum.CIFS_SHARE: share_param = self.prepare_cifs_share_parameters( is_read_only=is_read_only, is_encryption_enabled=is_encryption_enabled, is_con_avail_enabled=is_con_avail_enabled, is_ace_enabled=is_ace_enabled, add_ace=add_ace, delete_ace=delete_ace, is_abe_enabled=is_abe_enabled, is_branch_cache_enabled=is_branch_cache_enabled, offline_availability=offline_availability, umask=umask, description=description) if share_param: resp = self._modify_fs_share(share_param) else: resp = RestResponse('', self._cli) if self.type == CIFSTypeEnum.CIFS_SNAPSHOT: share_param = self.prepare_cifs_share_parameters( is_encryption_enabled=is_encryption_enabled, is_con_avail_enabled=is_con_avail_enabled, is_abe_enabled=is_abe_enabled, is_branch_cache_enabled=is_branch_cache_enabled, offline_availability=offline_availability, umask=umask, description=description) if share_param: resp = self._modify_snap_share(share_param) else: resp = RestResponse('', self._cli) resp.raise_if_err() return resp
def modify(self, default_access=None, min_security=None, no_access_hosts=None, read_only_hosts=None, read_write_hosts=None, root_access_hosts=None, read_only_root_access_hosts=None, no_access_hosts_string=None, read_only_hosts_string=None, read_write_hosts_string=None, read_only_root_hosts_string=None, root_access_hosts_string=None, anonymous_uid=None, anonymous_gid=None, export_option=None, host_config=None, description=None): if host_config is not None: no_access_hosts = host_config.no_access root_access_hosts = host_config.root read_only_root_access_hosts = host_config.root_ro read_only_hosts = host_config.ro read_write_hosts = host_config.rw NFSShareDefaultAccessEnum.verify(default_access) NFSShareSecurityEnum.verify(min_security) clz = storops.unity.resource.host.UnityHostList no_access_hosts = clz.get_list(self._cli, no_access_hosts) read_only_hosts = clz.get_list(self._cli, read_only_hosts) read_write_hosts = clz.get_list(self._cli, read_write_hosts) root_access_hosts = clz.get_list(self._cli, root_access_hosts) read_only_root_access_hosts = clz.get_list( self._cli, read_only_root_access_hosts) nfs_share_param = self.prepare_nfs_share_parameters( default_access=default_access, min_security=min_security, no_access_hosts=no_access_hosts, read_only_hosts=read_only_hosts, read_write_hosts=read_write_hosts, root_access_hosts=root_access_hosts, read_only_root_access_hosts=read_only_root_access_hosts, no_access_hosts_string=no_access_hosts_string, read_only_hosts_string=read_only_hosts_string, read_write_hosts_string=read_write_hosts_string, read_only_root_hosts_string=read_only_root_hosts_string, root_access_hosts_string=root_access_hosts_string, anonymous_uid=anonymous_uid, anonymous_gid=anonymous_gid, export_option=export_option, description=description) if nfs_share_param: # different api for different type of share if self.type == NFSTypeEnum.NFS_SHARE: resp = self._modify_fs_share(nfs_share_param) elif self.type == NFSTypeEnum.NFS_SNAPSHOT: resp = self._modify_snap_share(nfs_share_param) else: raise UnityShareTypeNotSupportAccessControlError() else: resp = RestResponse('', self._cli) resp.raise_if_err() return resp
def modify(self, default_access=None, min_security=None, no_access_hosts=None, read_only_hosts=None, read_write_hosts=None, root_access_hosts=None, host_config=None): if host_config is not None: no_access_hosts = host_config.no_access root_access_hosts = host_config.root read_only_hosts = host_config.ro read_write_hosts = host_config.rw NFSShareDefaultAccessEnum.verify(default_access) NFSShareSecurityEnum.verify(min_security) clz = storops.unity.resource.host.UnityHostList no_access_hosts = clz.get_list(self._cli, no_access_hosts) read_only_hosts = clz.get_list(self._cli, read_only_hosts) read_write_hosts = clz.get_list(self._cli, read_write_hosts) root_access_hosts = clz.get_list(self._cli, root_access_hosts) nfs_share_param = self._cli.make_body( allow_empty=True, defaultAccess=default_access, minSecurity=min_security, noAccessHosts=no_access_hosts, readOnlyHosts=read_only_hosts, readWriteHosts=read_write_hosts, rootAccessHosts=root_access_hosts) if nfs_share_param: # different api for different type of share if self.type == NFSTypeEnum.NFS_SHARE: resp = self._modify_fs_share(nfs_share_param) elif self.type == NFSTypeEnum.NFS_SNAPSHOT: resp = self._modify_snap_share(default_access, min_security, nfs_share_param) else: raise UnityShareTypeNotSupportAccessControlError() else: resp = RestResponse('', self._cli) resp.raise_if_err() return resp
def test_raise_if_err_nothing(self): body = read_error_json('200.json') resp = RestResponse(body) resp.raise_if_err()
def f(): body = read_error_json('409.json') resp = RestResponse(body) resp.raise_if_err()