Coverage for watcher/db/api.py: 100%
15 statements
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-17 12:22 +0000
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-17 12:22 +0000
1# Copyright 2013 Hewlett-Packard Development Company, L.P.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14"""
15Base classes for storage engines
16"""
18import abc
19from oslo_config import cfg
20from oslo_db import api as db_api
22_BACKEND_MAPPING = {'sqlalchemy': 'watcher.db.sqlalchemy.api'}
23IMPL = db_api.DBAPI.from_config(cfg.CONF, backend_mapping=_BACKEND_MAPPING,
24 lazy=True)
27def get_instance():
28 """Return a DB API instance."""
29 return IMPL
32class BaseConnection(object, metaclass=abc.ABCMeta):
33 """Base class for storage system connections."""
35 @abc.abstractmethod
36 def get_goal_list(self, context, filters=None, limit=None,
37 marker=None, sort_key=None, sort_dir=None, eager=False):
38 """Get specific columns for matching goals.
40 Return a list of the specified columns for all goals that
41 match the specified filters.
43 :param context: The security context
44 :param filters: Filters to apply. Defaults to None.
45 :param limit: Maximum number of goals to return.
46 :param marker: the last item of the previous page; we return the next
47 result set.
48 :param sort_key: Attribute by which results should be sorted.
49 :param sort_dir: direction in which results should be sorted.
50 (asc, desc)
51 :param eager: If True, also loads One-to-X data (Default: False)
52 :returns: A list of tuples of the specified columns.
53 """
55 @abc.abstractmethod
56 def create_goal(self, values):
57 """Create a new goal.
59 :param values: A dict containing several items used to identify
60 and track the goal. For example:
62 ::
64 {
65 'uuid': utils.generate_uuid(),
66 'name': 'DUMMY',
67 'display_name': 'Dummy',
68 }
69 :returns: A goal
70 :raises: :py:class:`~.GoalAlreadyExists`
71 """
73 @abc.abstractmethod
74 def get_goal_by_id(self, context, goal_id, eager=False):
75 """Return a goal given its ID.
77 :param context: The security context
78 :param goal_id: The ID of a goal
79 :param eager: If True, also loads One-to-X data (Default: False)
80 :returns: A goal
81 :raises: :py:class:`~.GoalNotFound`
82 """
84 @abc.abstractmethod
85 def get_goal_by_uuid(self, context, goal_uuid, eager=False):
86 """Return a goal given its UUID.
88 :param context: The security context
89 :param goal_uuid: The UUID of a goal
90 :param eager: If True, also loads One-to-X data (Default: False)
91 :returns: A goal
92 :raises: :py:class:`~.GoalNotFound`
93 """
95 @abc.abstractmethod
96 def get_goal_by_name(self, context, goal_name, eager=False):
97 """Return a goal given its name.
99 :param context: The security context
100 :param goal_name: The name of a goal
101 :param eager: If True, also loads One-to-X data (Default: False)
102 :returns: A goal
103 :raises: :py:class:`~.GoalNotFound`
104 """
106 @abc.abstractmethod
107 def destroy_goal(self, goal_uuid):
108 """Destroy a goal.
110 :param goal_uuid: The UUID of a goal
111 :raises: :py:class:`~.GoalNotFound`
112 """
114 @abc.abstractmethod
115 def update_goal(self, goal_uuid, values):
116 """Update properties of a goal.
118 :param goal_uuid: The UUID of a goal
119 :param values: A dict containing several items used to identify
120 and track the goal. For example:
122 ::
124 {
125 'uuid': utils.generate_uuid(),
126 'name': 'DUMMY',
127 'display_name': 'Dummy',
128 }
129 :returns: A goal
130 :raises: :py:class:`~.GoalNotFound`
131 :raises: :py:class:`~.Invalid`
132 """
134 def soft_delete_goal(self, goal_id):
135 """Soft delete a goal.
137 :param goal_id: The id or uuid of a goal.
138 :raises: :py:class:`~.GoalNotFound`
139 """
141 @abc.abstractmethod
142 def get_strategy_list(self, context, filters=None, limit=None,
143 marker=None, sort_key=None, sort_dir=None,
144 eager=True):
145 """Get specific columns for matching strategies.
147 Return a list of the specified columns for all strategies that
148 match the specified filters.
150 :param context: The security context
151 :param filters: Filters to apply. Defaults to None.
153 :param limit: Maximum number of strategies to return.
154 :param marker: The last item of the previous page; we return the next
155 result set.
156 :param sort_key: Attribute by which results should be sorted.
157 :param sort_dir: Direction in which results should be sorted.
158 (asc, desc)
159 :param eager: If True, also loads One-to-X data (Default: False)
160 :returns: A list of tuples of the specified columns.
161 """
163 @abc.abstractmethod
164 def create_strategy(self, values):
165 """Create a new strategy.
167 :param values: A dict containing items used to identify
168 and track the strategy. For example:
170 ::
172 {
173 'id': 1,
174 'uuid': utils.generate_uuid(),
175 'name': 'my_strategy',
176 'display_name': 'My strategy',
177 'goal_uuid': utils.generate_uuid(),
178 }
179 :returns: A strategy
180 :raises: :py:class:`~.StrategyAlreadyExists`
181 """
183 @abc.abstractmethod
184 def get_strategy_by_id(self, context, strategy_id, eager=False):
185 """Return a strategy given its ID.
187 :param context: The security context
188 :param strategy_id: The ID of a strategy
189 :param eager: If True, also loads One-to-X data (Default: False)
190 :returns: A strategy
191 :raises: :py:class:`~.StrategyNotFound`
192 """
194 @abc.abstractmethod
195 def get_strategy_by_uuid(self, context, strategy_uuid, eager=False):
196 """Return a strategy given its UUID.
198 :param context: The security context
199 :param strategy_uuid: The UUID of a strategy
200 :param eager: If True, also loads One-to-X data (Default: False)
201 :returns: A strategy
202 :raises: :py:class:`~.StrategyNotFound`
203 """
205 @abc.abstractmethod
206 def get_strategy_by_name(self, context, strategy_name, eager=False):
207 """Return a strategy given its name.
209 :param context: The security context
210 :param strategy_name: The name of a strategy
211 :param eager: If True, also loads One-to-X data (Default: False)
212 :returns: A strategy
213 :raises: :py:class:`~.StrategyNotFound`
214 """
216 @abc.abstractmethod
217 def destroy_strategy(self, strategy_uuid):
218 """Destroy a strategy.
220 :param strategy_uuid: The UUID of a strategy
221 :raises: :py:class:`~.StrategyNotFound`
222 """
224 @abc.abstractmethod
225 def update_strategy(self, strategy_uuid, values):
226 """Update properties of a strategy.
228 :param strategy_uuid: The UUID of a strategy
229 :returns: A strategy
230 :raises: :py:class:`~.StrategyNotFound`
231 :raises: :py:class:`~.Invalid`
232 """
234 def soft_delete_strategy(self, strategy_id):
235 """Soft delete a strategy.
237 :param strategy_id: The id or uuid of a strategy.
238 :raises: :py:class:`~.StrategyNotFound`
239 """
241 @abc.abstractmethod
242 def get_audit_template_list(self, context, filters=None,
243 limit=None, marker=None, sort_key=None,
244 sort_dir=None, eager=False):
245 """Get specific columns for matching audit templates.
247 Return a list of the specified columns for all audit templates that
248 match the specified filters.
250 :param context: The security context
251 :param filters: Filters to apply. Defaults to None.
252 :param limit: Maximum number of audit templates to return.
253 :param marker: the last item of the previous page; we return the next
254 result set.
255 :param sort_key: Attribute by which results should be sorted.
256 :param sort_dir: direction in which results should be sorted.
257 (asc, desc)
258 :param eager: If True, also loads One-to-X data (Default: False)
259 :returns: A list of tuples of the specified columns.
260 """
262 @abc.abstractmethod
263 def create_audit_template(self, values):
264 """Create a new audit template.
266 :param values: A dict containing several items used to identify
267 and track the audit template. For example:
269 ::
271 {
272 'uuid': utils.generate_uuid(),
273 'name': 'example',
274 'description': 'free text description'
275 'goal': 'DUMMY'
276 }
277 :returns: An audit template.
278 :raises: :py:class:`~.AuditTemplateAlreadyExists`
279 """
281 @abc.abstractmethod
282 def get_audit_template_by_id(self, context, audit_template_id,
283 eager=False):
284 """Return an audit template.
286 :param context: The security context
287 :param audit_template_id: The id of an audit template.
288 :param eager: If True, also loads One-to-X data (Default: False)
289 :returns: An audit template.
290 :raises: :py:class:`~.AuditTemplateNotFound`
291 """
293 @abc.abstractmethod
294 def get_audit_template_by_uuid(self, context, audit_template_uuid,
295 eager=False):
296 """Return an audit template.
298 :param context: The security context
299 :param audit_template_uuid: The uuid of an audit template.
300 :param eager: If True, also loads One-to-X data (Default: False)
301 :returns: An audit template.
302 :raises: :py:class:`~.AuditTemplateNotFound`
303 """
305 def get_audit_template_by_name(self, context, audit_template_name,
306 eager=False):
307 """Return an audit template.
309 :param context: The security context
310 :param audit_template_name: The name of an audit template.
311 :param eager: If True, also loads One-to-X data (Default: False)
312 :returns: An audit template.
313 :raises: :py:class:`~.AuditTemplateNotFound`
314 """
316 @abc.abstractmethod
317 def destroy_audit_template(self, audit_template_id):
318 """Destroy an audit template.
320 :param audit_template_id: The id or uuid of an audit template.
321 :raises: :py:class:`~.AuditTemplateNotFound`
322 """
324 @abc.abstractmethod
325 def update_audit_template(self, audit_template_id, values):
326 """Update properties of an audit template.
328 :param audit_template_id: The id or uuid of an audit template.
329 :returns: An audit template.
330 :raises: :py:class:`~.AuditTemplateNotFound`
331 :raises: :py:class:`~.Invalid`
332 """
334 @abc.abstractmethod
335 def soft_delete_audit_template(self, audit_template_id):
336 """Soft delete an audit template.
338 :param audit_template_id: The id or uuid of an audit template.
339 :raises: :py:class:`~.AuditTemplateNotFound`
340 """
342 @abc.abstractmethod
343 def get_audit_list(self, context, filters=None, limit=None,
344 marker=None, sort_key=None, sort_dir=None, eager=False):
345 """Get specific columns for matching audits.
347 Return a list of the specified columns for all audits that match the
348 specified filters.
350 :param context: The security context
351 :param filters: Filters to apply. Defaults to None.
352 :param limit: Maximum number of audits to return.
353 :param marker: the last item of the previous page; we return the next
354 result set.
355 :param sort_key: Attribute by which results should be sorted.
356 :param sort_dir: direction in which results should be sorted.
357 (asc, desc)
358 :param eager: If True, also loads One-to-X data (Default: False)
359 :returns: A list of tuples of the specified columns.
360 """
362 @abc.abstractmethod
363 def create_audit(self, values):
364 """Create a new audit.
366 :param values: A dict containing several items used to identify
367 and track the audit, and several dicts which are passed
368 into the Drivers when managing this audit. For example:
370 ::
372 {
373 'uuid': utils.generate_uuid(),
374 'type': 'ONESHOT',
375 }
376 :returns: An audit.
377 :raises: :py:class:`~.AuditAlreadyExists`
378 """
380 @abc.abstractmethod
381 def get_audit_by_id(self, context, audit_id, eager=False):
382 """Return an audit.
384 :param context: The security context
385 :param audit_id: The id of an audit.
386 :param eager: If True, also loads One-to-X data (Default: False)
387 :returns: An audit.
388 :raises: :py:class:`~.AuditNotFound`
389 """
391 @abc.abstractmethod
392 def get_audit_by_uuid(self, context, audit_uuid, eager=False):
393 """Return an audit.
395 :param context: The security context
396 :param audit_uuid: The uuid of an audit.
397 :param eager: If True, also loads One-to-X data (Default: False)
398 :returns: An audit.
399 :raises: :py:class:`~.AuditNotFound`
400 """
402 def get_audit_by_name(self, context, audit_name, eager=False):
403 """Return an audit.
405 :param context: The security context
406 :param audit_name: The name of an audit.
407 :param eager: If True, also loads One-to-X data (Default: False)
408 :returns: An audit.
409 :raises: :py:class:`~.AuditNotFound`
410 """
412 @abc.abstractmethod
413 def destroy_audit(self, audit_id):
414 """Destroy an audit and all associated action plans.
416 :param audit_id: The id or uuid of an audit.
417 :raises: :py:class:`~.AuditNotFound`
418 """
420 @abc.abstractmethod
421 def update_audit(self, audit_id, values):
422 """Update properties of an audit.
424 :param audit_id: The id or uuid of an audit.
425 :returns: An audit.
426 :raises: :py:class:`~.AuditNotFound`
427 :raises: :py:class:`~.Invalid`
428 """
430 def soft_delete_audit(self, audit_id):
431 """Soft delete an audit and all associated action plans.
433 :param audit_id: The id or uuid of an audit.
434 :raises: :py:class:`~.AuditNotFound`
435 """
437 @abc.abstractmethod
438 def get_action_list(self, context, filters=None, limit=None,
439 marker=None, sort_key=None, sort_dir=None,
440 eager=False):
441 """Get specific columns for matching actions.
443 Return a list of the specified columns for all actions that match the
444 specified filters.
446 :param context: The security context
447 :param filters: Filters to apply. Defaults to None.
448 :param limit: Maximum number of actions to return.
449 :param marker: the last item of the previous page; we return the next
450 result set.
451 :param sort_key: Attribute by which results should be sorted.
452 :param sort_dir: direction in which results should be sorted.
453 (asc, desc)
454 :param eager: If True, also loads One-to-X data (Default: False)
455 :returns: A list of tuples of the specified columns.
456 """
458 @abc.abstractmethod
459 def create_action(self, values):
460 """Create a new action.
462 :param values: A dict containing several items used to identify
463 and track the action, and several dicts which are passed
464 into the Drivers when managing this action. For example:
466 ::
468 {
469 'uuid': utils.generate_uuid(),
470 'name': 'example',
471 'description': 'free text description'
472 'aggregate': 'nova aggregate name or uuid'
473 }
474 :returns: A action.
475 :raises: :py:class:`~.ActionAlreadyExists`
476 """
478 @abc.abstractmethod
479 def get_action_by_id(self, context, action_id, eager=False):
480 """Return a action.
482 :param context: The security context
483 :param action_id: The id of a action.
484 :param eager: If True, also loads One-to-X data (Default: False)
485 :returns: A action.
486 :raises: :py:class:`~.ActionNotFound`
487 """
489 @abc.abstractmethod
490 def get_action_by_uuid(self, context, action_uuid, eager=False):
491 """Return a action.
493 :param context: The security context
494 :param action_uuid: The uuid of a action.
495 :param eager: If True, also loads One-to-X data (Default: False)
496 :returns: A action.
497 :raises: :py:class:`~.ActionNotFound`
498 """
500 @abc.abstractmethod
501 def destroy_action(self, action_id):
502 """Destroy a action and all associated interfaces.
504 :param action_id: The id or uuid of a action.
505 :raises: :py:class:`~.ActionNotFound`
506 :raises: :py:class:`~.ActionReferenced`
507 """
509 @abc.abstractmethod
510 def update_action(self, action_id, values):
511 """Update properties of a action.
513 :param action_id: The id or uuid of a action.
514 :returns: A action.
515 :raises: :py:class:`~.ActionNotFound`
516 :raises: :py:class:`~.ActionReferenced`
517 :raises: :py:class:`~.Invalid`
518 """
520 def soft_delete_action(self, action_id):
521 """Soft delete an action.
523 :param action_id: The id or uuid of an action.
524 :raises: :py:class:`~.ActionNotFound`
525 """
527 @abc.abstractmethod
528 def get_action_plan_list(
529 self, context, filters=None, limit=None,
530 marker=None, sort_key=None, sort_dir=None, eager=False):
531 """Get specific columns for matching action plans.
533 Return a list of the specified columns for all action plans that
534 match the specified filters.
536 :param context: The security context
537 :param filters: Filters to apply. Defaults to None.
538 :param limit: Maximum number of audits to return.
539 :param marker: the last item of the previous page; we return the next
540 result set.
541 :param sort_key: Attribute by which results should be sorted.
542 :param sort_dir: direction in which results should be sorted.
543 (asc, desc)
544 :param eager: If True, also loads One-to-X data (Default: False)
545 :returns: A list of tuples of the specified columns.
546 """
548 @abc.abstractmethod
549 def create_action_plan(self, values):
550 """Create a new action plan.
552 :param values: A dict containing several items used to identify
553 and track the action plan.
554 :returns: An action plan.
555 :raises: :py:class:`~.ActionPlanAlreadyExists`
556 """
558 @abc.abstractmethod
559 def get_action_plan_by_id(self, context, action_plan_id, eager=False):
560 """Return an action plan.
562 :param context: The security context
563 :param action_plan_id: The id of an action plan.
564 :param eager: If True, also loads One-to-X data (Default: False)
565 :returns: An action plan.
566 :raises: :py:class:`~.ActionPlanNotFound`
567 """
569 @abc.abstractmethod
570 def get_action_plan_by_uuid(self, context, action_plan__uuid, eager=False):
571 """Return a action plan.
573 :param context: The security context
574 :param action_plan__uuid: The uuid of an action plan.
575 :param eager: If True, also loads One-to-X data (Default: False)
576 :returns: An action plan.
577 :raises: :py:class:`~.ActionPlanNotFound`
578 """
580 @abc.abstractmethod
581 def destroy_action_plan(self, action_plan_id):
582 """Destroy an action plan and all associated interfaces.
584 :param action_plan_id: The id or uuid of a action plan.
585 :raises: :py:class:`~.ActionPlanNotFound`
586 :raises: :py:class:`~.ActionPlanReferenced`
587 """
589 @abc.abstractmethod
590 def update_action_plan(self, action_plan_id, values):
591 """Update properties of an action plan.
593 :param action_plan_id: The id or uuid of an action plan.
594 :returns: An action plan.
595 :raises: :py:class:`~.ActionPlanNotFound`
596 :raises: :py:class:`~.ActionPlanReferenced`
597 :raises: :py:class:`~.Invalid`
598 """
600 def soft_delete_action_plan(self, action_plan_id):
601 """Soft delete an action plan.
603 :param action_plan_id: The id or uuid of an action plan.
604 :raises: :py:class:`~.ActionPlanNotFound`
605 """
607 @abc.abstractmethod
608 def get_efficacy_indicator_list(self, context, filters=None, limit=None,
609 marker=None, sort_key=None, sort_dir=None,
610 eager=False):
611 """Get specific columns for matching efficacy indicators.
613 Return a list of the specified columns for all efficacy indicators that
614 match the specified filters.
616 :param context: The security context
617 :param columns: List of column names to return.
618 Defaults to 'id' column when columns == None.
619 :param filters: Filters to apply. Defaults to None.
621 :param limit: Maximum number of efficacy indicators to return.
622 :param marker: The last item of the previous page; we return the next
623 result set.
624 :param sort_key: Attribute by which results should be sorted.
625 :param sort_dir: Direction in which results should be sorted.
626 (asc, desc)
627 :param eager: If True, also loads One-to-X data (Default: False)
628 :returns: A list of tuples of the specified columns.
629 """
631 @abc.abstractmethod
632 def create_efficacy_indicator(self, values):
633 """Create a new efficacy indicator.
635 :param values: A dict containing items used to identify
636 and track the efficacy indicator. For example:
638 ::
640 {
641 'id': 1,
642 'uuid': utils.generate_uuid(),
643 'name': 'my_efficacy_indicator',
644 'display_name': 'My efficacy indicator',
645 'goal_uuid': utils.generate_uuid(),
646 }
647 :returns: An efficacy_indicator
648 :raises: :py:class:`~.EfficacyIndicatorAlreadyExists`
649 """
651 @abc.abstractmethod
652 def get_efficacy_indicator_by_id(self, context, efficacy_indicator_id,
653 eager=False):
654 """Return an efficacy indicator given its ID.
656 :param context: The security context
657 :param efficacy_indicator_id: The ID of an efficacy indicator
658 :param eager: If True, also loads One-to-X data (Default: False)
659 :returns: An efficacy indicator
660 :raises: :py:class:`~.EfficacyIndicatorNotFound`
661 """
663 @abc.abstractmethod
664 def get_efficacy_indicator_by_uuid(self, context, efficacy_indicator_uuid,
665 eager=False):
666 """Return an efficacy indicator given its UUID.
668 :param context: The security context
669 :param efficacy_indicator_uuid: The UUID of an efficacy indicator
670 :param eager: If True, also loads One-to-X data (Default: False)
671 :returns: An efficacy indicator
672 :raises: :py:class:`~.EfficacyIndicatorNotFound`
673 """
675 @abc.abstractmethod
676 def get_efficacy_indicator_by_name(self, context, efficacy_indicator_name,
677 eager=False):
678 """Return an efficacy indicator given its name.
680 :param context: The security context
681 :param efficacy_indicator_name: The name of an efficacy indicator
682 :param eager: If True, also loads One-to-X data (Default: False)
683 :returns: An efficacy indicator
684 :raises: :py:class:`~.EfficacyIndicatorNotFound`
685 """
687 @abc.abstractmethod
688 def destroy_efficacy_indicator(self, efficacy_indicator_uuid):
689 """Destroy an efficacy indicator.
691 :param efficacy_indicator_uuid: The UUID of an efficacy indicator
692 :raises: :py:class:`~.EfficacyIndicatorNotFound`
693 """
695 @abc.abstractmethod
696 def update_efficacy_indicator(self, efficacy_indicator_id, values):
697 """Update properties of an efficacy indicator.
699 :param efficacy_indicator_id: The ID of an efficacy indicator
700 :returns: An efficacy indicator
701 :raises: :py:class:`~.EfficacyIndicatorNotFound`
702 :raises: :py:class:`~.Invalid`
703 """
705 @abc.abstractmethod
706 def get_scoring_engine_list(
707 self, context, columns=None, filters=None, limit=None,
708 marker=None, sort_key=None, sort_dir=None, eager=False):
709 """Get specific columns for matching scoring engines.
711 Return a list of the specified columns for all scoring engines that
712 match the specified filters.
714 :param context: The security context
715 :param columns: List of column names to return.
716 Defaults to 'id' column when columns == None.
717 :param filters: Filters to apply. Defaults to None.
718 :param limit: Maximum number of scoring engines to return.
719 :param marker: the last item of the previous page; we return the next
720 result set.
721 :param sort_key: Attribute by which results should be sorted.
722 :param sort_dir: direction in which results should be sorted.
723 (asc, desc)
724 :param eager: If True, also loads One-to-X data (Default: False)
725 :returns: A list of tuples of the specified columns.
726 """
728 @abc.abstractmethod
729 def create_scoring_engine(self, values):
730 """Create a new scoring engine.
732 :param values: A dict containing several items used to identify
733 and track the scoring engine.
734 :returns: A scoring engine.
735 :raises: :py:class:`~.ScoringEngineAlreadyExists`
736 """
738 @abc.abstractmethod
739 def get_scoring_engine_by_id(self, context, scoring_engine_id,
740 eager=False):
741 """Return a scoring engine by its id.
743 :param context: The security context
744 :param scoring_engine_id: The id of a scoring engine.
745 :param eager: If True, also loads One-to-X data (Default: False)
746 :returns: A scoring engine.
747 :raises: :py:class:`~.ScoringEngineNotFound`
748 """
750 @abc.abstractmethod
751 def get_scoring_engine_by_uuid(self, context, scoring_engine_uuid,
752 eager=False):
753 """Return a scoring engine by its uuid.
755 :param context: The security context
756 :param scoring_engine_uuid: The uuid of a scoring engine.
757 :param eager: If True, also loads One-to-X data (Default: False)
758 :returns: A scoring engine.
759 :raises: :py:class:`~.ScoringEngineNotFound`
760 """
762 @abc.abstractmethod
763 def get_scoring_engine_by_name(self, context, scoring_engine_name,
764 eager=False):
765 """Return a scoring engine by its name.
767 :param context: The security context
768 :param scoring_engine_name: The name of a scoring engine.
769 :param eager: If True, also loads One-to-X data (Default: False)
770 :returns: A scoring engine.
771 :raises: :py:class:`~.ScoringEngineNotFound`
772 """
774 @abc.abstractmethod
775 def destroy_scoring_engine(self, scoring_engine_id):
776 """Destroy a scoring engine.
778 :param scoring_engine_id: The id of a scoring engine.
779 :raises: :py:class:`~.ScoringEngineNotFound`
780 """
782 @abc.abstractmethod
783 def update_scoring_engine(self, scoring_engine_id, values):
784 """Update properties of a scoring engine.
786 :param scoring_engine_id: The id of a scoring engine.
787 :returns: A scoring engine.
788 :raises: :py:class:`~.ScoringEngineNotFound`
789 :raises: :py:class:`~.Invalid`
790 """
792 @abc.abstractmethod
793 def get_service_list(self, context, filters=None, limit=None, marker=None,
794 sort_key=None, sort_dir=None, eager=False):
795 """Get specific columns for matching services.
797 Return a list of the specified columns for all services that
798 match the specified filters.
800 :param context: The security context
801 :param filters: Filters to apply. Defaults to None.
803 :param limit: Maximum number of services to return.
804 :param marker: The last item of the previous page; we return the next
805 result set.
806 :param sort_key: Attribute by which results should be sorted.
807 :param sort_dir: Direction in which results should be sorted.
808 (asc, desc)
809 :param eager: If True, also loads One-to-X data (Default: False)
810 :returns: A list of tuples of the specified columns.
811 """
813 @abc.abstractmethod
814 def create_service(self, values):
815 """Create a new service.
817 :param values: A dict containing items used to identify
818 and track the service. For example:
820 ::
822 {
823 'id': 1,
824 'name': 'watcher-api',
825 'status': 'ACTIVE',
826 'host': 'controller'
827 }
828 :returns: A service
829 :raises: :py:class:`~.ServiceAlreadyExists`
830 """
832 @abc.abstractmethod
833 def get_service_by_id(self, context, service_id, eager=False):
834 """Return a service given its ID.
836 :param context: The security context
837 :param service_id: The ID of a service
838 :param eager: If True, also loads One-to-X data (Default: False)
839 :returns: A service
840 :raises: :py:class:`~.ServiceNotFound`
841 """
843 @abc.abstractmethod
844 def get_service_by_name(self, context, service_name, eager=False):
845 """Return a service given its name.
847 :param context: The security context
848 :param service_name: The name of a service
849 :param eager: If True, also loads One-to-X data (Default: False)
850 :returns: A service
851 :raises: :py:class:`~.ServiceNotFound`
852 """
854 @abc.abstractmethod
855 def destroy_service(self, service_id):
856 """Destroy a service.
858 :param service_id: The ID of a service
859 :raises: :py:class:`~.ServiceNotFound`
860 """
862 @abc.abstractmethod
863 def update_service(self, service_id, values):
864 """Update properties of a service.
866 :param service_id: The ID of a service
867 :returns: A service
868 :raises: :py:class:`~.ServiceyNotFound`
869 :raises: :py:class:`~.Invalid`
870 """
872 @abc.abstractmethod
873 def soft_delete_service(self, service_id):
874 """Soft delete a service.
876 :param service_id: The id of a service.
877 :returns: A service.
878 :raises: :py:class:`~.ServiceNotFound`
879 """