license interface — VMware Salt API

license interface — VMware Salt API

license interface

The LoadedMod class allows for the module loaded onto the sub to return custom sequencing, for instance it can be iterated over to return all functions

apply_vra_license(vra_license_key: <class 'str'>)

Validate a vRA license key and apply it if it checks out.

Parameters

vra_license_key:vRA license key

Example:

client.api.license.apply_vra_license('0J4C2-0FK4K-M8UF2-02824-14EH4')

RPCResponse(riq=3,
            ret=None,
            error=None,
            warnings=[])
check_usage(force_check: bool | None)
Returns: <class 'dict'>

Return a dictionary that contains information about the license status.

Parameters

force_check:If False uses information cached over time since getting actual usage can be somewhat time-consuming for large environments. If True forces the usage calculation and then returns results.

Note

Make sure to track your license status and keep it active. If your license expires, the VMware Salt service will stop.

Example:

client.api.license.check_usage()

RPCResponse(riq=17,
    ret={u'timestamp': u'2017-11-30T15:58:24.475034',
         u'messages': [{u'detail': u'license expires 2018-06-01',
                        u'level': u'info'},
                       {u'detail': u'4 masters in use is within hard limit of 10',
                        u'level': u'info'},
                       {u'detail': u'4243 minions in use is within hard limit of 10000',
                        u'level': u'info'}]},
    error=None, warnings=[])
delete_license(license_uuid_or_serial: <class 'str'>)
Returns: str | None

Delete the license matching this uuid or serial number. Deleting an active license with no alternative license in place can cause RaaS to stop working.

Parameters

license_uuid_or_serial:UUID or serial number for the license to delete.

Example:

client.api.license.delete_license(license_uuid_or_serial='0J4C2-0FK4K-M8UF2-02824-14EH4')

RPCResponse(riq=4,
            ret='0J4C2-0FK4K-M8UF2-02824-14EH4',
            error=None,
            warnings=[])

client.api.license.delete_license(license_uuid_or_serial='dd1b95fe-930b-193d-a7f8-98172192d31a')

RPCResponse(riq=4,
            ret='dd1b95fe-930b-193d-a7f8-98172192d31a',
            error=None,
            warnings=[])
get_current_license()
Returns: <class 'dict'>

Retrieve the current license for RaaS. The returned license structure reflects the minion counts and features of all current licenses.

Note

Make sure to track your license status and keep it active. If your license expires, the VMware Salt service will stop.

Example:

c.api.license.get_current_license()

RPCResponse(riq=16,
   ret={u'uuid': u'1dbb6f3c-c622-11e6-874c-002590058d18',
        u'license': {u'masters':
                       {u'policy': u'fixed',
                        u'hard_limit': 10},
                     u'term': {u'duration': -1,
                               u'policy': u'fixed'},
                     u'features': [u'*'],
                     u'minions': {u'policy': u'fixed',
                                  u'hard_limit': 10000},
                     u'metadata': {u'customer': u'Aria Config',
                                   u'uuid': u'1dbb6f3c-c622-11e6-874c-002590058d18',
                                   u'created': u'2016-12-19'}},
        u'desc': [u'Customer:     Aria Config',
                  u'License UUID: 1dbb6f3c-c622-11e6-874c-002590058d18',
                  u'Created:      2016-12-19',
                  u'Duration:     UNLIMITED',
                  u'Masters:      up to 10',
                  u'Minions:      up to 10000',
                  u'Features:     *']},
    error=None, warnings=[])
get_license(license_uuid: <class 'uuid.UUID'>)
Returns: <class 'dict'>

Return license for the passed uuid. This routine is deprecated in favor of get_licenses().

Parameters

license_uuid:UUID for the desired license.
get_license_features()
Returns: <class 'dict'>

Get the state of license features

get_licenses(license_uuid: uuid.UUID | None, license_type: str | None, features: list[str] | None, origin: str | None, include_expired: bool | None)
Returns: <class 'list'>

Query current licenses.

Parameters

license_uuid:UUID for the desired license
license_type:License type to match
features:A list of feature strings to match
include_expired:Pass True to include expired licenses in the results
get_usage_snapshots(date_start: str | None, date_end: str | None)
Returns: <class 'list'>

Return snapshots of license usage for a given date range.

Snapshots are normally taken every hour.

Parameters

date_start:Initial snapshot date.
date_end:Final snapshot date.

Example:

client.api.license.get_usage_snapshots('2017-11-01','2017-11-17')

RPCResponse(riq=25,
    ret=[{u'license_uuid': u'1dbb6f3c-c622-11e6-874c-002590058d18',
          u'masters': 4,
          u'minions': 4212,
          u'datetime': u'2017-11-16T18:06:49.171497'},
         {u'license_uuid': u'1dbb6f3c-c622-11e6-874c-002590058d18',
          u'masters': 4, u'minions': 4243,
          u'datetime': u'2017-11-16T19:55:26.095901'},
         {u'license_uuid': u'1dbb6f3c-c622-11e6-874c-002590058d18',
          u'masters': 4,
          u'minions': 4222,
          u'datetime': u'2017-11-16T20:55:26.092793'} .... ],
    error=None, warnings=[])
get_vra_license()
Returns: <class 'list'>

Get the current vRA license keys and their license editions.

Example:

client.api.license.get_vra_license()

RPCResponse(riq=4,
            ret=[{'serial': '0J4C2-0FK4K-M8UF2-02824-14EH4',
                  'edition': 'vac.vrealizeFlex2019Enterprise.subscription.core'},
                 {'serial': 'MH027-NCH92-M8HL3-0H1R4-349KH',
                  'edition': 'vac.saltStackSecOps.serverVm'}]
            error=None,
            warnings=[])
save_license(license_key: <class 'str'>)
Returns: <class 'uuid.UUID'>

Validate a VMware license key and save the associated license to the database. A valid license takes effect immediately.