|
25 | 25 | from openstack.network.v2 import pool as _pool |
26 | 26 | from openstack.network.v2 import pool_member as _pool_member |
27 | 27 | from openstack.network.v2 import port as _port |
| 28 | +from openstack.network.v2 import qos_bandwidth_limit_rule as \ |
| 29 | + _qos_bandwidth_limit_rule |
28 | 30 | from openstack.network.v2 import qos_dscp_marking_rule as \ |
29 | 31 | _qos_dscp_marking_rule |
30 | 32 | from openstack.network.v2 import qos_minimum_bandwidth_rule as \ |
@@ -1148,6 +1150,132 @@ def get_subnet_ports(self, subnet_id): |
1148 | 1150 | result.append(puerta) |
1149 | 1151 | return result |
1150 | 1152 |
|
| 1153 | + def create_qos_bandwidth_limit_rule(self, qos_policy, **attrs): |
| 1154 | + """Create a new bandwidth limit rule |
| 1155 | +
|
| 1156 | + :param dict attrs: Keyword arguments which will be used to create |
| 1157 | + a :class:`~openstack.network.v2. |
| 1158 | + qos_bandwidth_limit_rule.QoSBandwidthLimitRule`, |
| 1159 | + comprised of the properties on the |
| 1160 | + QoSBandwidthLimitRule class. |
| 1161 | + :param qos_policy: The value can be the ID of the QoS policy that the |
| 1162 | + rule belongs or a :class:`~openstack.network.v2. |
| 1163 | + qos_policy.QoSPolicy` instance. |
| 1164 | +
|
| 1165 | + :returns: The results of resource creation |
| 1166 | + :rtype: :class:`~openstack.network.v2.qos_bandwidth_limit_rule. |
| 1167 | + QoSBandwidthLimitRule` |
| 1168 | + """ |
| 1169 | + qos_policy_id = resource.Resource.get_id(qos_policy) |
| 1170 | + return self._create( |
| 1171 | + _qos_bandwidth_limit_rule.QoSBandwidthLimitRule, |
| 1172 | + path_args={'qos_policy_id': qos_policy_id}, **attrs) |
| 1173 | + |
| 1174 | + def delete_qos_bandwidth_limit_rule(self, qos_rule, qos_policy, |
| 1175 | + ignore_missing=True): |
| 1176 | + """Delete a bandwidth limit rule |
| 1177 | +
|
| 1178 | + :param qos_rule: The value can be either the ID of a bandwidth limit |
| 1179 | + rule or a :class:`~openstack.network.v2. |
| 1180 | + qos_bandwidth_limit_rule.QoSBandwidthLimitRule` |
| 1181 | + instance. |
| 1182 | + :param qos_policy: The value can be the ID of the QoS policy that the |
| 1183 | + rule belongs or a :class:`~openstack.network.v2. |
| 1184 | + qos_policy.QoSPolicy` instance. |
| 1185 | + :param bool ignore_missing: When set to ``False`` |
| 1186 | + :class:`~openstack.exceptions.ResourceNotFound` will be |
| 1187 | + raised when the resource does not exist. |
| 1188 | + When set to ``True``, no exception will be set when |
| 1189 | + attempting to delete a nonexistent bandwidth limit rule. |
| 1190 | +
|
| 1191 | + :returns: ``None`` |
| 1192 | + """ |
| 1193 | + qos_policy_id = resource.Resource.get_id(qos_policy) |
| 1194 | + self._delete(_qos_bandwidth_limit_rule.QoSBandwidthLimitRule, |
| 1195 | + qos_rule, ignore_missing=ignore_missing, |
| 1196 | + path_args={'qos_policy_id': qos_policy_id}) |
| 1197 | + |
| 1198 | + def find_qos_bandwidth_limit_rule(self, qos_rule_id, qos_policy, |
| 1199 | + ignore_missing=True): |
| 1200 | + """Find a bandwidth limit rule |
| 1201 | +
|
| 1202 | + :param qos_rule_id: The ID of a bandwidth limit rule. |
| 1203 | + :param qos_policy: The value can be the ID of the QoS policy that the |
| 1204 | + rule belongs or a :class:`~openstack.network.v2. |
| 1205 | + qos_policy.QoSPolicy` instance. |
| 1206 | + :param bool ignore_missing: When set to ``False`` |
| 1207 | + :class:`~openstack.exceptions.ResourceNotFound` will be |
| 1208 | + raised when the resource does not exist. |
| 1209 | + When set to ``True``, None will be returned when |
| 1210 | + attempting to find a nonexistent resource. |
| 1211 | + :returns: One :class:`~openstack.network.v2.qos_bandwidth_limit_rule. |
| 1212 | + QoSBandwidthLimitRule` or None |
| 1213 | + """ |
| 1214 | + qos_policy_id = resource.Resource.get_id(qos_policy) |
| 1215 | + return self._find(_qos_bandwidth_limit_rule.QoSBandwidthLimitRule, |
| 1216 | + qos_rule_id, ignore_missing=ignore_missing, |
| 1217 | + path_args={'qos_policy_id': qos_policy_id}) |
| 1218 | + |
| 1219 | + def get_qos_bandwidth_limit_rule(self, qos_rule, qos_policy): |
| 1220 | + """Get a single bandwidth limit rule |
| 1221 | +
|
| 1222 | + :param qos_rule: The value can be the ID of a minimum bandwidth rule or |
| 1223 | + a :class:`~openstack.network.v2. |
| 1224 | + qos_bandwidth_limit_rule.QoSBandwidthLimitRule` |
| 1225 | + instance. |
| 1226 | + :param qos_policy: The value can be the ID of the QoS policy that the |
| 1227 | + rule belongs or a :class:`~openstack.network.v2. |
| 1228 | + qos_policy.QoSPolicy` instance. |
| 1229 | + :returns: One :class:`~openstack.network.v2.qos_bandwidth_limit_rule. |
| 1230 | + QoSBandwidthLimitRule` |
| 1231 | + :raises: :class:`~openstack.exceptions.ResourceNotFound` |
| 1232 | + when no resource can be found. |
| 1233 | + """ |
| 1234 | + qos_policy_id = resource.Resource.get_id(qos_policy) |
| 1235 | + return self._get(_qos_bandwidth_limit_rule.QoSBandwidthLimitRule, |
| 1236 | + qos_rule, path_args={'qos_policy_id': qos_policy_id}) |
| 1237 | + |
| 1238 | + def qos_bandwidth_limit_rules(self, qos_policy, **query): |
| 1239 | + """Return a generator of bandwidth limit rules |
| 1240 | +
|
| 1241 | + :param qos_policy: The value can be the ID of the QoS policy that the |
| 1242 | + rule belongs or a :class:`~openstack.network.v2. |
| 1243 | + qos_policy.QoSPolicy` instance. |
| 1244 | + :param kwargs \*\*query: Optional query parameters to be sent to limit |
| 1245 | + the resources being returned. |
| 1246 | + :returns: A generator of bandwidth limit rule objects |
| 1247 | + :rtype: :class:`~openstack.network.v2.qos_bandwidth_limit_rule. |
| 1248 | + QoSBandwidthLimitRule` |
| 1249 | + """ |
| 1250 | + qos_policy_id = resource.Resource.get_id(qos_policy) |
| 1251 | + return self._list(_qos_bandwidth_limit_rule.QoSBandwidthLimitRule, |
| 1252 | + paginated=False, |
| 1253 | + path_args={'qos_policy_id': qos_policy_id}, **query) |
| 1254 | + |
| 1255 | + def update_qos_bandwidth_limit_rule(self, qos_rule, qos_policy, |
| 1256 | + **attrs): |
| 1257 | + """Update a bandwidth limit rule |
| 1258 | +
|
| 1259 | + :param qos_rule: Either the id of a bandwidth limit rule or a |
| 1260 | + :class:`~openstack.network.v2. |
| 1261 | + qos_bandwidth_limit_rule.QoSBandwidthLimitRule` |
| 1262 | + instance. |
| 1263 | + :param qos_policy: The value can be the ID of the QoS policy that the |
| 1264 | + rule belongs or a :class:`~openstack.network.v2. |
| 1265 | + qos_policy.QoSPolicy` instance. |
| 1266 | + :attrs kwargs: The attributes to update on the bandwidth limit rule |
| 1267 | + represented by ``value``. |
| 1268 | +
|
| 1269 | + :returns: The updated minimum bandwidth rule |
| 1270 | + :rtype: :class:`~openstack.network.v2.qos_bandwidth_limit_rule. |
| 1271 | + QoSBandwidthLimitRule` |
| 1272 | + """ |
| 1273 | + qos_policy_id = resource.Resource.get_id(qos_policy) |
| 1274 | + return self._update(_qos_bandwidth_limit_rule.QoSBandwidthLimitRule, |
| 1275 | + qos_rule, |
| 1276 | + path_args={'qos_policy_id': qos_policy_id}, |
| 1277 | + **attrs) |
| 1278 | + |
1151 | 1279 | def create_qos_dscp_marking_rule(self, qos_policy, **attrs): |
1152 | 1280 | """Create a new QoS DSCP marking rule |
1153 | 1281 |
|
|
0 commit comments