9219c77beacbe785ab2cb4dfbb3eb70c091f39cf
[sdc.git] / openecomp-be / lib / openecomp-tosca-lib / src / main / java / org / openecomp / sdc / tosca / csar / ToscaMetaEntry.java
1 /*
2  *(===========LICENSE_START=======================================================
3  *  Copyright (C) 2019 Nordix Foundation
4  * (===============================================================================
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License.
15  *
16  *  SPDX-License-Identifier: Apache-2.0
17  * (===========LICENSE_END=========================================================
18  */
19 package org.openecomp.sdc.tosca.csar;
20
21 import java.util.Arrays;
22 import java.util.Optional;
23 import lombok.AllArgsConstructor;
24 import lombok.Getter;
25
26 /**
27  * Represents entry keys in a TOSCA.meta file.
28  */
29 @AllArgsConstructor
30 @Getter
31 public enum ToscaMetaEntry {
32     // @formatter:off
33     TOSCA_META_FILE_VERSION_ENTRY("TOSCA-Meta-File-Version"),
34     CSAR_VERSION_ENTRY("CSAR-Version"),
35     CREATED_BY_ENTRY("Created-By"),
36     ENTRY_DEFINITIONS("Entry-Definitions"),
37     ETSI_ENTRY_MANIFEST("ETSI-Entry-Manifest"),
38     ETSI_ENTRY_CHANGE_LOG("ETSI-Entry-Change-Log"),
39     ETSI_ENTRY_TESTS("ETSI-Entry-Tests"),
40     ETSI_ENTRY_LICENSES("ETSI-Entry-Licenses"),
41     ETSI_ENTRY_CERTIFICATE("ETSI-Entry-Certificate"),
42     OTHER_DEFINITIONS("Other-Definitions");
43     // @formatter:on
44
45     private final String name;
46
47     public static Optional<ToscaMetaEntry> parse(final String name) {
48         return Arrays.stream(values()).filter(toscaMetaEntry -> toscaMetaEntry.getName().equals(name)).findFirst();
49     }
50 }