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.mso.client.aai;
\r
23 import com.google.common.base.CaseFormat;
\r
25 public enum AAIObjectType implements AAIObjectName, AAIObjectUriTemplate, AAIObjectUriPartial {
\r
27 DEFAULT_CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/att-aic/{cloud-region-id}"),
\r
28 CUSTOMER(AAINamespaceConstants.BUSINESS, "/customers/customer/{global-customer-id}"),
\r
29 GENERIC_QUERY("/search", "/generic-query"),
\r
30 BULK_PROCESS("/bulkprocess", ""),
\r
31 GENERIC_VNF(AAINamespaceConstants.NETWORK, "/generic-vnfs/generic-vnf/{vnf-id}"),
\r
32 VF_MODULE(AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules/vf-module/{vf-module-id}"),
\r
33 L3_NETWORK(AAINamespaceConstants.NETWORK, "/l3-networks/l3-network/{network-id}"),
\r
34 NETWORK_POLICY(AAINamespaceConstants.NETWORK, "/network-policies/network-policy/{network-policy-id}"),
\r
35 NODES_QUERY("/search", "/nodes-query"),
\r
36 CUSTOM_QUERY("/query", ""),
\r
37 ROUTE_TABLE_REFERENCE(AAINamespaceConstants.NETWORK, "/route-table-references/route-table-reference/{route-table-reference-id}"),
\r
38 DEFAULT_TENANT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/att-aic/AAIAIC25", "/tenants/tenant/{tenant-id}"),
\r
39 VCE(AAINamespaceConstants.NETWORK, "/vces/vce/{vnf-id}"),
\r
40 VPN_BINDING(AAINamespaceConstants.NETWORK, "/vpn-bindings/vpn-binding/{vpn-id}"),
\r
41 CONFIGURATION(AAINamespaceConstants.NETWORK, "/configurations/configuration/{configuration-id}"),
\r
42 PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers/pserver/{hostname}"),
\r
43 SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions/service-subscription/{service-type}"),
\r
44 SERVICE_INSTANCE(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances/service-instance/{service-instance-id}"),
\r
45 PROJECT(AAINamespaceConstants.BUSINESS, "/projects/project/{id}"),
\r
46 LINE_OF_BUSINESS(AAINamespaceConstants.BUSINESS, "/lines-of-business/line-of-business/{id}"),
\r
47 PLATFORM(AAINamespaceConstants.BUSINESS, "/platforms/platform/{id}"),
\r
48 OWNING_ENTITY(AAINamespaceConstants.BUSINESS, "/owning-entities/owning-entity/{id}"),
\r
49 ALLOTTED_RESOURCE(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/allotted-resources/allotted-resource/{id}"),
\r
50 PNF(AAINamespaceConstants.NETWORK, "/pnfs/pnf/{pnf-name}"),
\r
51 OPERATIONAL_ENVIRONMENT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/operational-environments/operational-environment/{operational-environment-id}"),
\r
52 CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/{cloud-owner-id}/{cloud-region-id}"),
\r
53 TENANT(AAIObjectType.CLOUD_REGION.uriTemplate(), "/tenants/tenant/{tenant-id}"),
\r
54 VSERVER(AAIObjectType.TENANT.uriTemplate(), "/vservers/vserver/{vserver-id}"),
\r
55 MODEL_VER(AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", "/model-vers/model-ver/{model-version-id}"),
\r
56 TUNNEL_XCONNECT(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), "/tunnel-xconnects/tunnel-xconnect/{id}"),
\r
57 P_INTERFACE(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces/p-interface/{interface-name}"),
\r
58 PHYSICAL_LINK(AAINamespaceConstants.NETWORK, "/physical-links/physical-link/{link-name}"),
\r
61 private final String uriTemplate;
\r
62 private final String parentUri;
\r
63 private final String partialUri;
\r
64 private AAIObjectType(String parentUri, String partialUri) {
\r
65 this.parentUri = parentUri;
\r
66 this.partialUri = partialUri;
\r
67 this.uriTemplate = parentUri + partialUri;
\r
71 public String toString() {
\r
72 return this.uriTemplate();
\r
76 public String typeName() {
\r
77 return this.typeName(CaseFormat.LOWER_HYPHEN);
\r
80 public String typeName(CaseFormat format) {
\r
81 String enumName = this.name();
\r
82 if (this.equals(AAIObjectType.DEFAULT_CLOUD_REGION) || this.equals(AAIObjectType.DEFAULT_TENANT)) {
\r
83 enumName = enumName.replace("DEFAULT_", "");
\r
86 return CaseFormat.UPPER_UNDERSCORE.to(format, enumName);
\r
90 public String uriTemplate() {
\r
91 return this.uriTemplate;
\r
95 public String partialUri() {
\r
96 return this.partialUri;
\r