thoth.messaging package

Submodules

thoth.messaging.admin_client module

Helper functions for using confluent kafka admin client with thoth.messaging.

thoth.messaging.admin_client.check_connection(timeout: int = 10, config: Optional[Dict[str, str]] = None)[source]

Check connection to Kafka with either provided config or config gathered from env.

thoth.messaging.admin_client.create_admin_client(config: Optional[Dict[str, str]] = None) confluent_kafka.admin.AdminClient[source]

Create admin client.

thoth.messaging.admin_client.create_all_topics(admin: confluent_kafka.admin.AdminClient, partitions: int = 1, replication_factor: int = 1)[source]

Create admin client for all topics in thoth messaging with equal replication and partitions.

thoth.messaging.admin_client.create_topic(admin: confluent_kafka.admin.AdminClient, message: thoth.messaging.message_base.MessageBase, partitions: int = 1, replication_factor: int = 1)[source]

Create single topic.

thoth.messaging.advise_justification module

This is Thoth Messaging module for AdviseJustificationMessage.

class thoth.messaging.advise_justification.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v1', message: pydantic.types.StrictStr, justification_type: pydantic.types.StrictStr, count: pydantic.types.StrictInt, adviser_version: pydantic.types.StrictStr)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent contents of advise justification message Kafka topic.

adviser_version: pydantic.types.StrictStr
count: pydantic.types.StrictInt
justification_type: pydantic.types.StrictStr
message: pydantic.types.StrictStr
version: pydantic.types.StrictStr

thoth.messaging.adviser_trigger module

This is Thoth Messaging module for AdviseTriggerMessage.

class thoth.messaging.adviser_trigger.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v5', recommendation_type: pydantic.types.StrictStr, dev: pydantic.types.StrictBool = False, debug: pydantic.types.StrictBool = False, authenticated: pydantic.types.StrictBool = False, count: Optional[pydantic.types.StrictInt] = None, limit: Optional[pydantic.types.StrictInt] = None, origin: Optional[pydantic.types.StrictStr] = None, job_id: Optional[pydantic.types.StrictStr] = None, limit_latest_versions: Optional[pydantic.types.StrictInt] = None, re_run_adviser_id: Optional[pydantic.types.StrictStr] = None, source_type: Optional[pydantic.types.StrictStr] = None, kebechet_metadata: Optional[Dict[pydantic.types.StrictStr, Any]] = None, justification: Optional[List[Dict[pydantic.types.StrictStr, Any]]] = None, stack_info: Optional[List[Dict[pydantic.types.StrictStr, Any]]] = None)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent contents of a message Kafka topic.

class Config[source]

Bases: object

Config for pydantic.

arbitrary_types_allowed = True
authenticated: pydantic.types.StrictBool
count: Optional[pydantic.types.StrictInt]
debug: pydantic.types.StrictBool
dev: pydantic.types.StrictBool
job_id: Optional[pydantic.types.StrictStr]
justification: Optional[List[Dict[pydantic.types.StrictStr, Any]]]
kebechet_metadata: Optional[Dict[pydantic.types.StrictStr, Any]]
limit: Optional[pydantic.types.StrictInt]
limit_latest_versions: Optional[pydantic.types.StrictInt]
origin: Optional[pydantic.types.StrictStr]
re_run_adviser_id: Optional[pydantic.types.StrictStr]
recommendation_type: pydantic.types.StrictStr
source_type: Optional[pydantic.types.StrictStr]
stack_info: Optional[List[Dict[pydantic.types.StrictStr, Any]]]
version: pydantic.types.StrictStr

thoth.messaging.build_analysis_trigger module

This is Thoth Messaging module for BuildAnalysisTriggerMessage.

