def full_name(self): delimiter = ':' try: if validate_ip_v6_address(self.full_name_dict['name']): delimiter = '.' except TypeError: pass return '{0}{1}{2}'.format(self.full_name_dict['name'], delimiter, self.port)
def destination(self): if self.address is None: return None if self.port is None: return None if validate_ip_v6_address(self.address): result = '{0}.{1}'.format(self.address, self.port) else: result = '{0}:{1}'.format(self.address, self.port) return result
def create(self): self._set_changed_options() if self.want.reverse == 'enabled': if self.want.time_until_up != 0: raise F5ModuleError( "Monitors with the 'reverse' attribute are not currently compatible with 'time_until_up'." ) if not self.want.receive: raise F5ModuleError( "A 'receive' string must be specified when setting 'reverse'." ) if self.want.receive is not None and validate_ip_v6_address( self.want.receive) and self.want.query_type == 'a': raise F5ModuleError( "Monitor has a IPv6 address. Only a 'query_type' of 'aaaa' is supported for IPv6." ) elif (self.want.receive is not None and validate_ip_address(self.want.receive) and self.want.query_type == 'aaaa'): raise F5ModuleError( "Monitor has a IPv4 address. Only a 'query_type' of 'a' is supported for IPv4." ) if self.want.accept_rcode == 'anything': if self.want.receive is not None and is_valid_ip( self.want.receive): raise F5ModuleError( "No 'receive' string may be specified, or exist, when 'accept_rcode' is 'anything'." ) elif self.want.receive is None: self.want.update({'receive': ''}) if self.want.query_name is None: raise F5ModuleError( "'query_name' is required when creating a new DNS monitor.") if self.module.check_mode: return True self.create_on_device() return True
def full_name(self): delimiter = ':' if validate_ip_v6_address(self.full_name_dict['name']): delimiter = '.' return '{0}{1}{2}'.format(self.full_name_dict['name'], delimiter, self.port)