INSTRUCTION
stringlengths
1
46.3k
RESPONSE
stringlengths
75
80.2k
Return the hosts found in the hosts file in as an OrderedDict
def _list_hosts(): ''' Return the hosts found in the hosts file in as an OrderedDict ''' try: return __context__['hosts._list_hosts'] except KeyError: count = 0 hfn = __get_hosts_filename() ret = odict.OrderedDict() try: with salt.utils.files.fopen...
Return the ip associated with the named host CLI Example: .. code-block:: bash salt '*' hosts.get_ip <hostname>
def get_ip(host): ''' Return the ip associated with the named host CLI Example: .. code-block:: bash salt '*' hosts.get_ip <hostname> ''' hosts = _list_hosts() if not hosts: return '' # Look for the op for addr in hosts: if host in hosts[addr]: ...
Return true if the alias is set CLI Example: .. code-block:: bash salt '*' hosts.has_pair <ip> <alias>
def has_pair(ip, alias): ''' Return true if the alias is set CLI Example: .. code-block:: bash salt '*' hosts.has_pair <ip> <alias> ''' hosts = _list_hosts() try: return alias in hosts[ip] except KeyError: return False
Set the host entry in the hosts file for the given ip, this will overwrite any previous entry for the given ip .. versionchanged:: 2016.3.0 If ``alias`` does not include any host names (it is the empty string or contains only whitespace), all entries for the given IP address are removed...
def set_host(ip, alias): ''' Set the host entry in the hosts file for the given ip, this will overwrite any previous entry for the given ip .. versionchanged:: 2016.3.0 If ``alias`` does not include any host names (it is the empty string or contains only whitespace), all entries for the...
Remove a host entry from the hosts file CLI Example: .. code-block:: bash salt '*' hosts.rm_host <ip> <alias>
def rm_host(ip, alias): ''' Remove a host entry from the hosts file CLI Example: .. code-block:: bash salt '*' hosts.rm_host <ip> <alias> ''' if not has_pair(ip, alias): return True # Make sure future calls to _list_hosts() will re-read the file __context__.pop('hosts....
Add a host to an existing entry, if the entry is not in place then create it with the given host CLI Example: .. code-block:: bash salt '*' hosts.add_host <ip> <alias>
def add_host(ip, alias): ''' Add a host to an existing entry, if the entry is not in place then create it with the given host CLI Example: .. code-block:: bash salt '*' hosts.add_host <ip> <alias> ''' hfn = _get_or_create_hostfile() if not os.path.isfile(hfn): return F...
Open the connection to the Arista switch over the eAPI.
def init(opts): ''' Open the connection to the Arista switch over the eAPI. ''' proxy_dict = opts.get('proxy', {}) conn_args = proxy_dict.copy() conn_args.pop('proxytype', None) opts['multiprocessing'] = conn_args.get('multiprocessing', True) # This is not a SSH-based proxy, so it should...
Calls an arbitrary pyeapi method.
def call(method, *args, **kwargs): ''' Calls an arbitrary pyeapi method. ''' kwargs = clean_kwargs(**kwargs) return getattr(pyeapi_device['connection'], method)(*args, **kwargs)
Return the valid shells on this system
def _get_shells(): ''' Return the valid shells on this system ''' start = time.time() if 'sh.last_shells' in __context__: if start - __context__['sh.last_shells'] > 5: __context__['sh.last_shells'] = start else: __context__['sh.shells'] = __salt__['cmd.shells'...
Scan the shell execve routines. This beacon will convert all login shells .. code-block:: yaml beacons: sh: []
def beacon(config): ''' Scan the shell execve routines. This beacon will convert all login shells .. code-block:: yaml beacons: sh: [] ''' ret = [] pkey = 'sh.vt' shells = _get_shells() ps_out = __salt__['status.procs']() track_pids = [] for pid in ps_out: ...
Get instance details
def _get_instance(project_id, instance_zone, name, service): ''' Get instance details ''' return service.instances().get(project=project_id, zone=instance_zone, instance=name).execute()
Fetch network selfLink from network name.
def _get_network(project_id, network_name, service): ''' Fetch network selfLink from network name. ''' return service.networks().get(project=project_id, network=network_name).execute()
Create a route to send traffic destined to the Internet through your gateway instance credential_file : string File location of application default credential. For more information, refer: https://developers.google.com/identity/protocols/application-default-credentials project_id : string ...
def route_create(credential_file=None, project_id=None, name=None, dest_range=None, next_hop_instance=None, instance_zone=None, tags=None, network=None, priority=None ...
Takes a dictionary, max_val_size and replace_with and recursively loops through and replaces any values that are greater than max_val_size.
def _trim_dict_in_dict(data, max_val_size, replace_with): ''' Takes a dictionary, max_val_size and replace_with and recursively loops through and replaces any values that are greater than max_val_size. ''' for key in data: if isinstance(data[key], dict): _trim_dict_in_dict(da...
Takes a dictionary and iterates over its keys, looking for large values and replacing them with a trimmed string. If after the first pass over dictionary keys, the dictionary is not sufficiently small, the stepper_size will be increased and the dictionary will be rescanned. This allows for progressive ...
def trim_dict( data, max_dict_bytes, percent=50.0, stepper_size=10, replace_with='VALUE_TRIMMED', is_msgpacked=False, use_bin_type=False): ''' Takes a dictionary and iterates over its keys, looking for large values and replacing them with a trimmed str...
Return a value for 'name' from command line args then config file options. Specify 'key' if the config file option is not the same as 'name'.
def _config(name, key=None, **kwargs): ''' Return a value for 'name' from command line args then config file options. Specify 'key' if the config file option is not the same as 'name'. ''' if key is None: key = name if name in kwargs: value = kwargs[name] else: value ...
Instantiate LDAP Connection class and return an LDAP connection object
def _connect(**kwargs): ''' Instantiate LDAP Connection class and return an LDAP connection object ''' connargs = {} for name in ['uri', 'server', 'port', 'tls', 'no_verify', 'binddn', 'bindpw', 'anonymous']: connargs[name] = _config(name, **kwargs) return _LDAPConnecti...
Run an arbitrary LDAP query and return the results. CLI Example: .. code-block:: bash salt 'ldaphost' ldap.search "filter=cn=myhost" Return data: .. code-block:: python {'myhost': {'count': 1, 'results': [['cn=myhost,ou=hosts,o=acme,c=gb', ...
def search(filter, # pylint: disable=C0103 dn=None, # pylint: disable=C0103 scope=None, attrs=None, **kwargs): ''' Run an arbitrary LDAP query and return the results. CLI Example: .. code-block:: bash salt 'ldaphost' ldap.search "filter=cn=...
.. versionadded:: 2019.2.0 Check whether a domain name in the current zone is available for use. :param name: The DNS name to query. :param region: The region to query for the DNS name in question. CLI Example: .. code-block:: bash salt-call azurearm_network.check_dns_name_availability...
def check_dns_name_availability(name, region, **kwargs): ''' .. versionadded:: 2019.2.0 Check whether a domain name in the current zone is available for use. :param name: The DNS name to query. :param region: The region to query for the DNS name in question. CLI Example: .. code-block::...
.. versionadded:: 2019.2.0 Check that a private ip address is available within the specified virtual network. :param ip_address: The ip_address to query. :param virtual_network: The virtual network to query for the IP address in question. :param resource_group: The resource group name as...
def check_ip_address_availability(ip_address, virtual_network, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Check that a private ip address is available within the specified virtual network. :param ip_address: The ip_address to query. :param virt...
.. versionadded:: 2019.2.0 Get details about a default security rule within a security group. :param name: The name of the security rule to query. :param security_group: The network security group containing the security rule. :param resource_group: The resource group name assigned to the ...
def default_security_rule_get(name, security_group, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get details about a default security rule within a security group. :param name: The name of the security rule to query. :param security_group: The network security group containing the ...
.. versionadded:: 2019.2.0 List default security rules within a security group. :param security_group: The network security group to query. :param resource_group: The resource group name assigned to the network security group. CLI Example: .. code-block:: bash salt-call azurear...
def default_security_rules_list(security_group, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 List default security rules within a security group. :param security_group: The network security group to query. :param resource_group: The resource group name assigned to the network...
.. versionadded:: 2019.2.0 List security rules within a network security group. :param security_group: The network security group to query. :param resource_group: The resource group name assigned to the network security group. CLI Example: .. code-block:: bash salt-call azurear...
def security_rules_list(security_group, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 List security rules within a network security group. :param security_group: The network security group to query. :param resource_group: The resource group name assigned to the network securit...
.. versionadded:: 2019.2.0 Create or update a security rule within a specified network security group. :param name: The name of the security rule to create. :param access: 'allow' or 'deny' :param direction: 'inbound' or 'outbound' :param priority: Integer between 100 an...
def security_rule_create_or_update(name, access, direction, priority, protocol, security_group, resource_group, source_address_prefix=None, destination_address_prefix=None, source_port_range=None, destination_port_range=None, source_address_prefixes=...
.. versionadded:: 2019.2.0 Delete a security rule within a specified security group. :param name: The name of the security rule to delete. :param security_group: The network security group containing the security rule. :param resource_group: The resource group name assigned to the ne...
def security_rule_delete(security_rule, security_group, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Delete a security rule within a specified security group. :param name: The name of the security rule to delete. :param security_group: The network security gr...
.. versionadded:: 2019.2.0 Get a security rule within a specified network security group. :param name: The name of the security rule to query. :param security_group: The network security group containing the security rule. :param resource_group: The resource group name assigned to the ...
def security_rule_get(security_rule, security_group, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get a security rule within a specified network security group. :param name: The name of the security rule to query. :param security_group: The network security group containing the ...
.. versionadded:: 2019.2.0 Create or update a network security group. :param name: The name of the network security group to create. :param resource_group: The resource group name assigned to the network security group. CLI Example: .. code-block:: bash salt-call azurearm_netwo...
def network_security_group_create_or_update(name, resource_group, **kwargs): # pylint: disable=invalid-name ''' .. versionadded:: 2019.2.0 Create or update a network security group. :param name: The name of the network security group to create. :param resource_group: The resource group name assi...
.. versionadded:: 2019.2.0 Delete a network security group within a resource group. :param name: The name of the network security group to delete. :param resource_group: The resource group name assigned to the network security group. CLI Example: .. code-block:: bash salt-call ...
def network_security_group_delete(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Delete a network security group within a resource group. :param name: The name of the network security group to delete. :param resource_group: The resource group name assigned to the network ...
.. versionadded:: 2019.2.0 Get details about a network security group within a resource group. :param name: The name of the network security group to query. :param resource_group: The resource group name assigned to the network security group. CLI Example: .. code-block:: bash ...
def network_security_group_get(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get details about a network security group within a resource group. :param name: The name of the network security group to query. :param resource_group: The resource group name assigned to the n...
.. versionadded:: 2019.2.0 List all network security groups within a resource group. :param resource_group: The resource group name to list network security \ groups within. CLI Example: .. code-block:: bash salt-call azurearm_network.network_security_groups_list testgroup
def network_security_groups_list(resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 List all network security groups within a resource group. :param resource_group: The resource group name to list network security \ groups within. CLI Example: .. code-block:: bash sal...
.. versionadded:: 2019.2.0 List all network security groups within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.network_security_groups_list_all
def network_security_groups_list_all(**kwargs): # pylint: disable=invalid-name ''' .. versionadded:: 2019.2.0 List all network security groups within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.network_security_groups_list_all ''' result = {} ...
.. versionadded:: 2019.2.0 List all subnets within a virtual network. :param virtual_network: The virtual network name to list subnets within. :param resource_group: The resource group name assigned to the virtual network. CLI Example: .. code-block:: bash salt-call azurearm_ne...
def subnets_list(virtual_network, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 List all subnets within a virtual network. :param virtual_network: The virtual network name to list subnets within. :param resource_group: The resource group name assigned to the virtual network. ...
.. versionadded:: 2019.2.0 Get details about a specific subnet. :param name: The name of the subnet to query. :param virtual_network: The virtual network name containing the subnet. :param resource_group: The resource group name assigned to the virtual network. CLI Example: ...
def subnet_get(name, virtual_network, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get details about a specific subnet. :param name: The name of the subnet to query. :param virtual_network: The virtual network name containing the subnet. :param resource_group: The resour...
.. versionadded:: 2019.2.0 Create or update a subnet. :param name: The name assigned to the subnet being created or updated. :param address_prefix: A valid CIDR block within the virtual network. :param virtual_network: The virtual network name containing the subnet. :param resource_grou...
def subnet_create_or_update(name, address_prefix, virtual_network, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Create or update a subnet. :param name: The name assigned to the subnet being created or updated. :param address_prefix: A valid CIDR block within the virtual network. ...
.. versionadded:: 2019.2.0 Delete a subnet. :param name: The name of the subnet to delete. :param virtual_network: The virtual network name containing the subnet. :param resource_group: The resource group name assigned to the virtual network. CLI Example: .. code-block:: ba...
def subnet_delete(name, virtual_network, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Delete a subnet. :param name: The name of the subnet to delete. :param virtual_network: The virtual network name containing the subnet. :param resource_group: The resource group name as...
.. versionadded:: 2019.2.0 List all virtual networks within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.virtual_networks_list_all
def virtual_networks_list_all(**kwargs): ''' .. versionadded:: 2019.2.0 List all virtual networks within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.virtual_networks_list_all ''' result = {} netconn = __utils__['azurearm.get_client']('network...
.. versionadded:: 2019.2.0 List all virtual networks within a resource group. :param resource_group: The resource group name to list virtual networks within. CLI Example: .. code-block:: bash salt-call azurearm_network.virtual_networks_list testgroup
def virtual_networks_list(resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 List all virtual networks within a resource group. :param resource_group: The resource group name to list virtual networks within. CLI Example: .. code-block:: bash salt-call azurearm_network...
.. versionadded:: 2019.2.0 Create or update a virtual network. :param name: The name assigned to the virtual network being created or updated. :param address_prefixes: A list of CIDR blocks which can be used by subnets within the virtual network. :param resource_group: The resource g...
def virtual_network_create_or_update(name, address_prefixes, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Create or update a virtual network. :param name: The name assigned to th...
.. versionadded:: 2019.2.0 Delete a virtual network. :param name: The name of the virtual network to delete. :param resource_group: The resource group name assigned to the virtual network CLI Example: .. code-block:: bash salt-call azurearm_network.virtual_network_delete testne...
def virtual_network_delete(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Delete a virtual network. :param name: The name of the virtual network to delete. :param resource_group: The resource group name assigned to the virtual network CLI Example: .. code-block:...
.. versionadded:: 2019.2.0 Get details about a specific virtual network. :param name: The name of the virtual network to query. :param resource_group: The resource group name assigned to the virtual network. CLI Example: .. code-block:: bash salt-call azurearm_network.virtual_n...
def virtual_network_get(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get details about a specific virtual network. :param name: The name of the virtual network to query. :param resource_group: The resource group name assigned to the virtual network. CLI Example: ...
.. versionadded:: 2019.2.0 List all load balancers within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.load_balancers_list_all
def load_balancers_list_all(**kwargs): ''' .. versionadded:: 2019.2.0 List all load balancers within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.load_balancers_list_all ''' result = {} netconn = __utils__['azurearm.get_client']('network', **k...
.. versionadded:: 2019.2.0 List all load balancers within a resource group. :param resource_group: The resource group name to list load balancers within. CLI Example: .. code-block:: bash salt-call azurearm_network.load_balancers_list testgroup
def load_balancers_list(resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 List all load balancers within a resource group. :param resource_group: The resource group name to list load balancers within. CLI Example: .. code-block:: bash salt-call azurearm_network.load_...
.. versionadded:: 2019.2.0 Get details about a specific load balancer. :param name: The name of the load balancer to query. :param resource_group: The resource group name assigned to the load balancer. CLI Example: .. code-block:: bash salt-call azurearm_network.load_balancer_g...
def load_balancer_get(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get details about a specific load balancer. :param name: The name of the load balancer to query. :param resource_group: The resource group name assigned to the load balancer. CLI Example: .. co...
.. versionadded:: 2019.2.0 Create or update a load balancer within a specified resource group. :param name: The name of the load balancer to create. :param resource_group: The resource group name assigned to the load balancer. CLI Example: .. code-block:: bash salt-call azurear...
def load_balancer_create_or_update(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Create or update a load balancer within a specified resource group. :param name: The name of the load balancer to create. :param resource_group: The resource group name assigned to the load ...
.. versionadded:: 2019.2.0 Delete a load balancer. :param name: The name of the load balancer to delete. :param resource_group: The resource group name assigned to the load balancer. CLI Example: .. code-block:: bash salt-call azurearm_network.load_balancer_delete testlb testgr...
def load_balancer_delete(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Delete a load balancer. :param name: The name of the load balancer to delete. :param resource_group: The resource group name assigned to the load balancer. CLI Example: .. code-block:: bash ...
.. versionadded:: 2019.2.0 List subscription network usage for a location. :param location: The Azure location to query for network usage. CLI Example: .. code-block:: bash salt-call azurearm_network.usages_list westus
def usages_list(location, **kwargs): ''' .. versionadded:: 2019.2.0 List subscription network usage for a location. :param location: The Azure location to query for network usage. CLI Example: .. code-block:: bash salt-call azurearm_network.usages_list westus ''' netconn = ...
.. versionadded:: 2019.2.0 Delete a network interface. :param name: The name of the network interface to delete. :param resource_group: The resource group name assigned to the network interface. CLI Example: .. code-block:: bash salt-call azurearm_network.network_interface_dele...
def network_interface_delete(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Delete a network interface. :param name: The name of the network interface to delete. :param resource_group: The resource group name assigned to the network interface. CLI Example: .. co...
.. versionadded:: 2019.2.0 Get details about a specific network interface. :param name: The name of the network interface to query. :param resource_group: The resource group name assigned to the network interface. CLI Example: .. code-block:: bash salt-call azurearm_network.net...
def network_interface_get(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get details about a specific network interface. :param name: The name of the network interface to query. :param resource_group: The resource group name assigned to the network interface. CLI Exa...
.. versionadded:: 2019.2.0 Create or update a network interface within a specified resource group. :param name: The name of the network interface to create. :param ip_configurations: A list of dictionaries representing valid NetworkInterfaceIPConfiguration objects. The 'name' key is required at ...
def network_interface_create_or_update(name, ip_configurations, subnet, virtual_network, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Create or update a network interface within a specified resource group. :param name: The name of the network interfa...
.. versionadded:: 2019.2.0 List all network interfaces within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.network_interfaces_list_all
def network_interfaces_list_all(**kwargs): ''' .. versionadded:: 2019.2.0 List all network interfaces within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.network_interfaces_list_all ''' result = {} netconn = __utils__['azurearm.get_client']('n...
.. versionadded:: 2019.2.0 List all network interfaces within a resource group. :param resource_group: The resource group name to list network interfaces within. CLI Example: .. code-block:: bash salt-call azurearm_network.network_interfaces_list testgroup
def network_interfaces_list(resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 List all network interfaces within a resource group. :param resource_group: The resource group name to list network interfaces within. CLI Example: .. code-block:: bash salt-call azurearm_n...
.. versionadded:: 2019.2.0 Get all route tables for a specific network interface. :param name: The name of the network interface to query. :param resource_group: The resource group name assigned to the network interface. CLI Example: .. code-block:: bash salt-call azurearm_netw...
def network_interface_get_effective_route_table(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get all route tables for a specific network interface. :param name: The name of the network interface to query. :param resource_group: The resource group name assigned to the ne...
.. versionadded:: 2019.2.0 Get all network security groups applied to a specific network interface. :param name: The name of the network interface to query. :param resource_group: The resource group name assigned to the network interface. CLI Example: .. code-block:: bash salt-...
def network_interface_list_effective_network_security_groups(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get all network security groups applied to a specific network interface. :param name: The name of the network interface to query. :param resource_group: The resource group ...
.. versionadded:: 2019.2.0 Get information about all network interfaces in a specific virtual machine within a scale set. :param scale_set: The name of the scale set to query. :param vm_index: The virtual machine index. :param resource_group: The resource group name assigned to the scale set...
def list_virtual_machine_scale_set_vm_network_interfaces(scale_set, vm_index, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 ...
.. versionadded:: 2019.2.0 Get information about all network interfaces within a scale set. :param scale_set: The name of the scale set to query. :param resource_group: The resource group name assigned to the scale set. CLI Example: .. code-block:: bash salt-call azurearm_netwo...
def list_virtual_machine_scale_set_network_interfaces(scale_set, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get information about all network interfaces within a scale set. :param scale_set: The name of the scale set to query. :param resource_group: The resource group name assigned...
.. versionadded:: 2019.2.0 Get information about a specfic network interface within a scale set. :param name: The name of the network interface to query. :param scale_set: The name of the scale set containing the interface. :param vm_index: The virtual machine index. :param resource_group: The ...
def get_virtual_machine_scale_set_network_interface(name, scale_set, vm_index, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get information about a specfic network interface within a scale set. :param name: The name of the network interface to query. :param scale_set: The name of the...
.. versionadded:: 2019.2.0 Delete a public IP address. :param name: The name of the public IP address to delete. :param resource_group: The resource group name assigned to the public IP address. CLI Example: .. code-block:: bash salt-call azurearm_network.public_ip_address_dele...
def public_ip_address_delete(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Delete a public IP address. :param name: The name of the public IP address to delete. :param resource_group: The resource group name assigned to the public IP address. CLI Example: .. co...
.. versionadded:: 2019.2.0 Get details about a specific public IP address. :param name: The name of the public IP address to query. :param resource_group: The resource group name assigned to the public IP address. CLI Example: .. code-block:: bash salt-call azurearm_network.pub...
def public_ip_address_get(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get details about a specific public IP address. :param name: The name of the public IP address to query. :param resource_group: The resource group name assigned to the public IP address. CLI Exa...
.. versionadded:: 2019.2.0 Create or update a public IP address within a specified resource group. :param name: The name of the public IP address to create. :param resource_group: The resource group name assigned to the public IP address. CLI Example: .. code-block:: bash salt-...
def public_ip_address_create_or_update(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Create or update a public IP address within a specified resource group. :param name: The name of the public IP address to create. :param resource_group: The resource group name assigned to the ...
.. versionadded:: 2019.2.0 List all public IP addresses within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.public_ip_addresses_list_all
def public_ip_addresses_list_all(**kwargs): ''' .. versionadded:: 2019.2.0 List all public IP addresses within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.public_ip_addresses_list_all ''' result = {} netconn = __utils__['azurearm.get_client']...
.. versionadded:: 2019.2.0 List all public IP addresses within a resource group. :param resource_group: The resource group name to list public IP addresses within. CLI Example: .. code-block:: bash salt-call azurearm_network.public_ip_addresses_list testgroup
def public_ip_addresses_list(resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 List all public IP addresses within a resource group. :param resource_group: The resource group name to list public IP addresses within. CLI Example: .. code-block:: bash salt-call azurear...
.. versionadded:: 2019.2.0 Delete a route filter rule. :param name: The route filter rule to delete. :param route_filter: The route filter containing the rule. :param resource_group: The resource group name assigned to the route filter. CLI Example: .. code-block:: bash sa...
def route_filter_rule_delete(name, route_filter, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Delete a route filter rule. :param name: The route filter rule to delete. :param route_filter: The route filter containing the rule. :param resource_group: The resource group name assig...
.. versionadded:: 2019.2.0 Get details about a specific route filter rule. :param name: The route filter rule to query. :param route_filter: The route filter containing the rule. :param resource_group: The resource group name assigned to the route filter. CLI Example: .. code-block...
def route_filter_rule_get(name, route_filter, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get details about a specific route filter rule. :param name: The route filter rule to query. :param route_filter: The route filter containing the rule. :param resource_group: The resource ...
.. versionadded:: 2019.2.0 Create or update a rule within a specified route filter. :param name: The name of the rule to create. :param access: The access type of the rule. Valid values are 'Allow' and 'Deny'. :param communities: A list of BGP communities to filter on. :param route_filter: The ...
def route_filter_rule_create_or_update(name, access, communities, route_filter, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Create or update a rule within a specified route filter. :param name: The name of the rule to create. :param access: The access type of the rule. Valid values ...
.. versionadded:: 2019.2.0 List all routes within a route filter. :param route_filter: The route filter to query. :param resource_group: The resource group name assigned to the route filter. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filter_rules_list te...
def route_filter_rules_list(route_filter, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 List all routes within a route filter. :param route_filter: The route filter to query. :param resource_group: The resource group name assigned to the route filter. CLI Example: .....
.. versionadded:: 2019.2.0 Delete a route filter. :param name: The name of the route filter to delete. :param resource_group: The resource group name assigned to the route filter. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filter_delete test-filter testg...
def route_filter_delete(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Delete a route filter. :param name: The name of the route filter to delete. :param resource_group: The resource group name assigned to the route filter. CLI Example: .. code-block:: bash ...
.. versionadded:: 2019.2.0 Get details about a specific route filter. :param name: The name of the route table to query. :param resource_group: The resource group name assigned to the route filter. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filter_get te...
def route_filter_get(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get details about a specific route filter. :param name: The name of the route table to query. :param resource_group: The resource group name assigned to the route filter. CLI Example: .. code-bl...
.. versionadded:: 2019.2.0 Create or update a route filter within a specified resource group. :param name: The name of the route filter to create. :param resource_group: The resource group name assigned to the route filter. CLI Example: .. code-block:: bash salt-call azurearm_n...
def route_filter_create_or_update(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Create or update a route filter within a specified resource group. :param name: The name of the route filter to create. :param resource_group: The resource group name assigned to the route fi...
.. versionadded:: 2019.2.0 List all route filters within a resource group. :param resource_group: The resource group name to list route filters within. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filters_list testgroup
def route_filters_list(resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 List all route filters within a resource group. :param resource_group: The resource group name to list route filters within. CLI Example: .. code-block:: bash salt-call azurearm_network.route_fi...
.. versionadded:: 2019.2.0 List all route filters within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filters_list_all
def route_filters_list_all(**kwargs): ''' .. versionadded:: 2019.2.0 List all route filters within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filters_list_all ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwar...
.. versionadded:: 2019.2.0 Delete a route from a route table. :param name: The route to delete. :param route_table: The route table containing the route. :param resource_group: The resource group name assigned to the route table. CLI Example: .. code-block:: bash salt-call...
def route_delete(name, route_table, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Delete a route from a route table. :param name: The route to delete. :param route_table: The route table containing the route. :param resource_group: The resource group name assigned to the ...
.. versionadded:: 2019.2.0 Get details about a specific route. :param name: The route to query. :param route_table: The route table containing the route. :param resource_group: The resource group name assigned to the route table. CLI Example: .. code-block:: bash salt-call...
def route_get(name, route_table, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get details about a specific route. :param name: The route to query. :param route_table: The route table containing the route. :param resource_group: The resource group name assigned to the rou...
.. versionadded:: 2019.2.0 Create or update a route within a specified route table. :param name: The name of the route to create. :param address_prefix: The destination CIDR to which the route applies. :param next_hop_type: The type of Azure hop the packet should be sent to. Possible values are: ...
def route_create_or_update(name, address_prefix, next_hop_type, route_table, resource_group, next_hop_ip_address=None, **kwargs): ''' .. versionadded:: 2019.2.0 Create or update a route within a specified route table. :param name: The name of the route to create. :param...
.. versionadded:: 2019.2.0 List all routes within a route table. :param route_table: The route table to query. :param resource_group: The resource group name assigned to the route table. CLI Example: .. code-block:: bash salt-call azurearm_network.routes_list test-rt-table test...
def routes_list(route_table, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 List all routes within a route table. :param route_table: The route table to query. :param resource_group: The resource group name assigned to the route table. CLI Example: .. code-block:: bas...
.. versionadded:: 2019.2.0 Delete a route table. :param name: The name of the route table to delete. :param resource_group: The resource group name assigned to the route table. CLI Example: .. code-block:: bash salt-call azurearm_network.route_table_delete test-rt-table testgro...
def route_table_delete(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Delete a route table. :param name: The name of the route table to delete. :param resource_group: The resource group name assigned to the route table. CLI Example: .. code-block:: bash ...
.. versionadded:: 2019.2.0 Get details about a specific route table. :param name: The name of the route table to query. :param resource_group: The resource group name assigned to the route table. CLI Example: .. code-block:: bash salt-call azurearm_network.route_table_get test-...
def route_table_get(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get details about a specific route table. :param name: The name of the route table to query. :param resource_group: The resource group name assigned to the route table. CLI Example: .. code-block...
.. versionadded:: 2019.2.0 Create or update a route table within a specified resource group. :param name: The name of the route table to create. :param resource_group: The resource group name assigned to the route table. CLI Example: .. code-block:: bash salt-call azurearm_netw...
def route_table_create_or_update(name, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Create or update a route table within a specified resource group. :param name: The name of the route table to create. :param resource_group: The resource group name assigned to the route table...
.. versionadded:: 2019.2.0 List all route tables within a resource group. :param resource_group: The resource group name to list route tables within. CLI Example: .. code-block:: bash salt-call azurearm_network.route_tables_list testgroup
def route_tables_list(resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 List all route tables within a resource group. :param resource_group: The resource group name to list route tables within. CLI Example: .. code-block:: bash salt-call azurearm_network.route_table...
.. versionadded:: 2019.2.0 List all route tables within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.route_tables_list_all
def route_tables_list_all(**kwargs): ''' .. versionadded:: 2019.2.0 List all route tables within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.route_tables_list_all ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs)...
Given a specific platform (under the Capirca conventions), return the generator class. The generator class is identified looking under the <platform> module for a class inheriting the `ACLGenerator` class.
def _import_platform_generator(platform): ''' Given a specific platform (under the Capirca conventions), return the generator class. The generator class is identified looking under the <platform> module for a class inheriting the `ACLGenerator` class. ''' log.debug('Using platform: %s', plat...
Build a map of services based on the IANA assignment list: http://www.iana.org/assignments/port-numbers It will load the /etc/services file and will build the mapping on the fly, similar to the Capirca's SERVICES file: https://github.com/google/capirca/blob/master/def/SERVICES.svc As this module i...
def _get_services_mapping(): ''' Build a map of services based on the IANA assignment list: http://www.iana.org/assignments/port-numbers It will load the /etc/services file and will build the mapping on the fly, similar to the Capirca's SERVICES file: https://github.com/google/capirca/blob/mast...
Look into services and return the port value using the service name as lookup value.
def _translate_port(port): ''' Look into services and return the port value using the service name as lookup value. ''' services = _get_services_mapping() if port in services and services[port]['port']: return services[port]['port'][0] return port
Return the object list.
def _make_it_list(dict_, field_name, value): ''' Return the object list. ''' prev_value = [] # firsly we'll collect the prev value if field_name in dict_: prev_value = dict_[field_name] if value is None: return prev_value elif isinstance(value, (tuple, list)): # o...
Find an dictionary in a list of dictionaries, given its main key.
def _lookup_element(lst, key): ''' Find an dictionary in a list of dictionaries, given its main key. ''' if not lst: return {} for ele in lst: if not ele or not isinstance(ele, dict): continue if ele.keys()[0] == key: return ele.values()[0] return ...
Retrieve the pillar data from the right environment.
def _get_pillar_cfg(pillar_key, pillarenv=None, saltenv=None): ''' Retrieve the pillar data from the right environment. ''' pillar_cfg = __salt__['pillar.get'](pillar_key, pillarenv=pillarenv, ...
Return a list of non-empty dictionaries.
def _cleanup(lst): ''' Return a list of non-empty dictionaries. ''' clean = [] for ele in lst: if ele and isinstance(ele, dict): clean.append(ele) return clean
Merge lists of dictionaries. Each element of the list is a dictionary having one single key. That key is then used as unique lookup. The first element list has higher priority than the second. When there's an overlap between the two lists, it won't change the position, but the content.
def _merge_list_of_dict(first, second, prepend=True): ''' Merge lists of dictionaries. Each element of the list is a dictionary having one single key. That key is then used as unique lookup. The first element list has higher priority than the second. When there's an overlap between the two lists...
Return an instance of the ``_Term`` class given the term options.
def _get_term_object(filter_name, term_name, pillar_key='acl', pillarenv=None, saltenv=None, merge_pillar=True, **term_fields): ''' Return an instance of the ``_Term`` class given the te...
Return an instance of the ``_Policy`` class given the filters config.
def _get_policy_object(platform, filters=None, pillar_key='acl', pillarenv=None, saltenv=None, merge_pillar=True): ''' Return an instance of the ``_Policy`` class given the filters config. ''' ...
Refactor revision tag comments. Capirca generates the filter text having the following tag keys: - $Id:$ - $Revision:$ - $Date:$ This function goes through all the config lines and replaces those tags with the content requested by the user. If a certain value is not provided, the correspon...
def _revision_tag(text, revision_id=None, revision_no=None, revision_date=True, revision_date_format='%Y/%m/%d'): ''' Refactor revision tag comments. Capirca generates the filter text having the following tag keys: - $Id:$ - $R...
Return the configuration of a single policy term. platform The name of the Capirca platform. filter_name The name of the policy filter. term_name The name of the term. filter_options Additional filter options. These options are platform-specific. E.g.: ``inet6...
def get_term_config(platform, filter_name, term_name, filter_options=None, pillar_key='acl', pillarenv=None, saltenv=None, merge_pillar=True, revision_id=None, ...
Return the configuration of a policy filter. platform The name of the Capirca platform. filter_name The name of the policy filter. filter_options Additional filter options. These options are platform-specific. See the complete list of options_. .. _options: https:...
def get_filter_config(platform, filter_name, filter_options=None, terms=None, prepend=True, pillar_key='acl', pillarenv=None, saltenv=None, merg...
Return the configuration of the whole policy. platform The name of the Capirca platform. filters List of filters for this policy. If not specified or empty, will try to load the configuration from the pillar, unless ``merge_pillar`` is set as ``False``. prepend: ``True`` ...
def get_policy_config(platform, filters=None, prepend=True, pillar_key='acl', pillarenv=None, saltenv=None, merge_pillar=True, only_lower_merge=False, ...
Helper that can be used inside a state SLS, in order to get the filter configuration given its name. filter_name The name of the filter. pillar_key The root key of the whole policy config. pillarenv Query the master to generate fresh pillar data on the fly, specificall...
def get_filter_pillar(filter_name, pillar_key='acl', pillarenv=None, saltenv=None): ''' Helper that can be used inside a state SLS, in order to get the filter configuration given its name. filter_name The name of the filter. ...
Helper that can be used inside a state SLS, in order to get the term configuration given its name, under a certain filter uniquely identified by its name. filter_name The name of the filter. term_name The name of the term. pillar_key: ``acl`` The root key of the whole poli...
def get_term_pillar(filter_name, term_name, pillar_key='acl', pillarenv=None, saltenv=None): ''' Helper that can be used inside a state SLS, in order to get the term configuration given its name, under a certain filter uniqu...
Execute the salt call!
def run(self): ''' Execute the salt call! ''' self.parse_args() if self.options.file_root: # check if the argument is pointing to a file on disk file_root = os.path.abspath(self.options.file_root) self.config['file_roots'] = {'base': _expand_g...
Add content to a document generated using `highstate_doc.render`. This state does not preform any tasks on the host. It only is used in highstate_doc lowstate proccessers to include extra documents. .. code-block:: yaml {{sls}} example note: highstate_doc.note: - name:...
def note(name, source=None, contents=None, **kwargs): ''' Add content to a document generated using `highstate_doc.render`. This state does not preform any tasks on the host. It only is used in highstate_doc lowstate proccessers to include extra documents. .. code-block:: yaml {{sls}} exa...
.. versionadded:: 2017.7.0 List updates that match the passed criteria. This allows for more filter options than :func:`list`. Good for finding a specific GUID or KB. Args: software (bool): Include software updates in the results (default is True) drivers (bool): ...
def available(software=True, drivers=True, summary=False, skip_installed=True, skip_hidden=True, skip_mandatory=False, skip_reboot=False, categories=None, severities=None,): ''' .. versionadded:: 2017...
.. versionadded:: 2017.7.0 Returns details for the named update Args: name (str): The name of the update you're searching for. This can be the GUID, a KB number, or any part of the name of the update. GUIDs and KBs are preferred. Run ``list`` to get the GUID for th...
def get(name, download=False, install=False): ''' .. versionadded:: 2017.7.0 Returns details for the named update Args: name (str): The name of the update you're searching for. This can be the GUID, a KB number, or any part of the name of the update. GUIDs and KBs are ...
.. versionadded:: 2017.7.0 Returns a detailed list of available updates or a summary. If download or install is True the same list will be downloaded and/or installed. Args: software (bool): Include software updates in the results (default is True) drivers (bool): ...
def list(software=True, drivers=False, summary=False, skip_installed=True, categories=None, severities=None, download=False, install=False): ''' .. versionadded:: 2017.7.0 Returns a detailed list of available updates or a summary. If download o...