Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion class_generator/schema/__cluster_version__.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.34.2
v1.34.4
Binary file modified class_generator/schema/__resources-mappings.json.gz
Binary file not shown.
322,912 changes: 302,306 additions & 20,606 deletions class_generator/schema/_definitions.json

Large diffs are not rendered by default.

230 changes: 221 additions & 9 deletions class_generator/tests/manifests/Deployment/deployment.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,15 @@ def __init__(
) -> None:
r"""
Args:
default_backend (dict[str, Any]): IngressBackend describes all endpoints for a given service and port.

ingress_class_name (str): ingressClassName is the name of an IngressClass cluster resource.
Ingress controller implementations use this field to know whether
they should be serving this Ingress resource, by a transitive
connection (controller -> IngressClass -> Ingress resource).
Although the `kubernetes.io/ingress.class` annotation (simple
constant name) was never formally defined, it was widely supported
by Ingress controllers to create a direct binding between Ingress
controller and Ingress resources. Newly created Ingress resources
should prefer using the field. However, even though the annotation
is officially deprecated, for backwards compatibility reasons,
ingress controllers should still honor that annotation if present.

rules (list[Any]): rules is a list of host rules used to configure the Ingress. If
unspecified, or no rule matches, all traffic is sent to the
default backend.

tls (list[Any]): tls represents the TLS configuration. Currently the Ingress only
supports a single TLS port, 443. If multiple members of this list
specify different hosts, they will be multiplexed on the same port
according to the hostname specified through the SNI TLS extension,
if the ingress controller fulfilling the ingress supports SNI.
default_backend (dict[str, Any]): resource apiGroup kind name service name port name number.

ingress_class_name (str): No field description from API

rules (list[Any]): host http paths backend resource apiGroup kind name service name port
name number path pathType enum: Exact, ImplementationSpecific,
Prefix.

tls (list[Any]): hosts secretName.

"""
super().__init__(**kwargs)
Expand Down
341 changes: 249 additions & 92 deletions class_generator/tests/manifests/Pod/pod.py

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions ocp_resources/backup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
from typing import Any
from warnings import warn

from ocp_resources.resource import NamespacedResource

warn(
"backup.py module will be removed in the next release, please import `Backup` from backup_velero.io.py "
"or backup_postgresql_cnpg_noobaa_io.py instead",
DeprecationWarning,
stacklevel=2,
)


class Backup(NamespacedResource):
"""
Expand Down
91 changes: 91 additions & 0 deletions ocp_resources/backup_postgresql_cnpg_noobaa_io.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md


from typing import Any

from ocp_resources.exceptions import MissingRequiredArgumentError
from ocp_resources.resource import NamespacedResource


class Backup(NamespacedResource):
"""
A Backup resource is a request for a PostgreSQL backup by the user.
"""

api_group: str = NamespacedResource.ApiGroup.POSTGRESQL_CNPG_NOOBAA_IO

def __init__(
self,
cluster: dict[str, Any] | None = None,
method: str | None = None,
online: bool | None = None,
online_configuration: dict[str, Any] | None = None,
plugin_configuration: dict[str, Any] | None = None,
target: str | None = None,
**kwargs: Any,
) -> None:
r"""
Args:
cluster (dict[str, Any]): The cluster to backup

method (str): The backup method to be used, possible options are
`barmanObjectStore`, `volumeSnapshot` or `plugin`. Defaults to:
`barmanObjectStore`.

online (bool): Whether the default type of backup with volume snapshots is online/hot
(`true`, default) or offline/cold (`false`) Overrides the default
setting specified in the cluster field
'.spec.backup.volumeSnapshot.online'

online_configuration (dict[str, Any]): Configuration parameters to control the online/hot backup with volume
snapshots Overrides the default settings specified in the cluster
'.backup.volumeSnapshot.onlineConfiguration' stanza

plugin_configuration (dict[str, Any]): Configuration parameters passed to the plugin managing this backup

target (str): The policy to decide which instance should perform this backup. If
empty, it defaults to `cluster.spec.backup.target`. Available
options are empty string, `primary` and `prefer-standby`.
`primary` to have backups run always on primary instances,
`prefer-standby` to have backups run preferably on the most
updated standby, if available.

"""
super().__init__(**kwargs)

self.cluster = cluster
self.method = method
self.online = online
self.online_configuration = online_configuration
self.plugin_configuration = plugin_configuration
self.target = target

def to_dict(self) -> None:

super().to_dict()

if not self.kind_dict and not self.yaml_file:
if self.cluster is None:
raise MissingRequiredArgumentError(argument="self.cluster")

self.res["spec"] = {}
_spec = self.res["spec"]

_spec["cluster"] = self.cluster

if self.method is not None:
_spec["method"] = self.method

if self.online is not None:
_spec["online"] = self.online

if self.online_configuration is not None:
_spec["onlineConfiguration"] = self.online_configuration

if self.plugin_configuration is not None:
_spec["pluginConfiguration"] = self.plugin_configuration

if self.target is not None:
_spec["target"] = self.target

# End of generated code
Loading