2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.heat.datatypes.model;
23 import java.util.HashMap;
25 import java.util.Objects;
27 public enum ContrailV2ResourceTypes {
28 NETWROK_IPAM("OS::ContrailV2::NetworkIpam"),
29 VIRTUAL_NETWORK("OS::ContrailV2::VirtualNetwork"),
30 NETWORK_POLICY("OS::ContrailV2::NetworkPolicy"),
31 VIRTUAL_MACHINE_INTERFACE("OS::ContrailV2::VirtualMachineInterface");
33 private static Map<String, ContrailV2ResourceTypes> stringToContrailV2ResourceTypeMap;
36 stringToContrailV2ResourceTypeMap = new HashMap<>();
38 for (ContrailV2ResourceTypes type : ContrailV2ResourceTypes.values()) {
39 stringToContrailV2ResourceTypeMap.put(type.contrailV2ResourceType, type);
43 private String contrailV2ResourceType;
45 ContrailV2ResourceTypes(String contrailV2ResourceType) {
46 this.contrailV2ResourceType = contrailV2ResourceType;
49 public static ContrailV2ResourceTypes findByContrailV2Resource(String contrailV2Resource) {
50 return stringToContrailV2ResourceTypeMap.get(contrailV2Resource);
53 public static boolean isResourceTypeContrailV2(String resourceType) {
54 return Objects.nonNull(findByContrailV2Resource(resourceType));
57 public String getContrailV2ResourceType() {
58 return contrailV2ResourceType;