1725bf9fba5639337e06f42955adb85b9220862e
[so.git] / adapters / etsi-sol003-adapter / etsi-sol003-pkgm / etsi-sol003-pkgm-adapter / src / main / java / org / onap / so / adapters / etsisol003adapter / pkgm / extclients / etsicatalog / EtsiCatalogUrlProvider.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  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog;
22
23 import static org.slf4j.LoggerFactory.getLogger;
24 import org.slf4j.Logger;
25 import org.springframework.beans.factory.annotation.Value;
26 import org.springframework.stereotype.Service;
27
28 /**
29  * Provides the URLs for the REST Requests to the ETSI Catalog Manager.
30  * 
31  * @author gareth.roper@est.tech
32  */
33 @Service
34 public class EtsiCatalogUrlProvider {
35
36     private static final Logger logger = getLogger(EtsiCatalogUrlProvider.class);
37
38     @Value("${etsi-catalog-manager.vnfpkgm.endpoint}")
39     private String etsiCatalogManagerEndpoint;
40
41     public EtsiCatalogUrlProvider() {}
42
43     /**
44      * Get the URL for retrieving the Package Content from the ETSI Catalog.".
45      *
46      * @param vnfPkgId The ID of the VNF Package
47      * @return the URL for the GET operation
48      */
49     public String getVnfPackageContentUrl(final String vnfPkgId) {
50         final String url = etsiCatalogManagerEndpoint + "/vnf_packages/" + vnfPkgId + "/package_content";
51         logger.info("getEtsiCatalogVnfPackageContentUrl: {}", url);
52         return url;
53     }
54
55     /**
56      * Get the URL for retrieving VNF packages information from ETSI Catalog.".
57      *
58      * @return the URL for the GET operation
59      */
60     public String getVnfPackagesUrl() {
61         final String url = etsiCatalogManagerEndpoint + "/vnf_packages";
62         logger.info("getEtsiCatalogVnfPackagesEndpoint: {}", url);
63         return url;
64     }
65
66     /**
67      * Get the URL for retrieving specific VNF package information from the ETSI Catalog.".
68      *
69      * @param vnfPkgId The ID of the VNF Package
70      * @return the URL for the GET operation
71      */
72     public String getVnfPackageUrl(final String vnfPkgId) {
73         final String url = etsiCatalogManagerEndpoint + "/vnf_packages/" + vnfPkgId;
74         logger.info("getEtsiCatalogVnfPackageEndpoint: {}", url);
75         return url;
76     }
77
78     /**
79      * Get the URL for retrieving VNF Package Artifacts
80      *
81      * @param vnfPkgId The ID of the VNF Package
82      * @param artifactPath The path to the Artifact
83      * @return the URL for the GET operation
84      */
85     public String getVnfPackageArtifactUrl(final String vnfPkgId, final String artifactPath) {
86         final String url = etsiCatalogManagerEndpoint + "/vnf_packages/" + vnfPkgId + "/artifacts/" + artifactPath;
87         logger.info("getVnfPackageArtifactUrl: {}", url);
88         return url;
89     }
90
91     /**
92      * Get the URL for retrieving VNF packages vnfd from ETSI Catalog.
93      *
94      * @param vnfPkgId The ID of the VNF Package
95      * @return the URL for the GET operation
96      */
97     public String getVnfPackageVnfdUrl(final String vnfPkgId) {
98         final String url = etsiCatalogManagerEndpoint + "/vnf_packages/" + vnfPkgId + "/vnfd";
99         logger.info("getEtsiCatalogVnfPackageVnfd: {}", url);
100         return url;
101     }
102
103     /**
104      * Get the URL for posting/retrieving a Subscription
105      *
106      * @return the URL for the operation
107      */
108     public String getSubscriptionUrl() {
109         final String url = etsiCatalogManagerEndpoint + "/subscriptions";
110         logger.info("getSubscriptionNotificationUrl: {}", url);
111         return url;
112     }
113 }