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 * ===================================================================
24 export default class LoopCache {
27 constructor(loopJson) {
28 this.loopJsonCache=loopJson;
31 updateMicroServiceProperties(type, newMsProperties) {
32 if (newMsProperties["name"] === type) {
33 for (var policy in this.loopJsonCache["microServicePolicies"]) {
34 if (this.loopJsonCache["microServicePolicies"][policy]["name"] === type) {
35 this.loopJsonCache["microServicePolicies"][policy] = newMsProperties;
41 updateGlobalProperties(newGlobalProperties) {
42 this.loopJsonCache["globalPropertiesJson"] = newGlobalProperties;
45 updateOperationalPolicyProperties(newOpProperties) {
46 this.loopJsonCache["operationalPolicies"] = newOpProperties;
50 return this.loopJsonCache["name"];
53 getOperationalPolicyConfigurationJson() {
54 return JSON.parse(JSON.stringify(this.loopJsonCache["operationalPolicies"]["0"]["configurationsJson"]));
57 getOperationalPolicies() {
58 return JSON.parse(JSON.stringify(this.loopJsonCache["operationalPolicies"]));
61 getGlobalProperties() {
62 return JSON.parse(JSON.stringify(this.loopJsonCache["globalPropertiesJson"]));
65 getDcaeDeploymentProperties() {
66 return JSON.parse(JSON.stringify(this.loopJsonCache["globalPropertiesJson"]["dcaeDeployParameters"]));
69 getMicroServicesJsonForType(type) {
70 var msProperties = this.loopJsonCache["microServicePolicies"];
71 for (var policy in msProperties) {
72 if (msProperties[policy]["name"] === type) {
73 return JSON.parse(JSON.stringify(msProperties[policy]));
79 getMicroServiceProperties(type) {
80 var msProperties = this.loopJsonCache["microServicePolicies"];
81 for (var policy in msProperties) {
82 if (msProperties[policy]["name"] === type) {
83 if (msProperties[policy]["properties"] !== null && msProperties[policy]["properties"] !== undefined) {
84 return JSON.parse(JSON.stringify(msProperties[policy]["properties"]));
91 getMicroServiceJsonRepresentationForType(type) {
92 var msProperties = this.loopJsonCache["microServicePolicies"];
93 for (var policy in msProperties) {
94 if (msProperties[policy]["name"] === type) {
95 return JSON.parse(JSON.stringify(msProperties[policy]["jsonRepresentation"]));
101 getResourceDetailsVfProperty() {
102 return this.loopJsonCache["modelPropertiesJson"]["resourceDetails"]["VF"];
105 getResourceDetailsVfModuleProperty() {
106 return this.loopJsonCache["modelPropertiesJson"]["resourceDetails"]["VFModule"];
110 return this.loopJsonCache.loopLogs;
113 getComponentStates() {
114 return this.loopJsonCache.components;