saltext.vmware.modules.vmc_security_rules#

Salt execution module for VMC Security Rules Provides methods to Create, Read, Update and Delete security rules.

saltext.vmware.modules.vmc_security_rules.get(hostname, refresh_key, authorization_host, org_id, sddc_id, domain_id, verify_ssl=True, cert=None, sort_by=None, sort_ascending=None, page_size=None, cursor=None)[source]#

Retrieves security rules for Given SDDC

CLI Example:

salt vm_minion vmc_security_rules.get hostname=nsxt-manager.local domain_id=mgw ...
hostname

The host name of NSX-T manager

refresh_key

API Token of the user which is used to get the Access Token required for VMC operations

authorization_host

Hostname of the VMC cloud console

org_id

The Id of organization to which the SDDC belongs to

sddc_id

The Id of SDDC for which the security rules should be retrieved

domain_id

The domain_id for which the security rules should be retrieved. Possible values: mgw, cgw

verify_ssl

(Optional) Option to enable/disable SSL verification. Enabled by default. If set to False, the certificate validation is skipped.

cert

(Optional) Path to the SSL client certificate file to connect to VMC Cloud Console. The certificate can be retrieved from browser.

sort_by

(Optional) Field by which records are sorted

sort_ascending

(Optional) Boolean value to sort result in ascending order

page_size

(Optional) Maximum number of results to return in this page

cursor

(Optional) Opaque cursor to be used for getting next page of records (supplied by current result page)

saltext.vmware.modules.vmc_security_rules.get_by_id(hostname, refresh_key, authorization_host, org_id, sddc_id, domain_id, rule_id, verify_ssl=True, cert=None)[source]#

Retrieves given security rule from the given SDDC

CLI Example:

salt vm_minion vmc_security_rules.get_by_id hostname=nsxt-manager.local domain_id=mgw ...
hostname

The host name of NSX-T manager

refresh_key

API Token of the user which is used to get the Access Token required for VMC operations

authorization_host

Hostname of the VMC cloud console

org_id

The Id of organization to which the SDDC belongs to

sddc_id

The Id of SDDC for which the security rule should be retrieved

domain_id

The domain_id for which the security rule should be retrieved. Possible values: mgw, cgw

rule_id

Id of the security_rule to be retrieved from SDDC

verify_ssl

(Optional) Option to enable/disable SSL verification. Enabled by default. If set to False, the certificate validation is skipped.

cert

(Optional) Path to the SSL client certificate file to connect to VMC Cloud Console. The certificate can be retrieved from browser.

saltext.vmware.modules.vmc_security_rules.delete(hostname, refresh_key, authorization_host, org_id, sddc_id, domain_id, rule_id, verify_ssl=True, cert=None)[source]#

Deletes given security rule from the given SDDC

CLI Example:

salt vm_minion vmc_security_rules.delete hostname=nsxt-manager.local domain_id=mgw ...
hostname

The host name of NSX-T manager

refresh_key

API Token of the user which is used to get the Access Token required for VMC operations

authorization_host

Hostname of the VMC cloud console

org_id

The Id of organization to which the SDDC belongs to

sddc_id

The Id of SDDC from which the security rule should be deleted

domain_id

The domain_id for which the security rule should be deleted. Possible values: mgw, cgw

rule_id

Id of the security_rule to be deleted from SDDC

verify_ssl

(Optional) Option to enable/disable SSL verification. Enabled by default. If set to False, the certificate validation is skipped.

cert

(Optional) Path to the SSL client certificate file to connect to VMC Cloud Console. The certificate can be retrieved from browser.

saltext.vmware.modules.vmc_security_rules.create(hostname, refresh_key, authorization_host, org_id, sddc_id, domain_id, rule_id, verify_ssl=True, cert=None, source_groups=None, destination_groups=None, services=None, scope=None, action=None, tag=None, logged=None, disabled=None, notes=None, sequence_number=None, tags='USER_DEFINED_NONE')[source]#

Creates security rule for the given SDDC

CLI Example:

salt vm_minion vmc_security_rules.create hostname=nsxt-manager.local domain_id=mgw ...
hostname

