c7n.schema module

class c7n.schema.ElementSchema[source]

Bases: object

Utility functions for working with resource’s filters and actions.

static _expand_schema(schema, definitions)[source]

Expand references in schema to their full schema

static doc(cls)[source]

Return ‘best’ formatted doc string for a given class.

Walks up class hierarchy, skipping known bad. Returns empty string if no suitable doc string found.

static elements(registry)[source]

Given a resource registry return sorted de-aliased values.

static name(cls)[source]

For a filter or action return its name.

static resolve(vocabulary, schema_path)[source]

Given a resource vocabulary and a dotted path, resolve an element.

static schema(definitions, cls)[source]

Return a pretty’ified version of an element schema.

c7n.schema.check_unique(data)[source]
c7n.schema.generate(resource_types=())[source]
c7n.schema.json_dump(resource=None)[source]
c7n.schema.policy_error_scope(error, data)[source]

Scope a schema error to its policy name and resource.

c7n.schema.pprint_schema_summary(vocabulary)[source]
c7n.schema.process_resource(type_name, resource_type, resource_defs, alias_name=None, definitions=None, provider_name=None)[source]
c7n.schema.resource_vocabulary(cloud_name=None, qualify_name=True)[source]
c7n.schema.specific_error(error)[source]

Try to find the best error for humans to resolve

The jsonschema.exceptions.best_match error is based purely on a mix of a strong match (ie. not anyOf, oneOf) and schema depth, this often yields odd results that are semantically confusing, instead we can use a bit of structural knowledge of schema to provide better results.

c7n.schema.validate(data, schema=None)[source]