ce75b1716a0ebd0f16cf4246b19ed2024e04670f
[so.git] / common / src / main / java / org / onap / so / client / aai / AAIObjectType.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.so.client.aai;
22
23 import org.onap.so.client.graphinventory.GraphInventoryObjectType;
24
25 import com.google.common.base.CaseFormat;
26
27 public enum AAIObjectType implements GraphInventoryObjectType {
28
29         DEFAULT_CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/att-aic/{cloud-region-id}"),
30         CUSTOMER(AAINamespaceConstants.BUSINESS, "/customers/customer/{global-customer-id}"),
31         GENERIC_QUERY("/search", "/generic-query"),
32         BULK_PROCESS("/bulkprocess", ""),
33         GENERIC_VNF(AAINamespaceConstants.NETWORK, "/generic-vnfs/generic-vnf/{vnf-id}"),
34         VF_MODULE(AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules/vf-module/{vf-module-id}"),
35         L3_NETWORK(AAINamespaceConstants.NETWORK, "/l3-networks/l3-network/{network-id}"),
36         NETWORK_POLICY(AAINamespaceConstants.NETWORK, "/network-policies/network-policy/{network-policy-id}"),
37         NODES_QUERY("/search", "/nodes-query"),
38         CUSTOM_QUERY("/query", ""),
39         ROUTE_TABLE_REFERENCE(AAINamespaceConstants.NETWORK, "/route-table-references/route-table-reference/{route-table-reference-id}"),
40         DEFAULT_TENANT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/att-aic/AAIAIC25", "/tenants/tenant/{tenant-id}"),
41         VCE(AAINamespaceConstants.NETWORK, "/vces/vce/{vnf-id}"),
42         VPN_BINDING(AAINamespaceConstants.NETWORK, "/vpn-bindings/vpn-binding/{vpn-id}"),
43         VPN_BINDINGS(AAINamespaceConstants.NETWORK, "/vpn-bindings"),
44         CONFIGURATION(AAINamespaceConstants.NETWORK, "/configurations/configuration/{configuration-id}"),
45         PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers/pserver/{hostname}"),
46         SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions/service-subscription/{service-type}"),
47         SERVICE_INSTANCE(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances/service-instance/{service-instance-id}"),
48         PROJECT(AAINamespaceConstants.BUSINESS, "/projects/project/{id}"),
49         LINE_OF_BUSINESS(AAINamespaceConstants.BUSINESS, "/lines-of-business/line-of-business/{id}"),
50         PLATFORM(AAINamespaceConstants.BUSINESS, "/platforms/platform/{id}"),
51         OWNING_ENTITY(AAINamespaceConstants.BUSINESS, "/owning-entities/owning-entity/{id}"),
52         ALLOTTED_RESOURCE(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/allotted-resources/allotted-resource/{id}"),
53         PNF(AAINamespaceConstants.NETWORK, "/pnfs/pnf/{pnf-name}"),
54         OPERATIONAL_ENVIRONMENT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/operational-environments/operational-environment/{operational-environment-id}"),
55         CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/{cloud-owner-id}/{cloud-region-id}"),
56         TENANT(AAIObjectType.CLOUD_REGION.uriTemplate(), "/tenants/tenant/{tenant-id}"),
57         VOLUME_GROUP(AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups/volume-group/{volume-group-id}"),
58         VSERVER(AAIObjectType.TENANT.uriTemplate(), "/vservers/vserver/{vserver-id}"),
59         MODEL_VER(AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", "/model-vers/model-ver/{model-version-id}"),
60         TUNNEL_XCONNECT(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), "/tunnel-xconnects/tunnel-xconnect/{tunnel-id}"),
61         P_INTERFACE(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces/p-interface/{interface-name}"),
62         PHYSICAL_LINK(AAINamespaceConstants.NETWORK, "/physical-links/physical-link/{link-name}"),
63         INSTANCE_GROUP(AAINamespaceConstants.NETWORK, "/instance-groups/instance-group/{id}"),
64         COLLECTION(AAINamespaceConstants.NETWORK, "/collections/collection/{collection-id}"),
65         UNKNOWN("", "");
66
67         private final String uriTemplate;
68         private final String parentUri;
69         private final String partialUri;
70         private AAIObjectType(String parentUri, String partialUri) {
71                 this.parentUri = parentUri;
72                 this.partialUri = partialUri;
73                 this.uriTemplate = parentUri + partialUri;
74         }
75
76         @Override
77         public String toString() {
78                 return this.uriTemplate();
79         }
80
81         @Override
82         public String typeName() {
83                 return this.typeName(CaseFormat.LOWER_HYPHEN);
84         }
85         @Override
86         public String typeName(CaseFormat format) {
87                 String enumName = this.name();
88                 if (this.equals(AAIObjectType.DEFAULT_CLOUD_REGION) || this.equals(AAIObjectType.DEFAULT_TENANT)) {
89                         enumName = enumName.replace("DEFAULT_", "");
90                 }
91
92                 return CaseFormat.UPPER_UNDERSCORE.to(format, enumName);
93         }
94
95         @Override
96         public String uriTemplate() {
97                 return this.uriTemplate;
98         }
99
100         @Override
101         public String partialUri() {
102                 return this.partialUri;
103         }
104 }