def modify(self, name=None, policy_type=None, is_paused=None, max_iops=None, max_kbps=None, max_iops_density=None, max_kbps_density=None, description=None, is_shared=None, burst_rate=None, burst_time=None, burst_frequency=None): # name = self.name if name is None else self.name rule = self._cli.make_body(maxIOPS=max_iops, maxKBPS=max_kbps, maxIOPSDensity=max_iops_density, maxKBPSDensity=max_kbps_density, burstRate=burst_rate, burstTime=from_minute(burst_time), burstFrequency=from_hour(burst_frequency), id=self.io_limit_rule_settings[0].get_id()) resp = self._cli.modify(self.resource_class, self.get_id(), name=name, description=description, isShared=is_shared, type=policy_type, ioLimitRulesToModify=[rule]) resp.raise_if_err() return self
def create(cls, cli, name, max_iops=None, max_kbps=None, policy_type=None, is_shared=None, description=None, max_iops_density=None, max_kbps_density=None, burst_rate=None, burst_time=None, burst_frequency=None): if policy_type is None: policy_type = IOLimitPolicyTypeEnum.ABSOLUTE if is_shared is None: is_shared = False rule = cli.make_body(name='{}_rule'.format(name), maxIOPS=max_iops, maxKBPS=max_kbps, maxIOPSDensity=max_iops_density, maxKBPSDensity=max_kbps_density, burstRate=burst_rate, burstTime=from_minute(burst_time), burstFrequency=from_hour(burst_frequency)) resp = cli.post(cls().resource_class, name=name, description=description, isShared=is_shared, type=policy_type, ioLimitRules=[rule]) resp.raise_if_err() return cls(_id=resp.resource_id, cli=cli)
def conv(): converter.from_hour(25)
def test_from_hour_str(self): r = converter.from_hour(11) assert_that(r, equal_to("11:00:00.000"))