コード例 #1
0
 def target_ref(self, value: typing.Union["ObjectReference", dict]):
     """
     targetRef is a reference to a Kubernetes object that
     represents this endpoint.
     """
     if isinstance(value, dict):
         value = typing.cast(
             ObjectReference,
             ObjectReference().from_dict(value),
         )
     self._properties["targetRef"] = value
コード例 #2
0
 def related(self, value: typing.Union["ObjectReference", dict]):
     """
     related is the optional secondary object for more complex
     actions. E.g. when regarding object triggers a creation or
     deletion of related object.
     """
     if isinstance(value, dict):
         value = typing.cast(
             ObjectReference,
             ObjectReference().from_dict(value),
         )
     self._properties["related"] = value
コード例 #3
0
 def active(self, value: typing.Union[typing.List["ObjectReference"],
                                      typing.List[dict]]):
     """
     A list of pointers to currently running jobs.
     """
     cleaned: typing.List[ObjectReference] = []
     for item in value:
         if isinstance(item, dict):
             item = typing.cast(
                 ObjectReference,
                 ObjectReference().from_dict(item),
             )
         cleaned.append(typing.cast(ObjectReference, item))
     self._properties["active"] = cleaned
コード例 #4
0
 def regarding(self, value: typing.Union["ObjectReference", dict]):
     """
     regarding contains the object this Event is about. In most
     cases it's an Object reporting controller implements, e.g.
     ReplicaSetController implements ReplicaSets and this event
     is emitted because it acts on some changes in a ReplicaSet
     object.
     """
     if isinstance(value, dict):
         value = typing.cast(
             ObjectReference,
             ObjectReference().from_dict(value),
         )
     self._properties["regarding"] = value
コード例 #5
0
 def __init__(
     self,
     addresses: typing.List[str] = None,
     conditions: "EndpointConditions" = None,
     deprecated_topology: dict = None,
     hints: "EndpointHints" = None,
     hostname: str = None,
     node_name: str = None,
     target_ref: "ObjectReference" = None,
     zone: str = None,
 ):
     """Create Endpoint instance."""
     super(Endpoint, self).__init__(api_version="discovery/v1",
                                    kind="Endpoint")
     self._properties = {
         "addresses":
         addresses if addresses is not None else [],
         "conditions":
         conditions if conditions is not None else EndpointConditions(),
         "deprecatedTopology":
         deprecated_topology if deprecated_topology is not None else {},
         "hints":
         hints if hints is not None else EndpointHints(),
         "hostname":
         hostname if hostname is not None else "",
         "nodeName":
         node_name if node_name is not None else "",
         "targetRef":
         target_ref if target_ref is not None else ObjectReference(),
         "zone":
         zone if zone is not None else "",
     }
     self._types = {
         "addresses": (list, str),
         "conditions": (EndpointConditions, None),
         "deprecatedTopology": (dict, None),
         "hints": (EndpointHints, None),
         "hostname": (str, None),
         "nodeName": (str, None),
         "targetRef": (ObjectReference, None),
         "zone": (str, None),
     }
コード例 #6
0
 def __init__(
     self,
     action: str = None,
     deprecated_count: int = None,
     deprecated_first_timestamp: str = None,
     deprecated_last_timestamp: str = None,
     deprecated_source: "EventSource" = None,
     event_time: "MicroTime" = None,
     metadata: "ObjectMeta" = None,
     note: str = None,
     reason: str = None,
     regarding: "ObjectReference" = None,
     related: "ObjectReference" = None,
     reporting_controller: str = None,
     reporting_instance: str = None,
     series: "EventSeries" = None,
     type_: str = None,
 ):
     """Create Event instance."""
     super(Event, self).__init__(api_version="events/v1beta1", kind="Event")
     self._properties = {
         "action":
         action if action is not None else "",
         "deprecatedCount":
         deprecated_count if deprecated_count is not None else None,
         "deprecatedFirstTimestamp":
         deprecated_first_timestamp
         if deprecated_first_timestamp is not None else None,
         "deprecatedLastTimestamp":
         deprecated_last_timestamp
         if deprecated_last_timestamp is not None else None,
         "deprecatedSource":
         deprecated_source
         if deprecated_source is not None else EventSource(),
         "eventTime":
         event_time if event_time is not None else MicroTime(),
         "metadata":
         metadata if metadata is not None else ObjectMeta(),
         "note":
         note if note is not None else "",
         "reason":
         reason if reason is not None else "",
         "regarding":
         regarding if regarding is not None else ObjectReference(),
         "related":
         related if related is not None else ObjectReference(),
         "reportingController":
         reporting_controller if reporting_controller is not None else "",
         "reportingInstance":
         reporting_instance if reporting_instance is not None else "",
         "series":
         series if series is not None else EventSeries(),
         "type":
         type_ if type_ is not None else "",
     }
     self._types = {
         "action": (str, None),
         "apiVersion": (str, None),
         "deprecatedCount": (int, None),
         "deprecatedFirstTimestamp": (str, None),
         "deprecatedLastTimestamp": (str, None),
         "deprecatedSource": (EventSource, None),
         "eventTime": (MicroTime, None),
         "kind": (str, None),
         "metadata": (ObjectMeta, None),
         "note": (str, None),
         "reason": (str, None),
         "regarding": (ObjectReference, None),
         "related": (ObjectReference, None),
         "reportingController": (str, None),
         "reportingInstance": (str, None),
         "series": (EventSeries, None),
         "type": (str, None),
     }