Coverage for ocp_resources/volume_snapshot_class.py: 0%
20 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-30 10:48 +0200
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-30 10:48 +0200
1# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md
3from typing import Any, Dict, Optional
4from ocp_resources.resource import Resource, MissingRequiredArgumentError
7class VolumeSnapshotClass(Resource):
8 """
9 VolumeSnapshotClass specifies parameters that a underlying storage system uses when creating a volume snapshot. A specific VolumeSnapshotClass is used by specifying its name in a VolumeSnapshot object. VolumeSnapshotClasses are non-namespaced
10 """
12 api_group: str = Resource.ApiGroup.SNAPSHOT_STORAGE_K8S_IO
14 def __init__(
15 self,
16 deletion_policy: Optional[str] = "",
17 driver: Optional[str] = "",
18 parameters: Optional[Dict[str, Any]] = None,
19 **kwargs: Any,
20 ) -> None:
21 """
22 Args:
23 deletion_policy (str): deletionPolicy determines whether a VolumeSnapshotContent created
24 through the VolumeSnapshotClass should be deleted when its bound
25 VolumeSnapshot is deleted. Supported values are "Retain" and
26 "Delete". "Retain" means that the VolumeSnapshotContent and its
27 physical snapshot on underlying storage system are kept. "Delete"
28 means that the VolumeSnapshotContent and its physical snapshot on
29 underlying storage system are deleted. Required.
31 driver (str): driver is the name of the storage driver that handles this
32 VolumeSnapshotClass. Required.
34 parameters (Dict[str, Any]): parameters is a key-value map with storage driver specific parameters
35 for creating snapshots. These values are opaque to Kubernetes.
37 """
38 super().__init__(**kwargs)
40 self.deletion_policy = deletion_policy
41 self.driver = driver
42 self.parameters = parameters
44 def to_dict(self) -> None:
45 super().to_dict()
47 if not self.kind_dict and not self.yaml_file:
48 if not self.deletion_policy:
49 raise MissingRequiredArgumentError(argument="self.deletion_policy")
51 if not self.driver:
52 raise MissingRequiredArgumentError(argument="self.driver")
54 self.res["deletionPolicy"] = self.deletion_policy
55 self.res["driver"] = self.driver
57 if self.parameters:
58 self.res["parameters"] = self.parameters
60 # End of generated code