class thoth.messaging.build_analysis_trigger.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v1', base_image: Optional[pydantic.types.StrictStr] = None, base_image_analysis_id: Optional[pydantic.types.StrictStr] = None, buildlog_document_id: Optional[pydantic.types.StrictStr] = None, buildlog_parser_id: Optional[pydantic.types.StrictStr] = None, environment_type: Optional[pydantic.types.StrictStr] = None, debug: pydantic.types.StrictBool = False, job_id: Optional[pydantic.types.StrictStr] = None, origin: Optional[pydantic.types.StrictStr] = None, output_image: Optional[pydantic.types.StrictStr] = None, output_image_analysis_id: Optional[pydantic.types.StrictStr] = None, base_registry_password: Optional[pydantic.types.StrictStr] = None, base_registry_user: Optional[pydantic.types.StrictStr] = None, base_registry_verify_tls: pydantic.types.StrictBool = True, output_registry_password: Optional[pydantic.types.StrictStr] = None, output_registry_user: Optional[pydantic.types.StrictStr] = None, output_registry_verify_tls: pydantic.types.StrictBool = True)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent contents of a message Kafka topic.

base_image: Optional[pydantic.types.StrictStr]
base_image_analysis_id: Optional[pydantic.types.StrictStr]
base_registry_password: Optional[pydantic.types.StrictStr]
base_registry_user: Optional[pydantic.types.StrictStr]
base_registry_verify_tls: pydantic.types.StrictBool
buildlog_document_id: Optional[pydantic.types.StrictStr]
buildlog_parser_id: Optional[pydantic.types.StrictStr]
debug: pydantic.types.StrictBool
environment_type: Optional[pydantic.types.StrictStr]
job_id: Optional[pydantic.types.StrictStr]
origin: Optional[pydantic.types.StrictStr]
output_image: Optional[pydantic.types.StrictStr]
output_image_analysis_id: Optional[pydantic.types.StrictStr]
output_registry_password: Optional[pydantic.types.StrictStr]
output_registry_user: Optional[pydantic.types.StrictStr]
output_registry_verify_tls: pydantic.types.StrictBool
version: pydantic.types.StrictStr

thoth.messaging.config module

Helper functions for generating confluent kafka configuration.

thoth.messaging.config.kafka_config_from_env()[source]

Generate Kafka configuration from environment variables.

thoth.messaging.config.topic_config_from_env()[source]

Generate topic config from environment variables.

thoth.messaging.consumer module

Helper functions for using confluent kafka consumer with thoth.messaging.

thoth.messaging.consumer.create_consumer(config: Optional[Dict[str, str]] = None) cimpl.Consumer[source]

Initialize consumer.

thoth.messaging.consumer.subscribe_to_all(consumer: cimpl.Consumer)[source]

Subscribe to all topics defined in messaging.

thoth.messaging.consumer.subscribe_to_message(consumer: cimpl.Consumer, message_type: thoth.messaging.message_base.MessageBase)[source]

Subscribe to specific message by passing message class.

thoth.messaging.cve_provided module

This is Thoth Messaging module for CVEProvidedMessage.

class thoth.messaging.cve_provided.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v1', package_name: pydantic.types.StrictStr, package_version: pydantic.types.StrictStr, index_url: pydantic.types.StrictStr)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent contents of a cve-provided message Kafka topic.

index_url: pydantic.types.StrictStr
package_name: pydantic.types.StrictStr
package_version: pydantic.types.StrictStr
version: pydantic.types.StrictStr

thoth.messaging.hash_mismatch module

This is Thoth Messaging module for HashMismatchMessage.

class thoth.messaging.hash_mismatch.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v1', index_url: pydantic.types.StrictStr, package_name: pydantic.types.StrictStr, package_version: pydantic.types.StrictStr, missing_from_source: List[pydantic.types.StrictStr], missing_from_database: List[pydantic.types.StrictStr])[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent a contents of a hash-mismatch message Kafka topic.

index_url: pydantic.types.StrictStr
missing_from_database: List[pydantic.types.StrictStr]
missing_from_source: List[pydantic.types.StrictStr]
package_name: pydantic.types.StrictStr
package_version: pydantic.types.StrictStr
version: pydantic.types.StrictStr

thoth.messaging.inspection_complete module

This is Thoth Messaging module for InspectionCompleteMessage.

class thoth.messaging.inspection_complete.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v1', inspection_id: pydantic.types.StrictStr, force_sync: pydantic.types.StrictBool = False)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent contents of a inspection-completed message Kafka topic.