The host name of NSX-T manager

refresh_key

API Token of the user which is used to get the Access Token required for VMC operations

authorization_host

Hostname of the VMC cloud console

org_id

The Id of organization to which the SDDC belongs to

sddc_id

The Id of SDDC for which the security rule should be added

domain_id

The domain_id for which the security rule should be added. Possible values: mgw, cgw

rule_id

Id of the security_rule to be added to given SDDC

verify_ssl

(Optional) Option to enable/disable SSL verification. Enabled by default. If set to False, the certificate validation is skipped.

cert

(Optional) Path to the SSL client certificate file to connect to VMC Cloud Console. The certificate can be retrieved from browser.

source_groups

(Optional) List of Source group paths. We need paths as duplicate names may exist for groups under different domains. Along with paths we support IP Address of type IPv4 and IPv6. IP Address can be in one of the format(CIDR, IP Address, Range of IP Address). In order to specify all groups, use the constant “ANY”. This is case insensitive. If “ANY” is used, it should be the ONLY element in the group array. Error will be thrown if ANY is used in conjunction with other values. If this value is not passed, then [“ANY”] will be used by default.

destination_groups

(Optional) List of Destination group paths. We need paths as duplicate names may exist for groups under different domains. Along with paths we support IP Address of type IPv4 and IPv6. IP Address can be in one of the format(CIDR, IP Address, Range of IP Address). In order to specify all groups, use the constant “ANY”. This is case insensitive. If “ANY” is used, it should be the ONLY element in the group array. Error will be thrown if ANY is used in conjunction with other values. If this value is not passed, then [“ANY”] will be used by default.

Note: Both source_groups and destination_groups can not be [“ANY”] when domain_id=mgw

services

(Optional) Names of services. In order to specify all services, use the constant “ANY”. This is case insensitive. If “ANY” is used, it should be the ONLY element in the services array. Error will be thrown if ANY is used in conjunction with other values. If this value is not passed, then [“ANY”] will be used by default.

scope

(Optional) The list of policy paths where the rule is applied LR/Edge/T0/T1/LRP etc. Note that a given rule can be applied on multiple LRs/LRPs.

action

(Optional) The action to be applied to all the services. Possible Values for domain_id=cgw are: ALLOW, DROP, REJECT Possible Values for domain_id=mgw are: ALLOW

tag

(Optional) Tag applied on the rule. User level field which will be printed in CLI and packet logs.

logged

(Optional) Enable logging flag. Flag to enable packet logging. Default is disabled.

disabled

(Optional) Flag to disable the rule. Default is enabled.

notes

(Optional) Text for additional notes on changes.

sequence_number

(Optional) Sequence number of the Rule. This field is used to resolve conflicts between multiple Rules under Security or Gateway Policy for a Domain. If no sequence number is specified by the user, a value of 0 is assigned by default. If there are multiple rules with the same sequence number then their order is not deterministic. If a specific order of rules is desired, then one has to specify unique sequence numbers.

tags

(Optional) Opaque identifiers meaningful to the user.

tags='[
    {
        "tag": "<tag-key-1>"
        "scope": "<tag-value-1>"
    },
    {
        "tag": "<tag-key-2>"
        "scope": "<tag-value-2>"
    }
]'

Example values:

{
    "sequence_number": 0,
    "source_groups": [
        "ANY"
    ],
    "services": ["/infra/services/HTTPS"],
    "logged": false,
    "disabled": false,
    "destination_groups": [
        "/infra/domains/mgw/groups/VCENTER"
    ],
    "scope": [
        "/infra/tier-1s/mgw"
    ],
    "action": "ALLOW",
    "tag": "",
    "notes": "",
    "tags": [
        {
            "tag": "tag1",
            "scope": "scope1"
        }
    ]
}
saltext.vmware.modules.vmc_security_rules.update(hostname, refresh_key, authorization_host, org_id, sddc_id, domain_id, rule_id, verify_ssl=True, cert=None, source_groups=None, destination_groups=None, services=None, scope=None, action=None, tag=None, logged=None, disabled=None, notes=None, sequence_number=None, tags='USER_DEFINED_NONE', display_name=None)[source]#

