Debian Codegraph @

ansible_collections/community/dns/plugins/module_utils/_options.py

raw
1 # Copyright (c) 2021 Felix Fontein
2 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
3 # SPDX-License-Identifier: GPL-3.0-or-later
4
5 # Note that this module util is **PRIVATE** to the collection. It can have breaking changes at any time.
6 # Do not use this from other collections or standalone plugins/modules!
7
8 from __future__ import annotations
9
10 import typing as t
11
12 from ansible_collections.community.dns.plugins.module_utils._argspec import ArgumentSpec
13
14 if t.TYPE_CHECKING:
15 from ._provider import ProviderInformation # pragma: no cover
16
17
18 def create_bulk_operations_argspec(
19 provider_information: ProviderInformation,
20 ) -> ArgumentSpec:
21 """
22 If the provider supports bulk operations, return an ArgumentSpec object with appropriate
23 options. Otherwise return an empty one.
24 """
25 if not provider_information.supports_bulk_actions():
26 return ArgumentSpec()
27
28 return ArgumentSpec(
29 argument_spec={
30 "bulk_operation_threshold": {"type": "int", "default": 2},
31 },
32 )
33
34
35 def create_record_transformation_argspec() -> ArgumentSpec:
36 return ArgumentSpec(
37 argument_spec={
38 "txt_transformation": {
39 "type": "str",
40 "default": "unquoted",
41 "choices": ["api", "quoted", "unquoted"],
42 },
43 "txt_character_encoding": {
44 "type": "str",
45 "default": "decimal",
46 "choices": ["decimal", "octal"],
47 },
48 },
49 )