From c5f1159429e00eacdd0d2afff82cf854bdb41187 Mon Sep 17 00:00:00 2001 From: jananib Date: Thu, 27 Feb 2020 16:36:54 +0530 Subject: NSSMF Manager models Adding models to NSSMF Manager Change-Id: Ie3bb8554c0de12a1fc8703a1dd67a20d4e8ae33c Issue-ID: SO-2544 Signed-off-by: jananib --- .../onap/so/adapters/nssmf/rest/HttpMethod.java | 41 ++++++++++ .../org/onap/so/adapters/nssmf/rest/JobStatus.java | 42 ++++++++++ .../org/onap/so/adapters/nssmf/rest/NssmfInfo.java | 94 ++++++++++++++++++++++ 3 files changed, 177 insertions(+) create mode 100644 adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/HttpMethod.java create mode 100644 adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/JobStatus.java create mode 100644 adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfInfo.java (limited to 'adapters') diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/HttpMethod.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/HttpMethod.java new file mode 100644 index 0000000000..f6abd98794 --- /dev/null +++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/HttpMethod.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nssmf.rest; + +public enum HttpMethod { + GET, POST, PUT, DELETE, PATCH; + + public static HttpMethod fromString(String s) { + if (s == null) + return null; + if (("get").equalsIgnoreCase(s)) + return GET; + if (("post").equalsIgnoreCase(s)) + return POST; + if (("put").equalsIgnoreCase(s)) + return PUT; + if (("delete").equalsIgnoreCase(s)) + return DELETE; + if (("patch").equalsIgnoreCase(s)) + return PATCH; + throw new IllegalArgumentException("Invalid value for HTTP Method: " + s); + } +} diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/JobStatus.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/JobStatus.java new file mode 100644 index 0000000000..f2e651fd6e --- /dev/null +++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/JobStatus.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nssmf.rest; + +import org.onap.so.adapters.nssmf.exceptions.ApplicationException; + + +public enum JobStatus { + STARTED, PROCESSING, FINISHED, ERROR; + + public static JobStatus fromString(String s) throws ApplicationException { + if (s == null) + return null; + if (("started").equalsIgnoreCase(s)) + return STARTED; + if (("processing").equalsIgnoreCase(s)) + return PROCESSING; + if (("finished").equalsIgnoreCase(s)) + return FINISHED; + if (("error").equalsIgnoreCase(s)) + return ERROR; + throw new ApplicationException(500, "Invalid value for Job " + "Status: " + s); + } +} diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfInfo.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfInfo.java new file mode 100644 index 0000000000..6306643a97 --- /dev/null +++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfInfo.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nssmf.rest; + +public class NssmfInfo { + + private String url; + + private String ipAddress; + + private String port; + + private String insecure; + + private String cacert; + + private String userName; + + private String password; + + public String getInsecure() { + return insecure; + } + + public void setInsecure(String insecure) { + this.insecure = insecure; + } + + public String getCacert() { + return cacert; + } + + public void setCacert(String cacert) { + this.cacert = cacert; + } + + public String getIpAddress() { + return ipAddress; + } + + public void setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } +} -- cgit 1.2.3-korg