Convert file endlines to Unix (LF)
[pti/o2.git] / o2ims / adapter / clients / orm_stx.py
1 # Copyright (C) 2021 Wind River Systems, Inc.
2 #
3 #  Licensed under the Apache License, Version 2.0 (the "License");
4 #  you may not use this file except in compliance with the License.
5 #  You may obtain a copy of the License at
6 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
9 #  Unless required by applicable law or agreed to in writing, software
10 #  distributed under the License is distributed on an "AS IS" BASIS,
11 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #  See the License for the specific language governing permissions and
13 #  limitations under the License.
14
15 # from datetime import datetime
16 from sqlalchemy import (
17     Table,
18     MetaData,
19     Column,
20     # Integer,
21     String,
22     # Date,
23     DateTime,
24     # engine,
25     # ForeignKey,
26     # event,
27     Enum
28 )
29
30 # from sqlalchemy.orm import mapper
31
32 # from o2ims.domain import stx_object as ocloudModel
33
34 from o2common.service.unit_of_work import AbstractUnitOfWork
35 # from o2ims.adapter.unit_of_work import SqlAlchemyUnitOfWork
36 from o2ims.domain.resource_type import ResourceTypeEnum
37
38 from o2common.helper import o2logging
39 logger = o2logging.get_logger(__name__)
40
41 metadata = MetaData()
42
43 stxobject = Table(
44     "stxcache",
45     metadata,
46     Column("id", String(255), primary_key=True),
47     Column("type", Enum(ResourceTypeEnum, native_enum=False)),
48     Column("name", String(255)),
49     Column("updatetime", DateTime),
50     Column("createtime", DateTime),
51     Column("hash", String(255)),
52     Column("content", String)
53 )
54
55
56 def start_o2ims_stx_mappers(uow: AbstractUnitOfWork):
57     return
58     # logger.info("Starting O2 IMS Stx mappers")
59     # mapper(ocloudModel.StxGenericModel, stxobject)
60
61     # with uow:
62     #     engine1 = uow.session.get_bind()
63     #     metadata.create_all(engine1)
64     #     uow.commit()