1 # ================================================================================
2 # Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved.
3 # ================================================================================
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 # ============LICENSE_END=========================================================
17 """ ORM - mapping class for dtih_event_ack table """
20 from sqlalchemy import Column, String, Integer, ForeignKey, func
21 from sqlalchemy.dialects.postgresql import JSONB, TIMESTAMP
22 from sqlalchemy.orm import relationship
23 from sqlalchemy.ext.declarative import declarative_base
24 from ..models import Event
26 Base = declarative_base()
29 __tablename__ = 'dtih_event_ack'
30 __table_args__ = {'schema': 'dti'}
31 dtih_event_ack_id = Column(Integer, primary_key=True)
32 create_ts = Column(TIMESTAMP(timezone=True), default=func.now())
33 last_modified_ts = Column(TIMESTAMP(timezone=True), default=func.now())
34 action = Column(String)
35 k8s_namespace = Column(String)
36 k8s_service_name = Column(String)
37 k8s_service_port = Column(String)
38 k8s_cluster_fqdn = Column(String)
39 k8s_proxy_fqdn = Column(String)
40 k8s_pod_id = Column(String)
41 service_component = Column(String)
42 deployment_id = Column(String)
43 container_type = Column(String)
44 docker_host = Column(String)
45 container_id = Column(String)
46 reconfig_script = Column(String)
47 dtih_event_id = Column(Integer, ForeignKey(Event.dtih_event_id))
48 event = relationship(Event)
50 def update_action(self, action):
51 setattr(self, 'action', action)