force_sync: pydantic.types.StrictBool
inspection_id: pydantic.types.StrictStr
version: pydantic.types.StrictStr

thoth.messaging.kebechet_run_url module

This is Thoth Messaging module for KebechetRunUrlTriggerMessage.

class thoth.messaging.kebechet_run_url.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v2', url: Optional[pydantic.types.StrictStr] = None, service_name: Optional[pydantic.types.StrictStr] = None, installation_id: Optional[pydantic.types.StrictStr] = None, job_id: Optional[pydantic.types.StrictStr] = None, metadata: thoth.messaging.kebechet_run_url.Metadata = None)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent contents of a message Kafka topic.

installation_id: Optional[pydantic.types.StrictStr]
job_id: Optional[pydantic.types.StrictStr]
metadata: thoth.messaging.kebechet_run_url.Metadata
service_name: Optional[pydantic.types.StrictStr]
url: Optional[pydantic.types.StrictStr]
version: pydantic.types.StrictStr
class thoth.messaging.kebechet_run_url.Metadata(*, message_justification: Optional[pydantic.types.StrictInt] = None, package_name: Optional[pydantic.types.StrictStr] = None, package_version: Optional[pydantic.types.StrictStr] = None, package_index: Optional[pydantic.types.StrictStr] = None)[source]

Bases: pydantic.main.BaseModel

Metadata for kebechet-run-url message type.

message_justification: Optional[pydantic.types.StrictInt]
package_index: Optional[pydantic.types.StrictStr]
package_name: Optional[pydantic.types.StrictStr]
package_version: Optional[pydantic.types.StrictStr]

thoth.messaging.kebechet_trigger module

This is Thoth Messaging module for KebechetTriggerMessage.

class thoth.messaging.kebechet_trigger.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v1', webhook_payload: Dict[pydantic.types.StrictStr, Any], job_id: Optional[pydantic.types.StrictStr] = None)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent contents of a message Kafka topic.

class Config[source]

Bases: object

Config for pydantic.

arbitrary_types_allowed = True
job_id: Optional[pydantic.types.StrictStr]
version: pydantic.types.StrictStr
webhook_payload: Dict[pydantic.types.StrictStr, Any]

thoth.messaging.message_base module

This is Thoth Messaging module.

class thoth.messaging.message_base.BaseMessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v0')[source]

Bases: pydantic.main.BaseModel

Default params for message contents.

component_name: pydantic.types.StrictStr
service_version: pydantic.types.StrictStr
version: pydantic.types.StrictStr
class thoth.messaging.message_base.MessageBase(*, base_name: Optional[str] = None, model: Optional[Type[thoth.messaging.message_base.BaseMessageContents]] = None)[source]

Bases: object

Class used for Package Release events on Kafka topic.

property topic_name

Generate topic name.

thoth.messaging.message_factory module

This is Thoth Messaging module for message_factory.

thoth.messaging.message_factory.message_factory(b_name: str, message_model: Type[thoth.messaging.message_base.BaseMessageContents])[source]

Create new message types dynamically.

thoth.messaging.missing_package module

This is Thoth Messaging module for MissingPackageMessage.

class thoth.messaging.missing_package.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v1', index_url: pydantic.types.StrictStr, package_name: pydantic.types.StrictStr)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent a contents of a missing-package message Kafka topic.

index_url: pydantic.types.StrictStr
package_name: pydantic.types.StrictStr
version: pydantic.types.StrictStr

thoth.messaging.missing_version module

This is Thoth Messaging module for MissingVersionMessage.

class thoth.messaging.missing_version.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v1', index_url: pydantic.types.StrictStr, package_name: pydantic.types.StrictStr, package_version: pydantic.types.StrictStr)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent a contents of a missing-package version message Kafka topic.

index_url: pydantic.types.StrictStr
package_name: pydantic.types.StrictStr
package_version: pydantic.types.StrictStr
version: pydantic.types.StrictStr

thoth.messaging.package_extract_trigger module

This is Thoth Messaging module for PackageExtractTriggerMessage.

