2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END============================================
20 * ===================================================================
27 constructor(loopJson) {
28 this.loopJsonCache=loopJson;
29 //LoopCache.SET_LOOP_JSON_CACHE(require('./example.json');
32 updateMsProperties(type, newMsProperties) {
33 if (newMsProperties["name"] == type) {
34 for (var policy in this.loopJsonCache["microServicePolicies"]) {
35 if (this.loopJsonCache["microServicePolicies"][policy]["name"] == type) {
36 this.loopJsonCache["microServicePolicies"][policy] = newMsProperties;
42 updateGlobalProperties(newGlobalProperties) {
43 this.loopJsonCache["globalPropertiesJson"] = newGlobalProperties;
46 updateOpPolicyProperties(newOpProperties) {
47 this.loopJsonCache["operationalPolicies"] = newOpProperties;
51 return this.loopJsonCache["name"];
54 getOperationalPolicyProperty() {
55 return JSON.parse(JSON.stringify(this.loopJsonCache["operationalPolicies"]["0"]["configurationsJson"]));
58 getOperationalPolicies() {
59 return JSON.parse(JSON.stringify(this.loopJsonCache["operationalPolicies"]));
63 return JSON.parse(JSON.stringify(this.loopJsonCache["globalPropertiesJson"]));
66 getDeploymentProperties() {
67 return JSON.parse(JSON.stringify(this.loopJsonCache["globalPropertiesJson"]["dcaeDeployParameters"]));
71 var msProperties = this.loopJsonCache["microServicePolicies"];
72 for (var policy in msProperties) {
73 if (msProperties[policy]["name"] == type) {
74 return JSON.parse(JSON.stringify(msProperties[policy]));
81 var msProperties = this.loopJsonCache["microServicePolicies"];
82 for (var policy in msProperties) {
83 if (msProperties[policy]["name"] == type) {
84 if (msProperties[policy]["properties"] !== null && msProperties[policy]["properties"] !== undefined) {
85 return JSON.parse(JSON.stringify(msProperties[policy]["properties"]));
93 var msProperties = this.loopJsonCache["microServicePolicies"];
94 for (var policy in msProperties) {
95 if (msProperties[policy]["name"] == type) {
96 return JSON.parse(JSON.stringify(msProperties[policy]["jsonRepresentation"]));
102 getResourceDetailsVfProperty() {
103 return this.loopJsonCache["modelPropertiesJson"]["resourceDetails"]["VF"];
106 getResourceDetailsVfModuleProperty() {
107 return this.loopJsonCache["modelPropertiesJson"]["resourceDetails"]["VFModule"];
111 return this.loopJsonCache.loopLogs;
114 getComponentStates() {
115 return this.loopJsonCache.components;
118 get getLoopJsonCache() {
119 return this.loopJsonCache;
122 set setLoopJsonCache(newJson) {
123 this.loopJsonCache = newJson;
127 export const LOOP_CACHE = new LoopCache(require('./example.json'));
129 export default LoopCache;