saltext.gandi 0.1.0__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- saltext/gandi/__init__.py +28 -0
- saltext/gandi/modules/__init__.py +0 -0
- saltext/gandi/modules/gandi_billing.py +92 -0
- saltext/gandi/modules/gandi_domain.py +1526 -0
- saltext/gandi/modules/gandi_linkedzone.py +436 -0
- saltext/gandi/modules/gandi_livedns.py +962 -0
- saltext/gandi/modules/gandi_mod.py +225 -0
- saltext/gandi/runners/__init__.py +0 -0
- saltext/gandi/runners/gandi_billing.py +98 -0
- saltext/gandi/runners/gandi_domain.py +1535 -0
- saltext/gandi/runners/gandi_linkedzone.py +443 -0
- saltext/gandi/runners/gandi_livedns.py +971 -0
- saltext/gandi/runners/gandi_mod.py +176 -0
- saltext/gandi/states/__init__.py +0 -0
- saltext/gandi/states/gandi_domain.py +755 -0
- saltext/gandi/states/gandi_linkedzone.py +385 -0
- saltext/gandi/states/gandi_livedns.py +675 -0
- saltext/gandi/utils/__init__.py +0 -0
- saltext/gandi/utils/billing.py +97 -0
- saltext/gandi/utils/client.py +682 -0
- saltext/gandi/utils/domain.py +903 -0
- saltext/gandi/utils/linkedzone.py +371 -0
- saltext/gandi/utils/livedns.py +627 -0
- saltext/gandi/utils/profile.py +88 -0
- saltext/gandi/utils/resources.py +229 -0
- saltext/gandi/version.py +1 -0
- saltext_gandi-0.1.0.dist-info/METADATA +182 -0
- saltext_gandi-0.1.0.dist-info/RECORD +32 -0
- saltext_gandi-0.1.0.dist-info/WHEEL +6 -0
- saltext_gandi-0.1.0.dist-info/entry_points.txt +2 -0
- saltext_gandi-0.1.0.dist-info/licenses/LICENSE +373 -0
- saltext_gandi-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# pylint: disable=missing-module-docstring
|
|
2
|
+
import pathlib
|
|
3
|
+
|
|
4
|
+
PACKAGE_ROOT = pathlib.Path(__file__).resolve().parent
|
|
5
|
+
try:
|
|
6
|
+
from .version import __version__
|
|
7
|
+
except ImportError: # pragma: no cover
|
|
8
|
+
__version__ = "0.0.0.not-installed"
|
|
9
|
+
try:
|
|
10
|
+
from importlib.metadata import version, PackageNotFoundError
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
__version__ = version(__name__)
|
|
14
|
+
except PackageNotFoundError:
|
|
15
|
+
# package is not installed
|
|
16
|
+
pass
|
|
17
|
+
except ImportError:
|
|
18
|
+
try:
|
|
19
|
+
from pkg_resources import get_distribution, DistributionNotFound
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
__version__ = get_distribution(__name__).version
|
|
23
|
+
except DistributionNotFound:
|
|
24
|
+
# package is not installed
|
|
25
|
+
pass
|
|
26
|
+
except ImportError:
|
|
27
|
+
# pkg resources isn't even available?!
|
|
28
|
+
pass
|
|
File without changes
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
|
|
5
|
+
"""
|
|
6
|
+
Read `Gandi billing <https://api.gandi.net/docs/billing/>`_ information.
|
|
7
|
+
|
|
8
|
+
Three read-only endpoints: the account's balance and price grid, the same for
|
|
9
|
+
a specific organization, and the product catalogue. There are no writes and so
|
|
10
|
+
no states.
|
|
11
|
+
|
|
12
|
+
Connection profiles are shared with the rest of this extension; see the
|
|
13
|
+
:py:mod:`gandi execution module <saltext.gandi.modules.gandi_mod>` for how to
|
|
14
|
+
configure one.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
import logging
|
|
18
|
+
|
|
19
|
+
from saltext.gandi.utils import billing
|
|
20
|
+
from saltext.gandi.utils import profile as profile_util
|
|
21
|
+
|
|
22
|
+
log = logging.getLogger(__name__)
|
|
23
|
+
|
|
24
|
+
__virtualname__ = "gandi_billing"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def __virtual__():
|
|
28
|
+
return __virtualname__
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _get_config(profile=None):
|
|
32
|
+
return profile_util.from_minion(__salt__["config.get"], profile)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def get_info(sharing_id=None, profile=None):
|
|
36
|
+
"""
|
|
37
|
+
Return billing information for an account or an organization.
|
|
38
|
+
|
|
39
|
+
sharing_id
|
|
40
|
+
Organization to report on. Without one, the credential owner's own
|
|
41
|
+
account is reported. List the available values with
|
|
42
|
+
``gandi.list_organizations``.
|
|
43
|
+
|
|
44
|
+
profile
|
|
45
|
+
Profile to use (optional)
|
|
46
|
+
|
|
47
|
+
CLI Example:
|
|
48
|
+
|
|
49
|
+
.. code-block:: bash
|
|
50
|
+
|
|
51
|
+
salt '*' gandi_billing.get_info
|
|
52
|
+
salt '*' gandi_billing.get_info sharing_id=5a53edc7-b514-416a-98c2-2d477a288eb9
|
|
53
|
+
"""
|
|
54
|
+
return billing.get_info(_get_config(profile), sharing_id=sharing_id)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def get_prices(product_type, name, processes, per_page=None, profile=None, **params):
|
|
58
|
+
"""
|
|
59
|
+
Return catalogue prices for a product family.
|
|
60
|
+
|
|
61
|
+
product_type
|
|
62
|
+
One of ``cloud``, ``domain``, ``domain_option``, ``issued-cert``,
|
|
63
|
+
``mailboxv2``, ``openstack``, ``phone_advisory``, ``simple-hosting``,
|
|
64
|
+
``tmch``.
|
|
65
|
+
|
|
66
|
+
name
|
|
67
|
+
Product name, or list of them, e.g. ``com`` for the ``.com`` TLD.
|
|
68
|
+
|
|
69
|
+
processes
|
|
70
|
+
Process, or list of them: ``create``, ``renew``, ``transfer``,
|
|
71
|
+
``restore``.
|
|
72
|
+
|
|
73
|
+
per_page
|
|
74
|
+
Page size.
|
|
75
|
+
|
|
76
|
+
params
|
|
77
|
+
Any of ``country``, ``currency``, ``grid``, ``sharing_id``,
|
|
78
|
+
``prices_at``.
|
|
79
|
+
|
|
80
|
+
profile
|
|
81
|
+
Profile to use (optional)
|
|
82
|
+
|
|
83
|
+
CLI Example:
|
|
84
|
+
|
|
85
|
+
.. code-block:: bash
|
|
86
|
+
|
|
87
|
+
salt '*' gandi_billing.get_prices domain com create
|
|
88
|
+
salt '*' gandi_billing.get_prices domain '["com", "net"]' '["create", "renew"]' currency=CAD
|
|
89
|
+
"""
|
|
90
|
+
return billing.get_prices(
|
|
91
|
+
_get_config(profile), product_type, name, processes, per_page=per_page, **params
|
|
92
|
+
)
|