diff options
Diffstat (limited to 'src/main')
13 files changed, 1449 insertions, 0 deletions
diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/PostServiceResponseSpecJsonTransformer.java b/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/PostServiceResponseSpecJsonTransformer.java new file mode 100644 index 0000000..d9b10b3 --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/PostServiceResponseSpecJsonTransformer.java @@ -0,0 +1,53 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 <rakeshgirijaramesannair> + * =================================================================== + * 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.nbi.apis.servicecatalog.jolt; + +import java.util.List; + +import org.onap.nbi.exceptions.TechnicalException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import com.bazaarvoice.jolt.Chainr; +import com.bazaarvoice.jolt.JsonUtils; +import com.bazaarvoice.jolt.exception.JoltException; + +/** + * @author rakeshgirijaramesannair + * + */ +@Service +public class PostServiceResponseSpecJsonTransformer { + private Chainr chainr; + + private static final Logger LOGGER = LoggerFactory.getLogger(PostServiceSpecJsonTransformer.class); + + public PostServiceResponseSpecJsonTransformer() { + List<Object> specs = JsonUtils.classpathToList("/jolt/postServiceCatalogResponse.json"); + this.chainr = Chainr.fromSpec(specs); + } + + public Object transform(Object serviceSpec) { + Object output = null; + try { + output = chainr.transform(serviceSpec); + } catch (JoltException joE) { + LOGGER.error("Unable to transform SDC response to TMF format with JOLT Transformer -Ext API Post", joE); + throw new TechnicalException("Error while parsing ONAP SDC response"); + } + return output; + } + +} diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/PostServiceSpecJsonTransformer.java b/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/PostServiceSpecJsonTransformer.java new file mode 100644 index 0000000..80b82d8 --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/jolt/PostServiceSpecJsonTransformer.java @@ -0,0 +1,48 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 NikhilMohan + * =================================================================== + * 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.nbi.apis.servicecatalog.jolt; + +import com.bazaarvoice.jolt.Chainr; +import com.bazaarvoice.jolt.JsonUtils; +import com.bazaarvoice.jolt.exception.JoltException; +import org.onap.nbi.exceptions.TechnicalException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class PostServiceSpecJsonTransformer { + private Chainr chainr; + + private static final Logger LOGGER = LoggerFactory.getLogger(PostServiceSpecJsonTransformer.class); + + public PostServiceSpecJsonTransformer() { + List<Object> specs = JsonUtils.classpathToList("/jolt/postServiceCatalog.json"); + this.chainr = Chainr.fromSpec(specs); + } + + public Object transform(Object serviceSpec) { + Object output = null; + try { + output = chainr.transform(serviceSpec); + } catch (JoltException joE) { + LOGGER.error("Unable to transform SDC response with JOLT Transformer", joE); + throw new TechnicalException("Error while parsing ONAP response"); + } + return output; + } + +} diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/Attachment.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/Attachment.java new file mode 100644 index 0000000..e9565ce --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/Attachment.java @@ -0,0 +1,220 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 <rakeshgirijaramesannair> + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + +/** + * An attachment is a file uses to describe the service. In nbi we use attachment to retrieve ONAP artifacts. + */ +@ApiModel(description = "An attachment is a file uses to describe the service. In nbi we use attachment to retrieve ONAP artifacts.") + + +public class Attachment { + + private String id = null; + + + private String name = null; + + private String description = null; + + private String type = "ONAPartifact"; + + private String artifactLabel = null; + + private String artifactGroupType = null; + + private String artifactTimeout = null; + + private String artifactChecksum = null; + + private String artifactVersion = null; + + private String generatedFromUUID = null; + + private String url = null; + + private String mimeType = null; + + /** + * Unique identifier of the attachment - filled with artifactUUID. + * @return id + **/ + @ApiModelProperty(value = "Unique identifier of the attachment - filled with artifactUUID.") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * Name of the attachment - filled with artifactName + * @return name + **/ + @ApiModelProperty(value = "Name of the attachment - filled with artifactName") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * Description of the attachment - filled with artifactDescription + * @return description + **/ + @ApiModelProperty(value = "Description of the attachment - filled with artifactDescription") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + /** + * This attribute allows to dynamically extends TMF class. Valued with 'ONAPartifact'. We used this features to add following attributes: artifactLabel artifactGroupType artifactTimeout artifactChecksum artifactVersion generatedFromUUID + * @return type + **/ + @ApiModelProperty(value = "This attribute allows to dynamically extends TMF class. Valued with 'ONAPartifact'. We used this features to add following attributes: artifactLabel artifactGroupType artifactTimeout artifactChecksum artifactVersion generatedFromUUID") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + + /** + * Additional attribute (not in the TMF API) - extended through @type - artifactLabel + * @return artifactLabel + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - artifactLabel") + public String getArtifactLabel() { + return artifactLabel; + } + + public void setArtifactLabel(String artifactLabel) { + this.artifactLabel = artifactLabel; + } + + /** + * Additional attribute (not in the TMF API) - extended through @type - artifactGroupType + * @return artifactGroupType + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - artifactGroupType") + public String getArtifactGroupType() { + return artifactGroupType; + } + + public void setArtifactGroupType(String artifactGroupType) { + this.artifactGroupType = artifactGroupType; + } + + + /** + * Additional attribute (not in the TMF API) - extended through @type - artifactTimeout + * @return artifactTimeout + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - artifactTimeout") + public String getArtifactTimeout() { + return artifactTimeout; + } + + public void setArtifactTimeout(String artifactTimeout) { + this.artifactTimeout = artifactTimeout; + } + + + /** + * Additional attribute (not in the TMF API) - extended through @type - artifactChecksum + * @return artifactChecksum + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - artifactChecksum") + public String getArtifactChecksum() { + return artifactChecksum; + } + + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + + /** + * Additional attribute (not in the TMF API) - extended through @type - artifactVersion + * @return artifactVersion + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - artifactVersion") + public String getArtifactVersion() { + return artifactVersion; + } + + public void setArtifactVersion(String artifactVersion) { + this.artifactVersion = artifactVersion; + } + + + /** + * Additional attribute (not in the TMF API) - extended through @type - generatedFromUUID + * @return generatedFromUUID + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - generatedFromUUID") + public String getGeneratedFromUUID() { + return generatedFromUUID; + } + + public void setGeneratedFromUUID(String generatedFromUUID) { + this.generatedFromUUID = generatedFromUUID; + } + + /** + * Uniform Resource Locator, is a web page address - filled with artifactURL + * @return url + **/ + @ApiModelProperty(value = "Uniform Resource Locator, is a web page address - filled with artifactURL") + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + /** + * Filled with artifactType + * @return mimeType + **/ + @ApiModelProperty(value = "Filled with artifactType") + public String getMimeType() { + return mimeType; + } + + public void setMimeType(String mimeType) { + this.mimeType = mimeType; + } + + + + +} + diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/DistributionStatus.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/DistributionStatus.java new file mode 100644 index 0000000..7d0bf3b --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/DistributionStatus.java @@ -0,0 +1,45 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 <rakeshgirijaramesannair> + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + + +/** + * Service distribution status from ONAP. + * + */ + +public enum DistributionStatus { + + DISTRIBUTION_NOT_APPROVED("DISTRIBUTION_NOT_APPROVED"), + + DISTRIBUTION_APPROVED("DISTRIBUTION_APPROVED"), + + DISTRIBUTED("DISTRIBUTED"), + + DISTRIBUTION_REJECTED("DISTRIBUTION_REJECTED"); + + private String value; + + DistributionStatus(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + +} + diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/LifecycleStatusValues.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/LifecycleStatusValues.java new file mode 100644 index 0000000..d960325 --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/LifecycleStatusValues.java @@ -0,0 +1,49 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 NikhilMohan + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + + +/** + * Service lifecycle value from ONAP SDC + * + */ +public enum LifecycleStatusValues { + + NOT_CERTIFIED_CHECKOUT("NOT_CERTIFIED_CHECKOUT"), + + NOT_CERTIFIED_CHECKIN("NOT_CERTIFIED_CHECKIN"), + + READY_FOR_CERTIFICATION("READY_FOR_CERTIFICATION"), + + CERTIFICATION_IN_PROGRESS("CERTIFICATION_IN_PROGRESS"), + + CERTIFIED("CERTIFIED"); + + private String value; + + LifecycleStatusValues(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + + + +} + diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/RelatedPartyRef.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/RelatedPartyRef.java new file mode 100644 index 0000000..b4b52e5 --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/RelatedPartyRef.java @@ -0,0 +1,80 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 <rakeshgirijaramesannair> + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.constraints.NotEmpty; +import java.util.Objects; + +/** + * Party linked to the service catalog. in nbi we retrieve information about last updater of the service in SDC + */ +@ApiModel(description = "Party linked to the service catalog. in nbi we retrieve information about last updater of the service in SDC") + +public class RelatedPartyRef { + + @NotEmpty(message = "is missing in the request!") + private String id = null; + + private String role = null; + + private String name = null; + + /** + * Unique identifier of the related party. Filled with lastUpdaterUserId + * @return id + **/ + @ApiModelProperty(value = "Unique identifier of the related party. Filled with lastUpdaterUserId") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * Role payed by the related party Only role 'lastUpdater' is retrieved in Beijing release + * @return role + **/ + @ApiModelProperty(value = "Role payed by the related party Only role 'lastUpdater' is retrieved in Beijing release") + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + /** + * Name of the related party - Filled with lastUpdatedFullName + * @return name + **/ + @ApiModelProperty(value = "Name of the related party - Filled with lastUpdatedFullName") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + +} + diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/ResourceSpecificationRef.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ResourceSpecificationRef.java new file mode 100644 index 0000000..06399ce --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ResourceSpecificationRef.java @@ -0,0 +1,172 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 NikhilMohan + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + +/** + * A list of resourceSpec identified to deliver the service. for nbi we retrieve resource information available in service description (through SDC api) bu as well information retrieved in the TOSCA file. + */ +@ApiModel(description = "A list of resourceSpec identified to deliver the service. for nbi we retrieve resource information available in service description (through SDC api) bu as well information retrieved in the TOSCA file.") + +public class ResourceSpecificationRef { + private String id = null; + + private String version = null; + + private String name = null; + + private String type = "ONAPresource"; + + private String resourceInstanceName = null; + + private String resourceInvariantUUID = null; + + private String resourceType = null; + + private String modelCustomizationName = null; + + private String modelCustomizationId = null; + + + /** + * Unique identifier of the resource specification - filled with resourceUUID + * @return id + **/ + @ApiModelProperty(value = "Unique identifier of the resource specification - filled with resourceUUID") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + /** + * Version for this resource specification - filled with resourceVersion + * @return version + **/ + @ApiModelProperty(value = "Version for this resource specification - filled with resourceVersion") + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + + /** + * Name of the resource specification - filled with resourceName + * @return name + **/ + @ApiModelProperty(value = "Name of the resource specification - filled with resourceName") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + /** + * This attribute allows to dynamically extends TMF class. Valued with: 'ONAPresource'. We used this features to add following attributes: resourceInstanceName resourceInvariantUUID resourceType modelCustomizationName modelCustomizationId + * @return type + **/ + @ApiModelProperty(value = "This attribute allows to dynamically extends TMF class. Valued with: 'ONAPresource'. We used this features to add following attributes: resourceInstanceName resourceInvariantUUID resourceType modelCustomizationName modelCustomizationId") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + + /** + * Additional attribute (not in the TMF API) - extended through @type - resourceInstanceName + * @return resourceInstanceName + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - resourceInstanceName") + public String getResourceInstanceName() { + return resourceInstanceName; + } + + public void setResourceInstanceName(String resourceInstanceName) { + this.resourceInstanceName = resourceInstanceName; + } + + + /** + * Additional attribute (not in the TMF API) - extended through @type - resourceInvariantUUID + * @return resourceInvariantUUID + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - resourceInvariantUUID") + public String getResourceInvariantUUID() { + return resourceInvariantUUID; + } + + public void setResourceInvariantUUID(String resourceInvariantUUID) { + this.resourceInvariantUUID = resourceInvariantUUID; + } + + + /** + * Additional attribute (not in the TMF API) - extended through @type - resoucreType + * @return resourceType + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - resoucreType") + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + /** + * Additional attribute (not in the TMF API) - extended through @type - Retrieved in the TOSCA file : attribute name in topology_template/node_template for the resource + * @return modelCustomizationName + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - Retrieved in the TOSCA file : attribute name in topology_template/node_template for the resource") + public String getModelCustomizationName() { + return modelCustomizationName; + } + + public void setModelCustomizationName(String modelCustomizationName) { + this.modelCustomizationName = modelCustomizationName; + } + + + /** + * Additional attribute (not in the TMF API) - extended through @type - Retrieved in the TOSCA file : attribute customizationUUID in topology_template/node_template for the resource + * @return modelCustomizationId + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - Retrieved in the TOSCA file : attribute customizationUUID in topology_template/node_template for the resource") + public String getModelCustomizationId() { + return modelCustomizationId; + } + + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + +} + diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecCharacteristicRequest.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecCharacteristicRequest.java new file mode 100644 index 0000000..c1c80a5 --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecCharacteristicRequest.java @@ -0,0 +1,144 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 <rakeshgirijaramesannair> + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * A characteristic quality or distinctive feature of a ServiceSpecification. + */ +@ApiModel(description = "A characteristic quality or distinctive feature of a ServiceSpecification.") + +public class ServiceSpecCharacteristicRequest { + private String name = null; + + private String description = null; + + private String valueType = null; + + private String type = null; + + private String schemaLocation = null; + + private Boolean required = true; + + private List<ServiceSpecCharacteristicValueRequest> serviceSpecCharacteristicValue = null; + + /** + * Name of the characteristic + * @return name + **/ + @ApiModelProperty(value = "Name of the characteristic") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * A narrative that explains in detail what the characteristic is + * @return description + **/ + @ApiModelProperty(value = "A narrative that explains in detail what the characteristic is") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + /** + * A kind of value that the characteristic can take on, from Dublin from Dublin we use the object type to describe service characteristic values + * @return valueType + **/ + @ApiModelProperty(value = "A kind of value that the characteristic can take on, from Dublin from Dublin we use the object type to describe service characteristic values") + public String getValueType() { + return valueType; + } + + public void setValueType(String valueType) { + this.valueType = valueType; + } + + /** + * This attribute allows to dynamically extends TMF class. Valued with: 'ONAPserviceCharacteristic'. We do not used this feature in nbi + * @return type + **/ + @ApiModelProperty(value = "This attribute allows to dynamically extends TMF class. Valued with: 'ONAPserviceCharacteristic'. We do not used this feature in nbi") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * An url pointing to type description - we do not use it + * @return schemaLocation + **/ + @ApiModelProperty(value = "An url pointing to type description - we do not use it") + public String getSchemaLocation() { + return schemaLocation; + } + + public void setSchemaLocation(String schemaLocation) { + this.schemaLocation = schemaLocation; + } + + /** + * A parameter to define if the characteristic is mandatory + * @return required + **/ + @ApiModelProperty(value = "A parameter to define if the characteristic is mandatory") + public Boolean isRequired() { + return required; + } + + public void setRequired(Boolean required) { + this.required = required; + } + + public ServiceSpecCharacteristicRequest addServiceSpecCharacteristicValueItem(ServiceSpecCharacteristicValueRequest serviceSpecCharacteristicValueItem) { + if (this.serviceSpecCharacteristicValue == null) { + this.serviceSpecCharacteristicValue = new ArrayList<ServiceSpecCharacteristicValueRequest>(); + } + this.serviceSpecCharacteristicValue.add(serviceSpecCharacteristicValueItem); + return this; + } + + /** + * Get serviceSpecCharacteristicValue + * @return serviceSpecCharacteristicValue + **/ + @ApiModelProperty(value = "") + public List<ServiceSpecCharacteristicValueRequest> getServiceSpecCharacteristicValue() { + return serviceSpecCharacteristicValue; + } + + public void setServiceSpecCharacteristicValue(List<ServiceSpecCharacteristicValueRequest> serviceSpecCharacteristicValue) { + this.serviceSpecCharacteristicValue = serviceSpecCharacteristicValue; + } +} + diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecCharacteristicValueRequest.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecCharacteristicValueRequest.java new file mode 100644 index 0000000..568e8cf --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecCharacteristicValueRequest.java @@ -0,0 +1,78 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 NikhilMohan + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + +/** + * A json schema of the service specification input characteristic values + */ +@ApiModel(description = "A json schema of the service specification input characteristic values") + +public class ServiceSpecCharacteristicValueRequest { + private String valueType = null; + + private Boolean isDefault = null; + + private String value = null; + + /** + * This attribute describes the type of value + * @return valueType + **/ + @ApiModelProperty(value = "This attribute describes the type of value") + public String getValueType() { + return valueType; + } + + public void setValueType(String valueType) { + this.valueType = valueType; + } + + /** + * To describe whether the attribute is to be included by default or not + * @return isDefault + **/ + @ApiModelProperty(value = "To describe whether the attribute is to be included by default or not") + public Boolean isIsDefault() { + return isDefault; + } + + public void setIsDefault(Boolean isDefault) { + this.isDefault = isDefault; + } + + + /** + * Value of the attribute + * @return value + **/ + @ApiModelProperty(value = "Value of the attribute") + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + + +} + diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecificationRequest.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecificationRequest.java new file mode 100644 index 0000000..8b7022c --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/ServiceSpecificationRequest.java @@ -0,0 +1,320 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 NikhilMohan + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.Valid; +import javax.validation.constraints.NotEmpty; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * ServiceSpecification is a class that offers characteristics to describe a type of service. Functionally, it acts as a template by which Services may be instantiated. By sharing the same specification, these services would therefore share the same set of characteristics. + */ +@ApiModel(description = "ServiceSpecification is a class that offers characteristics to describe a type of service. Functionally, it acts as a template by which Services may be instantiated. By sharing the same specification, these services would therefore share the same set of characteristics.") +public class ServiceSpecificationRequest { + + @NotEmpty(message = "is missing in the request!") + private String name = null; + + @NotEmpty(message = "is missing in the request!") + private String description = null; + + private String type = "ONAPservice"; + + private String schemaLocation = null; + + private String baseType = null; + + private String toscaModelURL = null; + + private String toscaResourceName = null; + + @NotEmpty(message = "is missing in the request!") + private String category = null; + + private String subcategory = null; + + private String version = null; + + private LifecycleStatusValues lifecycleStatus = null; + + private TargetServiceSchemaRef targetServiceSchema = null; + + private List<Attachment> attachment = null; + + @NotEmpty(message = "is missing in the request!") + @Valid + private List<RelatedPartyRef> relatedParty = null; + + private List<ResourceSpecificationRef> resourceSpecification = null; + + private List<ServiceSpecCharacteristicRequest> serviceSpecCharacteristic = null; + + /** + * Name of the service specification + * @return name + **/ + @ApiModelProperty(value = "Name of the service specification") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + + /** + * A narrative that explains in detail what the service specification + * @return description + **/ + @ApiModelProperty(value = "A narrative that explains in detail what the service specification") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + /** + * This attribute allows to dynamically extends TMF class. Valued with 'ONAPservice'. We use this feature to add following attributes: toscaModelURL toscaResourceName category (1) subcategory (1) distributionStatus + * @return type + **/ + @ApiModelProperty(value = "This attribute allows to dynamically extends TMF class. Valued with 'ONAPservice'. We use this feature to add following attributes: toscaModelURL toscaResourceName category (1) subcategory (1) distributionStatus") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * Not used + * @return schemaLocation + **/ + @ApiModelProperty(value = "Not used") + public String getSchemaLocation() { + return schemaLocation; + } + + public void setSchemaLocation(String schemaLocation) { + this.schemaLocation = schemaLocation; + } + + + + /** + * Not used + * @return baseType + **/ + @ApiModelProperty(value = "Not used") + public String getBaseType() { + return baseType; + } + + public void setBaseType(String baseType) { + this.baseType = baseType; + } + + + + /** + * Additional attribute (not in the TMF API) - extended through @type - toscaModelURL + * @return toscaModelURL + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - toscaModelURL") + public String getToscaModelURL() { + return toscaModelURL; + } + + public void setToscaModelURL(String toscaModelURL) { + this.toscaModelURL = toscaModelURL; + } + + /** + * Additional attribute (not in the TMF API) - extended through @type - toscaResourceName + * @return toscaResourceName + **/ + @ApiModelProperty(value = "Additional attribute (not in the TMF API) - extended through @type - toscaResourceName") + public String getToscaResourceName() { + return toscaResourceName; + } + + public void setToscaResourceName(String toscaResourceName) { + this.toscaResourceName = toscaResourceName; + } + + /** + * Additional attribute - extended through @type - category Please note that this attribute is managed in TMF - in future release we'll introduce category resource + * @return category + **/ + @ApiModelProperty(value = "Additional attribute - extended through @type - category Please note that this attribute is managed in TMF - in future release we'll introduce category resource") + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + /** + * Additional attribute - extended through @type - category Please note that this attribute is managed in TMF - in future release we'll introduce category resource + * @return subcategory + **/ + @ApiModelProperty(value = "Additional attribute - extended through @type - category Please note that this attribute is managed in TMF - in future release we'll introduce category resource") + public String getSubcategory() { + return subcategory; + } + + public void setSubcategory(String subcategory) { + this.subcategory = subcategory; + } + + /** + * Service specification version + * @return version + **/ + @ApiModelProperty(value = "Service specification version") + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + /** + * Get lifecycleStatus + * @return lifecycleStatus + **/ + @ApiModelProperty(value = "") + public LifecycleStatusValues getLifecycleStatus() { + return lifecycleStatus; + } + + public void setLifecycleStatus(LifecycleStatusValues lifecycleStatus) { + this.lifecycleStatus = lifecycleStatus; + } + + /** + * Get targetServiceSchema + * @return targetServiceSchema + **/ + @ApiModelProperty(value = "") + public TargetServiceSchemaRef getTargetServiceSchema() { + return targetServiceSchema; + } + + public void setTargetServiceSchema(TargetServiceSchemaRef targetServiceSchema) { + this.targetServiceSchema = targetServiceSchema; + } + + public ServiceSpecificationRequest addAttachmentItem(Attachment attachmentItem) { + if (this.attachment == null) { + this.attachment = new ArrayList<Attachment>(); + } + this.attachment.add(attachmentItem); + return this; + } + + /** + * Get attachment + * @return attachment + **/ + @ApiModelProperty(value = "") + public List<Attachment> getAttachment() { + return attachment; + } + + public void setAttachment(List<Attachment> attachment) { + this.attachment = attachment; + } + + public ServiceSpecificationRequest addRelatedPartyItem(RelatedPartyRef relatedPartyItem) { + if (this.relatedParty == null) { + this.relatedParty = new ArrayList<RelatedPartyRef>(); + } + this.relatedParty.add(relatedPartyItem); + return this; + } + + /** + * Get relatedParty + * @return relatedParty + **/ + @ApiModelProperty(value = "") + public List<RelatedPartyRef> getRelatedParty() { + return relatedParty; + } + + public void setRelatedParty(List<RelatedPartyRef> relatedParty) { + this.relatedParty = relatedParty; + } + + public ServiceSpecificationRequest addResourceSpecificationItem(ResourceSpecificationRef resourceSpecificationItem) { + if (this.resourceSpecification == null) { + this.resourceSpecification = new ArrayList<ResourceSpecificationRef>(); + } + this.resourceSpecification.add(resourceSpecificationItem); + return this; + } + + /** + * Get resourceSpecification + * @return resourceSpecification + **/ + @ApiModelProperty(value = "") + public List<ResourceSpecificationRef> getResourceSpecification() { + return resourceSpecification; + } + + public void setResourceSpecification(List<ResourceSpecificationRef> resourceSpecification) { + this.resourceSpecification = resourceSpecification; + } + + public ServiceSpecificationRequest addServiceSpecCharacteristicItem(ServiceSpecCharacteristicRequest serviceSpecCharacteristicItem) { + if (this.serviceSpecCharacteristic == null) { + this.serviceSpecCharacteristic = new ArrayList<ServiceSpecCharacteristicRequest>(); + } + this.serviceSpecCharacteristic.add(serviceSpecCharacteristicItem); + return this; + } + + /** + * Get serviceSpecCharacteristic + * @return serviceSpecCharacteristic + **/ + @ApiModelProperty(value = "") + public List<ServiceSpecCharacteristicRequest> getServiceSpecCharacteristic() { + return serviceSpecCharacteristic; + } + + public void setServiceSpecCharacteristic(List<ServiceSpecCharacteristicRequest> serviceSpecCharacteristic) { + this.serviceSpecCharacteristic = serviceSpecCharacteristic; + } + + + + +} + diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/model/TargetServiceSchemaRef.java b/src/main/java/org/onap/nbi/apis/servicecatalog/model/TargetServiceSchemaRef.java new file mode 100644 index 0000000..1b36ad0 --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/model/TargetServiceSchemaRef.java @@ -0,0 +1,60 @@ +/* + * ============LICENSE_START============================================================================================================= + * Copyright (c) 2020 NikhilMohan + * =================================================================== + * 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.nbi.apis.servicecatalog.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.Objects; + +/** + * Target Service Schema + */ +@ApiModel(description = "Target Service Schema") + +public class TargetServiceSchemaRef { + private String type = null; + + private String schemaLocation = null; + + /** + * + * @return type + **/ + @ApiModelProperty(required = true, value = "") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * + * @return schemaLocation + **/ + @ApiModelProperty(required = true, value = "") + public String getSchemaLocation() { + return schemaLocation; + } + + public void setSchemaLocation(String schemaLocation) { + this.schemaLocation = schemaLocation; + } + +} + diff --git a/src/main/resources/jolt/postServiceCatalog.json b/src/main/resources/jolt/postServiceCatalog.json new file mode 100644 index 0000000..4cd51c3 --- /dev/null +++ b/src/main/resources/jolt/postServiceCatalog.json @@ -0,0 +1,75 @@ +[ + { + "operation": "shift", + "spec": { + "name": "name", + "description": "description", + "toscaModelURL": "toscaModelURL", + "toscaResourceName": "toscaResourceName", + "category": "categories[].name", + "version": "version", + "lifecycleStatus": "lifecycleState", + "serviceSpecCharacteristic": { + "*": { + "name": "properties[&1].name", + "description": "properties[&1].description", + "valueType": "properties[&1].type", + "required": "properties[&1].required", + "serviceSpecCharacteristicValue": { + "*": { + "value": "properties[&3].value", + "isDefault": { + "true": { + "@(2,value)": "properties[&5].defaultValue" + } + } + } + } + } + }, + "attachment": { + "*": { + "id": "artifacts[&1].artifactUUID", + "name": "artifacts[&1].artifactName", + "description": "artifacts[&1].artifactDescription", + "artifactLabel": "artifacts[&1].artifactLabel", + "artifactGroupType": "artifacts[&1].artifactGroupType", + "artifactTimeout": "artifacts[&1].artifactTimeout", + "artifactChecksum": "artifacts[&1].artifactChecksum", + "artifactVersion": "artifacts[&1].artifactVersion", + "generatedFromUUID": "artifacts[&1].generatedFromUUID", + "url": "artifacts[&1].artifactURL", + "mimeType": "artifacts[&1].artifactType" + } + }, + "relatedParty": { + "*": { + "id": ["contactId", "lastUpdaterUserId"], + "name": "lastUpdaterFullName" + } + }, + "resourceSpecification": { + "*": { + "id": "resources[&1].resourceUUID", + "version": "resources[&1].resourceVersion", + "name": "resources[&1].resourceName", + "resourceInstanceName": "resources[&1].resourceInstanceName", + "resourceInvariantUUID": "resources[&1].resourceInvariantUUID", + "resoucreType": "resources[&1].resourceType" + } + } + } + }, + { + "operation": "default", + "spec": { + "@type": "ONAPservicespec", + "distributionStatus": "DISTRIBUTION_NOT_APPROVED", + "categories": { + "*": { + "name": "" + } + } + } + } +]
\ No newline at end of file diff --git a/src/main/resources/jolt/postServiceCatalogResponse.json b/src/main/resources/jolt/postServiceCatalogResponse.json new file mode 100644 index 0000000..4d25554 --- /dev/null +++ b/src/main/resources/jolt/postServiceCatalogResponse.json @@ -0,0 +1,105 @@ +[{ + "operation": "default", + "spec": { + "ref": { + "True": true, + "False": false + } + } + }, + { + "operation": "shift", + "spec": { + "uuid": "id", + "name": "name", + "description": "description", + "invariantUUID": "invariantUUID", + "toscaModelURL": "toscaModelURL", + "toscaResourceName": "toscaResourceName", + "categories": { + "*": { + "name": "category" + } + }, + "properties": { + "*": { + "name": "serviceSpecCharacteristic[&1].name", + "description": "serviceSpecCharacteristic[&1].description", + "type": "serviceSpecCharacteristic[&1].valueType", + "required": "serviceSpecCharacteristic[&1].required", + "value": "serviceSpecCharacteristic[&1].serviceSpecCharacteristicValue[0].value", + "defaultValue": { + "*": { + "@(4,ref.True)": "serviceSpecCharacteristic[&3].serviceSpecCharacteristicValue[0].isDefault" + } + } + } + }, + "subcategory": "subcategory", + "distributionStatus": "distributionStatus", + "version": "version", + "lifecycleState": "lifecycleStatus", + "artifacts": { + "*": { + "artifactUUID": "attachment[&1].id", + "artifactName": "attachment[&1].name", + "artifactDescription": "attachment[&1].description", + "artifactLabel": "attachment[&1].artifactLabel", + "artifactGroupType": "attachment[&1].artifactGroupType", + "artifactTimeout": "attachment[&1].artifactTimeout", + "artifactChecksum": "attachment[&1].artifactChecksum", + "artifactVersion": "attachment[&1].artifactVersion", + "generatedFromUUID": "attachment[&1].generatedFromUUID", + "artifactURL": "attachment[&1].url", + "artifactType": "attachment[&1].mimeType" + } + }, + "lastUpdaterUserId": "relatedParty.id", + "lastUpdaterFullName": "relatedParty.name", + "resources": { + "*": { + "resourceUUID": "resourceSpecification[&1].id", + "resourceVersion": "resourceSpecification[&1].version", + "resourceName": "resourceSpecification[&1].name", + "resourceInstanceName": ["resourceSpecification[&1].resourceInstanceName", "resourceSpecification[&1].modelCustomizationName"], + "resourceInvariantUUID": "resourceSpecification[&1].resourceInvariantUUID", + "resoucreType": "resourceSpecification[&1].resourceType" + } + } + } + }, + { + "operation": "modify-overwrite-beta", + "spec": { + "href": "=concat('serviceSpecification/',@(1,id))" + } + }, + { + "operation": "default", + "spec": { + "@type": "ONAPservice", + "attachment[]": { + "*": { + "@type": "ONAPartifact" + } + }, + "serviceSpecCharacteristic[]": { + "*": { + "serviceSpecCharacteristicValue[]": { + "*": { + "isDefault": false + } + } + } + }, + "relatedParty": { + "role": "lastUpdater" + }, + "resourceSpecification[]": { + "*": { + "@type": "ONAPresource" + } + } + } + } +]
\ No newline at end of file |