mirror of
https://github.com/ansible-collections/hetzner.hcloud
synced 2024-11-10 06:34:13 +00:00
refactor: use super() to reference parent class (#280)
This commit is contained in:
parent
1b83de57ef
commit
98afa99904
32 changed files with 126 additions and 126 deletions
|
@ -71,8 +71,8 @@ class Hcloud:
|
|||
def _mark_as_changed(self):
|
||||
self.result["changed"] = True
|
||||
|
||||
@staticmethod
|
||||
def base_module_arguments():
|
||||
@classmethod
|
||||
def base_module_arguments(cls):
|
||||
return {
|
||||
"api_token": {
|
||||
"type": "str",
|
||||
|
|
|
@ -143,7 +143,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudCertificate(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_certificate")
|
||||
super().__init__(module, "hcloud_certificate")
|
||||
self.hcloud_certificate = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -234,8 +234,8 @@ class AnsibleHcloudCertificate(Hcloud):
|
|||
self._mark_as_changed()
|
||||
self.hcloud_certificate = None
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
|
@ -252,7 +252,7 @@ class AnsibleHcloudCertificate(Hcloud):
|
|||
"choices": ["absent", "present"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
required_one_of=[["id", "name"]],
|
||||
required_if=[["state", "present", ["name"]]],
|
||||
|
|
|
@ -91,7 +91,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudCertificateInfo(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_certificate_info")
|
||||
super().__init__(module, "hcloud_certificate_info")
|
||||
self.hcloud_certificate_info = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -129,14 +129,14 @@ class AnsibleHcloudCertificateInfo(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
name={"type": "str"},
|
||||
label_selector={"type": "str"},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -82,7 +82,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudDatacenterInfo(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_datacenter_info")
|
||||
super().__init__(module, "hcloud_datacenter_info")
|
||||
self.hcloud_datacenter_info = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -113,13 +113,13 @@ class AnsibleHcloudDatacenterInfo(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
name={"type": "str"},
|
||||
**Hcloud.base_module_arguments(),
|
||||
**super().base_module_arguments(),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -178,7 +178,7 @@ from ..module_utils.vendor.hcloud.firewalls.domain import FirewallRule
|
|||
|
||||
class AnsibleHcloudFirewall(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_firewall")
|
||||
super().__init__(module, "hcloud_firewall")
|
||||
self.hcloud_firewall = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -295,8 +295,8 @@ class AnsibleHcloudFirewall(Hcloud):
|
|||
self._mark_as_changed()
|
||||
self.hcloud_firewall = None
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
|
@ -319,7 +319,7 @@ class AnsibleHcloudFirewall(Hcloud):
|
|||
"choices": ["absent", "present"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
required_one_of=[["id", "name"]],
|
||||
required_if=[["state", "present", ["name"]]],
|
||||
|
|
|
@ -170,7 +170,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudFloatingIP(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_floating_ip")
|
||||
super().__init__(module, "hcloud_floating_ip")
|
||||
self.hcloud_floating_ip = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -297,8 +297,8 @@ class AnsibleHcloudFloatingIP(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
|
@ -314,7 +314,7 @@ class AnsibleHcloudFloatingIP(Hcloud):
|
|||
"choices": ["absent", "present"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
required_one_of=[["id", "name"]],
|
||||
mutually_exclusive=[["home_location", "server"]],
|
||||
|
|
|
@ -101,7 +101,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudFloatingIPInfo(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_floating_ip_info")
|
||||
super().__init__(module, "hcloud_floating_ip_info")
|
||||
self.hcloud_floating_ip_info = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -142,13 +142,13 @@ class AnsibleHcloudFloatingIPInfo(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
label_selector={"type": "str"},
|
||||
**Hcloud.base_module_arguments(),
|
||||
**super().base_module_arguments(),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -117,7 +117,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudImageInfo(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_image_info")
|
||||
super().__init__(module, "hcloud_image_info")
|
||||
self.hcloud_image_info = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -175,8 +175,8 @@ class AnsibleHcloudImageInfo(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
|
@ -184,7 +184,7 @@ class AnsibleHcloudImageInfo(Hcloud):
|
|||
label_selector={"type": "str"},
|
||||
type={"choices": ["system", "snapshot", "backup"], "default": "system", "type": "str"},
|
||||
architecture={"choices": ["x86", "arm"], "type": "str"},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -103,7 +103,7 @@ from ..module_utils.hcloud import Hcloud
|
|||
|
||||
class AnsibleHcloudIsoInfo(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_iso_info")
|
||||
super().__init__(module, "hcloud_iso_info")
|
||||
self.hcloud_iso_info = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -141,15 +141,15 @@ class AnsibleHcloudIsoInfo(Hcloud):
|
|||
except Exception as e:
|
||||
self.module.fail_json(msg=e.message)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
name={"type": "str"},
|
||||
architecture={"type": "str", "choices": ["x86", "arm"]},
|
||||
include_architecture_wildcard={"type": "bool"},
|
||||
**Hcloud.base_module_arguments(),
|
||||
**super().base_module_arguments(),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -150,7 +150,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudLoadBalancer(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_load_balancer")
|
||||
super().__init__(module, "hcloud_load_balancer")
|
||||
self.hcloud_load_balancer = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -274,8 +274,8 @@ class AnsibleHcloudLoadBalancer(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
|
@ -290,7 +290,7 @@ class AnsibleHcloudLoadBalancer(Hcloud):
|
|||
"choices": ["absent", "present"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
required_one_of=[["id", "name"]],
|
||||
mutually_exclusive=[["location", "network_zone"]],
|
||||
|
|
|
@ -265,7 +265,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudLoadBalancerInfo(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_load_balancer_info")
|
||||
super().__init__(module, "hcloud_load_balancer_info")
|
||||
self.hcloud_load_balancer_info = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -365,14 +365,14 @@ class AnsibleHcloudLoadBalancerInfo(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
name={"type": "str"},
|
||||
label_selector={"type": "str"},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -100,7 +100,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudLoadBalancerNetwork(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_load_balancer_network")
|
||||
super().__init__(module, "hcloud_load_balancer_network")
|
||||
self.hcloud_network = None
|
||||
self.hcloud_load_balancer = None
|
||||
self.hcloud_load_balancer_network = None
|
||||
|
@ -170,8 +170,8 @@ class AnsibleHcloudLoadBalancerNetwork(Hcloud):
|
|||
|
||||
self.hcloud_load_balancer_network = None
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
network={"type": "str", "required": True},
|
||||
|
@ -181,7 +181,7 @@ class AnsibleHcloudLoadBalancerNetwork(Hcloud):
|
|||
"choices": ["absent", "present"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -294,7 +294,7 @@ from ..module_utils.vendor.hcloud.load_balancers.domain import (
|
|||
|
||||
class AnsibleHcloudLoadBalancerService(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_load_balancer_service")
|
||||
super().__init__(module, "hcloud_load_balancer_service")
|
||||
self.hcloud_load_balancer = None
|
||||
self.hcloud_load_balancer_service = None
|
||||
|
||||
|
@ -507,8 +507,8 @@ class AnsibleHcloudLoadBalancerService(Hcloud):
|
|||
except APIException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
load_balancer={"type": "str", "required": True},
|
||||
|
@ -556,7 +556,7 @@ class AnsibleHcloudLoadBalancerService(Hcloud):
|
|||
"choices": ["absent", "present"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -149,7 +149,7 @@ from ..module_utils.vendor.hcloud.load_balancers.domain import (
|
|||
|
||||
class AnsibleHcloudLoadBalancerTarget(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_load_balancer_target")
|
||||
super().__init__(module, "hcloud_load_balancer_target")
|
||||
self.hcloud_load_balancer = None
|
||||
self.hcloud_load_balancer_target = None
|
||||
self.hcloud_server = None
|
||||
|
@ -276,8 +276,8 @@ class AnsibleHcloudLoadBalancerTarget(Hcloud):
|
|||
self._mark_as_changed()
|
||||
self.hcloud_load_balancer_target = None
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
type={"type": "str", "required": True, "choices": ["server", "label_selector", "ip"]},
|
||||
|
@ -290,7 +290,7 @@ class AnsibleHcloudLoadBalancerTarget(Hcloud):
|
|||
"choices": ["absent", "present"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -93,7 +93,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudLoadBalancerTypeInfo(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_load_balancer_type_info")
|
||||
super().__init__(module, "hcloud_load_balancer_type_info")
|
||||
self.hcloud_load_balancer_type_info = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -130,13 +130,13 @@ class AnsibleHcloudLoadBalancerTypeInfo(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
name={"type": "str"},
|
||||
**Hcloud.base_module_arguments(),
|
||||
**super().base_module_arguments(),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -83,7 +83,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudLocationInfo(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_location_info")
|
||||
super().__init__(module, "hcloud_location_info")
|
||||
self.hcloud_location_info = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -114,13 +114,13 @@ class AnsibleHcloudLocationInfo(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
name={"type": "str"},
|
||||
**Hcloud.base_module_arguments(),
|
||||
**super().base_module_arguments(),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -125,7 +125,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudNetwork(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_network")
|
||||
super().__init__(module, "hcloud_network")
|
||||
self.hcloud_network = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -222,8 +222,8 @@ class AnsibleHcloudNetwork(Hcloud):
|
|||
self.fail_json_hcloud(e)
|
||||
self.hcloud_network = None
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
|
@ -236,7 +236,7 @@ class AnsibleHcloudNetwork(Hcloud):
|
|||
"choices": ["absent", "present"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
required_one_of=[["id", "name"]],
|
||||
supports_check_mode=True,
|
||||
|
|
|
@ -190,7 +190,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudNetworkInfo(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_network_info")
|
||||
super().__init__(module, "hcloud_network_info")
|
||||
self.hcloud_network_info = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -264,14 +264,14 @@ class AnsibleHcloudNetworkInfo(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
name={"type": "str"},
|
||||
label_selector={"type": "str"},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -116,7 +116,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudPlacementGroup(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_placement_group")
|
||||
super().__init__(module, "hcloud_placement_group")
|
||||
self.hcloud_placement_group = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -183,8 +183,8 @@ class AnsibleHcloudPlacementGroup(Hcloud):
|
|||
self._mark_as_changed()
|
||||
self.hcloud_placement_group = None
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
|
@ -195,7 +195,7 @@ class AnsibleHcloudPlacementGroup(Hcloud):
|
|||
"choices": ["absent", "present"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
required_one_of=[["id", "name"]],
|
||||
required_if=[["state", "present", ["name"]]],
|
||||
|
|
|
@ -140,7 +140,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudPrimaryIP(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_primary_ip")
|
||||
super().__init__(module, "hcloud_primary_ip")
|
||||
self.hcloud_primary_ip = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -222,8 +222,8 @@ class AnsibleHcloudPrimaryIP(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
|
@ -237,7 +237,7 @@ class AnsibleHcloudPrimaryIP(Hcloud):
|
|||
"choices": ["absent", "present"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
required_one_of=[["id", "name"]],
|
||||
supports_check_mode=True,
|
||||
|
|
|
@ -126,7 +126,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudPrimaryIPInfo(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_primary_ip_info")
|
||||
super().__init__(module, "hcloud_primary_ip_info")
|
||||
self.hcloud_primary_ip_info = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -172,14 +172,14 @@ class AnsibleHcloudPrimaryIPInfo(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
label_selector={"type": "str"},
|
||||
name={"type": "str"},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -146,7 +146,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudReverseDNS(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_rdns")
|
||||
super().__init__(module, "hcloud_rdns")
|
||||
self.hcloud_resource = None
|
||||
self.hcloud_rdns = None
|
||||
|
||||
|
@ -311,8 +311,8 @@ class AnsibleHcloudReverseDNS(Hcloud):
|
|||
self._mark_as_changed()
|
||||
self.hcloud_rdns = None
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
server={"type": "str"},
|
||||
|
@ -325,7 +325,7 @@ class AnsibleHcloudReverseDNS(Hcloud):
|
|||
"choices": ["absent", "present"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
required_one_of=[["server", "floating_ip", "load_balancer", "primary_ip"]],
|
||||
mutually_exclusive=[["server", "floating_ip", "load_balancer", "primary_ip"]],
|
||||
|
|
|
@ -97,7 +97,7 @@ from ..module_utils.vendor.hcloud.networks.domain import NetworkRoute
|
|||
|
||||
class AnsibleHcloudRoute(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_route")
|
||||
super().__init__(module, "hcloud_route")
|
||||
self.hcloud_network = None
|
||||
self.hcloud_route = None
|
||||
|
||||
|
@ -155,8 +155,8 @@ class AnsibleHcloudRoute(Hcloud):
|
|||
self._mark_as_changed()
|
||||
self.hcloud_route = None
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
network={"type": "str", "required": True},
|
||||
|
@ -166,7 +166,7 @@ class AnsibleHcloudRoute(Hcloud):
|
|||
"choices": ["absent", "present"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -346,7 +346,7 @@ from ..module_utils.vendor.hcloud.volumes.domain import Volume
|
|||
|
||||
class AnsibleHcloudServer(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_server")
|
||||
super().__init__(module, "hcloud_server")
|
||||
self.hcloud_server = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -863,8 +863,8 @@ class AnsibleHcloudServer(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
|
@ -896,7 +896,7 @@ class AnsibleHcloudServer(Hcloud):
|
|||
"choices": ["absent", "present", "restarted", "started", "stopped", "rebuild"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
required_one_of=[["id", "name"]],
|
||||
mutually_exclusive=[["location", "datacenter"]],
|
||||
|
|
|
@ -146,7 +146,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudServerInfo(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_server_info")
|
||||
super().__init__(module, "hcloud_server_info")
|
||||
self.hcloud_server_info = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -200,14 +200,14 @@ class AnsibleHcloudServerInfo(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
name={"type": "str"},
|
||||
label_selector={"type": "str"},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -121,7 +121,7 @@ from ..module_utils.vendor.hcloud import APIException, HCloudException
|
|||
|
||||
class AnsibleHcloudServerNetwork(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_server_network")
|
||||
super().__init__(module, "hcloud_server_network")
|
||||
self.hcloud_network = None
|
||||
self.hcloud_server = None
|
||||
self.hcloud_server_network = None
|
||||
|
@ -205,8 +205,8 @@ class AnsibleHcloudServerNetwork(Hcloud):
|
|||
self._mark_as_changed()
|
||||
self.hcloud_server_network = None
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
network={"type": "str", "required": True},
|
||||
|
@ -217,7 +217,7 @@ class AnsibleHcloudServerNetwork(Hcloud):
|
|||
"choices": ["absent", "present"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -129,7 +129,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudServerTypeInfo(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_server_type_info")
|
||||
super().__init__(module, "hcloud_server_type_info")
|
||||
self.hcloud_server_type_info = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -171,13 +171,13 @@ class AnsibleHcloudServerTypeInfo(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
name={"type": "str"},
|
||||
**Hcloud.base_module_arguments(),
|
||||
**super().base_module_arguments(),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -119,7 +119,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudSSHKey(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_ssh_key")
|
||||
super().__init__(module, "hcloud_ssh_key")
|
||||
self.hcloud_ssh_key = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -193,8 +193,8 @@ class AnsibleHcloudSSHKey(Hcloud):
|
|||
self._mark_as_changed()
|
||||
self.hcloud_ssh_key = None
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
|
@ -206,7 +206,7 @@ class AnsibleHcloudSSHKey(Hcloud):
|
|||
"choices": ["absent", "present"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
required_one_of=[["id", "name", "fingerprint"]],
|
||||
required_if=[["state", "present", ["name"]]],
|
||||
|
|
|
@ -83,7 +83,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudSSHKeyInfo(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_ssh_key_info")
|
||||
super().__init__(module, "hcloud_ssh_key_info")
|
||||
self.hcloud_ssh_key_info = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -122,15 +122,15 @@ class AnsibleHcloudSSHKeyInfo(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
name={"type": "str"},
|
||||
fingerprint={"type": "str"},
|
||||
label_selector={"type": "str"},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -134,7 +134,7 @@ from ..module_utils.vendor.hcloud.networks.domain import NetworkSubnet
|
|||
|
||||
class AnsibleHcloudSubnetwork(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_subnetwork")
|
||||
super().__init__(module, "hcloud_subnetwork")
|
||||
self.hcloud_network = None
|
||||
self.hcloud_subnetwork = None
|
||||
|
||||
|
@ -199,8 +199,8 @@ class AnsibleHcloudSubnetwork(Hcloud):
|
|||
self._mark_as_changed()
|
||||
self.hcloud_subnetwork = None
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
network={"type": "str", "required": True},
|
||||
|
@ -212,7 +212,7 @@ class AnsibleHcloudSubnetwork(Hcloud):
|
|||
"choices": ["absent", "present"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
|
@ -166,7 +166,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudVolume(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_volume")
|
||||
super().__init__(module, "hcloud_volume")
|
||||
self.hcloud_volume = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -285,8 +285,8 @@ class AnsibleHcloudVolume(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
|
@ -302,7 +302,7 @@ class AnsibleHcloudVolume(Hcloud):
|
|||
"choices": ["absent", "present"],
|
||||
"default": "present",
|
||||
},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
required_one_of=[["id", "name"]],
|
||||
mutually_exclusive=[["location", "server"]],
|
||||
|
|
|
@ -100,7 +100,7 @@ from ..module_utils.vendor.hcloud import HCloudException
|
|||
|
||||
class AnsibleHcloudVolumeInfo(Hcloud):
|
||||
def __init__(self, module):
|
||||
Hcloud.__init__(self, module, "hcloud_volume_info")
|
||||
super().__init__(module, "hcloud_volume_info")
|
||||
self.hcloud_volume_info = None
|
||||
|
||||
def _prepare_result(self):
|
||||
|
@ -142,14 +142,14 @@ class AnsibleHcloudVolumeInfo(Hcloud):
|
|||
except HCloudException as e:
|
||||
self.fail_json_hcloud(e)
|
||||
|
||||
@staticmethod
|
||||
def define_module():
|
||||
@classmethod
|
||||
def define_module(cls):
|
||||
return AnsibleModule(
|
||||
argument_spec=dict(
|
||||
id={"type": "int"},
|
||||
name={"type": "str"},
|
||||
label_selector={"type": "str"},
|
||||
**Hcloud.base_module_arguments()
|
||||
**super().base_module_arguments()
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue