Models

The models returned by StarmapClient.

APIv2

class starmap_client.models.QueryResponseContainer(responses)[source]

Bases: object

Represent a full query response from APIv2.

Attributes:

responses: List[QueryResponseEntity]

List with all responses from a Query V2 mapping.

classmethod from_json(json)[source]

Convert the APIv2 response JSON into this object.

Parameters:

json (list) – A JSON containing a StArMap APIv2 response.

Returns:

The converted object from JSON.

filter_by_name(name, responses=None)[source]

Return a sublist of the responses with only the selected image name.

Parameters:
  • name (str) – The image name to filter the list of responses

  • responses (list, optional) – List of existing responses to filter. Default by the container’s own list.

Returns:

The sublist with only the selected image name.

Return type:

list

filter_by_workflow(workflow, responses=None)[source]

Return a sublist of the responses with only the selected workflow.

Parameters:
  • workflow (Workflow) – The workflow to filter the list of responses

  • responses (list, optional) – List of existing responses to filter. Default by the container’s own list.

Returns:

The sublist with only the selected workflows

Return type:

list

filter_by_cloud(cloud, responses=None)[source]

Return a sublist of the responses with only the selected cloud name.

Parameters:
  • cloud (str) – The cloud name to filter the list of responses

  • responses (list, optional) – List of existing responses to filter. Default by the container’s own list.

Returns:

The sublist with only the selected cloud name.

Return type:

list

filter_by(**kwargs)[source]

Return a sublist of the responses with the selected filters.

Return type:

List[QueryResponseEntity]

class starmap_client.models.QueryResponseEntity(meta, name, billing_code_config, cloud, workflow, mappings)[source]

Bases: MetaMixin, StarmapJSONDecodeMixin

Represent a single query response entity from StArMap APIv2.

Attributes:

name: str

The Policy name.

billing_code_config: Optional[Dict[str, BillingCodeRule]]

The Billing Code Configuration for the community workflow.

cloud: str

The cloud name where the destinations are meant to.

workflow: Workflow

The Policy workflow.

mappings: Dict[str, MappingResponseObject]

Dictionary with the cloud account names and MappingResponseObjects.

property account_names: List[str]

Return the list of cloud account names declared on mappings.

property all_mappings: List[MappingResponseObject]

Return all MappingResponseObject stored in mappings.

get_mapping_for_account(account)[source]

Return a single MappingResponseObject for a given account name.

Parameters:

account (str) – The account name to retrieve the MappingResponseObject

Returns:

The required mapping when found

Return type:

MappingResponseObject

Raises: KeyError when not found

to_classic_query_response()[source]

Return the representation of this object as a QueryResponse from APIv1.

Return type:

QueryResponse

class starmap_client.models.MappingResponseObject(meta, destinations, provider)[source]

Bases: MetaMixin, StarmapJSONDecodeMixin

Represent a single mapping response from QueryResponseObject for APIv2.

Attributes:

destinations: List[Destination]

List of destinations for the mapping response object.

provider: Optional[str]

The provider name for the community workflow.

class starmap_client.models.BillingCodeRule(codes, image_name, image_types, name)[source]

Bases: StarmapJSONDecodeMixin

Define a single Billing Code Configuration rule for APIv2.

Attributes:

codes: List[str]

The billing codes to insert when this rule is matched.

image_name: str

The image name to match the rule.

image_types: List[BillingImageType]

Image types list. Supported values are access and hourly.

name: Optional[str]

The billing code rule name.

APIv1 (Deprecated)

class starmap_client.models.QueryResponse(name, workflow, clouds=NOTHING)[source]

Represent a query response from StArMap.

Attributes:

name: str

The Policy name.

workflow: Workflow

The Policy workflow.

clouds: Dict[str, List[Destination]]

Dictionary with the cloud marketplaces aliases and their respective Destinations.

Common

class starmap_client.models.Policy(meta, id, mappings, name, workflow)[source]

Represent a StArMap policy.

Attributes:

mappings: List[Mapping]

List of marketplace mappings which the Policy applies to.

name: str

The Koji Package name representing also the Policy name.

workflow: Workflow

The policy workflow name.

class starmap_client.models.Mapping(meta, id, destinations, marketplace_account, version_fnmatch, version_regexmatch)[source]

Represent a marketplace Mapping from Policy.

Attributes:

destinations: List[Destination]

List of destinations for the marketplace account.

marketplace_account: str

A string representing the destination marketplace account.

version_fnmatch: Optional[str]

A fnmatch string to apply the destinations only to the matched NVR versions.

It can’t be set together with version_regexmatch.

version_regexmatch: Optional[str]

A regex string to apply the destinations only to the matched NVR versions.

It can’t be set together with version_fnmatch.

class starmap_client.models.Destination(meta, id, architecture, destination, overwrite, restrict_version, restrict_major, restrict_minor, provider, tags)[source]

Represent a destination entry from Mapping.

Attributes:

architecture: Optional[str]

Architecture of the VM image.

destination: str

The product listing destination in the cloud marketplace.

overwrite: bool

Whether to replace the existing VM image in the destination or append.

restrict_version: bool

Whether to restrict and image and delete it’s AMI and snapshot

restrict_major: Optional[int]

How many major versions are allowed in product

restrict_minor: Optional[int]

How many minor versions are allowed in product

provider: Optional[str]

Represent the RHSM provider name for the community workflow.

tags: Optional[Dict[str, str]]

Dictionary with custom tags to be set on cloud marketplaces resources.

Utils

class starmap_client.models.Workflow[source]

Define the valid workflows for StArMap.

community = 'community'

Workflow community.

stratosphere = 'stratosphere'

Workflow stratosphere for marketplaces.

class starmap_client.models.BillingImageType[source]

Define the image type for BillingCodeRule for APIv2.

access = 'access'

Billing type access.

hourly = 'hourly'

Billing type hourly.

marketplace = 'marketplace'

Billing type marketplace.

class starmap_client.models.StarmapJSONDecodeMixin[source]

Implement the default JSON deserialization for StArMap models.

classmethod from_json(json)[source]

Convert a JSON dictionary into class object.

Parameters:

json (dict) – A JSON containing a StArMap response.

Returns:

The converted object from JSON.

class starmap_client.models.MetaMixin(meta)[source]

Mixin for defining the meta attribute and its validator.

Attributes:

meta: Optional[Dict[str, Any]]

Dictionary with additional information related to a VM image.