The response to /ubuntu_pro/check_token now includes information about
the subscription: the name of the contract and the "name" of the account.
Instead of returning the list of services as an optional field, we now
include the list of services in the subscription object. The
subscription object is itself marked optional. This is a backward
incompatible change.
{
"status": "VALID_TOKEN",
"services": [
{
"name": "esm-infra",
"description": "UA Infra: Extended Security Maintenance (ESM)",
"auto_enabled": true
}
]
}
=>
{
"status": "VALID_TOKEN",
"subscription": {
"account_name": "user@domain.com",
"contract_name": "UA Apps - Essential (Virtual)",
"services": [
{
"name": "esm-infra",
"description": "UA Infra: Extended Security Maintenance (ESM)",
"auto_enabled": true
}
]
}
}
If the token is not valid, the subscription object will be null:
{
"status": "EXPIRED_TOKEN",
"subscription": null
}
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Instead of only checking if a given UA service is available, we now also
check if it is entitled.
- the available field for a service refers to its availability on the
current machine (e.g. on Focal running on a amd64 CPU) ; whereas
- the entitled field tells us if the contract covers the service.
Therefore, we need to make sure that we only list the services that are
both "available" and "entitled".
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit introduces example JSON files that would simulate output of
the ua_client script, as in the following command:
$ ubuntu-advantage status \
--simulate-with-token "${token}" \
--format json
Two files are added, one for each of the following scenario:
* output when supplied a valid, non expired token
* output when supplied a valid but expired token
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>