Coverage for ocp_resources/service_serving_knative_dev.py: 0%
17 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, List, Optional
4from ocp_resources.resource import NamespacedResource
7class Service(NamespacedResource):
8 """
9 Service acts as a top-level container that manages a Route and Configuration which implement a network service. Service exists to provide a singular abstraction which can be access controlled, reasoned about, and which encapsulates software lifecycle decisions such as rollout policy and team resource ownership. Service acts only as an orchestrator of the underlying Routes and Configurations (much as a kubernetes Deployment orchestrates ReplicaSets), and its usage is optional but recommended.
10 The Service's controller will track the statuses of its owned Configuration and Route, reflecting their statuses and conditions as its own.
11 See also: https://github.com/knative/serving/blob/main/docs/spec/overview.md#service
12 """
14 api_group: str = NamespacedResource.ApiGroup.SERVING_KNATIVE_DEV
16 def __init__(
17 self,
18 template: Optional[Dict[str, Any]] = None,
19 traffic: Optional[List[Any]] = None,
20 **kwargs: Any,
21 ) -> None:
22 """
23 Args:
24 template (Dict[str, Any]): Template holds the latest specification for the Revision to be stamped
25 out.
27 traffic (List[Any]): Traffic specifies how to distribute traffic over a collection of
28 revisions and configurations.
30 """
31 super().__init__(**kwargs)
33 self.template = template
34 self.traffic = traffic
36 def to_dict(self) -> None:
37 super().to_dict()
39 if not self.kind_dict and not self.yaml_file:
40 self.res["spec"] = {}
41 _spec = self.res["spec"]
43 if self.template:
44 _spec["template"] = self.template
46 if self.traffic:
47 _spec["traffic"] = self.traffic
49 # End of generated code