mainframe.models.schemas¶
Attributes¶
Classes¶
Server metadata. |
|
Cached summary of the package scanning queue. |
|
Database-derived rule and package performance totals. |
|
Internal per-rule performance totals. |
|
Public package totals safe for unauthenticated consumers. |
|
Persisted production alerting configuration. |
|
Mutable production alerting configuration. |
|
Rule corpus for a suppression; null means every rule. |
|
A new suppression. Omitting rules suppresses every rule. |
|
Replacement rule corpus for an existing suppression. |
|
A durable package-version suppression. |
|
Number of suppressions deleted by an operation. |
|
Error. |
|
One bounded source-level finding produced by OpenGrep. |
|
Read-only evidence and scan state, independent of Discord publication. |
|
Model representing a package queried from the database. |
|
Model used to specify a package by name and version. |
|
Model used to specify a package by name and version. |
|
Create a collection of name/value pairs. |
|
Model for a report using the PyPI Observation API. |
|
Bounded per-job counters; exported to Prometheus without database storage. |
|
Client payload to server containing the results of a package scan. |
|
The client's reason as to why scanning a package failed. |
|
Package information of a requested job. |
|
!!! abstract "Usage Documentation" |
|
Complete or partial OpenGrep shadow result with preserved findings. |
|
Failed OpenGrep shadow result. |
|
An alert delivered to Discord and eligible for OpenGrep processing. |
|
Completed OpenGrep shadow work awaiting bot publication. |
|
Identify the publisher holding a shadow-result lease. |
|
Durable Discord publication progress for retry-safe resumption. |
|
Publication acknowledgement for a completed shadow result. |
|
Returned when no available jobs were found. |
|
Returned after queueing a package. Contains the UUID. |
|
Recent system statistics. |
Module Contents¶
- class mainframe.models.schemas.ServerMetadata(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelServer metadata.
- class mainframe.models.schemas.QueueStatus(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelCached summary of the package scanning queue.
- oldest_queued_at: datetime.datetime | None[source]¶
- sampled_at: datetime.datetime[source]¶
- class mainframe.models.schemas.PerformanceStatus(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelDatabase-derived rule and package performance totals.
- sampled_at: datetime.datetime[source]¶
- class mainframe.models.schemas.RulePerformance(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelInternal per-rule performance totals.
- sampled_at: datetime.datetime[source]¶
- class mainframe.models.schemas.PublicStatistics(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelPublic package totals safe for unauthenticated consumers.
- sampled_at: datetime.datetime[source]¶
- class mainframe.models.schemas.AlertingConfigurationResponse(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelPersisted production alerting configuration.
- updated_at: datetime.datetime[source]¶
- class mainframe.models.schemas.AlertingConfigurationUpdate(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelMutable production alerting configuration.
- class mainframe.models.schemas.SuppressionRules(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelRule corpus for a suppression; null means every rule.
- class mainframe.models.schemas.SuppressionCreate(/, **data: Any)[source]¶
Bases:
SuppressionRulesA new suppression. Omitting rules suppresses every rule.
- class mainframe.models.schemas.SuppressionUpdate(/, **data: Any)[source]¶
Bases:
SuppressionRulesReplacement rule corpus for an existing suppression.
- class mainframe.models.schemas.SuppressionResponse(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelA durable package-version suppression.
- created_at: datetime.datetime[source]¶
- updated_at: datetime.datetime[source]¶
- classmethod from_db(suppression: mainframe.models.orm.Suppression) Self[source]¶
- class mainframe.models.schemas.SuppressionDeleteResponse(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelNumber of suppressions deleted by an operation.
- class mainframe.models.schemas.OpenGrepFinding(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelOne bounded source-level finding produced by OpenGrep.
- path: OpenGrepText[source]¶
- message: OpenGrepText[source]¶
- class mainframe.models.schemas.OpenGrepDetails(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelRead-only evidence and scan state, independent of Discord publication.
- findings: list[OpenGrepFinding][source]¶
- finished_at: datetime.datetime | None[source]¶
- class mainframe.models.schemas.Package(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelModel representing a package queried from the database.
- queued_at: datetime.datetime | None[source]¶
- reported_at: datetime.datetime | None[source]¶
- pending_at: datetime.datetime | None[source]¶
- dead_lettered_at: datetime.datetime | None[source]¶
- finished_at: datetime.datetime | None[source]¶
- opengrep: OpenGrepDetails | None = None[source]¶
- classmethod from_db(scan: mainframe.models.orm.Scan, opengrep: mainframe.models.orm.OpenGrepScan | None = None) Self[source]¶
- class mainframe.models.schemas.PackageSpecifier(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelModel used to specify a package by name and version.
name: A str of the name of the package to be scanned version: A str of the package version to scan.
- class mainframe.models.schemas.ReportPackageBody(/, **data: Any)[source]¶
Bases:
PackageSpecifierModel used to specify a package by name and version.
name: A str of the name of the package to be scanned version: A str of the package version to scan.
- class mainframe.models.schemas.ObservationKind(*args, **kwds)[source]¶
Bases:
enum.EnumCreate a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- class mainframe.models.schemas.ObservationReport(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelModel for a report using the PyPI Observation API.
- kind: ObservationKind[source]¶
- class mainframe.models.schemas.ScannerReuseMetrics(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelBounded per-job counters; exported to Prometheus without database storage.
- lookups: ReuseCount[source]¶
- candidate_files: ReuseCount[source]¶
- reused_files: ReuseCount[source]¶
- reused_bytes: ReuseBytes[source]¶
- inserted_files: ReuseCount[source]¶
- evicted_files: ReuseCount[source]¶
- errors: ReuseCount[source]¶
- validated_files: ReuseCount[source]¶
- mismatched_files: ReuseCount[source]¶
- overhead_us: ReuseMicros[source]¶
- engine_us: ReuseMicros[source]¶
- engine_files: ReuseCount[source]¶
- engine_bytes: ReuseBytes[source]¶
- class mainframe.models.schemas.PackageScanResult(/, **data: Any)[source]¶
Bases:
PackageSpecifierClient payload to server containing the results of a package scan.
- scan_reuse: ScannerReuseMetrics | None = None[source]¶
- class mainframe.models.schemas.PackageScanResultFail(/, **data: Any)[source]¶
Bases:
PackageSpecifierThe client’s reason as to why scanning a package failed.
- scan_reuse: ScannerReuseMetrics | None = None[source]¶
- class mainframe.models.schemas.JobResult(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelPackage information of a requested job.
- class mainframe.models.schemas.GetRules(/, **data: Any)[source]¶
Bases:
pydantic.BaseModel- !!! abstract “Usage Documentation”
[Models](../concepts/models.md)
A base class for creating Pydantic models.
- __pydantic_complete__[source]¶
Whether model building is completed, or if there are still undefined fields.
- __pydantic_decorators__[source]¶
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_generic_metadata__[source]¶
A dictionary containing metadata about generic Pydantic models. The origin and args items map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and the parameter item maps to the __parameter__ attribute of generic classes.
- __pydantic_parent_namespace__[source]¶
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_serializer__[source]¶
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__[source]¶
The pydantic-core SchemaValidator used to validate instances of the model.
- __pydantic_fields__[source]¶
A dictionary of field names and their corresponding [FieldInfo][pydantic.fields.FieldInfo] objects.
- __pydantic_computed_fields__[source]¶
A dictionary of computed field names and their corresponding [ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects.
- class mainframe.models.schemas.OpenGrepScanResult(/, **data: Any)[source]¶
Bases:
PackageSpecifierComplete or partial OpenGrep shadow result with preserved findings.
- scan_reuse: ScannerReuseMetrics | None = None[source]¶
- findings: list[OpenGrepFinding] = None[source]¶
- class mainframe.models.schemas.OpenGrepScanResultFail(/, **data: Any)[source]¶
Bases:
PackageSpecifierFailed OpenGrep shadow result.
- scan_reuse: ScannerReuseMetrics | None = None[source]¶
- class mainframe.models.schemas.OpenGrepAlert(/, **data: Any)[source]¶
Bases:
PackageSpecifierAn alert delivered to Discord and eligible for OpenGrep processing.
- class mainframe.models.schemas.OpenGrepResult(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelCompleted OpenGrep shadow work awaiting bot publication.
- findings: list[OpenGrepFinding][source]¶
- finished_at: datetime.datetime[source]¶
- class mainframe.models.schemas.OpenGrepPublicationClaim(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelIdentify the publisher holding a shadow-result lease.
- class mainframe.models.schemas.OpenGrepPublicationProgress(/, **data: Any)[source]¶
Bases:
OpenGrepPublicationClaimDurable Discord publication progress for retry-safe resumption.
- class mainframe.models.schemas.OpenGrepPublished(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelPublication acknowledgement for a completed shadow result.
- published_at: datetime.datetime[source]¶
- class mainframe.models.schemas.NoJob(/, **data: Any)[source]¶
Bases:
pydantic.BaseModelReturned when no available jobs were found.