class thoth.messaging.package_extract_trigger.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v2', image: pydantic.types.StrictStr, environment_type: pydantic.types.StrictStr, is_external: pydantic.types.StrictBool = True, verify_tls: pydantic.types.StrictBool = True, debug: pydantic.types.StrictBool = False, job_id: Optional[pydantic.types.StrictStr] = None, origin: Optional[pydantic.types.StrictStr] = None, registry_user: Optional[pydantic.types.StrictStr] = None, registry_password: Optional[pydantic.types.StrictStr] = None, graph_sync: pydantic.types.StrictBool = False)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent contents of a message Kafka topic.

debug: pydantic.types.StrictBool
environment_type: pydantic.types.StrictStr
graph_sync: pydantic.types.StrictBool
image: pydantic.types.StrictStr
is_external: pydantic.types.StrictBool
job_id: Optional[pydantic.types.StrictStr]
origin: Optional[pydantic.types.StrictStr]
registry_password: Optional[pydantic.types.StrictStr]
registry_user: Optional[pydantic.types.StrictStr]
verify_tls: pydantic.types.StrictBool
version: pydantic.types.StrictStr

thoth.messaging.package_releases module

This is Thoth Messaging module for PackageReleasedMessage.

class thoth.messaging.package_releases.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v1', index_url: pydantic.types.StrictStr, package_name: pydantic.types.StrictStr, package_version: pydantic.types.StrictStr)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent contents of a package-released message Kafka topic.

index_url: pydantic.types.StrictStr
package_name: pydantic.types.StrictStr
package_version: pydantic.types.StrictStr
version: pydantic.types.StrictStr

thoth.messaging.producer module

Helper functions for using confluent kafka producer with thoth.messaging.

thoth.messaging.producer.create_producer(config: Optional[Dict[str, Any]] = None) cimpl.Producer[source]

Create confluent kafka producer.

thoth.messaging.producer.publish_to_topic(producer: cimpl.Producer, message_type: thoth.messaging.message_base.MessageBase, message_contents: Union[thoth.messaging.message_base.BaseMessageContents, Dict[str, Any]], validate: bool = True)[source]

Publish to topic using message contents class.

producerProducer

Instance of confluent Kafka producer which handles sending the message to Kafka instance

message_typeMessageBase

Message type which determines the schema of the message as well as the topic name to produce to

message_contentsUnion[BaseMessageContents, Dict[str, Any]]

Message to be sent. A dict is parsed on messaging side to message_type.model.

None

ValidationError

When pydantic detects ill formed message

thoth.messaging.provenance_checker_trigger module

This is Thoth Messaging module for ProvenanceCheckerTriggerMessage.

class thoth.messaging.provenance_checker_trigger.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v4', debug: pydantic.types.StrictBool = False, authenticated: pydantic.types.StrictBool = False, origin: Optional[pydantic.types.StrictStr] = None, whitelisted_sources: Optional[List[pydantic.types.StrictStr]] = None, job_id: Optional[pydantic.types.StrictStr] = None, kebechet_metadata: Optional[Dict[pydantic.types.StrictStr, Any]] = None, justification: Optional[List[Dict[pydantic.types.StrictStr, Any]]] = None, stack_info: Optional[List[Dict[pydantic.types.StrictStr, Any]]] = None)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent contents of a message Kafka topic.

class Config[source]

Bases: object

Config for pydantic.

arbitrary_types_allowed = True
authenticated: pydantic.types.StrictBool
debug: pydantic.types.StrictBool
job_id: Optional[pydantic.types.StrictStr]
justification: Optional[List[Dict[pydantic.types.StrictStr, Any]]]
kebechet_metadata: Optional[Dict[pydantic.types.StrictStr, Any]]
origin: Optional[pydantic.types.StrictStr]
stack_info: Optional[List[Dict[pydantic.types.StrictStr, Any]]]
version: pydantic.types.StrictStr
whitelisted_sources: Optional[List[pydantic.types.StrictStr]]

thoth.messaging.si_unanalyzed_package module

