repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
saltstack/salt
salt/modules/keystoneng.py
domain_search
def domain_search(auth=None, **kwargs): ''' Search domains CLI Example: .. code-block:: bash salt '*' keystoneng.domain_search salt '*' keystoneng.domain_search name=domain1 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.search_domains(**kwargs)
python
def domain_search(auth=None, **kwargs): ''' Search domains CLI Example: .. code-block:: bash salt '*' keystoneng.domain_search salt '*' keystoneng.domain_search name=domain1 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.search_domains(**kwargs)
[ "def", "domain_search", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "search_domains", "(", "*", ...
Search domains CLI Example: .. code-block:: bash salt '*' keystoneng.domain_search salt '*' keystoneng.domain_search name=domain1
[ "Search", "domains" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L398-L411
train
saltstack/salt
salt/modules/keystoneng.py
domain_get
def domain_get(auth=None, **kwargs): ''' Get a single domain CLI Example: .. code-block:: bash salt '*' keystoneng.domain_get name=domain1 salt '*' keystoneng.domain_get name=b62e76fbeeff4e8fb77073f591cf211e ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.get_domain(**kwargs)
python
def domain_get(auth=None, **kwargs): ''' Get a single domain CLI Example: .. code-block:: bash salt '*' keystoneng.domain_get name=domain1 salt '*' keystoneng.domain_get name=b62e76fbeeff4e8fb77073f591cf211e ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.get_domain(**kwargs)
[ "def", "domain_get", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "get_domain", "(", "*", "*", ...
Get a single domain CLI Example: .. code-block:: bash salt '*' keystoneng.domain_get name=domain1 salt '*' keystoneng.domain_get name=b62e76fbeeff4e8fb77073f591cf211e
[ "Get", "a", "single", "domain" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L414-L427
train
saltstack/salt
salt/modules/keystoneng.py
role_create
def role_create(auth=None, **kwargs): ''' Create a role CLI Example: .. code-block:: bash salt '*' keystoneng.role_create name=role1 salt '*' keystoneng.role_create name=role1 domain_id=b62e76fbeeff4e8fb77073f591cf211e ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(keep_name=True, **kwargs) return cloud.create_role(**kwargs)
python
def role_create(auth=None, **kwargs): ''' Create a role CLI Example: .. code-block:: bash salt '*' keystoneng.role_create name=role1 salt '*' keystoneng.role_create name=role1 domain_id=b62e76fbeeff4e8fb77073f591cf211e ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(keep_name=True, **kwargs) return cloud.create_role(**kwargs)
[ "def", "role_create", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "keep_name", "=", "True", ",", "*", "*", "kwargs", ")", "return", "cloud", "."...
Create a role CLI Example: .. code-block:: bash salt '*' keystoneng.role_create name=role1 salt '*' keystoneng.role_create name=role1 domain_id=b62e76fbeeff4e8fb77073f591cf211e
[ "Create", "a", "role" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L430-L443
train
saltstack/salt
salt/modules/keystoneng.py
role_delete
def role_delete(auth=None, **kwargs): ''' Delete a role CLI Example: .. code-block:: bash salt '*' keystoneng.role_delete name=role1 domain_id=b62e76fbeeff4e8fb77073f591cf211e salt '*' keystoneng.role_delete name=1eb6edd5525e4ac39af571adee673559 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.delete_role(**kwargs)
python
def role_delete(auth=None, **kwargs): ''' Delete a role CLI Example: .. code-block:: bash salt '*' keystoneng.role_delete name=role1 domain_id=b62e76fbeeff4e8fb77073f591cf211e salt '*' keystoneng.role_delete name=1eb6edd5525e4ac39af571adee673559 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.delete_role(**kwargs)
[ "def", "role_delete", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "delete_role", "(", "*", "*",...
Delete a role CLI Example: .. code-block:: bash salt '*' keystoneng.role_delete name=role1 domain_id=b62e76fbeeff4e8fb77073f591cf211e salt '*' keystoneng.role_delete name=1eb6edd5525e4ac39af571adee673559
[ "Delete", "a", "role" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L446-L459
train
saltstack/salt
salt/modules/keystoneng.py
role_update
def role_update(auth=None, **kwargs): ''' Update a role CLI Example: .. code-block:: bash salt '*' keystoneng.role_update name=role1 new_name=newrole salt '*' keystoneng.role_update name=1eb6edd5525e4ac39af571adee673559 new_name=newrole ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) if 'new_name' in kwargs: kwargs['name'] = kwargs.pop('new_name') return cloud.update_role(**kwargs)
python
def role_update(auth=None, **kwargs): ''' Update a role CLI Example: .. code-block:: bash salt '*' keystoneng.role_update name=role1 new_name=newrole salt '*' keystoneng.role_update name=1eb6edd5525e4ac39af571adee673559 new_name=newrole ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) if 'new_name' in kwargs: kwargs['name'] = kwargs.pop('new_name') return cloud.update_role(**kwargs)
[ "def", "role_update", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "if", "'new_name'", "in", "kwargs", ":", "kwargs", "[...
Update a role CLI Example: .. code-block:: bash salt '*' keystoneng.role_update name=role1 new_name=newrole salt '*' keystoneng.role_update name=1eb6edd5525e4ac39af571adee673559 new_name=newrole
[ "Update", "a", "role" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L462-L477
train
saltstack/salt
salt/modules/keystoneng.py
role_list
def role_list(auth=None, **kwargs): ''' List roles CLI Example: .. code-block:: bash salt '*' keystoneng.role_list salt '*' keystoneng.role_list domain_id=b62e76fbeeff4e8fb77073f591cf211e ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.list_roles(**kwargs)
python
def role_list(auth=None, **kwargs): ''' List roles CLI Example: .. code-block:: bash salt '*' keystoneng.role_list salt '*' keystoneng.role_list domain_id=b62e76fbeeff4e8fb77073f591cf211e ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.list_roles(**kwargs)
[ "def", "role_list", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "list_roles", "(", "*", "*", ...
List roles CLI Example: .. code-block:: bash salt '*' keystoneng.role_list salt '*' keystoneng.role_list domain_id=b62e76fbeeff4e8fb77073f591cf211e
[ "List", "roles" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L480-L493
train
saltstack/salt
salt/modules/keystoneng.py
role_search
def role_search(auth=None, **kwargs): ''' Search roles CLI Example: .. code-block:: bash salt '*' keystoneng.role_search salt '*' keystoneng.role_search name=role1 salt '*' keystoneng.role_search domain_id=b62e76fbeeff4e8fb77073f591cf211e ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.search_roles(**kwargs)
python
def role_search(auth=None, **kwargs): ''' Search roles CLI Example: .. code-block:: bash salt '*' keystoneng.role_search salt '*' keystoneng.role_search name=role1 salt '*' keystoneng.role_search domain_id=b62e76fbeeff4e8fb77073f591cf211e ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.search_roles(**kwargs)
[ "def", "role_search", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "search_roles", "(", "*", "*"...
Search roles CLI Example: .. code-block:: bash salt '*' keystoneng.role_search salt '*' keystoneng.role_search name=role1 salt '*' keystoneng.role_search domain_id=b62e76fbeeff4e8fb77073f591cf211e
[ "Search", "roles" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L496-L510
train
saltstack/salt
salt/modules/keystoneng.py
role_get
def role_get(auth=None, **kwargs): ''' Get a single role CLI Example: .. code-block:: bash salt '*' keystoneng.role_get name=role1 salt '*' keystoneng.role_get name=role1 domain_id=b62e76fbeeff4e8fb77073f591cf211e salt '*' keystoneng.role_get name=1eb6edd5525e4ac39af571adee673559 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.get_role(**kwargs)
python
def role_get(auth=None, **kwargs): ''' Get a single role CLI Example: .. code-block:: bash salt '*' keystoneng.role_get name=role1 salt '*' keystoneng.role_get name=role1 domain_id=b62e76fbeeff4e8fb77073f591cf211e salt '*' keystoneng.role_get name=1eb6edd5525e4ac39af571adee673559 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.get_role(**kwargs)
[ "def", "role_get", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "get_role", "(", "*", "*", "kw...
Get a single role CLI Example: .. code-block:: bash salt '*' keystoneng.role_get name=role1 salt '*' keystoneng.role_get name=role1 domain_id=b62e76fbeeff4e8fb77073f591cf211e salt '*' keystoneng.role_get name=1eb6edd5525e4ac39af571adee673559
[ "Get", "a", "single", "role" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L513-L527
train
saltstack/salt
salt/modules/keystoneng.py
user_create
def user_create(auth=None, **kwargs): ''' Create a user CLI Example: .. code-block:: bash salt '*' keystoneng.user_create name=user1 salt '*' keystoneng.user_create name=user2 password=1234 enabled=False salt '*' keystoneng.user_create name=user3 domain_id=b62e76fbeeff4e8fb77073f591cf211e ''' cloud = get_openstack_cloud(auth) kwargs = _clean_kwargs(keep_name=True, **kwargs) return cloud.create_user(**kwargs)
python
def user_create(auth=None, **kwargs): ''' Create a user CLI Example: .. code-block:: bash salt '*' keystoneng.user_create name=user1 salt '*' keystoneng.user_create name=user2 password=1234 enabled=False salt '*' keystoneng.user_create name=user3 domain_id=b62e76fbeeff4e8fb77073f591cf211e ''' cloud = get_openstack_cloud(auth) kwargs = _clean_kwargs(keep_name=True, **kwargs) return cloud.create_user(**kwargs)
[ "def", "user_create", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_openstack_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "keep_name", "=", "True", ",", "*", "*", "kwargs", ")", "return", "cloud", "....
Create a user CLI Example: .. code-block:: bash salt '*' keystoneng.user_create name=user1 salt '*' keystoneng.user_create name=user2 password=1234 enabled=False salt '*' keystoneng.user_create name=user3 domain_id=b62e76fbeeff4e8fb77073f591cf211e
[ "Create", "a", "user" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L530-L544
train
saltstack/salt
salt/modules/keystoneng.py
user_delete
def user_delete(auth=None, **kwargs): ''' Delete a user CLI Example: .. code-block:: bash salt '*' keystoneng.user_delete name=user1 salt '*' keystoneng.user_delete name=user2 domain_id=b62e76fbeeff4e8fb77073f591cf211e salt '*' keystoneng.user_delete name=a42cbbfa1e894e839fd0f584d22e321f ''' cloud = get_openstack_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.delete_user(**kwargs)
python
def user_delete(auth=None, **kwargs): ''' Delete a user CLI Example: .. code-block:: bash salt '*' keystoneng.user_delete name=user1 salt '*' keystoneng.user_delete name=user2 domain_id=b62e76fbeeff4e8fb77073f591cf211e salt '*' keystoneng.user_delete name=a42cbbfa1e894e839fd0f584d22e321f ''' cloud = get_openstack_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.delete_user(**kwargs)
[ "def", "user_delete", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_openstack_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "delete_user", "(", "*", "*"...
Delete a user CLI Example: .. code-block:: bash salt '*' keystoneng.user_delete name=user1 salt '*' keystoneng.user_delete name=user2 domain_id=b62e76fbeeff4e8fb77073f591cf211e salt '*' keystoneng.user_delete name=a42cbbfa1e894e839fd0f584d22e321f
[ "Delete", "a", "user" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L547-L561
train
saltstack/salt
salt/modules/keystoneng.py
user_update
def user_update(auth=None, **kwargs): ''' Update a user CLI Example: .. code-block:: bash salt '*' keystoneng.user_update name=user1 enabled=False description='new description' salt '*' keystoneng.user_update name=user1 new_name=newuser ''' cloud = get_openstack_cloud(auth) kwargs = _clean_kwargs(**kwargs) if 'new_name' in kwargs: kwargs['name'] = kwargs.pop('new_name') return cloud.update_user(**kwargs)
python
def user_update(auth=None, **kwargs): ''' Update a user CLI Example: .. code-block:: bash salt '*' keystoneng.user_update name=user1 enabled=False description='new description' salt '*' keystoneng.user_update name=user1 new_name=newuser ''' cloud = get_openstack_cloud(auth) kwargs = _clean_kwargs(**kwargs) if 'new_name' in kwargs: kwargs['name'] = kwargs.pop('new_name') return cloud.update_user(**kwargs)
[ "def", "user_update", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_openstack_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "if", "'new_name'", "in", "kwargs", ":", "kwargs", "...
Update a user CLI Example: .. code-block:: bash salt '*' keystoneng.user_update name=user1 enabled=False description='new description' salt '*' keystoneng.user_update name=user1 new_name=newuser
[ "Update", "a", "user" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L564-L579
train
saltstack/salt
salt/modules/keystoneng.py
user_list
def user_list(auth=None, **kwargs): ''' List users CLI Example: .. code-block:: bash salt '*' keystoneng.user_list salt '*' keystoneng.user_list domain_id=b62e76fbeeff4e8fb77073f591cf211e ''' cloud = get_openstack_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.list_users(**kwargs)
python
def user_list(auth=None, **kwargs): ''' List users CLI Example: .. code-block:: bash salt '*' keystoneng.user_list salt '*' keystoneng.user_list domain_id=b62e76fbeeff4e8fb77073f591cf211e ''' cloud = get_openstack_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.list_users(**kwargs)
[ "def", "user_list", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_openstack_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "list_users", "(", "*", "*", ...
List users CLI Example: .. code-block:: bash salt '*' keystoneng.user_list salt '*' keystoneng.user_list domain_id=b62e76fbeeff4e8fb77073f591cf211e
[ "List", "users" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L582-L595
train
saltstack/salt
salt/modules/keystoneng.py
user_search
def user_search(auth=None, **kwargs): ''' List users CLI Example: .. code-block:: bash salt '*' keystoneng.user_list salt '*' keystoneng.user_list domain_id=b62e76fbeeff4e8fb77073f591cf211e ''' cloud = get_openstack_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.search_users(**kwargs)
python
def user_search(auth=None, **kwargs): ''' List users CLI Example: .. code-block:: bash salt '*' keystoneng.user_list salt '*' keystoneng.user_list domain_id=b62e76fbeeff4e8fb77073f591cf211e ''' cloud = get_openstack_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.search_users(**kwargs)
[ "def", "user_search", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_openstack_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "search_users", "(", "*", "*...
List users CLI Example: .. code-block:: bash salt '*' keystoneng.user_list salt '*' keystoneng.user_list domain_id=b62e76fbeeff4e8fb77073f591cf211e
[ "List", "users" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L598-L611
train
saltstack/salt
salt/modules/keystoneng.py
user_get
def user_get(auth=None, **kwargs): ''' Get a single user CLI Example: .. code-block:: bash salt '*' keystoneng.user_get name=user1 salt '*' keystoneng.user_get name=user1 domain_id=b62e76fbeeff4e8fb77073f591cf211e salt '*' keystoneng.user_get name=02cffaa173b2460f98e40eda3748dae5 ''' cloud = get_openstack_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.get_user(**kwargs)
python
def user_get(auth=None, **kwargs): ''' Get a single user CLI Example: .. code-block:: bash salt '*' keystoneng.user_get name=user1 salt '*' keystoneng.user_get name=user1 domain_id=b62e76fbeeff4e8fb77073f591cf211e salt '*' keystoneng.user_get name=02cffaa173b2460f98e40eda3748dae5 ''' cloud = get_openstack_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.get_user(**kwargs)
[ "def", "user_get", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_openstack_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "get_user", "(", "*", "*", "k...
Get a single user CLI Example: .. code-block:: bash salt '*' keystoneng.user_get name=user1 salt '*' keystoneng.user_get name=user1 domain_id=b62e76fbeeff4e8fb77073f591cf211e salt '*' keystoneng.user_get name=02cffaa173b2460f98e40eda3748dae5
[ "Get", "a", "single", "user" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L614-L628
train
saltstack/salt
salt/modules/keystoneng.py
endpoint_create
def endpoint_create(auth=None, **kwargs): ''' Create an endpoint CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_create interface=admin service=glance url=https://example.org:9292 salt '*' keystoneng.endpoint_create interface=public service=glance region=RegionOne url=https://example.org:9292 salt '*' keystoneng.endpoint_create interface=admin service=glance url=https://example.org:9292 enabled=True ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(keep_name=True, **kwargs) return cloud.create_endpoint(**kwargs)
python
def endpoint_create(auth=None, **kwargs): ''' Create an endpoint CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_create interface=admin service=glance url=https://example.org:9292 salt '*' keystoneng.endpoint_create interface=public service=glance region=RegionOne url=https://example.org:9292 salt '*' keystoneng.endpoint_create interface=admin service=glance url=https://example.org:9292 enabled=True ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(keep_name=True, **kwargs) return cloud.create_endpoint(**kwargs)
[ "def", "endpoint_create", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "keep_name", "=", "True", ",", "*", "*", "kwargs", ")", "return", "cloud", ...
Create an endpoint CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_create interface=admin service=glance url=https://example.org:9292 salt '*' keystoneng.endpoint_create interface=public service=glance region=RegionOne url=https://example.org:9292 salt '*' keystoneng.endpoint_create interface=admin service=glance url=https://example.org:9292 enabled=True
[ "Create", "an", "endpoint" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L631-L645
train
saltstack/salt
salt/modules/keystoneng.py
endpoint_delete
def endpoint_delete(auth=None, **kwargs): ''' Delete an endpoint CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_delete id=3bee4bd8c2b040ee966adfda1f0bfca9 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.delete_endpoint(**kwargs)
python
def endpoint_delete(auth=None, **kwargs): ''' Delete an endpoint CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_delete id=3bee4bd8c2b040ee966adfda1f0bfca9 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.delete_endpoint(**kwargs)
[ "def", "endpoint_delete", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "delete_endpoint", "(", "*"...
Delete an endpoint CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_delete id=3bee4bd8c2b040ee966adfda1f0bfca9
[ "Delete", "an", "endpoint" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L648-L660
train
saltstack/salt
salt/modules/keystoneng.py
endpoint_update
def endpoint_update(auth=None, **kwargs): ''' Update an endpoint CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_update endpoint_id=4f961ad09d2d48948896bbe7c6a79717 interface=public enabled=False salt '*' keystoneng.endpoint_update endpoint_id=4f961ad09d2d48948896bbe7c6a79717 region=newregion salt '*' keystoneng.endpoint_update endpoint_id=4f961ad09d2d48948896bbe7c6a79717 service_name_or_id=glance url=https://example.org:9292 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.update_endpoint(**kwargs)
python
def endpoint_update(auth=None, **kwargs): ''' Update an endpoint CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_update endpoint_id=4f961ad09d2d48948896bbe7c6a79717 interface=public enabled=False salt '*' keystoneng.endpoint_update endpoint_id=4f961ad09d2d48948896bbe7c6a79717 region=newregion salt '*' keystoneng.endpoint_update endpoint_id=4f961ad09d2d48948896bbe7c6a79717 service_name_or_id=glance url=https://example.org:9292 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.update_endpoint(**kwargs)
[ "def", "endpoint_update", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "update_endpoint", "(", "*"...
Update an endpoint CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_update endpoint_id=4f961ad09d2d48948896bbe7c6a79717 interface=public enabled=False salt '*' keystoneng.endpoint_update endpoint_id=4f961ad09d2d48948896bbe7c6a79717 region=newregion salt '*' keystoneng.endpoint_update endpoint_id=4f961ad09d2d48948896bbe7c6a79717 service_name_or_id=glance url=https://example.org:9292
[ "Update", "an", "endpoint" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L663-L677
train
saltstack/salt
salt/modules/keystoneng.py
endpoint_list
def endpoint_list(auth=None, **kwargs): ''' List endpoints CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_list ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.list_endpoints(**kwargs)
python
def endpoint_list(auth=None, **kwargs): ''' List endpoints CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_list ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.list_endpoints(**kwargs)
[ "def", "endpoint_list", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "list_endpoints", "(", "*", ...
List endpoints CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_list
[ "List", "endpoints" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L680-L692
train
saltstack/salt
salt/modules/keystoneng.py
endpoint_search
def endpoint_search(auth=None, **kwargs): ''' Search endpoints CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_search salt '*' keystoneng.endpoint_search id=02cffaa173b2460f98e40eda3748dae5 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.search_endpoints(**kwargs)
python
def endpoint_search(auth=None, **kwargs): ''' Search endpoints CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_search salt '*' keystoneng.endpoint_search id=02cffaa173b2460f98e40eda3748dae5 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.search_endpoints(**kwargs)
[ "def", "endpoint_search", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "search_endpoints", "(", "*...
Search endpoints CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_search salt '*' keystoneng.endpoint_search id=02cffaa173b2460f98e40eda3748dae5
[ "Search", "endpoints" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L695-L708
train
saltstack/salt
salt/modules/keystoneng.py
endpoint_get
def endpoint_get(auth=None, **kwargs): ''' Get a single endpoint CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_get id=02cffaa173b2460f98e40eda3748dae5 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.get_endpoint(**kwargs)
python
def endpoint_get(auth=None, **kwargs): ''' Get a single endpoint CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_get id=02cffaa173b2460f98e40eda3748dae5 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.get_endpoint(**kwargs)
[ "def", "endpoint_get", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "get_endpoint", "(", "*", "*...
Get a single endpoint CLI Example: .. code-block:: bash salt '*' keystoneng.endpoint_get id=02cffaa173b2460f98e40eda3748dae5
[ "Get", "a", "single", "endpoint" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L711-L723
train
saltstack/salt
salt/modules/keystoneng.py
service_create
def service_create(auth=None, **kwargs): ''' Create a service CLI Example: .. code-block:: bash salt '*' keystoneng.service_create name=glance type=image salt '*' keystoneng.service_create name=glance type=image description="Image" ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(keep_name=True, **kwargs) return cloud.create_service(**kwargs)
python
def service_create(auth=None, **kwargs): ''' Create a service CLI Example: .. code-block:: bash salt '*' keystoneng.service_create name=glance type=image salt '*' keystoneng.service_create name=glance type=image description="Image" ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(keep_name=True, **kwargs) return cloud.create_service(**kwargs)
[ "def", "service_create", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "keep_name", "=", "True", ",", "*", "*", "kwargs", ")", "return", "cloud", ...
Create a service CLI Example: .. code-block:: bash salt '*' keystoneng.service_create name=glance type=image salt '*' keystoneng.service_create name=glance type=image description="Image"
[ "Create", "a", "service" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L726-L739
train
saltstack/salt
salt/modules/keystoneng.py
service_delete
def service_delete(auth=None, **kwargs): ''' Delete a service CLI Example: .. code-block:: bash salt '*' keystoneng.service_delete name=glance salt '*' keystoneng.service_delete name=39cc1327cdf744ab815331554430e8ec ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.delete_service(**kwargs)
python
def service_delete(auth=None, **kwargs): ''' Delete a service CLI Example: .. code-block:: bash salt '*' keystoneng.service_delete name=glance salt '*' keystoneng.service_delete name=39cc1327cdf744ab815331554430e8ec ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.delete_service(**kwargs)
[ "def", "service_delete", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "delete_service", "(", "*", ...
Delete a service CLI Example: .. code-block:: bash salt '*' keystoneng.service_delete name=glance salt '*' keystoneng.service_delete name=39cc1327cdf744ab815331554430e8ec
[ "Delete", "a", "service" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L742-L755
train
saltstack/salt
salt/modules/keystoneng.py
service_update
def service_update(auth=None, **kwargs): ''' Update a service CLI Example: .. code-block:: bash salt '*' keystoneng.service_update name=cinder type=volumev2 salt '*' keystoneng.service_update name=cinder description='new description' salt '*' keystoneng.service_update name=ab4d35e269f147b3ae2d849f77f5c88f enabled=False ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.update_service(**kwargs)
python
def service_update(auth=None, **kwargs): ''' Update a service CLI Example: .. code-block:: bash salt '*' keystoneng.service_update name=cinder type=volumev2 salt '*' keystoneng.service_update name=cinder description='new description' salt '*' keystoneng.service_update name=ab4d35e269f147b3ae2d849f77f5c88f enabled=False ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.update_service(**kwargs)
[ "def", "service_update", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "update_service", "(", "*", ...
Update a service CLI Example: .. code-block:: bash salt '*' keystoneng.service_update name=cinder type=volumev2 salt '*' keystoneng.service_update name=cinder description='new description' salt '*' keystoneng.service_update name=ab4d35e269f147b3ae2d849f77f5c88f enabled=False
[ "Update", "a", "service" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L758-L772
train
saltstack/salt
salt/modules/keystoneng.py
service_list
def service_list(auth=None, **kwargs): ''' List services CLI Example: .. code-block:: bash salt '*' keystoneng.service_list ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.list_services(**kwargs)
python
def service_list(auth=None, **kwargs): ''' List services CLI Example: .. code-block:: bash salt '*' keystoneng.service_list ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.list_services(**kwargs)
[ "def", "service_list", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "list_services", "(", "*", "...
List services CLI Example: .. code-block:: bash salt '*' keystoneng.service_list
[ "List", "services" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L775-L787
train
saltstack/salt
salt/modules/keystoneng.py
service_search
def service_search(auth=None, **kwargs): ''' Search services CLI Example: .. code-block:: bash salt '*' keystoneng.service_search salt '*' keystoneng.service_search name=glance salt '*' keystoneng.service_search name=135f0403f8e544dc9008c6739ecda860 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.search_services(**kwargs)
python
def service_search(auth=None, **kwargs): ''' Search services CLI Example: .. code-block:: bash salt '*' keystoneng.service_search salt '*' keystoneng.service_search name=glance salt '*' keystoneng.service_search name=135f0403f8e544dc9008c6739ecda860 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.search_services(**kwargs)
[ "def", "service_search", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "search_services", "(", "*",...
Search services CLI Example: .. code-block:: bash salt '*' keystoneng.service_search salt '*' keystoneng.service_search name=glance salt '*' keystoneng.service_search name=135f0403f8e544dc9008c6739ecda860
[ "Search", "services" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L790-L804
train
saltstack/salt
salt/modules/keystoneng.py
service_get
def service_get(auth=None, **kwargs): ''' Get a single service CLI Example: .. code-block:: bash salt '*' keystoneng.service_get name=glance salt '*' keystoneng.service_get name=75a5804638944b3ab54f7fbfcec2305a ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.get_service(**kwargs)
python
def service_get(auth=None, **kwargs): ''' Get a single service CLI Example: .. code-block:: bash salt '*' keystoneng.service_get name=glance salt '*' keystoneng.service_get name=75a5804638944b3ab54f7fbfcec2305a ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.get_service(**kwargs)
[ "def", "service_get", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "get_service", "(", "*", "*",...
Get a single service CLI Example: .. code-block:: bash salt '*' keystoneng.service_get name=glance salt '*' keystoneng.service_get name=75a5804638944b3ab54f7fbfcec2305a
[ "Get", "a", "single", "service" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L807-L820
train
saltstack/salt
salt/modules/keystoneng.py
role_assignment_list
def role_assignment_list(auth=None, **kwargs): ''' List role assignments CLI Example: .. code-block:: bash salt '*' keystoneng.role_assignment_list ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.list_role_assignments(**kwargs)
python
def role_assignment_list(auth=None, **kwargs): ''' List role assignments CLI Example: .. code-block:: bash salt '*' keystoneng.role_assignment_list ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.list_role_assignments(**kwargs)
[ "def", "role_assignment_list", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "list_role_assignments", ...
List role assignments CLI Example: .. code-block:: bash salt '*' keystoneng.role_assignment_list
[ "List", "role", "assignments" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L823-L835
train
saltstack/salt
salt/modules/keystoneng.py
role_grant
def role_grant(auth=None, **kwargs): ''' Grant a role in a project/domain to a user/group CLI Example: .. code-block:: bash salt '*' keystoneng.role_grant name=role1 user=user1 project=project1 salt '*' keystoneng.role_grant name=ddbe3e0ed74e4c7f8027bad4af03339d group=user1 project=project1 domain=domain1 salt '*' keystoneng.role_grant name=ddbe3e0ed74e4c7f8027bad4af03339d group=19573afd5e4241d8b65c42215bae9704 project=1dcac318a83b4610b7a7f7ba01465548 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.grant_role(**kwargs)
python
def role_grant(auth=None, **kwargs): ''' Grant a role in a project/domain to a user/group CLI Example: .. code-block:: bash salt '*' keystoneng.role_grant name=role1 user=user1 project=project1 salt '*' keystoneng.role_grant name=ddbe3e0ed74e4c7f8027bad4af03339d group=user1 project=project1 domain=domain1 salt '*' keystoneng.role_grant name=ddbe3e0ed74e4c7f8027bad4af03339d group=19573afd5e4241d8b65c42215bae9704 project=1dcac318a83b4610b7a7f7ba01465548 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.grant_role(**kwargs)
[ "def", "role_grant", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "grant_role", "(", "*", "*", ...
Grant a role in a project/domain to a user/group CLI Example: .. code-block:: bash salt '*' keystoneng.role_grant name=role1 user=user1 project=project1 salt '*' keystoneng.role_grant name=ddbe3e0ed74e4c7f8027bad4af03339d group=user1 project=project1 domain=domain1 salt '*' keystoneng.role_grant name=ddbe3e0ed74e4c7f8027bad4af03339d group=19573afd5e4241d8b65c42215bae9704 project=1dcac318a83b4610b7a7f7ba01465548
[ "Grant", "a", "role", "in", "a", "project", "/", "domain", "to", "a", "user", "/", "group" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L838-L852
train
saltstack/salt
salt/modules/keystoneng.py
role_revoke
def role_revoke(auth=None, **kwargs): ''' Grant a role in a project/domain to a user/group CLI Example: .. code-block:: bash salt '*' keystoneng.role_revoke name=role1 user=user1 project=project1 salt '*' keystoneng.role_revoke name=ddbe3e0ed74e4c7f8027bad4af03339d group=user1 project=project1 domain=domain1 salt '*' keystoneng.role_revoke name=ddbe3e0ed74e4c7f8027bad4af03339d group=19573afd5e4241d8b65c42215bae9704 project=1dcac318a83b4610b7a7f7ba01465548 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.revoke_role(**kwargs)
python
def role_revoke(auth=None, **kwargs): ''' Grant a role in a project/domain to a user/group CLI Example: .. code-block:: bash salt '*' keystoneng.role_revoke name=role1 user=user1 project=project1 salt '*' keystoneng.role_revoke name=ddbe3e0ed74e4c7f8027bad4af03339d group=user1 project=project1 domain=domain1 salt '*' keystoneng.role_revoke name=ddbe3e0ed74e4c7f8027bad4af03339d group=19573afd5e4241d8b65c42215bae9704 project=1dcac318a83b4610b7a7f7ba01465548 ''' cloud = get_operator_cloud(auth) kwargs = _clean_kwargs(**kwargs) return cloud.revoke_role(**kwargs)
[ "def", "role_revoke", "(", "auth", "=", "None", ",", "*", "*", "kwargs", ")", ":", "cloud", "=", "get_operator_cloud", "(", "auth", ")", "kwargs", "=", "_clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "cloud", ".", "revoke_role", "(", "*", "*",...
Grant a role in a project/domain to a user/group CLI Example: .. code-block:: bash salt '*' keystoneng.role_revoke name=role1 user=user1 project=project1 salt '*' keystoneng.role_revoke name=ddbe3e0ed74e4c7f8027bad4af03339d group=user1 project=project1 domain=domain1 salt '*' keystoneng.role_revoke name=ddbe3e0ed74e4c7f8027bad4af03339d group=19573afd5e4241d8b65c42215bae9704 project=1dcac318a83b4610b7a7f7ba01465548
[ "Grant", "a", "role", "in", "a", "project", "/", "domain", "to", "a", "user", "/", "group" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/keystoneng.py#L855-L869
train
saltstack/salt
salt/modules/hosts.py
_get_or_create_hostfile
def _get_or_create_hostfile(): ''' Wrapper of __get_hosts_filename but create host file if it does not exist. ''' hfn = __get_hosts_filename() if hfn is None: hfn = '' if not os.path.exists(hfn): with salt.utils.files.fopen(hfn, 'w'): pass return hfn
python
def _get_or_create_hostfile(): ''' Wrapper of __get_hosts_filename but create host file if it does not exist. ''' hfn = __get_hosts_filename() if hfn is None: hfn = '' if not os.path.exists(hfn): with salt.utils.files.fopen(hfn, 'w'): pass return hfn
[ "def", "_get_or_create_hostfile", "(", ")", ":", "hfn", "=", "__get_hosts_filename", "(", ")", "if", "hfn", "is", "None", ":", "hfn", "=", "''", "if", "not", "os", ".", "path", ".", "exists", "(", "hfn", ")", ":", "with", "salt", ".", "utils", ".", ...
Wrapper of __get_hosts_filename but create host file if it does not exist.
[ "Wrapper", "of", "__get_hosts_filename", "but", "create", "host", "file", "if", "it", "does", "not", "exist", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/hosts.py#L34-L45
train
saltstack/salt
salt/modules/hosts.py
_list_hosts
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(hfn) as ifile: for line in ifile: line = salt.utils.stringutils.to_unicode(line).strip() if not line: continue if line.startswith('#'): ret.setdefault('comment-{0}'.format(count), []).append(line) count += 1 continue if '#' in line: line = line[:line.index('#')].strip() comps = line.split() ip = comps.pop(0) ret.setdefault(ip, []).extend(comps) except (IOError, OSError) as exc: salt.utils.files.process_read_exception(exc, hfn, ignore=errno.ENOENT) # Don't set __context__ since we weren't able to read from the # hosts file. return ret __context__['hosts._list_hosts'] = ret return ret
python
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(hfn) as ifile: for line in ifile: line = salt.utils.stringutils.to_unicode(line).strip() if not line: continue if line.startswith('#'): ret.setdefault('comment-{0}'.format(count), []).append(line) count += 1 continue if '#' in line: line = line[:line.index('#')].strip() comps = line.split() ip = comps.pop(0) ret.setdefault(ip, []).extend(comps) except (IOError, OSError) as exc: salt.utils.files.process_read_exception(exc, hfn, ignore=errno.ENOENT) # Don't set __context__ since we weren't able to read from the # hosts file. return ret __context__['hosts._list_hosts'] = ret return ret
[ "def", "_list_hosts", "(", ")", ":", "try", ":", "return", "__context__", "[", "'hosts._list_hosts'", "]", "except", "KeyError", ":", "count", "=", "0", "hfn", "=", "__get_hosts_filename", "(", ")", "ret", "=", "odict", ".", "OrderedDict", "(", ")", "try",...
Return the hosts found in the hosts file in as an OrderedDict
[ "Return", "the", "hosts", "found", "in", "the", "hosts", "file", "in", "as", "an", "OrderedDict" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/hosts.py#L48-L80
train
saltstack/salt
salt/modules/hosts.py
get_ip
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 addr # ip not found return ''
python
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 addr # ip not found return ''
[ "def", "get_ip", "(", "host", ")", ":", "hosts", "=", "_list_hosts", "(", ")", "if", "not", "hosts", ":", "return", "''", "# Look for the op", "for", "addr", "in", "hosts", ":", "if", "host", "in", "hosts", "[", "addr", "]", ":", "return", "addr", "#...
Return the ip associated with the named host CLI Example: .. code-block:: bash salt '*' hosts.get_ip <hostname>
[ "Return", "the", "ip", "associated", "with", "the", "named", "host" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/hosts.py#L99-L117
train
saltstack/salt
salt/modules/hosts.py
has_pair
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
python
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
[ "def", "has_pair", "(", "ip", ",", "alias", ")", ":", "hosts", "=", "_list_hosts", "(", ")", "try", ":", "return", "alias", "in", "hosts", "[", "ip", "]", "except", "KeyError", ":", "return", "False" ]
Return true if the alias is set CLI Example: .. code-block:: bash salt '*' hosts.has_pair <ip> <alias>
[ "Return", "true", "if", "the", "alias", "is", "set" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/hosts.py#L140-L154
train
saltstack/salt
salt/modules/hosts.py
set_host
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 given IP address are removed. CLI Example: .. code-block:: bash salt '*' hosts.set_host <ip> <alias> ''' hfn = _get_or_create_hostfile() ovr = False if not os.path.isfile(hfn): return False # Make sure future calls to _list_hosts() will re-read the file __context__.pop('hosts._list_hosts', None) line_to_add = salt.utils.stringutils.to_bytes( ip + '\t\t' + alias + os.linesep ) # support removing a host entry by providing an empty string if not alias.strip(): line_to_add = b'' with salt.utils.files.fopen(hfn, 'rb') as fp_: lines = fp_.readlines() for ind, _ in enumerate(lines): tmpline = lines[ind].strip() if not tmpline: continue if tmpline.startswith(b'#'): continue comps = tmpline.split() if comps[0] == salt.utils.stringutils.to_bytes(ip): if not ovr: lines[ind] = line_to_add ovr = True else: # remove other entries lines[ind] = b'' linesep_bytes = salt.utils.stringutils.to_bytes(os.linesep) if not ovr: # make sure there is a newline if lines and not lines[-1].endswith(linesep_bytes): lines[-1] += linesep_bytes line = line_to_add lines.append(line) with salt.utils.files.fopen(hfn, 'wb') as ofile: ofile.writelines(lines) return True
python
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 given IP address are removed. CLI Example: .. code-block:: bash salt '*' hosts.set_host <ip> <alias> ''' hfn = _get_or_create_hostfile() ovr = False if not os.path.isfile(hfn): return False # Make sure future calls to _list_hosts() will re-read the file __context__.pop('hosts._list_hosts', None) line_to_add = salt.utils.stringutils.to_bytes( ip + '\t\t' + alias + os.linesep ) # support removing a host entry by providing an empty string if not alias.strip(): line_to_add = b'' with salt.utils.files.fopen(hfn, 'rb') as fp_: lines = fp_.readlines() for ind, _ in enumerate(lines): tmpline = lines[ind].strip() if not tmpline: continue if tmpline.startswith(b'#'): continue comps = tmpline.split() if comps[0] == salt.utils.stringutils.to_bytes(ip): if not ovr: lines[ind] = line_to_add ovr = True else: # remove other entries lines[ind] = b'' linesep_bytes = salt.utils.stringutils.to_bytes(os.linesep) if not ovr: # make sure there is a newline if lines and not lines[-1].endswith(linesep_bytes): lines[-1] += linesep_bytes line = line_to_add lines.append(line) with salt.utils.files.fopen(hfn, 'wb') as ofile: ofile.writelines(lines) return True
[ "def", "set_host", "(", "ip", ",", "alias", ")", ":", "hfn", "=", "_get_or_create_hostfile", "(", ")", "ovr", "=", "False", "if", "not", "os", ".", "path", ".", "isfile", "(", "hfn", ")", ":", "return", "False", "# Make sure future calls to _list_hosts() wil...
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. CLI Example: .. code-block:: bash salt '*' hosts.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" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/hosts.py#L157-L212
train
saltstack/salt
salt/modules/hosts.py
rm_host
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._list_hosts', None) hfn = _get_or_create_hostfile() with salt.utils.files.fopen(hfn, 'rb') as fp_: lines = fp_.readlines() for ind, _ in enumerate(lines): tmpline = lines[ind].strip() if not tmpline: continue if tmpline.startswith(b'#'): continue comps = tmpline.split() b_ip = salt.utils.stringutils.to_bytes(ip) b_alias = salt.utils.stringutils.to_bytes(alias) if comps[0] == b_ip: newline = comps[0] + b'\t\t' for existing in comps[1:]: if existing == b_alias: continue newline += existing + b' ' if newline.strip() == b_ip: # No aliases exist for the line, make it empty lines[ind] = b'' else: # Only an alias was removed lines[ind] = newline + salt.utils.stringutils.to_bytes(os.linesep) with salt.utils.files.fopen(hfn, 'wb') as ofile: ofile.writelines(lines) return True
python
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._list_hosts', None) hfn = _get_or_create_hostfile() with salt.utils.files.fopen(hfn, 'rb') as fp_: lines = fp_.readlines() for ind, _ in enumerate(lines): tmpline = lines[ind].strip() if not tmpline: continue if tmpline.startswith(b'#'): continue comps = tmpline.split() b_ip = salt.utils.stringutils.to_bytes(ip) b_alias = salt.utils.stringutils.to_bytes(alias) if comps[0] == b_ip: newline = comps[0] + b'\t\t' for existing in comps[1:]: if existing == b_alias: continue newline += existing + b' ' if newline.strip() == b_ip: # No aliases exist for the line, make it empty lines[ind] = b'' else: # Only an alias was removed lines[ind] = newline + salt.utils.stringutils.to_bytes(os.linesep) with salt.utils.files.fopen(hfn, 'wb') as ofile: ofile.writelines(lines) return True
[ "def", "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._list_hosts'", ",", "None"...
Remove a host entry from the hosts file CLI Example: .. code-block:: bash salt '*' hosts.rm_host <ip> <alias>
[ "Remove", "a", "host", "entry", "from", "the", "hosts", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/hosts.py#L215-L255
train
saltstack/salt
salt/modules/hosts.py
add_host
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 False if has_pair(ip, alias): return True hosts = _list_hosts() # Make sure future calls to _list_hosts() will re-read the file __context__.pop('hosts._list_hosts', None) inserted = False for i, h in six.iteritems(hosts): for j in range(len(h)): if h[j].startswith('#') and i == ip: h.insert(j, alias) inserted = True if not inserted: hosts.setdefault(ip, []).append(alias) _write_hosts(hosts) return True
python
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 False if has_pair(ip, alias): return True hosts = _list_hosts() # Make sure future calls to _list_hosts() will re-read the file __context__.pop('hosts._list_hosts', None) inserted = False for i, h in six.iteritems(hosts): for j in range(len(h)): if h[j].startswith('#') and i == ip: h.insert(j, alias) inserted = True if not inserted: hosts.setdefault(ip, []).append(alias) _write_hosts(hosts) return True
[ "def", "add_host", "(", "ip", ",", "alias", ")", ":", "hfn", "=", "_get_or_create_hostfile", "(", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "hfn", ")", ":", "return", "False", "if", "has_pair", "(", "ip", ",", "alias", ")", ":", "ret...
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>
[ "Add", "a", "host", "to", "an", "existing", "entry", "if", "the", "entry", "is", "not", "in", "place", "then", "create", "it", "with", "the", "given", "host" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/hosts.py#L258-L290
train
saltstack/salt
salt/proxy/arista_pyeapi.py
init
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 be safe to enable # multiprocessing. try: conn = pyeapi.client.connect(**conn_args) node = pyeapi.client.Node(conn, enablepwd=conn_args.get('enablepwd')) pyeapi_device['connection'] = node pyeapi_device['initialized'] = True pyeapi_device['up'] = True except pyeapi.eapilib.ConnectionError as cerr: log.error('Unable to connect to %s', conn_args['host'], exc_info=True) return False return True
python
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 be safe to enable # multiprocessing. try: conn = pyeapi.client.connect(**conn_args) node = pyeapi.client.Node(conn, enablepwd=conn_args.get('enablepwd')) pyeapi_device['connection'] = node pyeapi_device['initialized'] = True pyeapi_device['up'] = True except pyeapi.eapilib.ConnectionError as cerr: log.error('Unable to connect to %s', conn_args['host'], exc_info=True) return False return True
[ "def", "init", "(", "opts", ")", ":", "proxy_dict", "=", "opts", ".", "get", "(", "'proxy'", ",", "{", "}", ")", "conn_args", "=", "proxy_dict", ".", "copy", "(", ")", "conn_args", ".", "pop", "(", "'proxytype'", ",", "None", ")", "opts", "[", "'mu...
Open the connection to the Arista switch over the eAPI.
[ "Open", "the", "connection", "to", "the", "Arista", "switch", "over", "the", "eAPI", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/arista_pyeapi.py#L119-L138
train
saltstack/salt
salt/proxy/arista_pyeapi.py
call
def call(method, *args, **kwargs): ''' Calls an arbitrary pyeapi method. ''' kwargs = clean_kwargs(**kwargs) return getattr(pyeapi_device['connection'], method)(*args, **kwargs)
python
def call(method, *args, **kwargs): ''' Calls an arbitrary pyeapi method. ''' kwargs = clean_kwargs(**kwargs) return getattr(pyeapi_device['connection'], method)(*args, **kwargs)
[ "def", "call", "(", "method", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "clean_kwargs", "(", "*", "*", "kwargs", ")", "return", "getattr", "(", "pyeapi_device", "[", "'connection'", "]", ",", "method", ")", "(", "*", "args",...
Calls an arbitrary pyeapi method.
[ "Calls", "an", "arbitrary", "pyeapi", "method", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/arista_pyeapi.py#L173-L178
train
saltstack/salt
salt/beacons/sh.py
_get_shells
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']() else: __context__['sh.last_shells'] = start __context__['sh.shells'] = __salt__['cmd.shells']() return __context__['sh.shells']
python
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']() else: __context__['sh.last_shells'] = start __context__['sh.shells'] = __salt__['cmd.shells']() return __context__['sh.shells']
[ "def", "_get_shells", "(", ")", ":", "start", "=", "time", ".", "time", "(", ")", "if", "'sh.last_shells'", "in", "__context__", ":", "if", "start", "-", "__context__", "[", "'sh.last_shells'", "]", ">", "5", ":", "__context__", "[", "'sh.last_shells'", "]...
Return the valid shells on this system
[ "Return", "the", "valid", "shells", "on", "this", "system" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/sh.py#L29-L42
train
saltstack/salt
salt/beacons/sh.py
beacon
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: if any(ps_out[pid].get('cmd', '').lstrip('-') in shell for shell in shells): track_pids.append(pid) if pkey not in __context__: __context__[pkey] = {} for pid in track_pids: if pid not in __context__[pkey]: cmd = ['strace', '-f', '-e', 'execve', '-p', '{0}'.format(pid)] __context__[pkey][pid] = {} __context__[pkey][pid]['vt'] = salt.utils.vt.Terminal( cmd, log_stdout=True, log_stderr=True, stream_stdout=False, stream_stderr=False) __context__[pkey][pid]['user'] = ps_out[pid].get('user') for pid in list(__context__[pkey]): out = '' err = '' while __context__[pkey][pid]['vt'].has_unread_data: tout, terr = __context__[pkey][pid]['vt'].recv() if not terr: break out += salt.utils.stringutils.to_unicode(tout or '') err += terr for line in err.split('\n'): event = {'args': [], 'tag': pid} if 'execve' in line: comps = line.split('execve')[1].split('"') for ind, field in enumerate(comps): if ind == 1: event['cmd'] = field continue if ind % 2 != 0: event['args'].append(field) event['user'] = __context__[pkey][pid]['user'] ret.append(event) if not __context__[pkey][pid]['vt'].isalive(): __context__[pkey][pid]['vt'].close() __context__[pkey].pop(pid) return ret
python
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: if any(ps_out[pid].get('cmd', '').lstrip('-') in shell for shell in shells): track_pids.append(pid) if pkey not in __context__: __context__[pkey] = {} for pid in track_pids: if pid not in __context__[pkey]: cmd = ['strace', '-f', '-e', 'execve', '-p', '{0}'.format(pid)] __context__[pkey][pid] = {} __context__[pkey][pid]['vt'] = salt.utils.vt.Terminal( cmd, log_stdout=True, log_stderr=True, stream_stdout=False, stream_stderr=False) __context__[pkey][pid]['user'] = ps_out[pid].get('user') for pid in list(__context__[pkey]): out = '' err = '' while __context__[pkey][pid]['vt'].has_unread_data: tout, terr = __context__[pkey][pid]['vt'].recv() if not terr: break out += salt.utils.stringutils.to_unicode(tout or '') err += terr for line in err.split('\n'): event = {'args': [], 'tag': pid} if 'execve' in line: comps = line.split('execve')[1].split('"') for ind, field in enumerate(comps): if ind == 1: event['cmd'] = field continue if ind % 2 != 0: event['args'].append(field) event['user'] = __context__[pkey][pid]['user'] ret.append(event) if not __context__[pkey][pid]['vt'].isalive(): __context__[pkey][pid]['vt'].close() __context__[pkey].pop(pid) return ret
[ "def", "beacon", "(", "config", ")", ":", "ret", "=", "[", "]", "pkey", "=", "'sh.vt'", "shells", "=", "_get_shells", "(", ")", "ps_out", "=", "__salt__", "[", "'status.procs'", "]", "(", ")", "track_pids", "=", "[", "]", "for", "pid", "in", "ps_out"...
Scan the shell execve routines. This beacon will convert all login shells .. code-block:: yaml beacons: sh: []
[ "Scan", "the", "shell", "execve", "routines", ".", "This", "beacon", "will", "convert", "all", "login", "shells" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/beacons/sh.py#L55-L110
train
saltstack/salt
salt/modules/gcp_addon.py
_get_network
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()
python
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()
[ "def", "_get_network", "(", "project_id", ",", "network_name", ",", "service", ")", ":", "return", "service", ".", "networks", "(", ")", ".", "get", "(", "project", "=", "project_id", ",", "network", "=", "network_name", ")", ".", "execute", "(", ")" ]
Fetch network selfLink from network name.
[ "Fetch", "network", "selfLink", "from", "network", "name", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gcp_addon.py#L49-L54
train
saltstack/salt
salt/modules/gcp_addon.py
_get_instance
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()
python
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()
[ "def", "_get_instance", "(", "project_id", ",", "instance_zone", ",", "name", ",", "service", ")", ":", "return", "service", ".", "instances", "(", ")", ".", "get", "(", "project", "=", "project_id", ",", "zone", "=", "instance_zone", ",", "instance", "=",...
Get instance details
[ "Get", "instance", "details" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gcp_addon.py#L57-L63
train
saltstack/salt
salt/modules/gcp_addon.py
route_create
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 ): ''' 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 Project ID where instance and network resides. name : string name of the route to create next_hop_instance : string the name of an instance that should handle traffic matching this route. instance_zone : string zone where instance("next_hop_instance") resides network : string Specifies the network to which the route will be applied. dest_range : string The destination range of outgoing packets that the route will apply to. tags : list (optional) Identifies the set of instances that this route will apply to. priority : int (optional) Specifies the priority of this route relative to other routes. default=1000 CLI Example: salt 'salt-master.novalocal' gcp.route_create credential_file=/root/secret_key.json project_id=cp100-170315 name=derby-db-route1 next_hop_instance=instance-1 instance_zone=us-central1-a network=default dest_range=0.0.0.0/0 tags=['no-ip'] priority=700 In above example, the instances which are having tag "no-ip" will route the packet to instance "instance-1"(if packet is intended to other network) ''' credentials = oauth2client.service_account.ServiceAccountCredentials.\ from_json_keyfile_name(credential_file) service = googleapiclient.discovery.build('compute', 'v1', credentials=credentials) routes = service.routes() routes_config = { 'name': six.text_type(name), 'network': _get_network(project_id, six.text_type(network), service=service)['selfLink'], 'destRange': six.text_type(dest_range), 'nextHopInstance': _get_instance(project_id, instance_zone, next_hop_instance, service=service)['selfLink'], 'tags': tags, 'priority': priority } route_create_request = routes.insert(project=project_id, body=routes_config) return route_create_request.execute()
python
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 ): ''' 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 Project ID where instance and network resides. name : string name of the route to create next_hop_instance : string the name of an instance that should handle traffic matching this route. instance_zone : string zone where instance("next_hop_instance") resides network : string Specifies the network to which the route will be applied. dest_range : string The destination range of outgoing packets that the route will apply to. tags : list (optional) Identifies the set of instances that this route will apply to. priority : int (optional) Specifies the priority of this route relative to other routes. default=1000 CLI Example: salt 'salt-master.novalocal' gcp.route_create credential_file=/root/secret_key.json project_id=cp100-170315 name=derby-db-route1 next_hop_instance=instance-1 instance_zone=us-central1-a network=default dest_range=0.0.0.0/0 tags=['no-ip'] priority=700 In above example, the instances which are having tag "no-ip" will route the packet to instance "instance-1"(if packet is intended to other network) ''' credentials = oauth2client.service_account.ServiceAccountCredentials.\ from_json_keyfile_name(credential_file) service = googleapiclient.discovery.build('compute', 'v1', credentials=credentials) routes = service.routes() routes_config = { 'name': six.text_type(name), 'network': _get_network(project_id, six.text_type(network), service=service)['selfLink'], 'destRange': six.text_type(dest_range), 'nextHopInstance': _get_instance(project_id, instance_zone, next_hop_instance, service=service)['selfLink'], 'tags': tags, 'priority': priority } route_create_request = routes.insert(project=project_id, body=routes_config) return route_create_request.execute()
[ "def", "route_create", "(", "credential_file", "=", "None", ",", "project_id", "=", "None", ",", "name", "=", "None", ",", "dest_range", "=", "None", ",", "next_hop_instance", "=", "None", ",", "instance_zone", "=", "None", ",", "tags", "=", "None", ",", ...
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 Project ID where instance and network resides. name : string name of the route to create next_hop_instance : string the name of an instance that should handle traffic matching this route. instance_zone : string zone where instance("next_hop_instance") resides network : string Specifies the network to which the route will be applied. dest_range : string The destination range of outgoing packets that the route will apply to. tags : list (optional) Identifies the set of instances that this route will apply to. priority : int (optional) Specifies the priority of this route relative to other routes. default=1000 CLI Example: salt 'salt-master.novalocal' gcp.route_create credential_file=/root/secret_key.json project_id=cp100-170315 name=derby-db-route1 next_hop_instance=instance-1 instance_zone=us-central1-a network=default dest_range=0.0.0.0/0 tags=['no-ip'] priority=700 In above example, the instances which are having tag "no-ip" will route the packet to instance "instance-1"(if packet is intended to other network)
[ "Create", "a", "route", "to", "send", "traffic", "destined", "to", "the", "Internet", "through", "your", "gateway", "instance" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/gcp_addon.py#L66-L137
train
saltstack/salt
salt/utils/dicttrim.py
_trim_dict_in_dict
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(data[key], max_val_size, replace_with) else: if sys.getsizeof(data[key]) > max_val_size: data[key] = replace_with
python
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(data[key], max_val_size, replace_with) else: if sys.getsizeof(data[key]) > max_val_size: data[key] = replace_with
[ "def", "_trim_dict_in_dict", "(", "data", ",", "max_val_size", ",", "replace_with", ")", ":", "for", "key", "in", "data", ":", "if", "isinstance", "(", "data", "[", "key", "]", ",", "dict", ")", ":", "_trim_dict_in_dict", "(", "data", "[", "key", "]", ...
Takes a dictionary, max_val_size and replace_with and recursively loops through and replaces any values that are greater than max_val_size.
[ "Takes", "a", "dictionary", "max_val_size", "and", "replace_with", "and", "recursively", "loops", "through", "and", "replaces", "any", "values", "that", "are", "greater", "than", "max_val_size", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dicttrim.py#L9-L22
train
saltstack/salt
salt/utils/dicttrim.py
trim_dict
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 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 scanning, removing large items first and only making additional passes for smaller items if necessary. This function uses msgpack to calculate the size of the dictionary in question. While this might seem like unnecessary overhead, a data structure in python must be serialized in order for sys.getsizeof() to accurately return the items referenced in the structure. Ex: >>> salt.utils.trim_dict({'a': 'b', 'c': 'x' * 10000}, 100) {'a': 'b', 'c': 'VALUE_TRIMMED'} To improve performance, it is adviseable to pass in msgpacked data structures instead of raw dictionaries. If a msgpack structure is passed in, it will not be unserialized unless necessary. If a msgpack is passed in, it will be repacked if necessary before being returned. :param use_bin_type: Set this to true if "is_msgpacked=True" and the msgpack data has been encoded with "use_bin_type=True". This also means that the msgpack data should be decoded with "encoding='utf-8'". ''' serializer = salt.payload.Serial({'serial': 'msgpack'}) if is_msgpacked: dict_size = sys.getsizeof(data) else: dict_size = sys.getsizeof(serializer.dumps(data)) if dict_size > max_dict_bytes: if is_msgpacked: if use_bin_type: data = serializer.loads(data, encoding='utf-8') else: data = serializer.loads(data) while True: percent = float(percent) max_val_size = float(max_dict_bytes * (percent / 100)) try: for key in data: if isinstance(data[key], dict): _trim_dict_in_dict(data[key], max_val_size, replace_with) else: if sys.getsizeof(data[key]) > max_val_size: data[key] = replace_with percent = percent - stepper_size max_val_size = float(max_dict_bytes * (percent / 100)) if use_bin_type: dump_data = serializer.dumps(data, use_bin_type=True) else: dump_data = serializer.dumps(data) cur_dict_size = sys.getsizeof(dump_data) if cur_dict_size < max_dict_bytes: if is_msgpacked: # Repack it return dump_data else: return data elif max_val_size == 0: if is_msgpacked: return dump_data else: return data except ValueError: pass if is_msgpacked: if use_bin_type: return serializer.dumps(data, use_bin_type=True) else: return serializer.dumps(data) else: return data else: return data
python
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 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 scanning, removing large items first and only making additional passes for smaller items if necessary. This function uses msgpack to calculate the size of the dictionary in question. While this might seem like unnecessary overhead, a data structure in python must be serialized in order for sys.getsizeof() to accurately return the items referenced in the structure. Ex: >>> salt.utils.trim_dict({'a': 'b', 'c': 'x' * 10000}, 100) {'a': 'b', 'c': 'VALUE_TRIMMED'} To improve performance, it is adviseable to pass in msgpacked data structures instead of raw dictionaries. If a msgpack structure is passed in, it will not be unserialized unless necessary. If a msgpack is passed in, it will be repacked if necessary before being returned. :param use_bin_type: Set this to true if "is_msgpacked=True" and the msgpack data has been encoded with "use_bin_type=True". This also means that the msgpack data should be decoded with "encoding='utf-8'". ''' serializer = salt.payload.Serial({'serial': 'msgpack'}) if is_msgpacked: dict_size = sys.getsizeof(data) else: dict_size = sys.getsizeof(serializer.dumps(data)) if dict_size > max_dict_bytes: if is_msgpacked: if use_bin_type: data = serializer.loads(data, encoding='utf-8') else: data = serializer.loads(data) while True: percent = float(percent) max_val_size = float(max_dict_bytes * (percent / 100)) try: for key in data: if isinstance(data[key], dict): _trim_dict_in_dict(data[key], max_val_size, replace_with) else: if sys.getsizeof(data[key]) > max_val_size: data[key] = replace_with percent = percent - stepper_size max_val_size = float(max_dict_bytes * (percent / 100)) if use_bin_type: dump_data = serializer.dumps(data, use_bin_type=True) else: dump_data = serializer.dumps(data) cur_dict_size = sys.getsizeof(dump_data) if cur_dict_size < max_dict_bytes: if is_msgpacked: # Repack it return dump_data else: return data elif max_val_size == 0: if is_msgpacked: return dump_data else: return data except ValueError: pass if is_msgpacked: if use_bin_type: return serializer.dumps(data, use_bin_type=True) else: return serializer.dumps(data) else: return data else: return data
[ "def", "trim_dict", "(", "data", ",", "max_dict_bytes", ",", "percent", "=", "50.0", ",", "stepper_size", "=", "10", ",", "replace_with", "=", "'VALUE_TRIMMED'", ",", "is_msgpacked", "=", "False", ",", "use_bin_type", "=", "False", ")", ":", "serializer", "=...
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 scanning, removing large items first and only making additional passes for smaller items if necessary. This function uses msgpack to calculate the size of the dictionary in question. While this might seem like unnecessary overhead, a data structure in python must be serialized in order for sys.getsizeof() to accurately return the items referenced in the structure. Ex: >>> salt.utils.trim_dict({'a': 'b', 'c': 'x' * 10000}, 100) {'a': 'b', 'c': 'VALUE_TRIMMED'} To improve performance, it is adviseable to pass in msgpacked data structures instead of raw dictionaries. If a msgpack structure is passed in, it will not be unserialized unless necessary. If a msgpack is passed in, it will be repacked if necessary before being returned. :param use_bin_type: Set this to true if "is_msgpacked=True" and the msgpack data has been encoded with "use_bin_type=True". This also means that the msgpack data should be decoded with "encoding='utf-8'".
[ "Takes", "a", "dictionary", "and", "iterates", "over", "its", "keys", "looking", "for", "large", "values", "and", "replacing", "them", "with", "a", "trimmed", "string", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/dicttrim.py#L25-L116
train
saltstack/salt
salt/modules/ldapmod.py
_config
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 = __salt__['config.option']('ldap.{0}'.format(key)) return salt.utils.data.decode(value, to_str=True)
python
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 = __salt__['config.option']('ldap.{0}'.format(key)) return salt.utils.data.decode(value, to_str=True)
[ "def", "_config", "(", "name", ",", "key", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "key", "is", "None", ":", "key", "=", "name", "if", "name", "in", "kwargs", ":", "value", "=", "kwargs", "[", "name", "]", "else", ":", "value", "=...
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'.
[ "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", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ldapmod.py#L78-L89
train
saltstack/salt
salt/modules/ldapmod.py
_connect
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 _LDAPConnection(**connargs).ldap
python
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 _LDAPConnection(**connargs).ldap
[ "def", "_connect", "(", "*", "*", "kwargs", ")", ":", "connargs", "=", "{", "}", "for", "name", "in", "[", "'uri'", ",", "'server'", ",", "'port'", ",", "'tls'", ",", "'no_verify'", ",", "'binddn'", ",", "'bindpw'", ",", "'anonymous'", "]", ":", "con...
Instantiate LDAP Connection class and return an LDAP connection object
[ "Instantiate", "LDAP", "Connection", "class", "and", "return", "an", "LDAP", "connection", "object" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ldapmod.py#L92-L101
train
saltstack/salt
salt/modules/ldapmod.py
search
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=myhost" Return data: .. code-block:: python {'myhost': {'count': 1, 'results': [['cn=myhost,ou=hosts,o=acme,c=gb', {'saltKeyValue': ['ntpserver=ntp.acme.local', 'foo=myfoo'], 'saltState': ['foo', 'bar']}]], 'time': {'human': '1.2ms', 'raw': '0.00123'}}} Search and connection options can be overridden by specifying the relevant option as key=value pairs, for example: .. code-block:: bash salt 'ldaphost' ldap.search filter=cn=myhost dn=ou=hosts,o=acme,c=gb scope=1 attrs='' server='localhost' port='7393' tls=True bindpw='ssh' ''' if not dn: dn = _config('dn', 'basedn') # pylint: disable=C0103 if not scope: scope = _config('scope') if attrs == '': # Allow command line 'return all' attr override attrs = None elif attrs is None: attrs = _config('attrs') _ldap = _connect(**kwargs) start = time.time() log.debug( 'Running LDAP search with filter:%s, dn:%s, scope:%s, ' 'attrs:%s', filter, dn, scope, attrs ) results = _ldap.search_s(dn, int(scope), filter, attrs) elapsed = (time.time() - start) if elapsed < 0.200: elapsed_h = six.text_type(round(elapsed * 1000, 1)) + 'ms' else: elapsed_h = six.text_type(round(elapsed, 2)) + 's' ret = { 'results': results, 'count': len(results), 'time': {'human': elapsed_h, 'raw': six.text_type(round(elapsed, 5))}, } return ret
python
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=myhost" Return data: .. code-block:: python {'myhost': {'count': 1, 'results': [['cn=myhost,ou=hosts,o=acme,c=gb', {'saltKeyValue': ['ntpserver=ntp.acme.local', 'foo=myfoo'], 'saltState': ['foo', 'bar']}]], 'time': {'human': '1.2ms', 'raw': '0.00123'}}} Search and connection options can be overridden by specifying the relevant option as key=value pairs, for example: .. code-block:: bash salt 'ldaphost' ldap.search filter=cn=myhost dn=ou=hosts,o=acme,c=gb scope=1 attrs='' server='localhost' port='7393' tls=True bindpw='ssh' ''' if not dn: dn = _config('dn', 'basedn') # pylint: disable=C0103 if not scope: scope = _config('scope') if attrs == '': # Allow command line 'return all' attr override attrs = None elif attrs is None: attrs = _config('attrs') _ldap = _connect(**kwargs) start = time.time() log.debug( 'Running LDAP search with filter:%s, dn:%s, scope:%s, ' 'attrs:%s', filter, dn, scope, attrs ) results = _ldap.search_s(dn, int(scope), filter, attrs) elapsed = (time.time() - start) if elapsed < 0.200: elapsed_h = six.text_type(round(elapsed * 1000, 1)) + 'ms' else: elapsed_h = six.text_type(round(elapsed, 2)) + 's' ret = { 'results': results, 'count': len(results), 'time': {'human': elapsed_h, 'raw': six.text_type(round(elapsed, 5))}, } return ret
[ "def", "search", "(", "filter", ",", "# pylint: disable=C0103", "dn", "=", "None", ",", "# pylint: disable=C0103", "scope", "=", "None", ",", "attrs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "dn", ":", "dn", "=", "_config", "(", "'...
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', {'saltKeyValue': ['ntpserver=ntp.acme.local', 'foo=myfoo'], 'saltState': ['foo', 'bar']}]], 'time': {'human': '1.2ms', 'raw': '0.00123'}}} Search and connection options can be overridden by specifying the relevant option as key=value pairs, for example: .. code-block:: bash salt 'ldaphost' ldap.search filter=cn=myhost dn=ou=hosts,o=acme,c=gb scope=1 attrs='' server='localhost' port='7393' tls=True bindpw='ssh'
[ "Run", "an", "arbitrary", "LDAP", "query", "and", "return", "the", "results", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ldapmod.py#L104-L163
train
saltstack/salt
salt/modules/azurearm_network.py
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:: bash salt-call azurearm_network.check_dns_name_availability testdnsname westus ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: check_dns_name = netconn.check_dns_name_availability( location=region, domain_name_label=name ) result = check_dns_name.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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:: bash salt-call azurearm_network.check_dns_name_availability testdnsname westus ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: check_dns_name = netconn.check_dns_name_availability( location=region, domain_name_label=name ) result = check_dns_name.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "check_dns_name_availability", "(", "name", ",", "region", ",", "*", "*", "kwargs", ")", ":", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "check_dns_name", "=", "netconn",...
.. 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 testdnsname westus
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L87-L115
train
saltstack/salt
salt/modules/azurearm_network.py
check_ip_address_availability
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 virtual_network: The virtual network to query for the IP address in question. :param resource_group: The resource group name assigned to the virtual network. CLI Example: .. code-block:: bash salt-call azurearm_network.check_ip_address_availability 10.0.0.4 testnet testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: check_ip = netconn.virtual_networks.check_ip_address_availability( resource_group_name=resource_group, virtual_network_name=virtual_network, ip_address=ip_address) result = check_ip.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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 virtual_network: The virtual network to query for the IP address in question. :param resource_group: The resource group name assigned to the virtual network. CLI Example: .. code-block:: bash salt-call azurearm_network.check_ip_address_availability 10.0.0.4 testnet testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: check_ip = netconn.virtual_networks.check_ip_address_availability( resource_group_name=resource_group, virtual_network_name=virtual_network, ip_address=ip_address) result = check_ip.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "check_ip_address_availability", "(", "ip_address", ",", "virtual_network", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ...
.. 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 assigned to the virtual network. CLI Example: .. code-block:: bash salt-call azurearm_network.check_ip_address_availability 10.0.0.4 testnet testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L118-L152
train
saltstack/salt
salt/modules/azurearm_network.py
default_security_rule_get
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 security rule. :param resource_group: The resource group name assigned to the network security group. CLI Example: .. code-block:: bash salt-call azurearm_network.default_security_rule_get DenyAllOutBound testnsg testgroup ''' result = {} default_rules = default_security_rules_list( security_group=security_group, resource_group=resource_group, **kwargs ) if isinstance(default_rules, dict) and 'error' in default_rules: return default_rules try: for default_rule in default_rules: if default_rule['name'] == name: result = default_rule if not result: result = { 'error': 'Unable to find {0} in {1}!'.format(name, security_group) } except KeyError as exc: log.error('Unable to find %s in %s!', name, security_group) result = {'error': str(exc)} return result
python
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 security rule. :param resource_group: The resource group name assigned to the network security group. CLI Example: .. code-block:: bash salt-call azurearm_network.default_security_rule_get DenyAllOutBound testnsg testgroup ''' result = {} default_rules = default_security_rules_list( security_group=security_group, resource_group=resource_group, **kwargs ) if isinstance(default_rules, dict) and 'error' in default_rules: return default_rules try: for default_rule in default_rules: if default_rule['name'] == name: result = default_rule if not result: result = { 'error': 'Unable to find {0} in {1}!'.format(name, security_group) } except KeyError as exc: log.error('Unable to find %s in %s!', name, security_group) result = {'error': str(exc)} return result
[ "def", "default_security_rule_get", "(", "name", ",", "security_group", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "default_rules", "=", "default_security_rules_list", "(", "security_group", "=", "security_group", ",", "reso...
.. 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 network security group. CLI Example: .. code-block:: bash salt-call azurearm_network.default_security_rule_get DenyAllOutBound testnsg testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L155-L199
train
saltstack/salt
salt/modules/azurearm_network.py
default_security_rules_list
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 security group. CLI Example: .. code-block:: bash salt-call azurearm_network.default_security_rules_list testnsg testgroup ''' result = {} secgroup = network_security_group_get( security_group=security_group, resource_group=resource_group, **kwargs ) if 'error' in secgroup: return secgroup try: result = secgroup['default_security_rules'] except KeyError as exc: log.error('No default security rules found for %s!', security_group) result = {'error': str(exc)} return result
python
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 security group. CLI Example: .. code-block:: bash salt-call azurearm_network.default_security_rules_list testnsg testgroup ''' result = {} secgroup = network_security_group_get( security_group=security_group, resource_group=resource_group, **kwargs ) if 'error' in secgroup: return secgroup try: result = secgroup['default_security_rules'] except KeyError as exc: log.error('No default security rules found for %s!', security_group) result = {'error': str(exc)} return result
[ "def", "default_security_rules_list", "(", "security_group", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "secgroup", "=", "network_security_group_get", "(", "security_group", "=", "security_group", ",", "resource_group", "=", ...
.. 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 azurearm_network.default_security_rules_list testnsg testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L202-L237
train
saltstack/salt
salt/modules/azurearm_network.py
security_rules_list
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 security group. CLI Example: .. code-block:: bash salt-call azurearm_network.security_rules_list testnsg testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: secrules = netconn.security_rules.list( network_security_group_name=security_group, resource_group_name=resource_group ) result = __utils__['azurearm.paged_object_to_list'](secrules) except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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 security group. CLI Example: .. code-block:: bash salt-call azurearm_network.security_rules_list testnsg testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: secrules = netconn.security_rules.list( network_security_group_name=security_group, resource_group_name=resource_group ) result = __utils__['azurearm.paged_object_to_list'](secrules) except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "security_rules_list", "(", "security_group", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "secrules", "=", "netco...
.. 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 azurearm_network.security_rules_list testnsg testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L240-L269
train
saltstack/salt
salt/modules/azurearm_network.py
security_rule_create_or_update
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=None, destination_address_prefixes=None, source_port_ranges=None, destination_port_ranges=None, **kwargs): ''' .. 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 and 4096 used for ordering rule application. :param protocol: 'tcp', 'udp', or '*' :param destination_address_prefix: The CIDR or destination IP range. Asterix '*' can also be used to match all destination IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. :param destination_port_range: The destination port or range. Integer or range between 0 and 65535. Asterix '*' can also be used to match all ports. :param source_address_prefix: The CIDR or source IP range. Asterix '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. :param source_port_range: The source port or range. Integer or range between 0 and 65535. Asterix '*' can also be used to match all ports. :param destination_address_prefixes: A list of destination_address_prefix values. This parameter overrides destination_address_prefix and will cause any value entered there to be ignored. :param destination_port_ranges: A list of destination_port_range values. This parameter overrides destination_port_range and will cause any value entered there to be ignored. :param source_address_prefixes: A list of source_address_prefix values. This parameter overrides source_address_prefix and will cause any value entered there to be ignored. :param source_port_ranges: A list of source_port_range values. This parameter overrides source_port_range and will cause any value entered there to be ignored. :param security_group: The network security group containing the security rule. :param resource_group: The resource group name assigned to the network security group. CLI Example: .. code-block:: bash salt-call azurearm_network.security_rule_create_or_update testrule1 allow outbound 101 tcp testnsg testgroup \ source_address_prefix='*' destination_address_prefix=internet source_port_range='*' \ destination_port_range='1-1024' ''' exclusive_params = [ ('source_port_ranges', 'source_port_range'), ('source_address_prefixes', 'source_address_prefix'), ('destination_port_ranges', 'destination_port_range'), ('destination_address_prefixes', 'destination_address_prefix'), ] for params in exclusive_params: # pylint: disable=eval-used if not eval(params[0]) and not eval(params[1]): log.error( 'Either the %s or %s parameter must be provided!', params[0], params[1] ) return False # pylint: disable=eval-used if eval(params[0]): # pylint: disable=exec-used exec('{0} = None'.format(params[1])) netconn = __utils__['azurearm.get_client']('network', **kwargs) try: rulemodel = __utils__['azurearm.create_object_model']( 'network', 'SecurityRule', name=name, access=access, direction=direction, priority=priority, protocol=protocol, source_port_ranges=source_port_ranges, source_port_range=source_port_range, source_address_prefixes=source_address_prefixes, source_address_prefix=source_address_prefix, destination_port_ranges=destination_port_ranges, destination_port_range=destination_port_range, destination_address_prefixes=destination_address_prefixes, destination_address_prefix=destination_address_prefix, **kwargs ) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: secrule = netconn.security_rules.create_or_update( resource_group_name=resource_group, network_security_group_name=security_group, security_rule_name=name, security_rule_parameters=rulemodel ) secrule.wait() secrule_result = secrule.result() result = secrule_result.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
python
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=None, destination_address_prefixes=None, source_port_ranges=None, destination_port_ranges=None, **kwargs): ''' .. 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 and 4096 used for ordering rule application. :param protocol: 'tcp', 'udp', or '*' :param destination_address_prefix: The CIDR or destination IP range. Asterix '*' can also be used to match all destination IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. :param destination_port_range: The destination port or range. Integer or range between 0 and 65535. Asterix '*' can also be used to match all ports. :param source_address_prefix: The CIDR or source IP range. Asterix '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. :param source_port_range: The source port or range. Integer or range between 0 and 65535. Asterix '*' can also be used to match all ports. :param destination_address_prefixes: A list of destination_address_prefix values. This parameter overrides destination_address_prefix and will cause any value entered there to be ignored. :param destination_port_ranges: A list of destination_port_range values. This parameter overrides destination_port_range and will cause any value entered there to be ignored. :param source_address_prefixes: A list of source_address_prefix values. This parameter overrides source_address_prefix and will cause any value entered there to be ignored. :param source_port_ranges: A list of source_port_range values. This parameter overrides source_port_range and will cause any value entered there to be ignored. :param security_group: The network security group containing the security rule. :param resource_group: The resource group name assigned to the network security group. CLI Example: .. code-block:: bash salt-call azurearm_network.security_rule_create_or_update testrule1 allow outbound 101 tcp testnsg testgroup \ source_address_prefix='*' destination_address_prefix=internet source_port_range='*' \ destination_port_range='1-1024' ''' exclusive_params = [ ('source_port_ranges', 'source_port_range'), ('source_address_prefixes', 'source_address_prefix'), ('destination_port_ranges', 'destination_port_range'), ('destination_address_prefixes', 'destination_address_prefix'), ] for params in exclusive_params: # pylint: disable=eval-used if not eval(params[0]) and not eval(params[1]): log.error( 'Either the %s or %s parameter must be provided!', params[0], params[1] ) return False # pylint: disable=eval-used if eval(params[0]): # pylint: disable=exec-used exec('{0} = None'.format(params[1])) netconn = __utils__['azurearm.get_client']('network', **kwargs) try: rulemodel = __utils__['azurearm.create_object_model']( 'network', 'SecurityRule', name=name, access=access, direction=direction, priority=priority, protocol=protocol, source_port_ranges=source_port_ranges, source_port_range=source_port_range, source_address_prefixes=source_address_prefixes, source_address_prefix=source_address_prefix, destination_port_ranges=destination_port_ranges, destination_port_range=destination_port_range, destination_address_prefixes=destination_address_prefixes, destination_address_prefix=destination_address_prefix, **kwargs ) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: secrule = netconn.security_rules.create_or_update( resource_group_name=resource_group, network_security_group_name=security_group, security_rule_name=name, security_rule_parameters=rulemodel ) secrule.wait() secrule_result = secrule.result() result = secrule_result.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
[ "def", "security_rule_create_or_update", "(", "name", ",", "access", ",", "direction", ",", "priority", ",", "protocol", ",", "security_group", ",", "resource_group", ",", "source_address_prefix", "=", "None", ",", "destination_address_prefix", "=", "None", ",", "so...
.. 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 and 4096 used for ordering rule application. :param protocol: 'tcp', 'udp', or '*' :param destination_address_prefix: The CIDR or destination IP range. Asterix '*' can also be used to match all destination IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. :param destination_port_range: The destination port or range. Integer or range between 0 and 65535. Asterix '*' can also be used to match all ports. :param source_address_prefix: The CIDR or source IP range. Asterix '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. :param source_port_range: The source port or range. Integer or range between 0 and 65535. Asterix '*' can also be used to match all ports. :param destination_address_prefixes: A list of destination_address_prefix values. This parameter overrides destination_address_prefix and will cause any value entered there to be ignored. :param destination_port_ranges: A list of destination_port_range values. This parameter overrides destination_port_range and will cause any value entered there to be ignored. :param source_address_prefixes: A list of source_address_prefix values. This parameter overrides source_address_prefix and will cause any value entered there to be ignored. :param source_port_ranges: A list of source_port_range values. This parameter overrides source_port_range and will cause any value entered there to be ignored. :param security_group: The network security group containing the security rule. :param resource_group: The resource group name assigned to the network security group. CLI Example: .. code-block:: bash salt-call azurearm_network.security_rule_create_or_update testrule1 allow outbound 101 tcp testnsg testgroup \ source_address_prefix='*' destination_address_prefix=internet source_port_range='*' \ destination_port_range='1-1024'
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L272-L406
train
saltstack/salt
salt/modules/azurearm_network.py
security_rule_delete
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 group containing the security rule. :param resource_group: The resource group name assigned to the network security group. CLI Example: .. code-block:: bash salt-call azurearm_network.security_rule_delete testrule1 testnsg testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: secrule = netconn.security_rules.delete( network_security_group_name=security_group, resource_group_name=resource_group, security_rule_name=security_rule ) secrule.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
python
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 group containing the security rule. :param resource_group: The resource group name assigned to the network security group. CLI Example: .. code-block:: bash salt-call azurearm_network.security_rule_delete testrule1 testnsg testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: secrule = netconn.security_rules.delete( network_security_group_name=security_group, resource_group_name=resource_group, security_rule_name=security_rule ) secrule.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
[ "def", "security_rule_delete", "(", "security_rule", ",", "security_group", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "False", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwar...
.. 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 network security group. CLI Example: .. code-block:: bash salt-call azurearm_network.security_rule_delete testrule1 testnsg testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L409-L444
train
saltstack/salt
salt/modules/azurearm_network.py
security_rule_get
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 security rule. :param resource_group: The resource group name assigned to the network security group. CLI Example: .. code-block:: bash salt-call azurearm_network.security_rule_get testrule1 testnsg testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: secrule = netconn.security_rules.get( network_security_group_name=security_group, resource_group_name=resource_group, security_rule_name=security_rule ) result = secrule.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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 security rule. :param resource_group: The resource group name assigned to the network security group. CLI Example: .. code-block:: bash salt-call azurearm_network.security_rule_get testrule1 testnsg testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: secrule = netconn.security_rules.get( network_security_group_name=security_group, resource_group_name=resource_group, security_rule_name=security_rule ) result = secrule.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "security_rule_get", "(", "security_rule", ",", "security_group", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "se...
.. 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 network security group. CLI Example: .. code-block:: bash salt-call azurearm_network.security_rule_get testrule1 testnsg testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L447-L480
train
saltstack/salt
salt/modules/azurearm_network.py
network_security_group_create_or_update
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 assigned to the network security group. CLI Example: .. code-block:: bash salt-call azurearm_network.network_security_group_create_or_update testnsg testgroup ''' if 'location' not in kwargs: rg_props = __salt__['azurearm_resource.resource_group_get']( resource_group, **kwargs ) if 'error' in rg_props: log.error( 'Unable to determine location from resource group specified.' ) return False kwargs['location'] = rg_props['location'] netconn = __utils__['azurearm.get_client']('network', **kwargs) try: secgroupmodel = __utils__['azurearm.create_object_model']('network', 'NetworkSecurityGroup', **kwargs) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: secgroup = netconn.network_security_groups.create_or_update( resource_group_name=resource_group, network_security_group_name=name, parameters=secgroupmodel ) secgroup.wait() secgroup_result = secgroup.result() result = secgroup_result.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
python
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 assigned to the network security group. CLI Example: .. code-block:: bash salt-call azurearm_network.network_security_group_create_or_update testnsg testgroup ''' if 'location' not in kwargs: rg_props = __salt__['azurearm_resource.resource_group_get']( resource_group, **kwargs ) if 'error' in rg_props: log.error( 'Unable to determine location from resource group specified.' ) return False kwargs['location'] = rg_props['location'] netconn = __utils__['azurearm.get_client']('network', **kwargs) try: secgroupmodel = __utils__['azurearm.create_object_model']('network', 'NetworkSecurityGroup', **kwargs) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: secgroup = netconn.network_security_groups.create_or_update( resource_group_name=resource_group, network_security_group_name=name, parameters=secgroupmodel ) secgroup.wait() secgroup_result = secgroup.result() result = secgroup_result.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
[ "def", "network_security_group_create_or_update", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=invalid-name", "if", "'location'", "not", "in", "kwargs", ":", "rg_props", "=", "__salt__", "[", "'azurearm_resource.resource_grou...
.. 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_network.network_security_group_create_or_update testnsg testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L483-L536
train
saltstack/salt
salt/modules/azurearm_network.py
network_security_group_delete
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 security group. CLI Example: .. code-block:: bash salt-call azurearm_network.network_security_group_delete testnsg testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: secgroup = netconn.network_security_groups.delete( resource_group_name=resource_group, network_security_group_name=name ) secgroup.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
python
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 security group. CLI Example: .. code-block:: bash salt-call azurearm_network.network_security_group_delete testnsg testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: secgroup = netconn.network_security_groups.delete( resource_group_name=resource_group, network_security_group_name=name ) secgroup.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
[ "def", "network_security_group_delete", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "False", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":",...
.. 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 azurearm_network.network_security_group_delete testnsg testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L539-L569
train
saltstack/salt
salt/modules/azurearm_network.py
network_security_group_get
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 network security group. CLI Example: .. code-block:: bash salt-call azurearm_network.network_security_group_get testnsg testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: secgroup = netconn.network_security_groups.get( resource_group_name=resource_group, network_security_group_name=name ) result = secgroup.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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 network security group. CLI Example: .. code-block:: bash salt-call azurearm_network.network_security_group_get testnsg testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: secgroup = netconn.network_security_groups.get( resource_group_name=resource_group, network_security_group_name=name ) result = secgroup.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "network_security_group_get", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "secgroup", "=", "netconn"...
.. 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 salt-call azurearm_network.network_security_group_get testnsg testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L572-L601
train
saltstack/salt
salt/modules/azurearm_network.py
network_security_groups_list
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 salt-call azurearm_network.network_security_groups_list testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: secgroups = __utils__['azurearm.paged_object_to_list']( netconn.network_security_groups.list( resource_group_name=resource_group ) ) for secgroup in secgroups: result[secgroup['name']] = secgroup except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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 salt-call azurearm_network.network_security_groups_list testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: secgroups = __utils__['azurearm.paged_object_to_list']( netconn.network_security_groups.list( resource_group_name=resource_group ) ) for secgroup in secgroups: result[secgroup['name']] = secgroup except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "network_security_groups_list", "(", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "secgroups",...
.. 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
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L604-L634
train
saltstack/salt
salt/modules/azurearm_network.py
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 = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: secgroups = __utils__['azurearm.paged_object_to_list']( netconn.network_security_groups.list_all() ) for secgroup in secgroups: result[secgroup['name']] = secgroup except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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 = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: secgroups = __utils__['azurearm.paged_object_to_list']( netconn.network_security_groups.list_all() ) for secgroup in secgroups: result[secgroup['name']] = secgroup except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "network_security_groups_list_all", "(", "*", "*", "kwargs", ")", ":", "# pylint: disable=invalid-name", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", ...
.. 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
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L637-L662
train
saltstack/salt
salt/modules/azurearm_network.py
subnets_list
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. CLI Example: .. code-block:: bash salt-call azurearm_network.subnets_list testnet testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: subnets = __utils__['azurearm.paged_object_to_list']( netconn.subnets.list( resource_group_name=resource_group, virtual_network_name=virtual_network ) ) for subnet in subnets: result[subnet['name']] = subnet except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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. CLI Example: .. code-block:: bash salt-call azurearm_network.subnets_list testnet testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: subnets = __utils__['azurearm.paged_object_to_list']( netconn.subnets.list( resource_group_name=resource_group, virtual_network_name=virtual_network ) ) for subnet in subnets: result[subnet['name']] = subnet except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "subnets_list", "(", "virtual_network", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", ...
.. 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_network.subnets_list testnet testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L665-L699
train
saltstack/salt
salt/modules/azurearm_network.py
subnet_get
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 resource group name assigned to the virtual network. CLI Example: .. code-block:: bash salt-call azurearm_network.subnet_get testsubnet testnet testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: subnet = netconn.subnets.get( resource_group_name=resource_group, virtual_network_name=virtual_network, subnet_name=name ) result = subnet.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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 resource group name assigned to the virtual network. CLI Example: .. code-block:: bash salt-call azurearm_network.subnet_get testsubnet testnet testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: subnet = netconn.subnets.get( resource_group_name=resource_group, virtual_network_name=virtual_network, subnet_name=name ) result = subnet.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "subnet_get", "(", "name", ",", "virtual_network", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "subnet", "=", ...
.. 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: .. code-block:: bash salt-call azurearm_network.subnet_get testsubnet testnet testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L702-L736
train
saltstack/salt
salt/modules/azurearm_network.py
subnet_create_or_update
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. :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:: bash salt-call azurearm_network.subnet_create_or_update testsubnet \ '10.0.0.0/24' testnet testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) # Use NSG name to link to the ID of an existing NSG. if kwargs.get('network_security_group'): nsg = network_security_group_get( name=kwargs['network_security_group'], resource_group=resource_group, **kwargs ) if 'error' not in nsg: kwargs['network_security_group'] = {'id': str(nsg['id'])} # Use Route Table name to link to the ID of an existing Route Table. if kwargs.get('route_table'): rt_table = route_table_get( name=kwargs['route_table'], resource_group=resource_group, **kwargs ) if 'error' not in rt_table: kwargs['route_table'] = {'id': str(rt_table['id'])} try: snetmodel = __utils__['azurearm.create_object_model']( 'network', 'Subnet', address_prefix=address_prefix, resource_group=resource_group, **kwargs ) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: subnet = netconn.subnets.create_or_update( resource_group_name=resource_group, virtual_network_name=virtual_network, subnet_name=name, subnet_parameters=snetmodel, ) subnet.wait() sn_result = subnet.result() result = sn_result.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
python
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. :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:: bash salt-call azurearm_network.subnet_create_or_update testsubnet \ '10.0.0.0/24' testnet testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) # Use NSG name to link to the ID of an existing NSG. if kwargs.get('network_security_group'): nsg = network_security_group_get( name=kwargs['network_security_group'], resource_group=resource_group, **kwargs ) if 'error' not in nsg: kwargs['network_security_group'] = {'id': str(nsg['id'])} # Use Route Table name to link to the ID of an existing Route Table. if kwargs.get('route_table'): rt_table = route_table_get( name=kwargs['route_table'], resource_group=resource_group, **kwargs ) if 'error' not in rt_table: kwargs['route_table'] = {'id': str(rt_table['id'])} try: snetmodel = __utils__['azurearm.create_object_model']( 'network', 'Subnet', address_prefix=address_prefix, resource_group=resource_group, **kwargs ) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: subnet = netconn.subnets.create_or_update( resource_group_name=resource_group, virtual_network_name=virtual_network, subnet_name=name, subnet_parameters=snetmodel, ) subnet.wait() sn_result = subnet.result() result = sn_result.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
[ "def", "subnet_create_or_update", "(", "name", ",", "address_prefix", ",", "virtual_network", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "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. :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:: bash salt-call azurearm_network.subnet_create_or_update testsubnet \ '10.0.0.0/24' testnet testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L739-L813
train
saltstack/salt
salt/modules/azurearm_network.py
subnet_delete
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 assigned to the virtual network. CLI Example: .. code-block:: bash salt-call azurearm_network.subnet_delete testsubnet testnet testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: subnet = netconn.subnets.delete( resource_group_name=resource_group, virtual_network_name=virtual_network, subnet_name=name ) subnet.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
python
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 assigned to the virtual network. CLI Example: .. code-block:: bash salt-call azurearm_network.subnet_delete testsubnet testnet testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: subnet = netconn.subnets.delete( resource_group_name=resource_group, virtual_network_name=virtual_network, subnet_name=name ) subnet.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
[ "def", "subnet_delete", "(", "name", ",", "virtual_network", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "False", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "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 assigned to the virtual network. CLI Example: .. code-block:: bash salt-call azurearm_network.subnet_delete testsubnet testnet testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L816-L850
train
saltstack/salt
salt/modules/azurearm_network.py
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', **kwargs) try: vnets = __utils__['azurearm.paged_object_to_list'](netconn.virtual_networks.list_all()) for vnet in vnets: result[vnet['name']] = vnet except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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', **kwargs) try: vnets = __utils__['azurearm.paged_object_to_list'](netconn.virtual_networks.list_all()) for vnet in vnets: result[vnet['name']] = vnet except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "virtual_networks_list_all", "(", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "vnets", "=", "__utils__", "[", "'...
.. versionadded:: 2019.2.0 List all virtual networks within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.virtual_networks_list_all
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L853-L877
train
saltstack/salt
salt/modules/azurearm_network.py
virtual_networks_list
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.virtual_networks_list testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: vnets = __utils__['azurearm.paged_object_to_list']( netconn.virtual_networks.list( resource_group_name=resource_group ) ) for vnet in vnets: result[vnet['name']] = vnet except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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.virtual_networks_list testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: vnets = __utils__['azurearm.paged_object_to_list']( netconn.virtual_networks.list( resource_group_name=resource_group ) ) for vnet in vnets: result[vnet['name']] = vnet except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "virtual_networks_list", "(", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "vnets", "=", "...
.. 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
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L880-L911
train
saltstack/salt
salt/modules/azurearm_network.py
virtual_network_create_or_update
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 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 group name assigned to the virtual network. CLI Example: .. code-block:: bash salt-call azurearm_network.virtual_network_create_or_update \ testnet ['10.0.0.0/16'] testgroup ''' if 'location' not in kwargs: rg_props = __salt__['azurearm_resource.resource_group_get']( resource_group, **kwargs ) if 'error' in rg_props: log.error( 'Unable to determine location from resource group specified.' ) return False kwargs['location'] = rg_props['location'] if not isinstance(address_prefixes, list): log.error( 'Address prefixes must be specified as a list!' ) return False netconn = __utils__['azurearm.get_client']('network', **kwargs) address_space = {'address_prefixes': address_prefixes} dhcp_options = {'dns_servers': kwargs.get('dns_servers')} try: vnetmodel = __utils__['azurearm.create_object_model']( 'network', 'VirtualNetwork', address_space=address_space, dhcp_options=dhcp_options, **kwargs ) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: vnet = netconn.virtual_networks.create_or_update( virtual_network_name=name, resource_group_name=resource_group, parameters=vnetmodel ) vnet.wait() vnet_result = vnet.result() result = vnet_result.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
python
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 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 group name assigned to the virtual network. CLI Example: .. code-block:: bash salt-call azurearm_network.virtual_network_create_or_update \ testnet ['10.0.0.0/16'] testgroup ''' if 'location' not in kwargs: rg_props = __salt__['azurearm_resource.resource_group_get']( resource_group, **kwargs ) if 'error' in rg_props: log.error( 'Unable to determine location from resource group specified.' ) return False kwargs['location'] = rg_props['location'] if not isinstance(address_prefixes, list): log.error( 'Address prefixes must be specified as a list!' ) return False netconn = __utils__['azurearm.get_client']('network', **kwargs) address_space = {'address_prefixes': address_prefixes} dhcp_options = {'dns_servers': kwargs.get('dns_servers')} try: vnetmodel = __utils__['azurearm.create_object_model']( 'network', 'VirtualNetwork', address_space=address_space, dhcp_options=dhcp_options, **kwargs ) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: vnet = netconn.virtual_networks.create_or_update( virtual_network_name=name, resource_group_name=resource_group, parameters=vnetmodel ) vnet.wait() vnet_result = vnet.result() result = vnet_result.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
[ "def", "virtual_network_create_or_update", "(", "name", ",", "address_prefixes", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "if", "'location'", "not", "in", "kwargs", ":", "rg_props", "=", "__salt__", "[", "'azurearm_resource.resource_group_get'", "]"...
.. 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 group name assigned to the virtual network. CLI Example: .. code-block:: bash salt-call azurearm_network.virtual_network_create_or_update \ testnet ['10.0.0.0/16'] testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L915-L991
train
saltstack/salt
salt/modules/azurearm_network.py
virtual_network_delete
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:: bash salt-call azurearm_network.virtual_network_delete testnet testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: vnet = netconn.virtual_networks.delete( virtual_network_name=name, resource_group_name=resource_group ) vnet.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
python
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:: bash salt-call azurearm_network.virtual_network_delete testnet testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: vnet = netconn.virtual_networks.delete( virtual_network_name=name, resource_group_name=resource_group ) vnet.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
[ "def", "virtual_network_delete", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "False", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "vne...
.. 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 testnet testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L994-L1024
train
saltstack/salt
salt/modules/azurearm_network.py
virtual_network_get
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: .. code-block:: bash salt-call azurearm_network.virtual_network_get testnet testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: vnet = netconn.virtual_networks.get( virtual_network_name=name, resource_group_name=resource_group ) result = vnet.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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: .. code-block:: bash salt-call azurearm_network.virtual_network_get testnet testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: vnet = netconn.virtual_networks.get( virtual_network_name=name, resource_group_name=resource_group ) result = vnet.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "virtual_network_get", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "vnet", "=", "netconn", ".", ...
.. 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_network_get testnet testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1027-L1056
train
saltstack/salt
salt/modules/azurearm_network.py
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', **kwargs) try: load_balancers = __utils__['azurearm.paged_object_to_list'](netconn.load_balancers.list_all()) for load_balancer in load_balancers: result[load_balancer['name']] = load_balancer except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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', **kwargs) try: load_balancers = __utils__['azurearm.paged_object_to_list'](netconn.load_balancers.list_all()) for load_balancer in load_balancers: result[load_balancer['name']] = load_balancer except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "load_balancers_list_all", "(", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "load_balancers", "=", "__utils__", "[...
.. versionadded:: 2019.2.0 List all load balancers within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.load_balancers_list_all
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1059-L1083
train
saltstack/salt
salt/modules/azurearm_network.py
load_balancers_list
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_balancers_list testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: load_balancers = __utils__['azurearm.paged_object_to_list']( netconn.load_balancers.list( resource_group_name=resource_group ) ) for load_balancer in load_balancers: result[load_balancer['name']] = load_balancer except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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_balancers_list testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: load_balancers = __utils__['azurearm.paged_object_to_list']( netconn.load_balancers.list( resource_group_name=resource_group ) ) for load_balancer in load_balancers: result[load_balancer['name']] = load_balancer except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "load_balancers_list", "(", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "load_balancers", "...
.. 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
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1086-L1117
train
saltstack/salt
salt/modules/azurearm_network.py
load_balancer_get
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: .. code-block:: bash salt-call azurearm_network.load_balancer_get testlb testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: load_balancer = netconn.load_balancers.get( load_balancer_name=name, resource_group_name=resource_group ) result = load_balancer.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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: .. code-block:: bash salt-call azurearm_network.load_balancer_get testlb testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: load_balancer = netconn.load_balancers.get( load_balancer_name=name, resource_group_name=resource_group ) result = load_balancer.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "load_balancer_get", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "load_balancer", "=", "netconn", ...
.. 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_get testlb testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1120-L1149
train
saltstack/salt
salt/modules/azurearm_network.py
load_balancer_create_or_update
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 balancer. CLI Example: .. code-block:: bash salt-call azurearm_network.load_balancer_create_or_update testlb testgroup ''' if 'location' not in kwargs: rg_props = __salt__['azurearm_resource.resource_group_get']( resource_group, **kwargs ) if 'error' in rg_props: log.error( 'Unable to determine location from resource group specified.' ) return False kwargs['location'] = rg_props['location'] netconn = __utils__['azurearm.get_client']('network', **kwargs) if isinstance(kwargs.get('frontend_ip_configurations'), list): for idx in six_range(0, len(kwargs['frontend_ip_configurations'])): # Use Public IP Address name to link to the ID of an existing Public IP if 'public_ip_address' in kwargs['frontend_ip_configurations'][idx]: pub_ip = public_ip_address_get( name=kwargs['frontend_ip_configurations'][idx]['public_ip_address'], resource_group=resource_group, **kwargs ) if 'error' not in pub_ip: kwargs['frontend_ip_configurations'][idx]['public_ip_address'] = {'id': str(pub_ip['id'])} # Use Subnet name to link to the ID of an existing Subnet elif 'subnet' in kwargs['frontend_ip_configurations'][idx]: vnets = virtual_networks_list( resource_group=resource_group, **kwargs ) if 'error' not in vnets: for vnet in vnets: subnets = subnets_list( virtual_network=vnet, resource_group=resource_group, **kwargs ) if kwargs['frontend_ip_configurations'][idx]['subnet'] in subnets: kwargs['frontend_ip_configurations'][idx]['subnet'] = { 'id': str(subnets[kwargs['frontend_ip_configurations'][idx]['subnet']]['id']) } break id_url = '/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/loadBalancers/{2}/{3}/{4}' if isinstance(kwargs.get('load_balancing_rules'), list): for idx in six_range(0, len(kwargs['load_balancing_rules'])): # Link to sub-objects which might be created at the same time as the load balancer if 'frontend_ip_configuration' in kwargs['load_balancing_rules'][idx]: kwargs['load_balancing_rules'][idx]['frontend_ip_configuration'] = { 'id': id_url.format( kwargs.get('subscription_id'), resource_group, name, 'frontendIPConfigurations', kwargs['load_balancing_rules'][idx]['frontend_ip_configuration'] ) } if 'backend_address_pool' in kwargs['load_balancing_rules'][idx]: kwargs['load_balancing_rules'][idx]['backend_address_pool'] = { 'id': id_url.format( kwargs.get('subscription_id'), resource_group, name, 'backendAddressPools', kwargs['load_balancing_rules'][idx]['backend_address_pool'] ) } if 'probe' in kwargs['load_balancing_rules'][idx]: kwargs['load_balancing_rules'][idx]['probe'] = { 'id': id_url.format( kwargs.get('subscription_id'), resource_group, name, 'probes', kwargs['load_balancing_rules'][idx]['probe'] ) } if isinstance(kwargs.get('inbound_nat_rules'), list): for idx in six_range(0, len(kwargs['inbound_nat_rules'])): # Link to sub-objects which might be created at the same time as the load balancer if 'frontend_ip_configuration' in kwargs['inbound_nat_rules'][idx]: kwargs['inbound_nat_rules'][idx]['frontend_ip_configuration'] = { 'id': id_url.format( kwargs.get('subscription_id'), resource_group, name, 'frontendIPConfigurations', kwargs['inbound_nat_rules'][idx]['frontend_ip_configuration'] ) } if isinstance(kwargs.get('inbound_nat_pools'), list): for idx in six_range(0, len(kwargs['inbound_nat_pools'])): # Link to sub-objects which might be created at the same time as the load balancer if 'frontend_ip_configuration' in kwargs['inbound_nat_pools'][idx]: kwargs['inbound_nat_pools'][idx]['frontend_ip_configuration'] = { 'id': id_url.format( kwargs.get('subscription_id'), resource_group, name, 'frontendIPConfigurations', kwargs['inbound_nat_pools'][idx]['frontend_ip_configuration'] ) } if isinstance(kwargs.get('outbound_nat_rules'), list): for idx in six_range(0, len(kwargs['outbound_nat_rules'])): # Link to sub-objects which might be created at the same time as the load balancer if 'frontend_ip_configuration' in kwargs['outbound_nat_rules'][idx]: kwargs['outbound_nat_rules'][idx]['frontend_ip_configuration'] = { 'id': id_url.format( kwargs.get('subscription_id'), resource_group, name, 'frontendIPConfigurations', kwargs['outbound_nat_rules'][idx]['frontend_ip_configuration'] ) } if 'backend_address_pool' in kwargs['outbound_nat_rules'][idx]: kwargs['outbound_nat_rules'][idx]['backend_address_pool'] = { 'id': id_url.format( kwargs.get('subscription_id'), resource_group, name, 'backendAddressPools', kwargs['outbound_nat_rules'][idx]['backend_address_pool'] ) } try: lbmodel = __utils__['azurearm.create_object_model']('network', 'LoadBalancer', **kwargs) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: load_balancer = netconn.load_balancers.create_or_update( resource_group_name=resource_group, load_balancer_name=name, parameters=lbmodel ) load_balancer.wait() lb_result = load_balancer.result() result = lb_result.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
python
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 balancer. CLI Example: .. code-block:: bash salt-call azurearm_network.load_balancer_create_or_update testlb testgroup ''' if 'location' not in kwargs: rg_props = __salt__['azurearm_resource.resource_group_get']( resource_group, **kwargs ) if 'error' in rg_props: log.error( 'Unable to determine location from resource group specified.' ) return False kwargs['location'] = rg_props['location'] netconn = __utils__['azurearm.get_client']('network', **kwargs) if isinstance(kwargs.get('frontend_ip_configurations'), list): for idx in six_range(0, len(kwargs['frontend_ip_configurations'])): # Use Public IP Address name to link to the ID of an existing Public IP if 'public_ip_address' in kwargs['frontend_ip_configurations'][idx]: pub_ip = public_ip_address_get( name=kwargs['frontend_ip_configurations'][idx]['public_ip_address'], resource_group=resource_group, **kwargs ) if 'error' not in pub_ip: kwargs['frontend_ip_configurations'][idx]['public_ip_address'] = {'id': str(pub_ip['id'])} # Use Subnet name to link to the ID of an existing Subnet elif 'subnet' in kwargs['frontend_ip_configurations'][idx]: vnets = virtual_networks_list( resource_group=resource_group, **kwargs ) if 'error' not in vnets: for vnet in vnets: subnets = subnets_list( virtual_network=vnet, resource_group=resource_group, **kwargs ) if kwargs['frontend_ip_configurations'][idx]['subnet'] in subnets: kwargs['frontend_ip_configurations'][idx]['subnet'] = { 'id': str(subnets[kwargs['frontend_ip_configurations'][idx]['subnet']]['id']) } break id_url = '/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Network/loadBalancers/{2}/{3}/{4}' if isinstance(kwargs.get('load_balancing_rules'), list): for idx in six_range(0, len(kwargs['load_balancing_rules'])): # Link to sub-objects which might be created at the same time as the load balancer if 'frontend_ip_configuration' in kwargs['load_balancing_rules'][idx]: kwargs['load_balancing_rules'][idx]['frontend_ip_configuration'] = { 'id': id_url.format( kwargs.get('subscription_id'), resource_group, name, 'frontendIPConfigurations', kwargs['load_balancing_rules'][idx]['frontend_ip_configuration'] ) } if 'backend_address_pool' in kwargs['load_balancing_rules'][idx]: kwargs['load_balancing_rules'][idx]['backend_address_pool'] = { 'id': id_url.format( kwargs.get('subscription_id'), resource_group, name, 'backendAddressPools', kwargs['load_balancing_rules'][idx]['backend_address_pool'] ) } if 'probe' in kwargs['load_balancing_rules'][idx]: kwargs['load_balancing_rules'][idx]['probe'] = { 'id': id_url.format( kwargs.get('subscription_id'), resource_group, name, 'probes', kwargs['load_balancing_rules'][idx]['probe'] ) } if isinstance(kwargs.get('inbound_nat_rules'), list): for idx in six_range(0, len(kwargs['inbound_nat_rules'])): # Link to sub-objects which might be created at the same time as the load balancer if 'frontend_ip_configuration' in kwargs['inbound_nat_rules'][idx]: kwargs['inbound_nat_rules'][idx]['frontend_ip_configuration'] = { 'id': id_url.format( kwargs.get('subscription_id'), resource_group, name, 'frontendIPConfigurations', kwargs['inbound_nat_rules'][idx]['frontend_ip_configuration'] ) } if isinstance(kwargs.get('inbound_nat_pools'), list): for idx in six_range(0, len(kwargs['inbound_nat_pools'])): # Link to sub-objects which might be created at the same time as the load balancer if 'frontend_ip_configuration' in kwargs['inbound_nat_pools'][idx]: kwargs['inbound_nat_pools'][idx]['frontend_ip_configuration'] = { 'id': id_url.format( kwargs.get('subscription_id'), resource_group, name, 'frontendIPConfigurations', kwargs['inbound_nat_pools'][idx]['frontend_ip_configuration'] ) } if isinstance(kwargs.get('outbound_nat_rules'), list): for idx in six_range(0, len(kwargs['outbound_nat_rules'])): # Link to sub-objects which might be created at the same time as the load balancer if 'frontend_ip_configuration' in kwargs['outbound_nat_rules'][idx]: kwargs['outbound_nat_rules'][idx]['frontend_ip_configuration'] = { 'id': id_url.format( kwargs.get('subscription_id'), resource_group, name, 'frontendIPConfigurations', kwargs['outbound_nat_rules'][idx]['frontend_ip_configuration'] ) } if 'backend_address_pool' in kwargs['outbound_nat_rules'][idx]: kwargs['outbound_nat_rules'][idx]['backend_address_pool'] = { 'id': id_url.format( kwargs.get('subscription_id'), resource_group, name, 'backendAddressPools', kwargs['outbound_nat_rules'][idx]['backend_address_pool'] ) } try: lbmodel = __utils__['azurearm.create_object_model']('network', 'LoadBalancer', **kwargs) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: load_balancer = netconn.load_balancers.create_or_update( resource_group_name=resource_group, load_balancer_name=name, parameters=lbmodel ) load_balancer.wait() lb_result = load_balancer.result() result = lb_result.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
[ "def", "load_balancer_create_or_update", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "if", "'location'", "not", "in", "kwargs", ":", "rg_props", "=", "__salt__", "[", "'azurearm_resource.resource_group_get'", "]", "(", "resource_group", ...
.. 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 azurearm_network.load_balancer_create_or_update testlb testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1152-L1323
train
saltstack/salt
salt/modules/azurearm_network.py
load_balancer_delete
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 salt-call azurearm_network.load_balancer_delete testlb testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: load_balancer = netconn.load_balancers.delete( load_balancer_name=name, resource_group_name=resource_group ) load_balancer.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
python
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 salt-call azurearm_network.load_balancer_delete testlb testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: load_balancer = netconn.load_balancers.delete( load_balancer_name=name, resource_group_name=resource_group ) load_balancer.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
[ "def", "load_balancer_delete", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "False", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "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 testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1326-L1356
train
saltstack/salt
salt/modules/azurearm_network.py
usages_list
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 = __utils__['azurearm.get_client']('network', **kwargs) try: result = __utils__['azurearm.paged_object_to_list'](netconn.usages.list(location)) except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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 = __utils__['azurearm.get_client']('network', **kwargs) try: result = __utils__['azurearm.paged_object_to_list'](netconn.usages.list(location)) except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "usages_list", "(", "location", ",", "*", "*", "kwargs", ")", ":", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "result", "=", "__utils__", "[", "'azurearm.paged_object_to_...
.. 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
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1359-L1381
train
saltstack/salt
salt/modules/azurearm_network.py
network_interface_delete
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: .. code-block:: bash salt-call azurearm_network.network_interface_delete test-iface0 testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: nic = netconn.network_interfaces.delete( network_interface_name=name, resource_group_name=resource_group ) nic.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
python
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: .. code-block:: bash salt-call azurearm_network.network_interface_delete test-iface0 testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: nic = netconn.network_interfaces.delete( network_interface_name=name, resource_group_name=resource_group ) nic.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
[ "def", "network_interface_delete", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "False", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "n...
.. 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_delete test-iface0 testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1384-L1415
train
saltstack/salt
salt/modules/azurearm_network.py
network_interface_get
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 Example: .. code-block:: bash salt-call azurearm_network.network_interface_get test-iface0 testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: nic = netconn.network_interfaces.get( network_interface_name=name, resource_group_name=resource_group ) result = nic.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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 Example: .. code-block:: bash salt-call azurearm_network.network_interface_get test-iface0 testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: nic = netconn.network_interfaces.get( network_interface_name=name, resource_group_name=resource_group ) result = nic.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "network_interface_get", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "nic", "=", "netconn", ".", ...
.. 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.network_interface_get test-iface0 testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1418-L1447
train
saltstack/salt
salt/modules/azurearm_network.py
network_interface_create_or_update
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 interface to create. :param ip_configurations: A list of dictionaries representing valid NetworkInterfaceIPConfiguration objects. The 'name' key is required at minimum. At least one IP Configuration must be present. :param subnet: The name of the subnet assigned to the network interface. :param virtual_network: The name of the virtual network assigned to the subnet. :param resource_group: The resource group name assigned to the virtual network. CLI Example: .. code-block:: bash salt-call azurearm_network.network_interface_create_or_update test-iface0 [{'name': 'testipconfig1'}] \ testsubnet testnet testgroup ''' if 'location' not in kwargs: rg_props = __salt__['azurearm_resource.resource_group_get']( resource_group, **kwargs ) if 'error' in rg_props: log.error( 'Unable to determine location from resource group specified.' ) return False kwargs['location'] = rg_props['location'] netconn = __utils__['azurearm.get_client']('network', **kwargs) # Use NSG name to link to the ID of an existing NSG. if kwargs.get('network_security_group'): nsg = network_security_group_get( name=kwargs['network_security_group'], resource_group=resource_group, **kwargs ) if 'error' not in nsg: kwargs['network_security_group'] = {'id': str(nsg['id'])} # Use VM name to link to the ID of an existing VM. if kwargs.get('virtual_machine'): vm_instance = __salt__['azurearm_compute.virtual_machine_get']( name=kwargs['virtual_machine'], resource_group=resource_group, **kwargs ) if 'error' not in vm_instance: kwargs['virtual_machine'] = {'id': str(vm_instance['id'])} # Loop through IP Configurations and build each dictionary to pass to model creation. if isinstance(ip_configurations, list): subnet = subnet_get( name=subnet, virtual_network=virtual_network, resource_group=resource_group, **kwargs ) if 'error' not in subnet: subnet = {'id': str(subnet['id'])} for ipconfig in ip_configurations: if 'name' in ipconfig: ipconfig['subnet'] = subnet if isinstance(ipconfig.get('application_gateway_backend_address_pools'), list): # TODO: Add ID lookup for referenced object names pass if isinstance(ipconfig.get('load_balancer_backend_address_pools'), list): # TODO: Add ID lookup for referenced object names pass if isinstance(ipconfig.get('load_balancer_inbound_nat_rules'), list): # TODO: Add ID lookup for referenced object names pass if ipconfig.get('public_ip_address'): pub_ip = public_ip_address_get( name=ipconfig['public_ip_address'], resource_group=resource_group, **kwargs ) if 'error' not in pub_ip: ipconfig['public_ip_address'] = {'id': str(pub_ip['id'])} try: nicmodel = __utils__['azurearm.create_object_model']( 'network', 'NetworkInterface', ip_configurations=ip_configurations, **kwargs ) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: interface = netconn.network_interfaces.create_or_update( resource_group_name=resource_group, network_interface_name=name, parameters=nicmodel ) interface.wait() nic_result = interface.result() result = nic_result.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
python
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 interface to create. :param ip_configurations: A list of dictionaries representing valid NetworkInterfaceIPConfiguration objects. The 'name' key is required at minimum. At least one IP Configuration must be present. :param subnet: The name of the subnet assigned to the network interface. :param virtual_network: The name of the virtual network assigned to the subnet. :param resource_group: The resource group name assigned to the virtual network. CLI Example: .. code-block:: bash salt-call azurearm_network.network_interface_create_or_update test-iface0 [{'name': 'testipconfig1'}] \ testsubnet testnet testgroup ''' if 'location' not in kwargs: rg_props = __salt__['azurearm_resource.resource_group_get']( resource_group, **kwargs ) if 'error' in rg_props: log.error( 'Unable to determine location from resource group specified.' ) return False kwargs['location'] = rg_props['location'] netconn = __utils__['azurearm.get_client']('network', **kwargs) # Use NSG name to link to the ID of an existing NSG. if kwargs.get('network_security_group'): nsg = network_security_group_get( name=kwargs['network_security_group'], resource_group=resource_group, **kwargs ) if 'error' not in nsg: kwargs['network_security_group'] = {'id': str(nsg['id'])} # Use VM name to link to the ID of an existing VM. if kwargs.get('virtual_machine'): vm_instance = __salt__['azurearm_compute.virtual_machine_get']( name=kwargs['virtual_machine'], resource_group=resource_group, **kwargs ) if 'error' not in vm_instance: kwargs['virtual_machine'] = {'id': str(vm_instance['id'])} # Loop through IP Configurations and build each dictionary to pass to model creation. if isinstance(ip_configurations, list): subnet = subnet_get( name=subnet, virtual_network=virtual_network, resource_group=resource_group, **kwargs ) if 'error' not in subnet: subnet = {'id': str(subnet['id'])} for ipconfig in ip_configurations: if 'name' in ipconfig: ipconfig['subnet'] = subnet if isinstance(ipconfig.get('application_gateway_backend_address_pools'), list): # TODO: Add ID lookup for referenced object names pass if isinstance(ipconfig.get('load_balancer_backend_address_pools'), list): # TODO: Add ID lookup for referenced object names pass if isinstance(ipconfig.get('load_balancer_inbound_nat_rules'), list): # TODO: Add ID lookup for referenced object names pass if ipconfig.get('public_ip_address'): pub_ip = public_ip_address_get( name=ipconfig['public_ip_address'], resource_group=resource_group, **kwargs ) if 'error' not in pub_ip: ipconfig['public_ip_address'] = {'id': str(pub_ip['id'])} try: nicmodel = __utils__['azurearm.create_object_model']( 'network', 'NetworkInterface', ip_configurations=ip_configurations, **kwargs ) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: interface = netconn.network_interfaces.create_or_update( resource_group_name=resource_group, network_interface_name=name, parameters=nicmodel ) interface.wait() nic_result = interface.result() result = nic_result.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
[ "def", "network_interface_create_or_update", "(", "name", ",", "ip_configurations", ",", "subnet", ",", "virtual_network", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "if", "'location'", "not", "in", "kwargs", ":", "rg_props", "=", "__salt__", "[",...
.. 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 minimum. At least one IP Configuration must be present. :param subnet: The name of the subnet assigned to the network interface. :param virtual_network: The name of the virtual network assigned to the subnet. :param resource_group: The resource group name assigned to the virtual network. CLI Example: .. code-block:: bash salt-call azurearm_network.network_interface_create_or_update test-iface0 [{'name': 'testipconfig1'}] \ testsubnet testnet testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1451-L1570
train
saltstack/salt
salt/modules/azurearm_network.py
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']('network', **kwargs) try: nics = __utils__['azurearm.paged_object_to_list'](netconn.network_interfaces.list_all()) for nic in nics: result[nic['name']] = nic except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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']('network', **kwargs) try: nics = __utils__['azurearm.paged_object_to_list'](netconn.network_interfaces.list_all()) for nic in nics: result[nic['name']] = nic except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "network_interfaces_list_all", "(", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "nics", "=", "__utils__", "[", "...
.. versionadded:: 2019.2.0 List all network interfaces within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.network_interfaces_list_all
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1573-L1597
train
saltstack/salt
salt/modules/azurearm_network.py
network_interfaces_list
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_network.network_interfaces_list testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: nics = __utils__['azurearm.paged_object_to_list']( netconn.network_interfaces.list( resource_group_name=resource_group ) ) for nic in nics: result[nic['name']] = nic except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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_network.network_interfaces_list testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: nics = __utils__['azurearm.paged_object_to_list']( netconn.network_interfaces.list( resource_group_name=resource_group ) ) for nic in nics: result[nic['name']] = nic except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "network_interfaces_list", "(", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "nics", "=", ...
.. 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
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1600-L1631
train
saltstack/salt
salt/modules/azurearm_network.py
network_interface_get_effective_route_table
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 network interface. CLI Example: .. code-block:: bash salt-call azurearm_network.network_interface_get_effective_route_table test-iface0 testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: nic = netconn.network_interfaces.get_effective_route_table( network_interface_name=name, resource_group_name=resource_group ) nic.wait() tables = nic.result() tables = tables.as_dict() result = tables['value'] except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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 network interface. CLI Example: .. code-block:: bash salt-call azurearm_network.network_interface_get_effective_route_table test-iface0 testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: nic = netconn.network_interfaces.get_effective_route_table( network_interface_name=name, resource_group_name=resource_group ) nic.wait() tables = nic.result() tables = tables.as_dict() result = tables['value'] except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "network_interface_get_effective_route_table", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "nic", "=",...
.. 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_network.network_interface_get_effective_route_table test-iface0 testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1635-L1667
train
saltstack/salt
salt/modules/azurearm_network.py
network_interface_list_effective_network_security_groups
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 name assigned to the network interface. CLI Example: .. code-block:: bash salt-call azurearm_network.network_interface_list_effective_network_security_groups test-iface0 testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: nic = netconn.network_interfaces.list_effective_network_security_groups( network_interface_name=name, resource_group_name=resource_group ) nic.wait() groups = nic.result() groups = groups.as_dict() result = groups['value'] except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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 name assigned to the network interface. CLI Example: .. code-block:: bash salt-call azurearm_network.network_interface_list_effective_network_security_groups test-iface0 testgroup ''' netconn = __utils__['azurearm.get_client']('network', **kwargs) try: nic = netconn.network_interfaces.list_effective_network_security_groups( network_interface_name=name, resource_group_name=resource_group ) nic.wait() groups = nic.result() groups = groups.as_dict() result = groups['value'] except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "network_interface_list_effective_network_security_groups", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", ...
.. 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-call azurearm_network.network_interface_list_effective_network_security_groups test-iface0 testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1671-L1703
train
saltstack/salt
salt/modules/azurearm_network.py
list_virtual_machine_scale_set_vm_network_interfaces
def list_virtual_machine_scale_set_vm_network_interfaces(scale_set, vm_index, resource_group, **kwargs): ''' .. 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. CLI Example: .. code-block:: bash salt-call azurearm_network.list_virtual_machine_scale_set_vm_network_interfaces testset testvm testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: nics = __utils__['azurearm.paged_object_to_list']( netconn.network_interfaces.list_virtual_machine_scale_set_vm_network_interfaces( virtual_machine_scale_set_name=scale_set, virtualmachine_index=vm_index, resource_group_name=resource_group ) ) for nic in nics: result[nic['name']] = nic except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
def list_virtual_machine_scale_set_vm_network_interfaces(scale_set, vm_index, resource_group, **kwargs): ''' .. 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. CLI Example: .. code-block:: bash salt-call azurearm_network.list_virtual_machine_scale_set_vm_network_interfaces testset testvm testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: nics = __utils__['azurearm.paged_object_to_list']( netconn.network_interfaces.list_virtual_machine_scale_set_vm_network_interfaces( virtual_machine_scale_set_name=scale_set, virtualmachine_index=vm_index, resource_group_name=resource_group ) ) for nic in nics: result[nic['name']] = nic except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "list_virtual_machine_scale_set_vm_network_interfaces", "(", "scale_set", ",", "vm_index", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", "...
.. 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. CLI Example: .. code-block:: bash salt-call azurearm_network.list_virtual_machine_scale_set_vm_network_interfaces testset testvm testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1707-L1747
train
saltstack/salt
salt/modules/azurearm_network.py
list_virtual_machine_scale_set_network_interfaces
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 to the scale set. CLI Example: .. code-block:: bash salt-call azurearm_network.list_virtual_machine_scale_set_vm_network_interfaces testset testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: nics = __utils__['azurearm.paged_object_to_list']( netconn.network_interfaces.list_virtual_machine_scale_set_network_interfaces( virtual_machine_scale_set_name=scale_set, resource_group_name=resource_group ) ) for nic in nics: result[nic['name']] = nic except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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 to the scale set. CLI Example: .. code-block:: bash salt-call azurearm_network.list_virtual_machine_scale_set_vm_network_interfaces testset testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: nics = __utils__['azurearm.paged_object_to_list']( netconn.network_interfaces.list_virtual_machine_scale_set_network_interfaces( virtual_machine_scale_set_name=scale_set, resource_group_name=resource_group ) ) for nic in nics: result[nic['name']] = nic except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "list_virtual_machine_scale_set_network_interfaces", "(", "scale_set", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwa...
.. 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_network.list_virtual_machine_scale_set_vm_network_interfaces testset testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1751-L1785
train
saltstack/salt
salt/modules/azurearm_network.py
get_virtual_machine_scale_set_network_interface
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 scale set containing the interface. :param vm_index: The virtual machine index. :param resource_group: The resource group name assigned to the scale set. CLI Example: .. code-block:: bash salt-call azurearm_network.get_virtual_machine_scale_set_network_interface test-iface0 testset testvm testgroup ''' expand = kwargs.get('expand') netconn = __utils__['azurearm.get_client']('network', **kwargs) try: nic = netconn.network_interfaces.list_virtual_machine_scale_set_vm_network_interfaces( network_interface_name=name, virtual_machine_scale_set_name=scale_set, virtualmachine_index=vm_index, resource_group_name=resource_group, exapnd=expand ) result = nic.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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 scale set containing the interface. :param vm_index: The virtual machine index. :param resource_group: The resource group name assigned to the scale set. CLI Example: .. code-block:: bash salt-call azurearm_network.get_virtual_machine_scale_set_network_interface test-iface0 testset testvm testgroup ''' expand = kwargs.get('expand') netconn = __utils__['azurearm.get_client']('network', **kwargs) try: nic = netconn.network_interfaces.list_virtual_machine_scale_set_vm_network_interfaces( network_interface_name=name, virtual_machine_scale_set_name=scale_set, virtualmachine_index=vm_index, resource_group_name=resource_group, exapnd=expand ) result = nic.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "get_virtual_machine_scale_set_network_interface", "(", "name", ",", "scale_set", ",", "vm_index", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "expand", "=", "kwargs", ".", "get", "(", "'expand'", ")", "netconn", "=", "__utils__", "[", "'a...
.. 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 resource group name assigned to the scale set. CLI Example: .. code-block:: bash salt-call azurearm_network.get_virtual_machine_scale_set_network_interface test-iface0 testset testvm testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1789-L1828
train
saltstack/salt
salt/modules/azurearm_network.py
public_ip_address_delete
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: .. code-block:: bash salt-call azurearm_network.public_ip_address_delete test-pub-ip testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: pub_ip = netconn.public_ip_addresses.delete( public_ip_address_name=name, resource_group_name=resource_group ) pub_ip.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
python
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: .. code-block:: bash salt-call azurearm_network.public_ip_address_delete test-pub-ip testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: pub_ip = netconn.public_ip_addresses.delete( public_ip_address_name=name, resource_group_name=resource_group ) pub_ip.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
[ "def", "public_ip_address_delete", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "False", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "p...
.. 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_delete test-pub-ip testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1831-L1861
train
saltstack/salt
salt/modules/azurearm_network.py
public_ip_address_get
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 Example: .. code-block:: bash salt-call azurearm_network.public_ip_address_get test-pub-ip testgroup ''' expand = kwargs.get('expand') netconn = __utils__['azurearm.get_client']('network', **kwargs) try: pub_ip = netconn.public_ip_addresses.get( public_ip_address_name=name, resource_group_name=resource_group, expand=expand ) result = pub_ip.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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 Example: .. code-block:: bash salt-call azurearm_network.public_ip_address_get test-pub-ip testgroup ''' expand = kwargs.get('expand') netconn = __utils__['azurearm.get_client']('network', **kwargs) try: pub_ip = netconn.public_ip_addresses.get( public_ip_address_name=name, resource_group_name=resource_group, expand=expand ) result = pub_ip.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "public_ip_address_get", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "expand", "=", "kwargs", ".", "get", "(", "'expand'", ")", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*...
.. 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.public_ip_address_get test-pub-ip testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1864-L1897
train
saltstack/salt
salt/modules/azurearm_network.py
public_ip_address_create_or_update
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 public IP address. CLI Example: .. code-block:: bash salt-call azurearm_network.public_ip_address_create_or_update test-ip-0 testgroup ''' if 'location' not in kwargs: rg_props = __salt__['azurearm_resource.resource_group_get']( resource_group, **kwargs ) if 'error' in rg_props: log.error( 'Unable to determine location from resource group specified.' ) return False kwargs['location'] = rg_props['location'] netconn = __utils__['azurearm.get_client']('network', **kwargs) try: pub_ip_model = __utils__['azurearm.create_object_model']('network', 'PublicIPAddress', **kwargs) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: ip = netconn.public_ip_addresses.create_or_update( resource_group_name=resource_group, public_ip_address_name=name, parameters=pub_ip_model ) ip.wait() ip_result = ip.result() result = ip_result.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
python
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 public IP address. CLI Example: .. code-block:: bash salt-call azurearm_network.public_ip_address_create_or_update test-ip-0 testgroup ''' if 'location' not in kwargs: rg_props = __salt__['azurearm_resource.resource_group_get']( resource_group, **kwargs ) if 'error' in rg_props: log.error( 'Unable to determine location from resource group specified.' ) return False kwargs['location'] = rg_props['location'] netconn = __utils__['azurearm.get_client']('network', **kwargs) try: pub_ip_model = __utils__['azurearm.create_object_model']('network', 'PublicIPAddress', **kwargs) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: ip = netconn.public_ip_addresses.create_or_update( resource_group_name=resource_group, public_ip_address_name=name, parameters=pub_ip_model ) ip.wait() ip_result = ip.result() result = ip_result.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
[ "def", "public_ip_address_create_or_update", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "if", "'location'", "not", "in", "kwargs", ":", "rg_props", "=", "__salt__", "[", "'azurearm_resource.resource_group_get'", "]", "(", "resource_group"...
.. 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-call azurearm_network.public_ip_address_create_or_update test-ip-0 testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1900-L1953
train
saltstack/salt
salt/modules/azurearm_network.py
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']('network', **kwargs) try: pub_ips = __utils__['azurearm.paged_object_to_list'](netconn.public_ip_addresses.list_all()) for ip in pub_ips: result[ip['name']] = ip except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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']('network', **kwargs) try: pub_ips = __utils__['azurearm.paged_object_to_list'](netconn.public_ip_addresses.list_all()) for ip in pub_ips: result[ip['name']] = ip except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "public_ip_addresses_list_all", "(", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "pub_ips", "=", "__utils__", "[",...
.. 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
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1956-L1980
train
saltstack/salt
salt/modules/azurearm_network.py
public_ip_addresses_list
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 azurearm_network.public_ip_addresses_list testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: pub_ips = __utils__['azurearm.paged_object_to_list']( netconn.public_ip_addresses.list( resource_group_name=resource_group ) ) for ip in pub_ips: result[ip['name']] = ip except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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 azurearm_network.public_ip_addresses_list testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: pub_ips = __utils__['azurearm.paged_object_to_list']( netconn.public_ip_addresses.list( resource_group_name=resource_group ) ) for ip in pub_ips: result[ip['name']] = ip except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "public_ip_addresses_list", "(", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "pub_ips", "="...
.. 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
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L1983-L2014
train
saltstack/salt
salt/modules/azurearm_network.py
route_filter_rule_delete
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 assigned to the route filter. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filter_rule_delete test-rule test-filter testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: rule = netconn.route_filter_rules.delete( resource_group_name=resource_group, route_filter_name=route_filter, rule_name=name ) rule.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
python
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 assigned to the route filter. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filter_rule_delete test-rule test-filter testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: rule = netconn.route_filter_rules.delete( resource_group_name=resource_group, route_filter_name=route_filter, rule_name=name ) rule.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
[ "def", "route_filter_rule_delete", "(", "name", ",", "route_filter", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "False", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "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 assigned to the route filter. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filter_rule_delete test-rule test-filter testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2017-L2050
train
saltstack/salt
salt/modules/azurearm_network.py
route_filter_rule_get
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 group name assigned to the route filter. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filter_rule_get test-rule test-filter testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: rule = netconn.route_filter_rules.get( resource_group_name=resource_group, route_filter_name=route_filter, rule_name=name ) result = rule.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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 group name assigned to the route filter. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filter_rule_get test-rule test-filter testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: rule = netconn.route_filter_rules.get( resource_group_name=resource_group, route_filter_name=route_filter, rule_name=name ) result = rule.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "route_filter_rule_get", "(", "name", ",", "route_filter", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "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 group name assigned to the route filter. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filter_rule_get test-rule test-filter testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2053-L2087
train
saltstack/salt
salt/modules/azurearm_network.py
route_filter_rule_create_or_update
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 are 'Allow' and 'Deny'. :param communities: A list of BGP communities to filter on. :param route_filter: The name of the route filter containing the rule. :param resource_group: The resource group name assigned to the route filter. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filter_rule_create_or_update \ test-rule allow "['12076:51006']" test-filter testgroup ''' if not isinstance(communities, list): log.error( 'The communities parameter must be a list of strings!' ) return False if 'location' not in kwargs: rg_props = __salt__['azurearm_resource.resource_group_get']( resource_group, **kwargs ) if 'error' in rg_props: log.error( 'Unable to determine location from resource group specified.' ) return False kwargs['location'] = rg_props['location'] netconn = __utils__['azurearm.get_client']('network', **kwargs) try: rule_model = __utils__['azurearm.create_object_model']( 'network', 'RouteFilterRule', access=access, communities=communities, **kwargs ) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: rule = netconn.route_filter_rules.create_or_update( resource_group_name=resource_group, route_filter_name=route_filter, rule_name=name, route_filter_rule_parameters=rule_model ) rule.wait() rule_result = rule.result() result = rule_result.as_dict() except CloudError as exc: message = str(exc) if kwargs.get('subscription_id') == str(message).strip(): message = 'Subscription not authorized for this operation!' __utils__['azurearm.log_cloud_error']('network', message, **kwargs) result = {'error': message} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
python
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 are 'Allow' and 'Deny'. :param communities: A list of BGP communities to filter on. :param route_filter: The name of the route filter containing the rule. :param resource_group: The resource group name assigned to the route filter. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filter_rule_create_or_update \ test-rule allow "['12076:51006']" test-filter testgroup ''' if not isinstance(communities, list): log.error( 'The communities parameter must be a list of strings!' ) return False if 'location' not in kwargs: rg_props = __salt__['azurearm_resource.resource_group_get']( resource_group, **kwargs ) if 'error' in rg_props: log.error( 'Unable to determine location from resource group specified.' ) return False kwargs['location'] = rg_props['location'] netconn = __utils__['azurearm.get_client']('network', **kwargs) try: rule_model = __utils__['azurearm.create_object_model']( 'network', 'RouteFilterRule', access=access, communities=communities, **kwargs ) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: rule = netconn.route_filter_rules.create_or_update( resource_group_name=resource_group, route_filter_name=route_filter, rule_name=name, route_filter_rule_parameters=rule_model ) rule.wait() rule_result = rule.result() result = rule_result.as_dict() except CloudError as exc: message = str(exc) if kwargs.get('subscription_id') == str(message).strip(): message = 'Subscription not authorized for this operation!' __utils__['azurearm.log_cloud_error']('network', message, **kwargs) result = {'error': message} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
[ "def", "route_filter_rule_create_or_update", "(", "name", ",", "access", ",", "communities", ",", "route_filter", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "if", "not", "isinstance", "(", "communities", ",", "list", ")", ":", "log", ".", "err...
.. 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 name of the route filter containing the rule. :param resource_group: The resource group name assigned to the route filter. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filter_rule_create_or_update \ test-rule allow "['12076:51006']" test-filter testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2090-L2166
train
saltstack/salt
salt/modules/azurearm_network.py
route_filter_rules_list
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: .. code-block:: bash salt-call azurearm_network.route_filter_rules_list test-filter testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: rules = __utils__['azurearm.paged_object_to_list']( netconn.route_filter_rules.list_by_route_filter( resource_group_name=resource_group, route_filter_name=route_filter ) ) for rule in rules: result[rule['name']] = rule except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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: .. code-block:: bash salt-call azurearm_network.route_filter_rules_list test-filter testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: rules = __utils__['azurearm.paged_object_to_list']( netconn.route_filter_rules.list_by_route_filter( resource_group_name=resource_group, route_filter_name=route_filter ) ) for rule in rules: result[rule['name']] = rule except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "route_filter_rules_list", "(", "route_filter", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ...
.. 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 test-filter testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2169-L2203
train
saltstack/salt
salt/modules/azurearm_network.py
route_filter_delete
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 salt-call azurearm_network.route_filter_delete test-filter testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: route_filter = netconn.route_filters.delete( route_filter_name=name, resource_group_name=resource_group ) route_filter.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
python
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 salt-call azurearm_network.route_filter_delete test-filter testgroup ''' result = False netconn = __utils__['azurearm.get_client']('network', **kwargs) try: route_filter = netconn.route_filters.delete( route_filter_name=name, resource_group_name=resource_group ) route_filter.wait() result = True except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) return result
[ "def", "route_filter_delete", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "False", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "route_...
.. 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 testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2206-L2236
train
saltstack/salt
salt/modules/azurearm_network.py
route_filter_get
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-block:: bash salt-call azurearm_network.route_filter_get test-filter testgroup ''' expand = kwargs.get('expand') netconn = __utils__['azurearm.get_client']('network', **kwargs) try: route_filter = netconn.route_filters.get( route_filter_name=name, resource_group_name=resource_group, expand=expand ) result = route_filter.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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-block:: bash salt-call azurearm_network.route_filter_get test-filter testgroup ''' expand = kwargs.get('expand') netconn = __utils__['azurearm.get_client']('network', **kwargs) try: route_filter = netconn.route_filters.get( route_filter_name=name, resource_group_name=resource_group, expand=expand ) result = route_filter.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "route_filter_get", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "expand", "=", "kwargs", ".", "get", "(", "'expand'", ")", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", ...
.. 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 test-filter testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2239-L2272
train
saltstack/salt
salt/modules/azurearm_network.py
route_filter_create_or_update
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 filter. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filter_create_or_update test-filter testgroup ''' if 'location' not in kwargs: rg_props = __salt__['azurearm_resource.resource_group_get']( resource_group, **kwargs ) if 'error' in rg_props: log.error( 'Unable to determine location from resource group specified.' ) return False kwargs['location'] = rg_props['location'] netconn = __utils__['azurearm.get_client']('network', **kwargs) try: rt_filter_model = __utils__['azurearm.create_object_model']('network', 'RouteFilter', **kwargs) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: rt_filter = netconn.route_filters.create_or_update( resource_group_name=resource_group, route_filter_name=name, route_filter_parameters=rt_filter_model ) rt_filter.wait() rt_result = rt_filter.result() result = rt_result.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
python
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 filter. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filter_create_or_update test-filter testgroup ''' if 'location' not in kwargs: rg_props = __salt__['azurearm_resource.resource_group_get']( resource_group, **kwargs ) if 'error' in rg_props: log.error( 'Unable to determine location from resource group specified.' ) return False kwargs['location'] = rg_props['location'] netconn = __utils__['azurearm.get_client']('network', **kwargs) try: rt_filter_model = __utils__['azurearm.create_object_model']('network', 'RouteFilter', **kwargs) except TypeError as exc: result = {'error': 'The object model could not be built. ({0})'.format(str(exc))} return result try: rt_filter = netconn.route_filters.create_or_update( resource_group_name=resource_group, route_filter_name=name, route_filter_parameters=rt_filter_model ) rt_filter.wait() rt_result = rt_filter.result() result = rt_result.as_dict() except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} except SerializationError as exc: result = {'error': 'The object model could not be parsed. ({0})'.format(str(exc))} return result
[ "def", "route_filter_create_or_update", "(", "name", ",", "resource_group", ",", "*", "*", "kwargs", ")", ":", "if", "'location'", "not", "in", "kwargs", ":", "rg_props", "=", "__salt__", "[", "'azurearm_resource.resource_group_get'", "]", "(", "resource_group", "...
.. 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_network.route_filter_create_or_update test-filter testgroup
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2275-L2328
train
saltstack/salt
salt/modules/azurearm_network.py
route_filters_list
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_filters_list testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: filters = __utils__['azurearm.paged_object_to_list']( netconn.route_filters.list_by_resource_group( resource_group_name=resource_group ) ) for route_filter in filters: result[route_filter['name']] = route_filter except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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_filters_list testgroup ''' result = {} netconn = __utils__['azurearm.get_client']('network', **kwargs) try: filters = __utils__['azurearm.paged_object_to_list']( netconn.route_filters.list_by_resource_group( resource_group_name=resource_group ) ) for route_filter in filters: result[route_filter['name']] = route_filter except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "route_filters_list", "(", "resource_group", ",", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "filters", "=", "_...
.. 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
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2331-L2362
train
saltstack/salt
salt/modules/azurearm_network.py
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', **kwargs) try: filters = __utils__['azurearm.paged_object_to_list'](netconn.route_filters.list()) for route_filter in filters: result[route_filter['name']] = route_filter except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
python
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', **kwargs) try: filters = __utils__['azurearm.paged_object_to_list'](netconn.route_filters.list()) for route_filter in filters: result[route_filter['name']] = route_filter except CloudError as exc: __utils__['azurearm.log_cloud_error']('network', str(exc), **kwargs) result = {'error': str(exc)} return result
[ "def", "route_filters_list_all", "(", "*", "*", "kwargs", ")", ":", "result", "=", "{", "}", "netconn", "=", "__utils__", "[", "'azurearm.get_client'", "]", "(", "'network'", ",", "*", "*", "kwargs", ")", "try", ":", "filters", "=", "__utils__", "[", "'a...
.. versionadded:: 2019.2.0 List all route filters within a subscription. CLI Example: .. code-block:: bash salt-call azurearm_network.route_filters_list_all
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/azurearm_network.py#L2365-L2389
train