diff options
Diffstat (limited to 'mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model')
43 files changed, 1518 insertions, 0 deletions
diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/basemicroservice/BaseMicroservice.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/basemicroservice/BaseMicroservice.java new file mode 100644 index 0000000..3e5891f --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/basemicroservice/BaseMicroservice.java @@ -0,0 +1,65 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.basemicroservice; + +import org.onap.dcaegen2.platform.mod.model.common.AuditFields; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * A model class which represents Base-Microservice entity + */ +@Data +@NoArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +//TODO: migrate the document to microservices +@Document("base-microservices") +public class BaseMicroservice { + private String id; + + @ApiModelProperty(required = true) + private String name; + + @ApiModelProperty(required = true) + private String tag; + + private String serviceName; + + private BaseMsType type; + + private BaseMsLocation location; + + private String namespace; + + private BaseMsStatus status; + + private AuditFields metadata; + + private List<Map<String, String>> msInstances = new ArrayList<>(); +} + diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/basemicroservice/BaseMsLocation.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/basemicroservice/BaseMsLocation.java new file mode 100644 index 0000000..e8114a5 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/basemicroservice/BaseMsLocation.java @@ -0,0 +1,29 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.basemicroservice; +/** + * Supported values for Base-Microservice location + */ +public enum BaseMsLocation { + CENTRAL, + EDGE, + UNSPECIFIED +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/basemicroservice/BaseMsStatus.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/basemicroservice/BaseMsStatus.java new file mode 100644 index 0000000..4460e04 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/basemicroservice/BaseMsStatus.java @@ -0,0 +1,28 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.basemicroservice; + +/** + * Supported statuses for Base-Microservice entity + */ +public enum BaseMsStatus { + ACTIVE, RETIRED +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/basemicroservice/BaseMsType.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/basemicroservice/BaseMsType.java new file mode 100644 index 0000000..1cc81e8 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/basemicroservice/BaseMsType.java @@ -0,0 +1,32 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.basemicroservice; + +/** + * Supported Types for Base-Microservice + */ +public enum BaseMsType { + TICK, + FM_COLLECTOR, + PM_COLLECTOR, + ANALYTIC, + OTHER +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/common/AuditFields.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/common/AuditFields.java new file mode 100644 index 0000000..d062456 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/common/AuditFields.java @@ -0,0 +1,51 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.common; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Builder; +import lombok.Data; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * A model class for auditfields + */ +@Data +@Builder +@JsonInclude(JsonInclude.Include.NON_NULL) +public class AuditFields { + + private String createdBy; + private Date createdOn; + private String updatedBy; + private Date updatedOn; + //TODO set default empty values if not exist + private String notes = ""; + private List<String> labels = new ArrayList<>(); + + public void setLabels(Object labels) { + if(labels instanceof List) + this.labels = (List<String>) labels; + } +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifact.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifact.java new file mode 100644 index 0000000..600c735 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifact.java @@ -0,0 +1,51 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.deploymentartifact; + +import lombok.Data; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.util.Map; + +/** + * A model class which represents Deployment-Artifact entity + */ +@Data +@Document("deployment-artifact") +public class DeploymentArtifact { + + private String id; + + private Integer version; + + private String content; + + private String fileName; + + private DeploymentArtifactStatus status; + + private Map<String, Object> metadata; + + private MsInstanceInfo msInstanceInfo; + + private Map<String, Object> specificationInfo; + +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifactFilter.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifactFilter.java new file mode 100644 index 0000000..870ca46 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifactFilter.java @@ -0,0 +1,40 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.deploymentartifact; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +/** + * A model class to construct a filter that can be passed in DeploymentArtifactSearch + * @see org.onap.dcaegen2.platform.mod.model.deploymentartifact.DeploymentArtifactSearch + */ +@Data +public class DeploymentArtifactFilter { + @JsonProperty("release") + private String release; + + @JsonProperty("status") + private DeploymentArtifactStatus status; + + @JsonProperty("tag") + private String tag; +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifactSearch.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifactSearch.java new file mode 100644 index 0000000..9e955cd --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifactSearch.java @@ -0,0 +1,38 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.deploymentartifact; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +/** + * A model class to define Deployment-Artifact's searching criteria. + */ +@Data +public class DeploymentArtifactSearch { + + @JsonProperty("filter") + private DeploymentArtifactFilter filter; + + public DeploymentArtifactSearch() { + this.filter = new DeploymentArtifactFilter(); + } +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifactStatus.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifactStatus.java new file mode 100644 index 0000000..4ee4e0e --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifactStatus.java @@ -0,0 +1,30 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.deploymentartifact; + +/** + * Supported Statuses for a Deployment-Artifact + */ +public enum DeploymentArtifactStatus { + + IN_DEV, NOT_NEEDED, DEV_COMPLETE, + IN_PROD, PROD_FAILED +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/MsInstanceInfo.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/MsInstanceInfo.java new file mode 100644 index 0000000..665961c --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/MsInstanceInfo.java @@ -0,0 +1,33 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.deploymentartifact; + +import lombok.Data; + +/** + * MsInstance Reference model used in DeploymentArtifact entity + */ +@Data +public class MsInstanceInfo { + String id; + String name; + String release; +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/ErrorMessages.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/ErrorMessages.java new file mode 100644 index 0000000..9b96066 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/ErrorMessages.java @@ -0,0 +1,33 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions; + +public class ErrorMessages { + + public static final String MICROSERVICE_NAME_CONFLICT_MESSAGE = "Microservice with this name already exists."; + public static final String MICROSERVICE_TAG_CONFLICT_MESSAGE = "Microservice with this tag name already exists."; + public static final String MS_TAG_NAME_VALIDATION_MESSAGE = + "Microservice tag name is Invalid. Accepts lowercase letters and hyphens." + + " Tag name length cannot exceed 50 characters"; + public static final String MS_SERVICE_NAME_CONFLICT_MESSAGE = "Microservice with this core name already exists."; + public static final String MS_SERVICE_NAME_VALIDATION_MESSAGE = + "Service name is Invalid. Accepts lowercase letters and hyphens"; +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/MissingRequestBodyException.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/MissingRequestBodyException.java new file mode 100644 index 0000000..2d7d785 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/MissingRequestBodyException.java @@ -0,0 +1,24 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions; + +public class MissingRequestBodyException extends RuntimeException { +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/OperationNotAllowedException.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/OperationNotAllowedException.java new file mode 100644 index 0000000..47dafc9 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/OperationNotAllowedException.java @@ -0,0 +1,27 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions; + +public class OperationNotAllowedException extends RuntimeException { + public OperationNotAllowedException(String message) { + super(message); + } +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/ReleaseNotSupportedException.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/ReleaseNotSupportedException.java new file mode 100644 index 0000000..7ea6834 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/ReleaseNotSupportedException.java @@ -0,0 +1,24 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions; + +public class ReleaseNotSupportedException extends RuntimeException{ +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/ResourceConflictException.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/ResourceConflictException.java new file mode 100644 index 0000000..d81c68c --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/ResourceConflictException.java @@ -0,0 +1,27 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions; + +public class ResourceConflictException extends RuntimeException{ + public ResourceConflictException(String message) { + super(message); + } +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/basemicroservice/BaseMicroserviceNotFoundException.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/basemicroservice/BaseMicroserviceNotFoundException.java new file mode 100644 index 0000000..3ee81e4 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/basemicroservice/BaseMicroserviceNotFoundException.java @@ -0,0 +1,27 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions.basemicroservice; + +public class BaseMicroserviceNotFoundException extends RuntimeException { + public BaseMicroserviceNotFoundException(String message) { + super(message); + } +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/basemicroservice/BaseMicroserviceTagAlreadyExists.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/basemicroservice/BaseMicroserviceTagAlreadyExists.java new file mode 100644 index 0000000..e0bd119 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/basemicroservice/BaseMicroserviceTagAlreadyExists.java @@ -0,0 +1,24 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions.basemicroservice; + +public class BaseMicroserviceTagAlreadyExists extends RuntimeException { +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/basemicroservice/BaseMicroserviceTagInvalid.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/basemicroservice/BaseMicroserviceTagInvalid.java new file mode 100644 index 0000000..79282aa --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/basemicroservice/BaseMicroserviceTagInvalid.java @@ -0,0 +1,24 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions.basemicroservice; + +public class BaseMicroserviceTagInvalid extends RuntimeException { +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/basemicroservice/BaseMsServiceNameAlreadyExists.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/basemicroservice/BaseMsServiceNameAlreadyExists.java new file mode 100644 index 0000000..3ae1b6f --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/basemicroservice/BaseMsServiceNameAlreadyExists.java @@ -0,0 +1,24 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions.basemicroservice; + +public class BaseMsServiceNameAlreadyExists extends RuntimeException { +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/basemicroservice/BaseMsServiceNameInvalid.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/basemicroservice/BaseMsServiceNameInvalid.java new file mode 100644 index 0000000..6de3014 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/basemicroservice/BaseMsServiceNameInvalid.java @@ -0,0 +1,24 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions.basemicroservice; + +public class BaseMsServiceNameInvalid extends RuntimeException { +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/common/UserNotPassedException.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/common/UserNotPassedException.java new file mode 100644 index 0000000..b34e065 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/common/UserNotPassedException.java @@ -0,0 +1,27 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions.common; + +public class UserNotPassedException extends RuntimeException { + public UserNotPassedException(String message) { + super(message); + } +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/deploymentartifact/BlueprintFileNameCreateException.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/deploymentartifact/BlueprintFileNameCreateException.java new file mode 100644 index 0000000..5f52885 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/deploymentartifact/BlueprintFileNameCreateException.java @@ -0,0 +1,27 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions.deploymentartifact; + +public class BlueprintFileNameCreateException extends RuntimeException{ + public BlueprintFileNameCreateException(String message) { + super(message); + } +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/deploymentartifact/DeploymentArtifactNotFound.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/deploymentartifact/DeploymentArtifactNotFound.java new file mode 100644 index 0000000..e10c54e --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/deploymentartifact/DeploymentArtifactNotFound.java @@ -0,0 +1,27 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions.deploymentartifact; + +public class DeploymentArtifactNotFound extends RuntimeException{ + public DeploymentArtifactNotFound(String message) { + super(message); + } +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/deploymentartifact/StatusChangeNotValidException.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/deploymentartifact/StatusChangeNotValidException.java new file mode 100644 index 0000000..99faf50 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/deploymentartifact/StatusChangeNotValidException.java @@ -0,0 +1,28 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions.deploymentartifact; + +public class StatusChangeNotValidException extends RuntimeException { + + public StatusChangeNotValidException(String message) { + super(message); + } +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/msinstance/MsInstanceAlreadyExistsException.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/msinstance/MsInstanceAlreadyExistsException.java new file mode 100644 index 0000000..80778ea --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/msinstance/MsInstanceAlreadyExistsException.java @@ -0,0 +1,24 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions.msinstance; + +public class MsInstanceAlreadyExistsException extends RuntimeException { +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/msinstance/MsInstanceNotFoundException.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/msinstance/MsInstanceNotFoundException.java new file mode 100644 index 0000000..9ea977c --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/msinstance/MsInstanceNotFoundException.java @@ -0,0 +1,27 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions.msinstance; + +public class MsInstanceNotFoundException extends RuntimeException{ + public MsInstanceNotFoundException(String message) { + super(message); + } +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/specification/SpecificationInvalid.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/specification/SpecificationInvalid.java new file mode 100644 index 0000000..1b56d35 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/specification/SpecificationInvalid.java @@ -0,0 +1,38 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions.specification; + +import java.util.Map; + +public class SpecificationInvalid extends RuntimeException { + + Map<String, Object> errorsMap; + + public SpecificationInvalid(String message) { + super(message); + } + + public SpecificationInvalid(Map<String, Object> errorsMap){ + this.errorsMap = errorsMap; + } + + +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/specification/SpecificationNotFoundException.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/specification/SpecificationNotFoundException.java new file mode 100644 index 0000000..9728b15 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/exceptions/specification/SpecificationNotFoundException.java @@ -0,0 +1,24 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.exceptions.specification; + +public class SpecificationNotFoundException extends RuntimeException { +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/microserviceinstance/DeploymentArtifactsRef.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/microserviceinstance/DeploymentArtifactsRef.java new file mode 100644 index 0000000..fe1aed5 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/microserviceinstance/DeploymentArtifactsRef.java @@ -0,0 +1,36 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.microserviceinstance; + +import lombok.Data; + +import java.util.List; + +/** + * DeploymentArtifacts Reference model used in Microservice-Instance entity + */ +@Data +public class DeploymentArtifactsRef { + + private int mostRecentVersion; + private List<String> deploymentArtifacts; + +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/microserviceinstance/MsInstance.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/microserviceinstance/MsInstance.java new file mode 100644 index 0000000..d305aa4 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/microserviceinstance/MsInstance.java @@ -0,0 +1,56 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.microserviceinstance; + +import org.onap.dcaegen2.platform.mod.model.specification.Specification; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.DBRef; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.util.Map; + +/** + * A model class which represents Microservice-Instance entity + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Document("ms-instance") +public class MsInstance { + @Id + private String id; + private String name; + private String release; + private String version; + private MsInstanceStatus status; + private Map<String, Object> metadata; + private Map<String,Object> msInfo; + + @DBRef + private Specification activeSpec; + + private DeploymentArtifactsRef deploymentArtifactsInfo; +}
\ No newline at end of file diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/microserviceinstance/MsInstanceStatus.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/microserviceinstance/MsInstanceStatus.java new file mode 100644 index 0000000..223f3dc --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/microserviceinstance/MsInstanceStatus.java @@ -0,0 +1,28 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.microserviceinstance; + +/** + * Supported Statuses for Microservice-Instance entity + */ +public enum MsInstanceStatus { + NEW, IN_DEV, DEV_COMPLETE, IN_TEST, CERTIFIED, PROD_DEPLOYED +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/DeploymentArtifactPatchRequest.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/DeploymentArtifactPatchRequest.java new file mode 100644 index 0000000..8d52488 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/DeploymentArtifactPatchRequest.java @@ -0,0 +1,40 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.restapi; + +import org.onap.dcaegen2.platform.mod.model.deploymentartifact.DeploymentArtifactStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +import java.util.Map; + +/** + * A model that represent request body to patch DeploymentArtifact entity. + */ +@Data +public class DeploymentArtifactPatchRequest { + + @JsonProperty("status") + private DeploymentArtifactStatus status; + + @JsonProperty("metadata") + private Map<String, Object> metaData; +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/ErrorResponse.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/ErrorResponse.java new file mode 100644 index 0000000..fe78f94 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/ErrorResponse.java @@ -0,0 +1,35 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.restapi; + +import lombok.AllArgsConstructor; +import lombok.Data; + +/** + * A model that represent response body to send a simple error response. + */ +@Data +@AllArgsConstructor +public class ErrorResponse { + + private String message; + +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/GenericErrorResponse.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/GenericErrorResponse.java new file mode 100644 index 0000000..76597e2 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/GenericErrorResponse.java @@ -0,0 +1,54 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.restapi; + +import lombok.Data; +import org.springframework.http.HttpStatus; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * A model that represent response body to send a detailed error response. + */ +@Data +public class GenericErrorResponse { + private List<String> errors = new ArrayList<>(); + private HttpStatus status; + private String message; + + public GenericErrorResponse() { + } + + public GenericErrorResponse(List<String> errors, HttpStatus status, String message) { + this.errors = errors; + this.status = status; + this.message = message; + } + + public GenericErrorResponse(String error, HttpStatus status, String message) { + this.status = status; + this.message = message; + errors = Arrays.asList(error); + } + +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/MicroserviceCreateRequest.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/MicroserviceCreateRequest.java new file mode 100644 index 0000000..f8288cb --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/MicroserviceCreateRequest.java @@ -0,0 +1,59 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.restapi; + +import org.onap.dcaegen2.platform.mod.model.basemicroservice.BaseMsLocation; +import org.onap.dcaegen2.platform.mod.model.basemicroservice.BaseMsType; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; +import java.util.Map; + +/** + * A model that represent request body to create a Microservice entity. + */ +@NoArgsConstructor +@Data +public class MicroserviceCreateRequest { + + @NotBlank(message = "Microservice tag can not be blank") + @Pattern(regexp = "^([a-z0-9](-[a-z0-9])*)+$", message = "Microservice tag name is Invalid. Accepts alphanumerics and hyphens.") + @Size(min = 5, max = 50, message = "Tag name length cannot exceed 50 characters") + private String tag; + + @NotBlank(message = "Microservice name cannot be blank") + private String name; + + @Pattern(regexp = "^[a-z-]*$", message = "Microservice core name is Invalid. Accepts lowercase letters and hyphens.") + private String serviceName; + + private BaseMsType type; + private BaseMsLocation location; + private String namespace; + private Map<String, Object> metadata; + + @NotBlank(message = "user can not be blank") + private String user; + +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/MicroserviceUpdateRequest.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/MicroserviceUpdateRequest.java new file mode 100644 index 0000000..a7262d6 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/MicroserviceUpdateRequest.java @@ -0,0 +1,52 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.restapi; + +import org.onap.dcaegen2.platform.mod.model.basemicroservice.BaseMsLocation; +import org.onap.dcaegen2.platform.mod.model.basemicroservice.BaseMsType; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import java.util.Map; + +/** + * A model that represent request body to update a Microservice entity. + */ +@NoArgsConstructor +@Data +public class MicroserviceUpdateRequest { + + @Pattern(regexp = "^(?!\\s*$).+", message = "must not be blank") + private String name; + + @Pattern(regexp = "^[a-z-]*$", message = "Microservice core name is Invalid. Accepts lowercase letters and hyphens.") + private String serviceName; + + private BaseMsType type; + private BaseMsLocation location; + private String namespace; + private Map<String, Object> metadata; + + @NotBlank(message = "user cannot be blank") + private String user; +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/MsInstanceRequest.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/MsInstanceRequest.java new file mode 100644 index 0000000..803d417 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/MsInstanceRequest.java @@ -0,0 +1,52 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.restapi; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import java.util.Map; + +/** + * A model that represent request body to create MsInsance entity. + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class MsInstanceRequest { + + @NotBlank + private String name; + + @NotBlank + private String release; + + private String version; + + @NotBlank + private String user; + + private Map<String,Object> metadata; +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/MsInstanceUpdateRequest.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/MsInstanceUpdateRequest.java new file mode 100644 index 0000000..2af61a8 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/MsInstanceUpdateRequest.java @@ -0,0 +1,42 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.restapi; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.Map; + +/** + * A model that represent request body to patch MsInstance entity. + */ +@Data +public class MsInstanceUpdateRequest { + + private String release; + private String version; + private Map<String,Object> metadata; + + @NotBlank(message = "User cannot be blank.") + private String user; +} + + diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/SpecificationRequest.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/SpecificationRequest.java new file mode 100644 index 0000000..e34379e --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/SpecificationRequest.java @@ -0,0 +1,45 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.restapi; + +import org.onap.dcaegen2.platform.mod.model.specification.DeploymentType; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Map; + +/** + * A model that represent request body to create Specification entity. + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class SpecificationRequest { + + private Map<String,Object> specContent; + private Map<String, Object> policyJson; + private DeploymentType type; + private String user; + private Map<String,Object> metadata; +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/SuccessResponse.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/SuccessResponse.java new file mode 100644 index 0000000..d428407 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/restapi/SuccessResponse.java @@ -0,0 +1,34 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.restapi; + +import lombok.AllArgsConstructor; +import lombok.Data; + +/** + * A model that represent a simple Success response body. + */ +@Data +@AllArgsConstructor +public class SuccessResponse { + + private String message; +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/specification/DeploymentType.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/specification/DeploymentType.java new file mode 100644 index 0000000..815a529 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/specification/DeploymentType.java @@ -0,0 +1,28 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.specification; + +/** + * Supported Deployment Types in Specification entity + */ +public enum DeploymentType { + K8S, DOCKER +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/specification/Specification.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/specification/Specification.java new file mode 100644 index 0000000..32778a3 --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/specification/Specification.java @@ -0,0 +1,52 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.specification; + +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.util.Map; + +/** + * A model class which represents Specification entity + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@JsonInclude(JsonInclude.Include.NON_NULL) +@Document("specification") +public class Specification { + + @Id + private String id; + private SpecificationStatus status; + private Map<String,Object> specContent; + private Map<String, Object> policyJson; + private DeploymentType type; + private Map<String,Object> metadata; + private Map<String,Object> msInstanceInfo; +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/specification/SpecificationStatus.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/specification/SpecificationStatus.java new file mode 100644 index 0000000..3e6cd1a --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/specification/SpecificationStatus.java @@ -0,0 +1,28 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.model.specification; + +/** + * Supported statuses for Specification entity + */ +public enum SpecificationStatus { + ACTIVE, INACTIVE +} |