|
| 1 | +# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md |
| 2 | + |
| 3 | + |
| 4 | +from typing import Any |
| 5 | + |
| 6 | +from ocp_resources.resource import NamespacedResource |
| 7 | + |
| 8 | + |
| 9 | +class Backup(NamespacedResource): |
| 10 | + """ |
| 11 | + Backup is a Velero resource that represents the capture of Kubernetes |
| 12 | + cluster state at a point in time (API objects and associated volume state). |
| 13 | + """ |
| 14 | + |
| 15 | + api_group: str = NamespacedResource.ApiGroup.VELERO_IO |
| 16 | + |
| 17 | + def __init__( |
| 18 | + self, |
| 19 | + csi_snapshot_timeout: str | None = None, |
| 20 | + datamover: str | None = None, |
| 21 | + default_volumes_to_fs_backup: bool | None = None, |
| 22 | + default_volumes_to_restic: bool | None = None, |
| 23 | + excluded_cluster_scoped_resources: list[Any] | None = None, |
| 24 | + excluded_namespace_scoped_resources: list[Any] | None = None, |
| 25 | + excluded_namespaces: list[Any] | None = None, |
| 26 | + excluded_resources: list[Any] | None = None, |
| 27 | + hooks: dict[str, Any] | None = None, |
| 28 | + include_cluster_resources: bool | None = None, |
| 29 | + included_cluster_scoped_resources: list[Any] | None = None, |
| 30 | + included_namespace_scoped_resources: list[Any] | None = None, |
| 31 | + included_namespaces: list[Any] | None = None, |
| 32 | + included_resources: list[Any] | None = None, |
| 33 | + item_operation_timeout: str | None = None, |
| 34 | + label_selector: dict[str, Any] | None = None, |
| 35 | + metadata: dict[str, Any] | None = None, |
| 36 | + or_label_selectors: list[Any] | None = None, |
| 37 | + ordered_resources: dict[str, Any] | None = None, |
| 38 | + resource_policy: dict[str, Any] | None = None, |
| 39 | + snapshot_move_data: bool | None = None, |
| 40 | + snapshot_volumes: bool | None = None, |
| 41 | + storage_location: str | None = None, |
| 42 | + ttl: str | None = None, |
| 43 | + uploader_config: dict[str, Any] | None = None, |
| 44 | + volume_snapshot_locations: list[Any] | None = None, |
| 45 | + **kwargs: Any, |
| 46 | + ) -> None: |
| 47 | + r""" |
| 48 | + Args: |
| 49 | + csi_snapshot_timeout (str): CSISnapshotTimeout specifies the time used to wait for CSI |
| 50 | + VolumeSnapshot status turns to ReadyToUse during creation, before |
| 51 | + returning error as timeout. The default value is 10 minute. |
| 52 | +
|
| 53 | + datamover (str): DataMover specifies the data mover to be used by the backup. If |
| 54 | + DataMover is "" or "velero", the built-in data mover will be used. |
| 55 | +
|
| 56 | + default_volumes_to_fs_backup (bool): DefaultVolumesToFsBackup specifies whether pod volume file system |
| 57 | + backup should be used for all volumes by default. |
| 58 | +
|
| 59 | + default_volumes_to_restic (bool): DefaultVolumesToRestic specifies whether restic should be used to take |
| 60 | + a backup of all pod volumes by default. Deprecated: this field is |
| 61 | + no longer used and will be removed entirely in future. Use |
| 62 | + DefaultVolumesToFsBackup instead. |
| 63 | +
|
| 64 | + excluded_cluster_scoped_resources (list[Any]): ExcludedClusterScopedResources is a slice of cluster-scoped resource |
| 65 | + type names to exclude from the backup. If set to "*", all cluster- |
| 66 | + scoped resource types are excluded. The default value is empty. |
| 67 | +
|
| 68 | +
|
| 69 | + excluded_namespace_scoped_resources (list[Any]): ExcludedNamespaceScopedResources is a slice of namespace-scoped |
| 70 | + resource type names to exclude from the backup. If set to "*", all |
| 71 | + namespace-scoped resource types are excluded. The default value is |
| 72 | + empty. |
| 73 | +
|
| 74 | + excluded_namespaces (list[Any]): ExcludedNamespaces contains a list of namespaces that are not included |
| 75 | + in the backup. |
| 76 | +
|
| 77 | + excluded_resources (list[Any]): ExcludedResources is a slice of resource names that are not included |
| 78 | + in the backup. |
| 79 | +
|
| 80 | + hooks (dict[str, Any]): Hooks represent custom behaviors that should be executed at different |
| 81 | + phases of the backup. |
| 82 | +
|
| 83 | + include_cluster_resources (bool): IncludeClusterResources specifies whether cluster-scoped resources |
| 84 | + should be included for consideration in the backup. |
| 85 | +
|
| 86 | + included_cluster_scoped_resources (list[Any]): IncludedClusterScopedResources is a slice of cluster-scoped resource |
| 87 | + type names to include in the backup. If set to "*", all cluster- |
| 88 | + scoped resource types are included. The default value is empty, |
| 89 | + which means only related cluster-scoped resources are included. |
| 90 | +
|
| 91 | + included_namespace_scoped_resources (list[Any]): IncludedNamespaceScopedResources is a slice of namespace-scoped |
| 92 | + resource type names to include in the backup. The default value is |
| 93 | + "*". |
| 94 | +
|
| 95 | + included_namespaces (list[Any]): IncludedNamespaces is a slice of namespace names to include objects |
| 96 | + from. If empty, all namespaces are included. |
| 97 | +
|
| 98 | + included_resources (list[Any]): IncludedResources is a slice of resource names to include in the |
| 99 | + backup. If empty, all resources are included. |
| 100 | +
|
| 101 | + item_operation_timeout (str): ItemOperationTimeout specifies the time used to wait for asynchronous |
| 102 | + BackupItemAction operations The default value is 4 hour. |
| 103 | +
|
| 104 | + label_selector (dict[str, Any]): LabelSelector is a metav1.LabelSelector to filter with when adding |
| 105 | + individual objects to the backup. If empty or nil, all objects are |
| 106 | + included. Optional. |
| 107 | +
|
| 108 | + metadata (dict[str, Any]): No field description from API |
| 109 | +
|
| 110 | + or_label_selectors (list[Any]): OrLabelSelectors is list of metav1.LabelSelector to filter with when |
| 111 | + adding individual objects to the backup. If multiple provided they |
| 112 | + will be joined by the OR operator. LabelSelector as well as |
| 113 | + OrLabelSelectors cannot co-exist in backup request, only one of |
| 114 | + them can be used. |
| 115 | +
|
| 116 | + ordered_resources (dict[str, Any]): OrderedResources specifies the backup order of resources of specific |
| 117 | + Kind. The map key is the resource name and value is a list of |
| 118 | + object names separated by commas. Each resource name has format |
| 119 | + "namespace/objectname". For cluster resources, simply use |
| 120 | + "objectname". |
| 121 | +
|
| 122 | + resource_policy (dict[str, Any]): ResourcePolicy specifies the referenced resource policies that backup |
| 123 | + should follow |
| 124 | +
|
| 125 | + snapshot_move_data (bool): SnapshotMoveData specifies whether snapshot data should be moved |
| 126 | +
|
| 127 | + snapshot_volumes (bool): SnapshotVolumes specifies whether to take snapshots of any PV's |
| 128 | + referenced in the set of objects included in the Backup. |
| 129 | +
|
| 130 | + storage_location (str): StorageLocation is a string containing the name of a |
| 131 | + BackupStorageLocation where the backup should be stored. |
| 132 | +
|
| 133 | + ttl (str): TTL is a time.Duration-parseable string describing how long the Backup |
| 134 | + should be retained for. |
| 135 | +
|
| 136 | + uploader_config (dict[str, Any]): UploaderConfig specifies the configuration for the uploader. |
| 137 | +
|
| 138 | + volume_snapshot_locations (list[Any]): VolumeSnapshotLocations is a list containing names of |
| 139 | + VolumeSnapshotLocations associated with this backup. |
| 140 | +
|
| 141 | +
|
| 142 | + """ |
| 143 | + super().__init__(**kwargs) |
| 144 | + |
| 145 | + self.csi_snapshot_timeout = csi_snapshot_timeout |
| 146 | + self.datamover = datamover |
| 147 | + self.default_volumes_to_fs_backup = default_volumes_to_fs_backup |
| 148 | + self.default_volumes_to_restic = default_volumes_to_restic |
| 149 | + self.excluded_cluster_scoped_resources = excluded_cluster_scoped_resources |
| 150 | + self.excluded_namespace_scoped_resources = excluded_namespace_scoped_resources |
| 151 | + self.excluded_namespaces = excluded_namespaces |
| 152 | + self.excluded_resources = excluded_resources |
| 153 | + self.hooks = hooks |
| 154 | + self.include_cluster_resources = include_cluster_resources |
| 155 | + self.included_cluster_scoped_resources = included_cluster_scoped_resources |
| 156 | + self.included_namespace_scoped_resources = included_namespace_scoped_resources |
| 157 | + self.included_namespaces = included_namespaces |
| 158 | + self.included_resources = included_resources |
| 159 | + self.item_operation_timeout = item_operation_timeout |
| 160 | + self.label_selector = label_selector |
| 161 | + self.metadata = metadata |
| 162 | + self.or_label_selectors = or_label_selectors |
| 163 | + self.ordered_resources = ordered_resources |
| 164 | + self.resource_policy = resource_policy |
| 165 | + self.snapshot_move_data = snapshot_move_data |
| 166 | + self.snapshot_volumes = snapshot_volumes |
| 167 | + self.storage_location = storage_location |
| 168 | + self.ttl = ttl |
| 169 | + self.uploader_config = uploader_config |
| 170 | + self.volume_snapshot_locations = volume_snapshot_locations |
| 171 | + |
| 172 | + def to_dict(self) -> None: |
| 173 | + |
| 174 | + super().to_dict() |
| 175 | + |
| 176 | + if not self.kind_dict and not self.yaml_file: |
| 177 | + self.res["spec"] = {} |
| 178 | + _spec = self.res["spec"] |
| 179 | + |
| 180 | + if self.csi_snapshot_timeout is not None: |
| 181 | + _spec["csiSnapshotTimeout"] = self.csi_snapshot_timeout |
| 182 | + |
| 183 | + if self.datamover is not None: |
| 184 | + _spec["datamover"] = self.datamover |
| 185 | + |
| 186 | + if self.default_volumes_to_fs_backup is not None: |
| 187 | + _spec["defaultVolumesToFsBackup"] = self.default_volumes_to_fs_backup |
| 188 | + |
| 189 | + if self.default_volumes_to_restic is not None: |
| 190 | + _spec["defaultVolumesToRestic"] = self.default_volumes_to_restic |
| 191 | + |
| 192 | + if self.excluded_cluster_scoped_resources is not None: |
| 193 | + _spec["excludedClusterScopedResources"] = self.excluded_cluster_scoped_resources |
| 194 | + |
| 195 | + if self.excluded_namespace_scoped_resources is not None: |
| 196 | + _spec["excludedNamespaceScopedResources"] = self.excluded_namespace_scoped_resources |
| 197 | + |
| 198 | + if self.excluded_namespaces is not None: |
| 199 | + _spec["excludedNamespaces"] = self.excluded_namespaces |
| 200 | + |
| 201 | + if self.excluded_resources is not None: |
| 202 | + _spec["excludedResources"] = self.excluded_resources |
| 203 | + |
| 204 | + if self.hooks is not None: |
| 205 | + _spec["hooks"] = self.hooks |
| 206 | + |
| 207 | + if self.include_cluster_resources is not None: |
| 208 | + _spec["includeClusterResources"] = self.include_cluster_resources |
| 209 | + |
| 210 | + if self.included_cluster_scoped_resources is not None: |
| 211 | + _spec["includedClusterScopedResources"] = self.included_cluster_scoped_resources |
| 212 | + |
| 213 | + if self.included_namespace_scoped_resources is not None: |
| 214 | + _spec["includedNamespaceScopedResources"] = self.included_namespace_scoped_resources |
| 215 | + |
| 216 | + if self.included_namespaces is not None: |
| 217 | + _spec["includedNamespaces"] = self.included_namespaces |
| 218 | + |
| 219 | + if self.included_resources is not None: |
| 220 | + _spec["includedResources"] = self.included_resources |
| 221 | + |
| 222 | + if self.item_operation_timeout is not None: |
| 223 | + _spec["itemOperationTimeout"] = self.item_operation_timeout |
| 224 | + |
| 225 | + if self.label_selector is not None: |
| 226 | + _spec["labelSelector"] = self.label_selector |
| 227 | + |
| 228 | + if self.metadata is not None: |
| 229 | + _spec["metadata"] = self.metadata |
| 230 | + |
| 231 | + if self.or_label_selectors is not None: |
| 232 | + _spec["orLabelSelectors"] = self.or_label_selectors |
| 233 | + |
| 234 | + if self.ordered_resources is not None: |
| 235 | + _spec["orderedResources"] = self.ordered_resources |
| 236 | + |
| 237 | + if self.resource_policy is not None: |
| 238 | + _spec["resourcePolicy"] = self.resource_policy |
| 239 | + |
| 240 | + if self.snapshot_move_data is not None: |
| 241 | + _spec["snapshotMoveData"] = self.snapshot_move_data |
| 242 | + |
| 243 | + if self.snapshot_volumes is not None: |
| 244 | + _spec["snapshotVolumes"] = self.snapshot_volumes |
| 245 | + |
| 246 | + if self.storage_location is not None: |
| 247 | + _spec["storageLocation"] = self.storage_location |
| 248 | + |
| 249 | + if self.ttl is not None: |
| 250 | + _spec["ttl"] = self.ttl |
| 251 | + |
| 252 | + if self.uploader_config is not None: |
| 253 | + _spec["uploaderConfig"] = self.uploader_config |
| 254 | + |
| 255 | + if self.volume_snapshot_locations is not None: |
| 256 | + _spec["volumeSnapshotLocations"] = self.volume_snapshot_locations |
| 257 | + |
| 258 | + # End of generated code |
| 259 | + |
0 commit comments