This is Thoth Messaging module for SIUnanalyzedPackageMessage.

class thoth.messaging.si_unanalyzed_package.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v1', package_name: pydantic.types.StrictStr, package_version: pydantic.types.StrictStr, index_url: pydantic.types.StrictStr)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent contents of a SI unanalyzed package message Kafka topic.

index_url: pydantic.types.StrictStr
package_name: pydantic.types.StrictStr
package_version: pydantic.types.StrictStr
version: pydantic.types.StrictStr

thoth.messaging.solved_package module

This is Thoth Messaging module for SolvedPackageMessage.

class thoth.messaging.solved_package.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v1', package_name: pydantic.types.StrictStr, package_version: pydantic.types.StrictStr, index_url: pydantic.types.StrictStr, solver: pydantic.types.StrictStr)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent contents of a solved package message Kafka topic.

index_url: pydantic.types.StrictStr
package_name: pydantic.types.StrictStr
package_version: pydantic.types.StrictStr
solver: pydantic.types.StrictStr
version: pydantic.types.StrictStr

thoth.messaging.thoth_repo_init module

This is Thoth Messaging module for repo init messages.

class thoth.messaging.thoth_repo_init.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v1', project_url: pydantic.types.StrictStr, job_id: Optional[pydantic.types.StrictStr] = None)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent a trigger for thoth repo initialization.

job_id: Optional[pydantic.types.StrictStr]
project_url: pydantic.types.StrictStr
version: pydantic.types.StrictStr

thoth.messaging.unresolved_package module

This is Thoth Messaging module for UnresolvedPackageMessage.

class thoth.messaging.unresolved_package.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v1', package_name: pydantic.types.StrictStr, index_url: pydantic.types.StrictStr, package_version: Optional[pydantic.types.StrictStr] = None, solver: Optional[pydantic.types.StrictStr] = None)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent contents of a unresolved package message Kafka topic.

index_url: pydantic.types.StrictStr
package_name: pydantic.types.StrictStr
package_version: Optional[pydantic.types.StrictStr]
solver: Optional[pydantic.types.StrictStr]
version: pydantic.types.StrictStr

thoth.messaging.unrevsolved_package module

This is Thoth Messaging module for UnrevsolvedPackageMessage.

class thoth.messaging.unrevsolved_package.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v1', package_name: pydantic.types.StrictStr, package_version: pydantic.types.StrictStr)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent contents of a unrevsolved package message Kafka topic.

package_name: pydantic.types.StrictStr
package_version: pydantic.types.StrictStr
version: pydantic.types.StrictStr

thoth.messaging.update_provides_src_distro module

This is Thoth Messaging module for UpdateProvidesSourceDistroMessage.

class thoth.messaging.update_provides_src_distro.MessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v1', package_name: pydantic.types.StrictStr, package_version: pydantic.types.StrictStr, index_url: pydantic.types.StrictStr, value: pydantic.types.StrictBool)[source]

Bases: thoth.messaging.message_base.BaseMessageContents

Class used to represent a contents of a update-provides-source-distro message.

index_url: pydantic.types.StrictStr
package_name: pydantic.types.StrictStr
package_version: pydantic.types.StrictStr
value: pydantic.types.StrictBool
version: pydantic.types.StrictStr

Module contents

This is Thoth Messaging module.

class thoth.messaging.BaseMessageContents(*, component_name: pydantic.types.StrictStr, service_version: pydantic.types.StrictStr, version: pydantic.types.StrictStr = 'v0')[source]

Bases: pydantic.main.BaseModel

Default params for message contents.

component_name: pydantic.types.StrictStr
service_version: pydantic.types.StrictStr
version: pydantic.types.StrictStr
class thoth.messaging.MessageBase(*, base_name: Optional[str] = None, model: Optional[Type[thoth.messaging.message_base.BaseMessageContents]] = None)[source]

Bases: object

Class used for Package Release events on Kafka topic.

property topic_name

Generate topic name.

thoth.messaging.message_factory(b_name: str, message_model: Type[thoth.messaging.message_base.BaseMessageContents])[source]

Create new message types dynamically.