GCPLicenseCodes

This parser reads the output of a command curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/licenses/?recursive=True", which is used to check whether the google cloud instance is a licensed marketplace instance.

For more details, See: https://cloud.google.com/compute/docs/reference/rest/v1/images/get#body.Image.FIELDS.license_code

class insights.parsers.gcp_license_codes.GCPLicenseCodes(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser

Class for parsing the GCP License Codes returned by command curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/licenses/?recursive=True",

Typical Output of this command is:

[{"id": "601259152637613565"}]
Raises
ids

A list containing the IDs found on the instance

Type

list

raw

The full JSON of the plan returned by the curl command

Type

str

Examples

>>> gcp_licenses.ids == ["601259152637613565"]
True
>>> gcp_licenses.raw == [{"id": "601259152637613565"}]
True
parse_content(content)[source]

This method must be implemented by classes based on this class.