X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=mod%2Fdistributorapi%2Fdistributor%2Fdata_access.py;h=5b544d8ff0cceafc443a11df7b6f8a3bfa03788f;hb=c83d2369eb2f0ac40d5acd2db2d7350fe86101e5;hp=e1a45e3a966af8075b912e6eefdb38615ba0711b;hpb=2b31b78fb0c6621259898c3553187be4ab0acf8a;p=dcaegen2%2Fplatform.git diff --git a/mod/distributorapi/distributor/data_access.py b/mod/distributorapi/distributor/data_access.py index e1a45e3..5b544d8 100644 --- a/mod/distributorapi/distributor/data_access.py +++ b/mod/distributorapi/distributor/data_access.py @@ -1,5 +1,5 @@ # ============LICENSE_START======================================================= -# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2019-2022 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -29,9 +29,10 @@ def get_distribution_targets(): def get_distribution_target(ds_id): global _cache - result = [ i for i in _cache if i["dt_id"] == ds_id ] + result = [i for i in _cache if i["dt_id"] == ds_id] return result[0] if result else {} + def transform_request(req): """Transform request to object to store @@ -44,6 +45,7 @@ def transform_request(req): req["processGroups"] = [] return req + def add_distribution_target(dt): global _cache _cache.append(dt) @@ -58,6 +60,7 @@ def merge_request(dt, req): dt["modified"] = datetime.utcnow().isoformat() return dt + def update_distribution_target(updated_dt): dt_id = updated_dt["dt_id"] global _cache @@ -85,5 +88,3 @@ def add_process_group(ds_id, process_group): dt["processGroups"].append(process_group) return process_group return None - -