Updates security rule for the given SDDC

CLI Example:

salt vm_minion vmc_security_rules.update hostname=nsxt-manager.local domain_id=mgw ...
hostname

The host name of NSX-T manager

refresh_key

API Token of the user which is used to get the Access Token required for VMC operations

authorization_host

Hostname of the VMC cloud console

org_id

The Id of organization to which the SDDC belongs to

sddc_id

The Id of SDDC for which the security rule belongs to

domain_id

The domain_id for which the security rule belongs to. Possible values: mgw, cgw

rule_id

Id of the security_rule to be updated for given SDDC

verify_ssl

(Optional) Option to enable/disable SSL verification. Enabled by default. If set to False, the certificate validation is skipped.

cert

(Optional) Path to the SSL client certificate file to connect to VMC Cloud Console. The certificate can be retrieved from browser.

source_groups

(Optional) List of Source group paths. We need paths as duplicate names may exist for groups under different domains. Along with paths we support IP Address of type IPv4 and IPv6. IP Address can be in one of the format(CIDR, IP Address, Range of IP Address). In order to specify all groups, use the constant “ANY”. This is case insensitive. If “ANY” is used, it should be the ONLY element in the group array. Error will be thrown if ANY is used in conjunction with other values. If this value is not passed, then [“ANY”] will be used by default.

destination_groups

(Optional) List of Destination group paths. We need paths as duplicate names may exist for groups under different domains. Along with paths we support IP Address of type IPv4 and IPv6. IP Address can be in one of the format(CIDR, IP Address, Range of IP Address). In order to specify all groups, use the constant “ANY”. This is case insensitive. If “ANY” is used, it should be the ONLY element in the group array. Error will be thrown if ANY is used in conjunction with other values. If this value is not passed, then [“ANY”] will be used by default.

Note: Both source_groups and destination_groups can not be [“ANY”] when domain_id=mgw

services

(Optional) Names of services. In order to specify all services, use the constant “ANY”. This is case insensitive. If “ANY” is used, it should be the ONLY element in the services array. Error will be thrown if ANY is used in conjunction with other values. If this value is not passed, then [“ANY”] will be used by default.

scope

(Optional) The list of policy paths where the rule is applied LR/Edge/T0/T1/LRP etc. Note that a given rule can be applied on multiple LRs/LRPs.

action

(Optional) The action to be applied to all the services. Possible Values for domain_id=cgw are: ALLOW, DROP, REJECT Possible Values for domain_id=mgw are: ALLOW

tag

(Optional) Tag applied on the rule. User level field which will be printed in CLI and packet logs.

logged

(Optional) Enable logging flag. Flag to enable packet logging. Default is disabled.

disabled

(Optional) Flag to disable the rule. Default is enabled.

notes

(Optional) Text for additional notes on changes.

sequence_number

(Optional) Sequence number of the Rule. This field is used to resolve conflicts between multiple Rules under Security or Gateway Policy for a Domain. If no sequence number is specified by the user, a value of 0 is assigned by default. If there are multiple rules with the same sequence number then their order is not deterministic. If a specific order of rules is desired, then one has to specify unique sequence numbers.

tags

(Optional) Opaque identifiers meaningful to the user.

tags='[
    {
        "tag": "<tag-key-1>"
        "scope": "<tag-value-1>"
    },
    {
        "tag": "<tag-key-2>"
        "scope": "<tag-value-2>"
    }
]'
display_name

Identifier to use when displaying entity in logs or GUI

Example values:

{
    "display_name": "vCenter Inbound Rule"
    "sequence_number": 0,
    "source_groups": [
        "ANY"
    ],
    "services": ["/infra/services/HTTPS"],
    "logged": false,
    "disabled": false,
    "destination_groups": [
        "/infra/domains/mgw/groups/VCENTER"
    ],
    "scope": [
        "/infra/tier-1s/mgw"
    ],
    "action": "ALLOW",
    "tag": "",
    "notes": "",
    "tags": [
        {
            "tag": "tag1",
            "scope": "scope1"
        }
    ]
}