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(name, newMsProperties) {
32 for (var policy in this.loopJsonCache["microServicePolicies"]) {
33 if (this.loopJsonCache["microServicePolicies"][policy]["name"] === name) {
34 this.loopJsonCache["microServicePolicies"][policy]["properties"] = newMsProperties;
39 updateGlobalProperties(newGlobalProperties) {
40 this.loopJsonCache["globalPropertiesJson"] = newGlobalProperties;
43 updateOperationalPolicyProperties(newOpProperties) {
44 this.loopJsonCache["operationalPolicies"] = newOpProperties;
48 return this.loopJsonCache["name"];
51 getOperationalPolicyConfigurationJson() {
52 return this.loopJsonCache["operationalPolicies"]["0"]["configurationsJson"];
55 getOperationalPolicyJsonSchema() {
56 return this.loopJsonCache["operationalPolicySchema"];
59 getOperationalPolicies() {
60 return this.loopJsonCache["operationalPolicies"];
63 getGlobalProperties() {
64 return this.loopJsonCache["globalPropertiesJson"];
67 getDcaeDeploymentProperties() {
68 return this.loopJsonCache["globalPropertiesJson"]["dcaeDeployParameters"];
71 getMicroServicePolicies() {
72 return this.loopJsonCache["microServicePolicies"];
75 getMicroServiceForName(name) {
76 var msProperties=this.getMicroServicePolicies();
77 for (var policy in msProperties) {
78 if (msProperties[policy]["name"] === name) {
79 return msProperties[policy];
85 getMicroServicePropertiesForName(name) {
86 var msConfig = this.getMicroServiceForName(name);
87 if (msConfig !== null) {
88 return msConfig["properties"];
93 getMicroServiceJsonRepresentationForName(name) {
94 var msConfig = this.getMicroServiceForName(name);
95 if (msConfig !== null) {
96 return msConfig["jsonRepresentation"];
101 getResourceDetailsVfProperty() {
102 return this.loopJsonCache["modelService"]["resourceDetails"]["VF"];
105 getResourceDetailsVfModuleProperty() {
106 return this.loopJsonCache["modelService"]["resourceDetails"]["VFModule"];
110 return this.loopJsonCache.loopLogs;
114 return this.loopJsonCache.lastComputedState;
117 getComponentStates() {
118 return this.loopJsonCache.components;