saltext.vcf.utils.nsx

NSX Policy API connection helpers.

The NSX Policy API uses HTTP Basic auth on every request. No token exchange is performed, so there is no per-process cache — each request carries credentials.

Config is read from Salt opts/pillar under saltext.vcf.nsx:

saltext.vcf:
  nsx:
    host: mgmt-nsx.vcf.nimbus.internal
    username: admin
    password: VMware123!VMware123!
    verify_ssl: false
saltext.vcf.utils.nsx.get_config(opts, profile=None)[source]

Extract NSX connection config from Salt opts/pillar.

Returns a dict with keys: host, username, password, verify_ssl.

saltext.vcf.utils.nsx.api_get(opts, path, params=None, profile=None)[source]

GET /policy/api/v1/<path> from NSX and return parsed JSON.

saltext.vcf.utils.nsx.api_post(opts, path, body=None, profile=None)[source]

POST JSON body to NSX and return parsed JSON.

saltext.vcf.utils.nsx.api_put(opts, path, body=None, profile=None)[source]

PUT JSON body to NSX (create/update on Policy API) and return parsed JSON.

saltext.vcf.utils.nsx.api_delete(opts, path, profile=None)[source]

DELETE a resource from NSX.