From 4c9e7c0489c3c12122ed1c4494cf14207905be78 Mon Sep 17 00:00:00 2001 From: Stefan Genov Date: Thu, 16 Jan 2025 08:51:31 +0200 Subject: [PATCH 01/10] refactor(vrops): Moved models Signed-off-by: Stefan Genov --- .../vmware/pscoe/iac/artifact/IMPORTANT.md | 2 +- .../iac/artifact/PackageStoreFactory.java | 3 + .../{package => pack}/VraNgPackageStore.java | 7 +- .../configuration/ConfigurationVrops.java | 6 +- .../operations/models/AdapterKindDTO.java | 172 +++ .../operations/models/AlertDefinitionDTO.java | 500 +++++++ .../aria/operations/models/AuthGroupDTO.java | 408 ++++++ .../aria/operations/models/AuthGroupsDTO.java | 59 + .../aria/operations/models/AuthUserDTO.java | 327 +++++ .../aria/operations/models/AuthUsersDTO.java | 56 + .../operations/models/CustomGroupDTO.java | 720 ++++++++++ .../operations/models/CustomGroupTypeDTO.java | 35 + .../PolicyCustomGroupAssignmentDTO.java | 111 ++ .../aria/operations/models/PolicyDTO.java | 277 ++++ .../models/PolicyImportResultDTO.java | 131 ++ .../operations/models/RecommendationDTO.java | 189 +++ .../models/ReportDefinitionDTO.java | 288 ++++ .../operations/models/ResourceKindDTO.java | 231 ++++ .../aria/operations/models/ResourcesDTO.java | 1171 +++++++++++++++++ .../operations/models/SupermetricDTO.java | 146 ++ .../models/SymptomDefinitionDTO.java | 380 ++++++ .../operations/models/ViewDefinitionDTO.java | 187 +++ .../aria/operations/models/package-info.java | 20 + .../operations}/rest/RestClientVrops.java | 43 +- .../rest/RestClientVropsAuthNInterceptor.java | 14 +- .../RestClientVropsBasicAuthInterceptor.java | 5 +- .../operations/store}/VropsPackageStore.java | 603 ++++++--- .../iac/artifact/cli/CliManagerFactory.java | 2 +- .../iac/artifact/cli/CliManagerVrops.java | 46 +- .../iac/artifact/rest/RestClientFactory.java | 2 +- .../client/vrli/AbstractRestClientVrli.java | 2 +- .../rest/client/vrli/RestClientVrliV1.java | 2 +- .../rest/client/vrli/RestClientVrliV2.java | 2 +- .../rest/model/vrops/AdapterKindDTO.java | 2 +- .../rest/model/vrops/AlertDefinitionDTO.java | 2 +- .../rest/model/vrops/AuthGroupDTO.java | 2 +- .../rest/model/vrops/AuthGroupsDTO.java | 2 +- .../rest/model/vrops/AuthUserDTO.java | 2 +- .../rest/model/vrops/AuthUsersDTO.java | 2 +- .../rest/model/vrops/CustomGroupDTO.java | 2 +- .../rest/model/vrops/CustomGroupTypeDTO.java | 2 +- .../vrops/PolicyCustomGroupAssignmentDTO.java | 2 +- .../artifact/rest/model/vrops/PolicyDTO.java | 2 +- .../model/vrops/PolicyImportResultDTO.java | 2 +- .../rest/model/vrops/RecommendationDTO.java | 2 +- .../rest/model/vrops/ReportDefinitionDTO.java | 2 +- .../rest/model/vrops/ResourceKindDTO.java | 2 +- .../rest/model/vrops/ResourcesDTO.java | 2 +- .../rest/model/vrops/SupermetricDTO.java | 2 +- .../model/vrops/SymptomDefinitionDTO.java | 2 +- .../rest/model/vrops/ViewDefinitionDTO.java | 2 +- .../rest/model/vrops/package-info.java | 2 +- .../configuration/ConfigurationVropsTest.java | 4 +- .../store/vrops/VropsPackageStoreTest.java | 14 +- .../pscoe/maven/plugins/PackageMojo.java | 2 +- .../vmware/pscoe/iac/installer/Installer.java | 2 +- 56 files changed, 5905 insertions(+), 302 deletions(-) rename common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/{package => pack}/VraNgPackageStore.java (97%) rename common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/{ => aria/operations}/configuration/ConfigurationVrops.java (96%) create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AdapterKindDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AlertDefinitionDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AuthGroupDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AuthGroupsDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AuthUserDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AuthUsersDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/CustomGroupDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/CustomGroupTypeDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/PolicyCustomGroupAssignmentDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/PolicyDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/PolicyImportResultDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/RecommendationDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/ReportDefinitionDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/ResourceKindDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/ResourcesDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/SupermetricDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/SymptomDefinitionDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/ViewDefinitionDTO.java create mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/package-info.java rename common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/{ => aria/operations}/rest/RestClientVrops.java (98%) rename common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/{ => aria/operations}/rest/RestClientVropsAuthNInterceptor.java (90%) rename common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/{ => aria/operations}/rest/RestClientVropsBasicAuthInterceptor.java (87%) rename common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/{ => aria/operations/store}/VropsPackageStore.java (80%) diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/IMPORTANT.md b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/IMPORTANT.md index 3e8201b35..8e2526efb 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/IMPORTANT.md +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/IMPORTANT.md @@ -7,7 +7,7 @@ The structure of this folder is being reworked. Classes are being moved based on - [x] Aria Automation - [ ] Aria Orchestrator - [ ] Aria Logs -- [ ] Aria Operations +- [x] Aria Operations - [ ] SSH - [ ] vCD - [ ] CS diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/PackageStoreFactory.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/PackageStoreFactory.java index d15ebe316..d7fc2d0dc 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/PackageStoreFactory.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/PackageStoreFactory.java @@ -26,7 +26,10 @@ import org.slf4j.LoggerFactory; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; +import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.store.VropsPackageStore; import com.vmware.pscoe.iac.artifact.aria.automation.configuration.ConfigurationVraNg; +import com.vmware.pscoe.iac.artifact.aria.automation.pack.VraNgPackageStore; import com.vmware.pscoe.iac.artifact.cli.CliManagerFactory; import com.vmware.pscoe.iac.artifact.cli.CliManagerVrops; import com.vmware.pscoe.iac.artifact.model.Version; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/package/VraNgPackageStore.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/pack/VraNgPackageStore.java similarity index 97% rename from common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/package/VraNgPackageStore.java rename to common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/pack/VraNgPackageStore.java index ec5777083..37b6d750b 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/package/VraNgPackageStore.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/pack/VraNgPackageStore.java @@ -16,7 +16,7 @@ * LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact; +package com.vmware.pscoe.iac.artifact.aria.automation.pack; import java.io.File; import java.io.IOException; @@ -25,6 +25,9 @@ import java.util.Collections; import java.util.List; +import com.vmware.pscoe.iac.artifact.GenericPackageStore; +import com.vmware.pscoe.iac.artifact.PackageManager; +import com.vmware.pscoe.iac.artifact.PackageStore; import com.vmware.pscoe.iac.artifact.aria.automation.configuration.ConfigurationVraNg; import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.model.PackageContent.Content; @@ -58,7 +61,7 @@ public class VraNgPackageStore extends GenericPackageStore adapterKind = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("adapter-kind") + public List getAdapterKind() { + return adapterKind; + } + + @JsonProperty("adapter-kind") + public void setAdapterKind(List adapterKind) { + this.adapterKind = adapterKind; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "key", "name", "description", "adapterKindType", "describeVersion", "identifiers", "resourceKinds", "links" }) + @JsonIgnoreProperties({ "links" }) + public static class AdapterKind implements Serializable { + private static final long serialVersionUID = -6414593808503585818L; + + @JsonProperty("key") + private String key; + + @JsonProperty("name") + private String name; + + @JsonProperty("description") + private String description; + + @JsonProperty("adapterKindType") + private String adapterKindType; + + @JsonProperty("describeVersion") + private Integer describeVersion; + + @JsonProperty("identifiers") + private List identifiers = new ArrayList<>(); + + @JsonProperty("resourceKinds") + private List resourceKinds = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("key") + public String getKey() { + return key; + } + + @JsonProperty("key") + public void setKey(String key) { + this.key = key; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty("adapterKindType") + public String getAdapterKindType() { + return adapterKindType; + } + + @JsonProperty("adapterKindType") + public void setAdapterKindType(String adapterKindType) { + this.adapterKindType = adapterKindType; + } + + @JsonProperty("describeVersion") + public Integer getDescribeVersion() { + return describeVersion; + } + + @JsonProperty("describeVersion") + public void setDescribeVersion(Integer describeVersion) { + this.describeVersion = describeVersion; + } + + @JsonProperty("identifiers") + public List getIdentifiers() { + return identifiers; + } + + @JsonProperty("identifiers") + public void setIdentifiers(List identifiers) { + this.identifiers = identifiers; + } + + @JsonProperty("resourceKinds") + public List getResourceKinds() { + return resourceKinds; + } + + @JsonProperty("resourceKinds") + public void setResourceKinds(List resourceKinds) { + this.resourceKinds = resourceKinds; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AlertDefinitionDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AlertDefinitionDTO.java new file mode 100644 index 000000000..ae6248bd5 --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AlertDefinitionDTO.java @@ -0,0 +1,500 @@ +/* + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "alertDefinitions", "pageInfo", "links" }) +@JsonIgnoreProperties({ "pageInfo", "links" }) +public class AlertDefinitionDTO implements Serializable { + private static final long serialVersionUID = -8907264880213106337L; + + @JsonProperty("alertDefinitions") + private List alertDefinitions = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("alertDefinitions") + public List getAlertDefinitions() { + return alertDefinitions; + } + + @JsonProperty("alertDefinitions") + public void setAlertDefinitions(List alertDefinitions) { + this.alertDefinitions = alertDefinitions; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "id", "name", "description", "adapterKindKey", "resourceKindKey", "waitCycles", "cancelCycles", "type", "subType", "states" }) + public static class AlertDefinition implements Serializable { + private static final long serialVersionUID = -5556208274143439935L; + + @JsonProperty("id") + private String id; + + @JsonProperty("name") + private String name; + + @JsonProperty("description") + private String description; + + @JsonProperty("adapterKindKey") + private String adapterKindKey; + + @JsonProperty("resourceKindKey") + private String resourceKindKey; + + @JsonProperty("waitCycles") + private Integer waitCycles; + + @JsonProperty("cancelCycles") + private Integer cancelCycles; + + @JsonProperty("type") + private Integer type; + + @JsonProperty("subType") + private Integer subType; + + @JsonProperty("states") + private List states = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty("adapterKindKey") + public String getAdapterKindKey() { + return adapterKindKey; + } + + @JsonProperty("adapterKindKey") + public void setAdapterKindKey(String adapterKindKey) { + this.adapterKindKey = adapterKindKey; + } + + @JsonProperty("resourceKindKey") + public String getResourceKindKey() { + return resourceKindKey; + } + + @JsonProperty("resourceKindKey") + public void setResourceKindKey(String resourceKindKey) { + this.resourceKindKey = resourceKindKey; + } + + @JsonProperty("waitCycles") + public Integer getWaitCycles() { + return waitCycles; + } + + @JsonProperty("waitCycles") + public void setWaitCycles(Integer waitCycles) { + this.waitCycles = waitCycles; + } + + @JsonProperty("cancelCycles") + public Integer getCancelCycles() { + return cancelCycles; + } + + @JsonProperty("cancelCycles") + public void setCancelCycles(Integer cancelCycles) { + this.cancelCycles = cancelCycles; + } + + @JsonProperty("type") + public Integer getType() { + return type; + } + + @JsonProperty("type") + public void setType(Integer type) { + this.type = type; + } + + @JsonProperty("subType") + public Integer getSubType() { + return subType; + } + + @JsonProperty("subType") + public void setSubType(Integer subType) { + this.subType = subType; + } + + @JsonProperty("states") + public List getStates() { + return states; + } + + @JsonProperty("states") + public void setStates(List states) { + this.states = states; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "type", "relation", "aggregation", "symptomSetOperator", "symptomDefinitionIds", "symptomSets" }) + public static class BaseSymptomSet implements Serializable { + private static final long serialVersionUID = 7061962708255866132L; + + @JsonProperty("type") + private String type; + + @JsonProperty("relation") + private String relation; + + @JsonProperty("aggregation") + private String aggregation; + + @JsonProperty("symptomSetOperator") + private String symptomSetOperator; + + @JsonProperty("symptomDefinitionIds") + private List symptomDefinitionIds = new ArrayList<>(); + + @JsonProperty("symptomSets") + private List symptomSets = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonProperty("type") + public void setType(String type) { + this.type = type; + } + + @JsonProperty("relation") + public String getRelation() { + return relation; + } + + @JsonProperty("relation") + public void setRelation(String relation) { + this.relation = relation; + } + + @JsonProperty("aggregation") + public String getAggregation() { + return aggregation; + } + + @JsonProperty("aggregation") + public void setAggregation(String aggregation) { + this.aggregation = aggregation; + } + + @JsonProperty("symptomSetOperator") + public String getSymptomSetOperator() { + return symptomSetOperator; + } + + @JsonProperty("symptomSetOperator") + public void setSymptomSetOperator(String symptomSetOperator) { + this.symptomSetOperator = symptomSetOperator; + } + + @JsonProperty("symptomDefinitionIds") + public List getSymptomDefinitionIds() { + return symptomDefinitionIds; + } + + @JsonProperty("symptomDefinitionIds") + public void setSymptomDefinitionIds(List symptomDefinitionIds) { + this.symptomDefinitionIds = symptomDefinitionIds; + } + + @JsonProperty("symptomSets") + public List getSymptomSets() { + return symptomSets; + } + + @JsonProperty("symptomSets") + public void setSymptomSets(List symptomSets) { + this.symptomSets = symptomSets; + } + + @JsonAnySetter + public void setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "type", "relation", "aggregation", "symptomSetOperator", "symptomDefinitionIds" }) + public static class SymptomSet implements Serializable { + private static final long serialVersionUID = 7061962708255866132L; + + @JsonProperty("type") + private String type; + + @JsonProperty("relation") + private String relation; + + @JsonProperty("aggregation") + private String aggregation; + + @JsonProperty("symptomSetOperator") + private String symptomSetOperator; + + @JsonProperty("symptomDefinitionIds") + private List symptomDefinitionIds = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonProperty("type") + public void setType(String type) { + this.type = type; + } + + @JsonProperty("relation") + public String getRelation() { + return relation; + } + + @JsonProperty("relation") + public void setRelation(String relation) { + this.relation = relation; + } + + @JsonProperty("aggregation") + public String getAggregation() { + return aggregation; + } + + @JsonProperty("aggregation") + public void setAggregation(String aggregation) { + this.aggregation = aggregation; + } + + @JsonProperty("symptomSetOperator") + public String getSymptomSetOperator() { + return symptomSetOperator; + } + + @JsonProperty("symptomSetOperator") + public void setSymptomSetOperator(String symptomSetOperator) { + this.symptomSetOperator = symptomSetOperator; + } + + @JsonProperty("symptomDefinitionIds") + public List getSymptomDefinitionIds() { + return symptomDefinitionIds; + } + + @JsonProperty("symptomDefinitionIds") + public void setSymptomDefinitionIds(List symptomDefinitionIds) { + this.symptomDefinitionIds = symptomDefinitionIds; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "impactType", "detail" }) + public static class Impact implements Serializable { + private static final long serialVersionUID = 8675023498733072632L; + + @JsonProperty("impactType") + private String impactType; + + @JsonProperty("detail") + private String detail; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("impactType") + public String getImpactType() { + return impactType; + } + + @JsonProperty("impactType") + public void setImpactType(String impactType) { + this.impactType = impactType; + } + + @JsonProperty("detail") + public String getDetail() { + return detail; + } + + @JsonProperty("detail") + public void setDetail(String detail) { + this.detail = detail; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "severity", "base-symptom-set", "impact", "recommendationPriorityMap" }) + @JsonIgnoreProperties({ "recommendationPriorityMap" }) + public static class State implements Serializable { + private static final long serialVersionUID = -4167387367232110038L; + + @JsonProperty("severity") + private String severity; + + @JsonProperty("base-symptom-set") + private BaseSymptomSet baseSymptomSet; + + @JsonProperty("impact") + private Impact impact; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("severity") + public String getSeverity() { + return severity; + } + + @JsonProperty("severity") + public void setSeverity(String severity) { + this.severity = severity; + } + + @JsonProperty("base-symptom-set") + public BaseSymptomSet getBaseSymptomSet() { + return baseSymptomSet; + } + + @JsonProperty("base-symptom-set") + public void setBaseSymptomSet(BaseSymptomSet baseSymptomSet) { + this.baseSymptomSet = baseSymptomSet; + } + + @JsonProperty("impact") + public Impact getImpact() { + return impact; + } + + @JsonProperty("impact") + public void setImpact(Impact impact) { + this.impact = impact; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + } + +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AuthGroupDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AuthGroupDTO.java new file mode 100644 index 000000000..667182bf5 --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AuthGroupDTO.java @@ -0,0 +1,408 @@ +/* + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "id", "authSourceId", "name", "description", "displayName", "userIds", "roleNames", "role-permissions", "links" }) +public class AuthGroupDTO implements Serializable { + private static final long serialVersionUID = -5001015063559031411L; + + @JsonProperty("id") + private String id; + + @JsonProperty("authSourceId") + private String authSourceId; + + @JsonProperty("name") + private String name; + + @JsonProperty("description") + private String description; + + @JsonProperty("displayName") + private String displayName; + + @JsonProperty("userIds") + private List userIds = new ArrayList<>(); + + @JsonProperty("roleNames") + private List roleNames = new ArrayList<>(); + + @JsonProperty("role-permissions") + private List rolePermissions = new ArrayList<>(); + + @JsonProperty("links") + private List links = new ArrayList<>(); + + @JsonIgnore + private Map additionalProperties = new HashMap<>(); + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + @JsonProperty("authSourceId") + public String getAuthSourceId() { + return authSourceId; + } + + @JsonProperty("authSourceId") + public void setAuthSourceId(String authSourceId) { + this.authSourceId = authSourceId; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty("displayName") + public String getDisplayName() { + return displayName; + } + + @JsonProperty("displayName") + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + @JsonProperty("userIds") + public List getUserIds() { + return userIds; + } + + @JsonProperty("userIds") + public void setUserIds(List userIds) { + this.userIds = userIds; + } + + @JsonProperty("roleNames") + public List getRoleNames() { + return roleNames; + } + + @JsonProperty("roleNames") + public void setRoleNames(List roleNames) { + this.roleNames = roleNames; + } + + @JsonProperty("role-permissions") + public List getRolePermissions() { + return rolePermissions; + } + + @JsonProperty("role-permissions") + public void setRolePermissions(List rolePermissions) { + this.rolePermissions = rolePermissions; + } + + @JsonProperty("links") + public List getLinks() { + return links; + } + + @JsonProperty("links") + public void setLinks(List links) { + this.links = links; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "roleName", "traversal-spec-instances", "allowAllObjects" }) + public static class RolePermission implements Serializable { + private static final long serialVersionUID = -8932971877839018059L; + + @JsonProperty("roleName") + private String roleName; + + @JsonProperty("traversal-spec-instances") + private List traversalSpecInstances = new ArrayList<>(); + + @JsonProperty("allowAllObjects") + private Boolean allowAllObjects; + + @JsonIgnore + private Map additionalProperties = new HashMap<>(); + + @JsonProperty("roleName") + public String getRoleName() { + return roleName; + } + + @JsonProperty("roleName") + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + @JsonProperty("traversal-spec-instances") + public List getTraversalSpecInstances() { + return traversalSpecInstances; + } + + @JsonProperty("traversal-spec-instances") + public void setTraversalSpecInstances(List traversalSpecInstances) { + this.traversalSpecInstances = traversalSpecInstances; + } + + @JsonProperty("allowAllObjects") + public Boolean getAllowAllObjects() { + return allowAllObjects; + } + + @JsonProperty("allowAllObjects") + public void setAllowAllObjects(Boolean allowAllObjects) { + this.allowAllObjects = allowAllObjects; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "adapterKind", "resourceKind", "name", "resourceSelection", "selectAllResources" }) + public static class TraversalSpecInstance implements Serializable { + private static final long serialVersionUID = -4749828660631156039L; + + @JsonProperty("adapterKind") + private String adapterKind; + + @JsonProperty("resourceKind") + private String resourceKind; + + @JsonProperty("name") + private String name; + + @JsonProperty("resourceSelection") + private List resourceSelection = new ArrayList<>(); + + @JsonProperty("selectAllResources") + private Boolean selectAllResources; + + @JsonIgnore + private Map additionalProperties = new HashMap<>(); + + @JsonProperty("adapterKind") + public String getAdapterKind() { + return adapterKind; + } + + @JsonProperty("adapterKind") + public void setAdapterKind(String adapterKind) { + this.adapterKind = adapterKind; + } + + @JsonProperty("resourceKind") + public String getResourceKind() { + return resourceKind; + } + + @JsonProperty("resourceKind") + public void setResourceKind(String resourceKind) { + this.resourceKind = resourceKind; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("resourceSelection") + public List getResourceSelection() { + return resourceSelection; + } + + @JsonProperty("resourceSelection") + public void setResourceSelection(List resourceSelection) { + this.resourceSelection = resourceSelection; + } + + @JsonProperty("selectAllResources") + public Boolean getSelectAllResources() { + return selectAllResources; + } + + @JsonProperty("selectAllResources") + public void setSelectAllResources(Boolean selectAllResources) { + this.selectAllResources = selectAllResources; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "type", "resourceId" }) + public static class ResourceSelection implements Serializable { + private static final long serialVersionUID = 757388741865799633L; + + @JsonProperty("type") + private String type; + + @JsonProperty("resourceId") + private List resourceId = new ArrayList<>(); + + @JsonIgnore + private Map additionalProperties = new HashMap<>(); + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonProperty("type") + public void setType(String type) { + this.type = type; + } + + @JsonProperty("resourceId") + public List getResourceId() { + return resourceId; + } + + @JsonProperty("resourceId") + public void setResourceId(List resourceId) { + this.resourceId = resourceId; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "href", "rel", "name" }) + public static class Link implements Serializable { + private static final long serialVersionUID = 5366630360818372853L; + + @JsonProperty("href") + private String href; + + @JsonProperty("rel") + private String rel; + + @JsonProperty("name") + private String name; + + @JsonIgnore + private Map additionalProperties = new HashMap<>(); + + @JsonProperty("href") + public String getHref() { + return href; + } + + @JsonProperty("href") + public void setHref(String href) { + this.href = href; + } + + @JsonProperty("rel") + public String getRel() { + return rel; + } + + @JsonProperty("rel") + public void setRel(String rel) { + this.rel = rel; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AuthGroupsDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AuthGroupsDTO.java new file mode 100644 index 000000000..dd6f69f31 --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AuthGroupsDTO.java @@ -0,0 +1,59 @@ +/* + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "userGroups" }) +public class AuthGroupsDTO implements Serializable { + private static final long serialVersionUID = -1418134583655271586L; + + @JsonProperty("userGroups") + private List userGroups = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("userGroups") + public List getUserGroups() { + return userGroups; + } + + @JsonProperty("userGroups") + public void setUserGroups(List userGroups) { + this.userGroups = userGroups; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AuthUserDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AuthUserDTO.java new file mode 100644 index 000000000..4b298864c --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AuthUserDTO.java @@ -0,0 +1,327 @@ +/*- + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "id", "username", "firstName", "lastName", "password", "emailAddress", "distinguishedName", "enabled", "groupIds", "roleNames", + "role-permissions", "lastLoginTime", "links" }) +public class AuthUserDTO { + + @JsonProperty("id") + private String id; + + @JsonProperty("username") + private String username; + + @JsonProperty("firstName") + private String firstName; + + @JsonProperty("lastName") + private String lastName; + + @JsonProperty("password") + private Object password; + + @JsonProperty("emailAddress") + private String emailAddress; + + @JsonProperty("distinguishedName") + private String distinguishedName; + + @JsonProperty("enabled") + private Boolean enabled; + + @JsonProperty("groupIds") + private List groupIds; + + @JsonProperty("roleNames") + private List roleNames; + + @JsonProperty("role-permissions") + private List rolePermissions; + + @JsonProperty("lastLoginTime") + private Long lastLoginTime; + + @JsonProperty("links") + private List links; + + @JsonIgnore + private Map additionalProperties = new LinkedHashMap(); + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + @JsonProperty("username") + public String getUsername() { + return username; + } + + @JsonProperty("username") + public void setUsername(String username) { + this.username = username; + } + + @JsonProperty("firstName") + public String getFirstName() { + return firstName; + } + + @JsonProperty("firstName") + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + @JsonProperty("lastName") + public String getLastName() { + return lastName; + } + + @JsonProperty("lastName") + public void setLastName(String lastName) { + this.lastName = lastName; + } + + @JsonProperty("password") + public Object getPassword() { + return password; + } + + @JsonProperty("password") + public void setPassword(Object password) { + this.password = password; + } + + @JsonProperty("emailAddress") + public String getEmailAddress() { + return emailAddress; + } + + @JsonProperty("emailAddress") + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + @JsonProperty("distinguishedName") + public String getDistinguishedName() { + return distinguishedName; + } + + @JsonProperty("distinguishedName") + public void setDistinguishedName(String distinguishedName) { + this.distinguishedName = distinguishedName; + } + + @JsonProperty("enabled") + public Boolean getEnabled() { + return enabled; + } + + @JsonProperty("enabled") + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + @JsonProperty("groupIds") + public List getGroupIds() { + return groupIds; + } + + @JsonProperty("groupIds") + public void setGroupIds(List groupIds) { + this.groupIds = groupIds; + } + + @JsonProperty("roleNames") + public List getRoleNames() { + return roleNames; + } + + @JsonProperty("roleNames") + public void setRoleNames(List roleNames) { + this.roleNames = roleNames; + } + + @JsonProperty("role-permissions") + public List getRolePermissions() { + return rolePermissions; + } + + @JsonProperty("role-permissions") + public void setRolePermissions(List rolePermissions) { + this.rolePermissions = rolePermissions; + } + + @JsonProperty("lastLoginTime") + public Long getLastLoginTime() { + return lastLoginTime; + } + + @JsonProperty("lastLoginTime") + public void setLastLoginTime(Long lastLoginTime) { + this.lastLoginTime = lastLoginTime; + } + + @JsonProperty("links") + public List getLinks() { + return links; + } + + @JsonProperty("links") + public void setLinks(List links) { + this.links = links; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "roleName", "scopeId", "allowAllObjects" }) + public static class RolePermission { + + @JsonProperty("roleName") + private String roleName; + + @JsonProperty("scopeId") + private String scopeId; + + @JsonProperty("allowAllObjects") + private Boolean allowAllObjects; + @JsonIgnore + private Map additionalProperties = new LinkedHashMap(); + + @JsonProperty("roleName") + public String getRoleName() { + return roleName; + } + + @JsonProperty("roleName") + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + @JsonProperty("scopeId") + public String getScopeId() { + return scopeId; + } + + @JsonProperty("scopeId") + public void setScopeId(String scopeId) { + this.scopeId = scopeId; + } + + @JsonProperty("allowAllObjects") + public Boolean getAllowAllObjects() { + return allowAllObjects; + } + + @JsonProperty("allowAllObjects") + public void setAllowAllObjects(Boolean allowAllObjects) { + this.allowAllObjects = allowAllObjects; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "href", "rel", "name" }) + public static class Link { + + @JsonProperty("href") + private String href; + + @JsonProperty("rel") + private String rel; + + @JsonProperty("name") + private String name; + + @JsonIgnore + private Map additionalProperties = new LinkedHashMap(); + + @JsonProperty("href") + public String getHref() { + return href; + } + + @JsonProperty("href") + public void setHref(String href) { + this.href = href; + } + + @JsonProperty("rel") + public String getRel() { + return rel; + } + + @JsonProperty("rel") + public void setRel(String rel) { + this.rel = rel; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AuthUsersDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AuthUsersDTO.java new file mode 100644 index 000000000..3d03384da --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/AuthUsersDTO.java @@ -0,0 +1,56 @@ +/*- + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "users" }) +public class AuthUsersDTO { + + @JsonProperty("users") + private List users; + + @JsonIgnore + private Map additionalProperties = new LinkedHashMap(); + + @JsonProperty("users") + public List getUsers() { + return users; + } + + @JsonProperty("users") + public void setUsers(List users) { + this.users = users; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/CustomGroupDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/CustomGroupDTO.java new file mode 100644 index 000000000..97ab6f432 --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/CustomGroupDTO.java @@ -0,0 +1,720 @@ +/* + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "groups" }) +public class CustomGroupDTO implements Serializable { + private static final long serialVersionUID = -8907264880213106297L; + + @JsonProperty("groups") + private List groups = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("groups") + public List getGroups() { + return groups; + } + + @JsonProperty("groups") + public void setGroups(List groups) { + this.groups = groups; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "id", "identifier", "resourceKey", "policy", "autoResolveMembership", "membershipDefinition", "links" }) + @JsonIgnoreProperties({ "links" }) + public static class Group implements Serializable { + private static final long serialVersionUID = -3051771900705327803L; + + @JsonProperty("id") + private String id; + + @JsonProperty("identifier") + private String identifier; + + @JsonProperty("resourceKey") + private ResourceKey resourceKey; + + @JsonProperty("policy") + private String policy; + + @JsonProperty("autoResolveMembership") + private Boolean autoResolveMembership; + + @JsonProperty("membershipDefinition") + private MembershipDefinition membershipDefinition; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + @JsonProperty("identifier") + public String getIdentifier() { + return identifier; + } + + @JsonProperty("identifier") + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + @JsonProperty("resourceKey") + public ResourceKey getResourceKey() { + return resourceKey; + } + + @JsonProperty("resourceKey") + public void setResourceKey(ResourceKey resourceKey) { + this.resourceKey = resourceKey; + } + + @JsonProperty("policy") + public String getPolicy() { + return policy; + } + + @JsonProperty("policy") + public void setPolicy(String policy) { + this.policy = policy; + } + + @JsonProperty("autoResolveMembership") + public Boolean isAutoResolveMembership() { + return autoResolveMembership; + } + + @JsonProperty("autoResolveMembership") + public void setAutoResolveMembership(Boolean autoResolveMembership) { + this.autoResolveMembership = autoResolveMembership; + } + + @JsonProperty("membershipDefinition") + public MembershipDefinition getMembershipDefinition() { + return membershipDefinition; + } + + @JsonProperty("membershipDefinition") + public void setMembershipDefinition(MembershipDefinition membershipDefinition) { + this.membershipDefinition = membershipDefinition; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "includedResources", "excludedResources", "custom-group-properties", "rules" }) + public static class MembershipDefinition implements Serializable { + private static final long serialVersionUID = 7552803338575289017L; + + @JsonProperty("includedResources") + private List includedResources = new ArrayList<>(); + + @JsonProperty("excludedResources") + private List excludedResources = new ArrayList<>(); + + @JsonProperty("custom-group-properties") + private List customGroupProperties = new ArrayList<>(); + + @JsonProperty("rules") + private List rules = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("includedResources") + public List getIncludedResources() { + return includedResources; + } + + @JsonProperty("includedResources") + public void setIncludedResources(List includedResources) { + this.includedResources = includedResources; + } + + @JsonProperty("excludedResources") + public List getExcludedResources() { + return excludedResources; + } + + @JsonProperty("excludedResources") + public void setExcludedResources(List excludedResources) { + this.excludedResources = excludedResources; + } + + @JsonProperty("custom-group-properties") + public List getCustomGroupProperties() { + return customGroupProperties; + } + + @JsonProperty("custom-group-properties") + public void setCustomGroupProperties(List customGroupProperties) { + this.customGroupProperties = customGroupProperties; + } + + @JsonProperty("rules") + public List getRules() { + return rules; + } + + @JsonProperty("rules") + public void setRules(List rules) { + this.rules = rules; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "resourceKindKey", "statConditionRules", "propertyConditionRules", "resourceNameConditionRules", "relationshipConditionRules" }) + public static class Rule implements Serializable { + private static final long serialVersionUID = 2858223788988040394L; + + @JsonProperty("resourceKindKey") + private ResourceKindKey resourceKindKey; + + @JsonProperty("statConditionRules") + private List statConditionRules = new ArrayList<>(); + + @JsonProperty("propertyConditionRules") + private List propertyConditionRules = new ArrayList<>(); + + @JsonProperty("resourceNameConditionRules") + private List resourceNameConditionRules = new ArrayList<>(); + + @JsonProperty("relationshipConditionRules") + private List relationshipConditionRules = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("resourceKindKey") + public ResourceKindKey getResourceKindKey() { + return resourceKindKey; + } + + @JsonProperty("resourceKindKey") + public void setResourceKindKey(ResourceKindKey resourceKindKey) { + this.resourceKindKey = resourceKindKey; + } + + @JsonProperty("statConditionRules") + public List getStatConditionRules() { + return statConditionRules; + } + + @JsonProperty("statConditionRules") + public void setStatConditionRules(List statConditionRules) { + this.statConditionRules = statConditionRules; + } + + @JsonProperty("propertyConditionRules") + public List getPropertyConditionRules() { + return propertyConditionRules; + } + + @JsonProperty("propertyConditionRules") + public void setPropertyConditionRules(List propertyConditionRules) { + this.propertyConditionRules = propertyConditionRules; + } + + @JsonProperty("resourceNameConditionRules") + public List getResourceNameConditionRules() { + return resourceNameConditionRules; + } + + @JsonProperty("resourceNameConditionRules") + public void setResourceNameConditionRules(List resourceNameConditionRules) { + this.resourceNameConditionRules = resourceNameConditionRules; + } + + @JsonProperty("relationshipConditionRules") + public List getRelationshipConditionRules() { + return relationshipConditionRules; + } + + @JsonProperty("relationshipConditionRules") + public void setRelationshipConditionRules(List relationshipConditionRules) { + this.relationshipConditionRules = relationshipConditionRules; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "key", "stringValue", "doubleValue", "compareOperator" }) + public static class StatConditionRule implements Serializable { + private static final long serialVersionUID = -5386165550764511301L; + + @JsonProperty("key") + private String key; + + @JsonProperty("stringValue") + private String stringValue; + + @JsonProperty("doubleValue") + private Double doubleValue; + + @JsonProperty("compareOperator") + private String compareOperator; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("key") + public String getKey() { + return key; + } + + @JsonProperty("key") + public void setKey(String key) { + this.key = key; + } + + @JsonProperty("stringValue") + public String getStringValue() { + return stringValue; + } + + @JsonProperty("stringValue") + public void setStringValue(String stringValue) { + this.stringValue = stringValue; + } + + @JsonProperty("doubleValue") + public Double getDoubleValue() { + return doubleValue; + } + + @JsonProperty("doubleValue") + public void setDoubleValue(Double doubleValue) { + this.doubleValue = doubleValue; + } + + @JsonProperty("compareOperator") + public String getCompareOperator() { + return compareOperator; + } + + @JsonProperty("compareOperator") + public void setCompareOperator(String compareOperator) { + this.compareOperator = compareOperator; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "name", "compareOperator" }) + public static class ResourceNameConditionRule implements Serializable { + private static final long serialVersionUID = -7089630077528662679L; + + @JsonProperty("name") + private String name; + + @JsonProperty("compareOperator") + private String compareOperator; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("compareOperator") + public String getCompareOperator() { + return compareOperator; + } + + @JsonProperty("compareOperator") + public void setCompareOperator(String compareOperator) { + this.compareOperator = compareOperator; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "relation", "name", "compareOperator", "travesalSpecId" }) + public static class RelationshipConditionRule implements Serializable { + private static final long serialVersionUID = -750100357961113288L; + + @JsonProperty("relation") + private String relation; + + @JsonProperty("name") + private String name; + + @JsonProperty("compareOperator") + private String compareOperator; + + @JsonProperty("travesalSpecId") + private String travesalSpecId; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("relation") + public String getRelation() { + return relation; + } + + @JsonProperty("relation") + public void setRelation(String relation) { + this.relation = relation; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("compareOperator") + public String getCompareOperator() { + return compareOperator; + } + + @JsonProperty("compareOperator") + public void setCompareOperator(String compareOperator) { + this.compareOperator = compareOperator; + } + + @JsonProperty("travesalSpecId") + public String getTravesalSpecId() { + return travesalSpecId; + } + + @JsonProperty("travesalSpecId") + public void setTravesalSpecId(String travesalSpecId) { + this.travesalSpecId = travesalSpecId; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "resourceKind", "adapterKind" }) + public static class ResourceKindKey implements Serializable { + private static final long serialVersionUID = -1575312205325925888L; + + @JsonProperty("resourceKind") + private String resourceKind; + + @JsonProperty("adapterKind") + private String adapterKind; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("resourceKind") + public String getResourceKind() { + return resourceKind; + } + + @JsonProperty("resourceKind") + public void setResourceKind(String resourceKind) { + this.resourceKind = resourceKind; + } + + @JsonProperty("adapterKind") + public String getAdapterKind() { + return adapterKind; + } + + @JsonProperty("adapterKind") + public void setAdapterKind(String adapterKind) { + this.adapterKind = adapterKind; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "name", "adapterKindKey", "resourceKindKey", "resourceIdentifiers" }) + public static class ResourceKey implements Serializable { + private static final long serialVersionUID = 1936847230252766216L; + + @JsonProperty("name") + private String name; + + @JsonProperty("adapterKindKey") + private String adapterKindKey; + + @JsonProperty("resourceKindKey") + private String resourceKindKey; + + @JsonProperty("resourceIdentifiers") + private List resourceIdentifiers = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("adapterKindKey") + public String getAdapterKindKey() { + return adapterKindKey; + } + + @JsonProperty("adapterKindKey") + public void setAdapterKindKey(String adapterKindKey) { + this.adapterKindKey = adapterKindKey; + } + + @JsonProperty("resourceKindKey") + public String getResourceKindKey() { + return resourceKindKey; + } + + @JsonProperty("resourceKindKey") + public void setResourceKindKey(String resourceKindKey) { + this.resourceKindKey = resourceKindKey; + } + + @JsonProperty("resourceIdentifiers") + public List getResourceIdentifiers() { + return resourceIdentifiers; + } + + @JsonProperty("resourceIdentifiers") + public void setResourceIdentifiers(List resourceIdentifiers) { + this.resourceIdentifiers = resourceIdentifiers; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "identifierType", "value" }) + public static class ResourceIdentifier implements Serializable { + private static final long serialVersionUID = -4631445128052519908L; + + @JsonProperty("identifierType") + private IdentifierType identifierType; + + @JsonProperty("value") + private String value; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("identifierType") + public IdentifierType getIdentifierType() { + return identifierType; + } + + @JsonProperty("identifierType") + public void setIdentifierType(IdentifierType identifierType) { + this.identifierType = identifierType; + } + + @JsonProperty("value") + public String getValue() { + return value; + } + + @JsonProperty("value") + public void setValue(String value) { + this.value = value; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "name", "dataType", "isPartOfUniqueness" }) + public static class IdentifierType implements Serializable { + private static final long serialVersionUID = -1370467208132974903L; + + @JsonProperty("name") + private String name; + + @JsonProperty("dataType") + private String dataType; + + @JsonProperty("isPartOfUniqueness") + private Boolean isPartOfUniqueness; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("dataType") + public String getDataType() { + return dataType; + } + + @JsonProperty("dataType") + public void setDataType(String dataType) { + this.dataType = dataType; + } + + @JsonProperty("isPartOfUniqueness") + public Boolean isIsPartOfUniqueness() { + return isPartOfUniqueness; + } + + @JsonProperty("isPartOfUniqueness") + public void setIsPartOfUniqueness(Boolean isPartOfUniqueness) { + this.isPartOfUniqueness = isPartOfUniqueness; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/CustomGroupTypeDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/CustomGroupTypeDTO.java new file mode 100644 index 000000000..c91120476 --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/CustomGroupTypeDTO.java @@ -0,0 +1,35 @@ +/* + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonPropertyOrder({ "name" }) +public class CustomGroupTypeDTO { + + @JsonProperty("name") + private String name; + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/PolicyCustomGroupAssignmentDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/PolicyCustomGroupAssignmentDTO.java new file mode 100644 index 000000000..c4c6f0083 --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/PolicyCustomGroupAssignmentDTO.java @@ -0,0 +1,111 @@ +/*- + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import java.io.Serializable; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "id", "groups" }) +public class PolicyCustomGroupAssignmentDTO implements Serializable { + private static final long serialVersionUID = -8042756118741033913L; + + /** + * id. + */ + @JsonProperty("id") + private String id; + + /** + * groups. + */ + @JsonProperty("groups") + private List groups; + + /** + * additionalProperties. + */ + @JsonIgnore + private Map additionalProperties = new LinkedHashMap(); + + /** + * getId(). + * + * @return policy id. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * setId(). + * + * @param id policy id to be set. + */ + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + /** + * getGroups(). + * + * @return list of assigned groups. + */ + @JsonProperty("groups") + public List getGroups() { + return groups; + } + + /** + * setGroups(). + * + * @param groups to be assigned policy to. + */ + @JsonProperty("groups") + public void setGroups(List groups) { + this.groups = groups; + } + + /** + * getAdditionalProperties(). + * + * @return map of additional properties. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * setAdditionalProperties(). + * + * @param name the name of the property. + * @param value the value of the property. + */ + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/PolicyDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/PolicyDTO.java new file mode 100644 index 000000000..d0d27cdc5 --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/PolicyDTO.java @@ -0,0 +1,277 @@ +/* + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * PolicyDTO. + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class PolicyDTO { + + /** + * policies. + */ + @JsonProperty("policy-summaries") + private List policies; + + /** + * policySummaries. + */ + @JsonProperty("policySummaries") + private List policySummaries; + + /** + * additionalProperties. + */ + @JsonIgnore + private Map additionalProperties = new HashMap<>(); + + /** + * getPolicies(). + * + * @return list of policies. + */ + @JsonProperty("policy-summaries") + public List getPolicies() { + return this.policies; + } + + /** + * setPolicySummaries(). + * + * @param policySummaries policies to be set. + */ + @JsonProperty("policySummaries") + public void setPolicySummaries(List policySummaries) { + this.policySummaries = policySummaries; + } + + /** + * policySummaries(). + * + * @return list of policySummaries. + */ + @JsonProperty("policySummaries") + public List getPolicySummaries() { + return this.policySummaries; + } + + /** + * setPolicies(). + * + * @param policies policies to be set. + */ + @JsonProperty("policy-summaries") + public void setPolicies(List policies) { + this.policies = policies; + } + + /** + * getAdditionalProperties(). + * + * @return map of additional properties. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * setAdditionalProperties(). + * + * @param propName name of the property. + * @param value value of the property. + */ + @JsonAnySetter + public void setAdditionalProperties(String propName, Object value) { + this.additionalProperties.put(propName, value); + } + + /** + * Policy. + */ + @JsonPropertyOrder({ "id", "name", "defaultPolicy", "priority" }) + @JsonIgnoreProperties(ignoreUnknown = true) + public static class Policy { + + /** + * id. + */ + @JsonProperty("id") + private String id; + + /** + * name. + */ + @JsonProperty("name") + private String name; + + /** + * zipFile. + */ + @JsonIgnore + private byte[] zipFile; + + /** + * defaultPolicy. + */ + @JsonProperty("defaultPolicy") + private boolean defaultPolicy; + + /** + * priority. + */ + @JsonProperty("priority") + private Long priority; + + /** + * additionalProperties. + */ + @JsonIgnore + private Map additionalProperties = new HashMap<>(); + + /** + * getId(). + * + * @return string with id. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * setId(). + * + * @param id id to be set. + */ + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + /** + * getName(). + * + * @return string with name. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * setName(). + * + * @param name name of the policy. + */ + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + /** + * setZipFile(). + * + * @param file byte array of the file. + */ + @JsonIgnore + public void setZipFile(byte[] file) { + this.zipFile = file; + } + + /** + * getZipFile(). + * + * @return byte array of the file. + */ + @JsonIgnore + public byte[] getZipFile() { + return this.zipFile; + } + + /** + * getDefaultPolicy(). + * + * @return whether it is default policy. + */ + @JsonProperty("defaultPolicy") + public boolean getDefaultPolicy() { + return defaultPolicy; + } + + /** + * setDefaultPolicy(). + * + * @param defaultPolicy default policy flag. + */ + @JsonProperty("defaultPolicy") + public void setDefaultPolicy(boolean defaultPolicy) { + this.defaultPolicy = defaultPolicy; + } + + /** + * getPriority(). + * + * @return policy priority (if applicable). + */ + @JsonProperty("priority") + public Long getPriority() { + return priority; + } + + /** + * setPriority(). + * + * @param priority set policy priority. + */ + @JsonProperty("priority") + public void setPriority(Long priority) { + this.priority = priority; + } + + /** + * getAdditionalProperties(). + * + * @return map with additional properties. + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * setAdditionalProperties(). + * + * @param propName name of the property. + * @param value value of the property. + */ + @JsonAnySetter + public void setAdditionalProperties(String propName, Object value) { + this.additionalProperties.put(propName, value); + } + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/PolicyImportResultDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/PolicyImportResultDTO.java new file mode 100644 index 000000000..a0b7b13e7 --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/PolicyImportResultDTO.java @@ -0,0 +1,131 @@ +/* + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "created-policies", "updated-policies", "skipped-policies" }) +public class PolicyImportResultDTO implements Serializable { + private static final long serialVersionUID = -8042756118741022913L; + + @JsonProperty("created-policies") + private List createdPolicies = new ArrayList<>(); + + @JsonProperty("updated-policies") + private List updatedPolicies = new ArrayList<>(); + + @JsonProperty("skipped-policies") + private List skippedPolicies = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("created-policies") + public List getCreatedPolicies() { + return createdPolicies; + } + + @JsonProperty("created-policies") + public void setCreatedPolicies(List createdPolicies) { + this.createdPolicies = createdPolicies; + } + + @JsonProperty("updated-policies") + public List getUpdatedPolicies() { + return updatedPolicies; + } + + @JsonProperty("updated-policies") + public void setUpdatedPolicies(List updatedPolicies) { + this.updatedPolicies = updatedPolicies; + } + + @JsonProperty("skipped-policies") + public List getSkippedPolicies() { + return skippedPolicies; + } + + @JsonProperty("skipped-policies") + public void setSkippedPolicies(List skippedPolicies) { + this.skippedPolicies = skippedPolicies; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "id", "name" }) + public static class Policy implements Serializable { + private static final long serialVersionUID = 6102066058193690851L; + + @JsonProperty("id") + private String id; + + @JsonProperty("name") + private String name; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/RecommendationDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/RecommendationDTO.java new file mode 100644 index 000000000..f409f4629 --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/RecommendationDTO.java @@ -0,0 +1,189 @@ +/* + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "recommendations" }) +public class RecommendationDTO implements Serializable { + private static final long serialVersionUID = -8907264880213103337L; + + @JsonProperty("recommendations") + private List recommendations = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("recommendations") + public List getRecommendations() { + return recommendations; + } + + @JsonProperty("symptomDefinitions") + public void setRecommendations(List recommendations) { + this.recommendations = recommendations; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "id", "description", "action" }) + public static class Recommendation implements Serializable { + private static final long serialVersionUID = 7776106897722096326L; + + @JsonProperty("id") + private String id; + + @JsonProperty("description") + private String description; + + @JsonProperty("action") + private Action action; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty("action") + public Action getAction() { + return action; + } + + @JsonProperty("action") + public void setAction(Action action) { + this.action = action; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "actionAdapterKindId", "targetAdapterKindId", "targetResourceKindId", "targetMethod" }) + public static class Action implements Serializable { + private static final long serialVersionUID = -3341905633826439983L; + + @JsonProperty("actionAdapterKindId") + private String actionAdapterKindId; + + @JsonProperty("targetAdapterKindId") + private String targetAdapterKindId; + + @JsonProperty("targetResourceKindId") + private String targetResourceKindId; + + @JsonProperty("targetMethod") + private String targetMethod; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("actionAdapterKindId") + public String getActionAdapterKindId() { + return actionAdapterKindId; + } + + @JsonProperty("actionAdapterKindId") + public void setActionAdapterKindId(String actionAdapterKindId) { + this.actionAdapterKindId = actionAdapterKindId; + } + + @JsonProperty("targetAdapterKindId") + public String getTargetAdapterKindId() { + return targetAdapterKindId; + } + + @JsonProperty("targetAdapterKindId") + public void setTargetAdapterKindId(String targetAdapterKindId) { + this.targetAdapterKindId = targetAdapterKindId; + } + + @JsonProperty("targetResourceKindId") + public String getTargetResourceKindId() { + return targetResourceKindId; + } + + @JsonProperty("targetResourceKindId") + public void setTargetResourceKindId(String targetResourceKindId) { + this.targetResourceKindId = targetResourceKindId; + } + + @JsonProperty("targetMethod") + public String getTargetMethod() { + return targetMethod; + } + + @JsonProperty("targetMethod") + public void setTargetMethod(String targetMethod) { + this.targetMethod = targetMethod; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/ReportDefinitionDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/ReportDefinitionDTO.java new file mode 100644 index 000000000..172d7cfec --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/ReportDefinitionDTO.java @@ -0,0 +1,288 @@ +/* + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "pageInfo", "links", "reportDefinitions" }) +@JsonIgnoreProperties({ "pageInfo", "links" }) +public class ReportDefinitionDTO implements Serializable { + private static final long serialVersionUID = -8001968595944498757L; + + @JsonProperty("reportDefinitions") + private List reportDefinitions = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("reportDefinitions") + public List getReportDefinitions() { + return reportDefinitions; + } + + @JsonProperty("reportDefinitions") + public void setReportDefinitions(List reportDefinitions) { + this.reportDefinitions = reportDefinitions; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "id", "name", "description", "subject", "traversal-specs", "active", "owner" }) + public static class ReportDefinition implements Serializable { + private static final long serialVersionUID = 5524309873790715075L; + + @JsonProperty("id") + private String id; + + @JsonProperty("name") + private String name; + + @JsonProperty("description") + private String description; + + @JsonProperty("subject") + private List subject = new ArrayList<>(); + + @JsonProperty("traversal-specs") + private TraversalSpecs traversalSpecs; + + @JsonProperty("active") + private Boolean active; + + @JsonProperty("owner") + private String owner; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty("subject") + public List getSubject() { + return subject; + } + + @JsonProperty("subject") + public void setSubject(List subject) { + this.subject = subject; + } + + @JsonProperty("traversal-specs") + public TraversalSpecs getTraversalSpecs() { + return traversalSpecs; + } + + @JsonProperty("traversal-specs") + public void setTraversalSpecs(TraversalSpecs traversalSpecs) { + this.traversalSpecs = traversalSpecs; + } + + @JsonProperty("active") + public Boolean isActive() { + return active; + } + + @JsonProperty("active") + public void setActive(Boolean active) { + this.active = active; + } + + @JsonProperty("owner") + public String getOwner() { + return owner; + } + + @JsonProperty("owner") + public void setOwner(String owner) { + this.owner = owner; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "specs" }) + public static class TraversalSpecs implements Serializable { + private static final long serialVersionUID = 5055582582989558793L; + + @JsonProperty("specs") + private List specs = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("specs") + public List getSpecs() { + return specs; + } + + @JsonProperty("specs") + public void setSpecs(List specs) { + this.specs = specs; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "name", "description", "rootAdapterKindKey", "rootResourceKindKey", "adapterInstanceAssociation" }) + public static class Spec implements Serializable { + private static final long serialVersionUID = 4779483169838434664L; + + @JsonProperty("name") + private String name; + + @JsonProperty("description") + private String description; + + @JsonProperty("rootAdapterKindKey") + private String rootAdapterKindKey; + + @JsonProperty("rootResourceKindKey") + private String rootResourceKindKey; + + @JsonProperty("adapterInstanceAssociation") + private Boolean adapterInstanceAssociation; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty("rootAdapterKindKey") + public String getRootAdapterKindKey() { + return rootAdapterKindKey; + } + + @JsonProperty("rootAdapterKindKey") + public void setRootAdapterKindKey(String rootAdapterKindKey) { + this.rootAdapterKindKey = rootAdapterKindKey; + } + + @JsonProperty("rootResourceKindKey") + public String getRootResourceKindKey() { + return rootResourceKindKey; + } + + @JsonProperty("rootResourceKindKey") + public void setRootResourceKindKey(String rootResourceKindKey) { + this.rootResourceKindKey = rootResourceKindKey; + } + + @JsonProperty("adapterInstanceAssociation") + public Boolean isAdapterInstanceAssociation() { + return adapterInstanceAssociation; + } + + @JsonProperty("adapterInstanceAssociation") + public void setAdapterInstanceAssociation(Boolean adapterInstanceAssociation) { + this.adapterInstanceAssociation = adapterInstanceAssociation; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + } + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/ResourceKindDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/ResourceKindDTO.java new file mode 100644 index 000000000..00804d4e0 --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/ResourceKindDTO.java @@ -0,0 +1,231 @@ +/* + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "pageInfo", "links", "resource-kind" }) +@JsonIgnoreProperties({ "pageInfo", "links" }) +public class ResourceKindDTO implements Serializable { + private static final long serialVersionUID = 6493081292177966190L; + + @JsonProperty("resource-kind") + private List resourceKind = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("resource-kind") + public List getResourceKind() { + return resourceKind; + } + + @JsonProperty("resource-kind") + public void setResourceKind(List resourceKind) { + this.resourceKind = resourceKind; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "key", "name", "adapterKind", "adapterKindName", "resourceKindType", "resourceKindSubType", "resourceIdentifierTypes", "links" }) + @JsonIgnoreProperties({ "links" }) + public static class ResourceKind implements Serializable { + private static final long serialVersionUID = -4211567276552123736L; + + @JsonProperty("key") + private String key; + + @JsonProperty("name") + private String name; + + @JsonProperty("adapterKind") + private String adapterKind; + + @JsonProperty("adapterKindName") + private String adapterKindName; + + @JsonProperty("resourceKindType") + private String resourceKindType; + + @JsonProperty("resourceKindSubType") + private String resourceKindSubType; + + @JsonProperty("resourceIdentifierTypes") + private List resourceIdentifierTypes = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("key") + public String getKey() { + return key; + } + + @JsonProperty("key") + public void setKey(String key) { + this.key = key; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("adapterKind") + public String getAdapterKind() { + return adapterKind; + } + + @JsonProperty("adapterKind") + public void setAdapterKind(String adapterKind) { + this.adapterKind = adapterKind; + } + + @JsonProperty("adapterKindName") + public String getAdapterKindName() { + return adapterKindName; + } + + @JsonProperty("adapterKindName") + public void setAdapterKindName(String adapterKindName) { + this.adapterKindName = adapterKindName; + } + + @JsonProperty("resourceKindType") + public String getResourceKindType() { + return resourceKindType; + } + + @JsonProperty("resourceKindType") + public void setResourceKindType(String resourceKindType) { + this.resourceKindType = resourceKindType; + } + + @JsonProperty("resourceKindSubType") + public String getResourceKindSubType() { + return resourceKindSubType; + } + + @JsonProperty("resourceKindSubType") + public void setResourceKindSubType(String resourceKindSubType) { + this.resourceKindSubType = resourceKindSubType; + } + + @JsonProperty("resourceIdentifierTypes") + public List getResourceIdentifierTypes() { + return resourceIdentifierTypes; + } + + @JsonProperty("resourceIdentifierTypes") + public void setResourceIdentifierTypes(List resourceIdentifierTypes) { + this.resourceIdentifierTypes = resourceIdentifierTypes; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "name", "dataType", "isPartOfUniqueness" }) + public static class ResourceIdentifierType implements Serializable { + private static final long serialVersionUID = -7009149651340736012L; + + @JsonProperty("name") + private String name; + + @JsonProperty("dataType") + private String dataType; + + @JsonProperty("isPartOfUniqueness") + private Boolean isPartOfUniqueness; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("dataType") + public String getDataType() { + return dataType; + } + + @JsonProperty("dataType") + public void setDataType(String dataType) { + this.dataType = dataType; + } + + @JsonProperty("isPartOfUniqueness") + public Boolean isIsPartOfUniqueness() { + return isPartOfUniqueness; + } + + @JsonProperty("isPartOfUniqueness") + public void setIsPartOfUniqueness(Boolean isPartOfUniqueness) { + this.isPartOfUniqueness = isPartOfUniqueness; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/ResourcesDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/ResourcesDTO.java new file mode 100644 index 000000000..927d6af7f --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/ResourcesDTO.java @@ -0,0 +1,1171 @@ +/* + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "pageInfo", "links", "resourceList" }) +public final class ResourcesDTO implements Serializable { + private static final long serialVersionUID = -4565701751149713687L; + + /** + * pageInfo. + */ + @JsonProperty("pageInfo") + private PageInfo pageInfo; + + /** + * links. + */ + @JsonProperty("links") + private List links; + + /** + * resourceList. + */ + @JsonProperty("resourceList") + private List resourceList = new ArrayList<>(); + + /** + * additionalProperties. + */ + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + /** + * getPageInfo. + * + * @return pageInfo + */ + @JsonProperty("pageInfo") + public PageInfo getPageInfo() { + return pageInfo; + } + + /** + * setPageInfo. + * + * @param pageInfo + */ + @JsonProperty("pageInfo") + public void setPageInfo(PageInfo pageInfo) { + this.pageInfo = pageInfo; + } + + /** + * getLinks. + * + * @return links + */ + @JsonProperty("links") + public List getLinks() { + return links; + } + + /** + * setLinks. + * + * @param links + */ + @JsonProperty("links") + public void setLinks(List links) { + this.links = links; + } + + /** + * getResourceList. + * + * @return resourceList + */ + @JsonProperty("resourceList") + public List getResourceList() { + return resourceList; + } + + /** + * setResourceList. + * + * @param resourceList + */ + @JsonProperty("resourceList") + public void setResourceList(List resourceList) { + this.resourceList = resourceList; + } + + /** + * getAdditionalProperties. + * + * @return additionalProperties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * setAdditionalProperties. + * + * @param key + * @param val + */ + @JsonAnySetter + public void setAdditionalProperties(String key, Object val) { + this.additionalProperties.put(key, val); + } + + @JsonPropertyOrder({ "totalCount", "page", "pageSize" }) + public static final class PageInfo { + /** + * totalCount. + */ + @JsonProperty("totalCount") + private Long totalCount; + + /** + * page. + */ + @JsonProperty("page") + private Long page; + + /** + * pageSize. + */ + @JsonProperty("pageSize") + private Long pageSize; + + /** + * additionalProperties. + */ + @JsonIgnore + private transient Map additionalProperties = new LinkedHashMap(); + + /** + * getTotalCount. + * + * @return totalCount + */ + @JsonProperty("totalCount") + public Long getTotalCount() { + return totalCount; + } + + /** + * setTotalCount. + * + * @param totalCount + */ + @JsonProperty("totalCount") + public void setTotalCount(Long totalCount) { + this.totalCount = totalCount; + } + + /** + * getPage. + * + * @return page + */ + @JsonProperty("page") + public Long getPage() { + return page; + } + + /** + * setPage. + * + * @param page + */ + @JsonProperty("page") + public void setPage(Long page) { + this.page = page; + } + + /** + * getPageSize. + * + * @return pageSize + */ + @JsonProperty("pageSize") + public Long getPageSize() { + return pageSize; + } + + /** + * setPageSize. + * + * @param pageSize + */ + @JsonProperty("pageSize") + public void setPageSize(Long pageSize) { + this.pageSize = pageSize; + } + + /** + * getAdditionalProperties. + * + * @return additionalProperties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * setAdditionalProperty. + * + * @param key + * @param val + */ + @JsonAnySetter + public void setAdditionalProperty(String key, Object val) { + this.additionalProperties.put(key, val); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "href", "rel", "name" }) + public static final class Link { + /** + * href. + */ + @JsonProperty("href") + private String href; + + /** + * rel. + */ + @JsonProperty("rel") + private String rel; + + /** + * name. + */ + @JsonProperty("name") + private String name; + + /** + * additionalProperties. + */ + @JsonIgnore + private transient Map additionalProperties = new LinkedHashMap(); + + /** + * getHref. + * + * @return href + */ + @JsonProperty("href") + public String getHref() { + return href; + } + + /** + * setHref. + * + * @param href + */ + @JsonProperty("href") + public void setHref(String href) { + this.href = href; + } + + /** + * getRel. + * + * @return getRel + */ + @JsonProperty("rel") + public String getRel() { + return rel; + } + + /** + * setRel. + * + * @param rel + */ + @JsonProperty("rel") + public void setRel(String rel) { + this.rel = rel; + } + + /** + * getName. + * + * @return name + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * setName. + * + * @param name + */ + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + /** + * getAdditionalProperties. + * + * @return additionalProperties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * setAdditionalProperty. + * + * @param key + * @param val + */ + @JsonAnySetter + public void setAdditionalProperty(String key, Object val) { + this.additionalProperties.put(key, val); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "creationTime", "resourceKey", "resourceStatusStates", "resourceHealth", "resourceHealthValue", "dtEnabled", "monitoringInterval", + "badges", "relatedResources", "links", "identifier" }) + @JsonIgnoreProperties({ "links" }) + public static final class ResourceList implements Serializable { + private static final long serialVersionUID = -7272621081244854723L; + + /** + * creationTime. + */ + @JsonProperty("creationTime") + private long creationTime; + + /** + * credentialInstanceId. + */ + @JsonProperty("credentialInstanceId") + private String credentialInstanceId; + + /** + * description. + */ + @JsonProperty("description") + private String description; + + /** + * resourceKey. + */ + @JsonProperty("resourceKey") + private ResourceKey resourceKey; + + /** + * resourceStatusStates. + */ + @JsonProperty("resourceStatusStates") + private List resourceStatusStates = new ArrayList<>(); + + /** + * resourceHealth. + */ + @JsonProperty("resourceHealth") + private String resourceHealth; + + /** + * resourceHealthValue. + */ + @JsonProperty("resourceHealthValue") + private Double resourceHealthValue; + + /** + * dtEnabled. + */ + @JsonProperty("dtEnabled") + private Boolean dtEnabled; + + /** + * monitoringInterval. + */ + @JsonProperty("monitoringInterval") + private Integer monitoringInterval; + + /** + * badges. + */ + @JsonProperty("badges") + private List badges = new ArrayList<>(); + + /** + * relatedResources. + */ + @JsonProperty("relatedResources") + private List relatedResources = new ArrayList<>(); + + /** + * identifier. + */ + @JsonProperty("identifier") + private String identifier; + + /** + * additionalProperties. + */ + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + /** + * getCreationTime. + * + * @return creationTime + */ + @JsonProperty("creationTime") + public long getCreationTime() { + return creationTime; + } + + /** + * setCreationTime. + * + * @param creationTime + */ + @JsonProperty("creationTime") + public void setCreationTime(long creationTime) { + this.creationTime = creationTime; + } + + /** + * getCredentialInstanceId. + * + * @return credentialInstanceId + */ + public String getCredentialInstanceId() { + return credentialInstanceId; + } + + /** + * setCredentialInstanceId. + * + * @param credentialInstanceId + */ + public void setCredentialInstanceId(String credentialInstanceId) { + this.credentialInstanceId = credentialInstanceId; + } + + /** + * getDescription. + * + * @return description + */ + public String getDescription() { + return description; + } + + /** + * setDescription. + * + * @param description + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * getResourceKey. + * + * @return resourceKey + */ + @JsonProperty("resourceKey") + public ResourceKey getResourceKey() { + return resourceKey; + } + + /** + * setResourceKey. + * + * @param resourceKey + */ + @JsonProperty("resourceKey") + public void setResourceKey(ResourceKey resourceKey) { + this.resourceKey = resourceKey; + } + + /** + * getResourceStatusStates. + * + * @return resourceStatusStates + */ + @JsonProperty("resourceStatusStates") + public List getResourceStatusStates() { + return resourceStatusStates; + } + + /** + * setResourceStatusStates. + * + * @param resourceStatusStates + */ + @JsonProperty("resourceStatusStates") + public void setResourceStatusStates(List resourceStatusStates) { + this.resourceStatusStates = resourceStatusStates; + } + + /** + * getResourceHealth. + * + * @return resourceHealth + */ + @JsonProperty("resourceHealth") + public String getResourceHealth() { + return resourceHealth; + } + + /** + * setResourceHealth. + * + * @param resourceHealth + */ + @JsonProperty("resourceHealth") + public void setResourceHealth(String resourceHealth) { + this.resourceHealth = resourceHealth; + } + + /** + * getResourceHealthValue. + * + * @return resourceHealthValue + */ + @JsonProperty("resourceHealthValue") + public Double getResourceHealthValue() { + return resourceHealthValue; + } + + /** + * setResourceHealthValue. + * + * @param resourceHealthValue + */ + @JsonProperty("resourceHealthValue") + public void setResourceHealthValue(Double resourceHealthValue) { + this.resourceHealthValue = resourceHealthValue; + } + + /** + * isDtEnabled. + * + * @return dtEnabled + */ + @JsonProperty("dtEnabled") + public Boolean isDtEnabled() { + return dtEnabled; + } + + /** + * setDtEnabled. + * + * @param dtEnabled + */ + @JsonProperty("dtEnabled") + public void setDtEnabled(Boolean dtEnabled) { + this.dtEnabled = dtEnabled; + } + + /** + * getMonitoringInterval. + * + * @return monitoringInterval + */ + @JsonProperty("monitoringInterval") + public Integer getMonitoringInterval() { + return monitoringInterval; + } + + /** + * setMonitoringInterval. + * + * @param monitoringInterval + */ + @JsonProperty("monitoringInterval") + public void setMonitoringInterval(Integer monitoringInterval) { + this.monitoringInterval = monitoringInterval; + } + + /** + * getBadges. + * + * @return badges + */ + @JsonProperty("badges") + public List getBadges() { + return badges; + } + + /** + * setBadges. + * + * @param badges + */ + @JsonProperty("badges") + public void setBadges(List badges) { + this.badges = badges; + } + + /** + * getRelatedResources. + * + * @return relatedResources + */ + @JsonProperty("relatedResources") + public List getRelatedResources() { + return relatedResources; + } + + /** + * setRelatedResources. + * + * @param relatedResources + */ + @JsonProperty("relatedResources") + public void setRelatedResources(List relatedResources) { + this.relatedResources = relatedResources; + } + + /** + * getIdentifier. + * + * @return identifier + */ + @JsonProperty("identifier") + public String getIdentifier() { + return identifier; + } + + /** + * setIdentifier. + * + * @param identifier + */ + @JsonProperty("identifier") + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + /** + * getAdditionalProperties. + * + * @return additionalProperties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * setAdditionalProperties. + * + * @param key + * @param val + */ + @JsonAnySetter + public void setAdditionalProperties(String key, Object val) { + this.additionalProperties.put(key, val); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "adapterInstanceId", "resourceStatus", "resourceState", "statusMessage" }) + public static final class ResourceStatusState implements Serializable { + private static final long serialVersionUID = -787582647822155817L; + + /** + * adapterInstanceId. + */ + @JsonProperty("adapterInstanceId") + private String adapterInstanceId; + + /** + * resourceStatus. + */ + @JsonProperty("resourceStatus") + private String resourceStatus; + + /** + * resourceState. + */ + @JsonProperty("resourceState") + private String resourceState; + + /** + * statusMessage. + */ + @JsonProperty("statusMessage") + private String statusMessage; + + /** + * additionalProperties. + */ + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + /** + * getAdapterInstanceId. + * + * @return adapterInstanceId + */ + @JsonProperty("adapterInstanceId") + public String getAdapterInstanceId() { + return adapterInstanceId; + } + + /** + * setAdapterInstanceId. + * + * @param adapterInstanceId + */ + @JsonProperty("adapterInstanceId") + public void setAdapterInstanceId(String adapterInstanceId) { + this.adapterInstanceId = adapterInstanceId; + } + + /** + * getResourceStatus. + * + * @return adapterInstanceId + */ + @JsonProperty("resourceStatus") + public String getResourceStatus() { + return resourceStatus; + } + + /** + * setResourceStatus. + * + * @param resourceStatus + */ + @JsonProperty("resourceStatus") + public void setResourceStatus(String resourceStatus) { + this.resourceStatus = resourceStatus; + } + + /** + * getResourceState. + * + * @return resourceState + */ + @JsonProperty("resourceState") + public String getResourceState() { + return resourceState; + } + + /** + * setResourceState. + * + * @param resourceState + */ + @JsonProperty("resourceState") + public void setResourceState(String resourceState) { + this.resourceState = resourceState; + } + + /** + * getStatusMessage. + * + * @return statusMessage + */ + @JsonProperty("statusMessage") + public String getStatusMessage() { + return statusMessage; + } + + /** + * statusMessage. + * + * @param statusMessage + */ + @JsonProperty("statusMessage") + public void setStatusMessage(String statusMessage) { + this.statusMessage = statusMessage; + } + + /** + * getAdditionalProperties. + * + * @return additionalProperties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * setAdditionalProperties. + * + * @param key + * @param val + */ + @JsonAnySetter + public void setAdditionalProperties(String key, Object val) { + this.additionalProperties.put(key, val); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "name", "adapterKindKey", "resourceKindKey", "resourceIdentifiers" }) + public static final class ResourceKey implements Serializable { + private static final long serialVersionUID = -7173935404365000209L; + + /** + * name. + */ + @JsonProperty("name") + private String name; + + /** + * adapterKindKey. + */ + @JsonProperty("adapterKindKey") + private String adapterKindKey; + + /** + * resourceKindKey. + */ + @JsonProperty("resourceKindKey") + private String resourceKindKey; + + /** + * resourceIdentifiers. + */ + @JsonProperty("resourceIdentifiers") + private List resourceIdentifiers = new ArrayList<>(); + + /** + * additionalProperties. + */ + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + /** + * getName. + * + * @return name + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * setName. + * + * @param name + */ + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + /** + * getAdapterKindKey. + * + * @return adapterKindKey + */ + @JsonProperty("adapterKindKey") + public String getAdapterKindKey() { + return adapterKindKey; + } + + /** + * setAdapterKindKey. + * + * @param adapterKindKey + */ + @JsonProperty("adapterKindKey") + public void setAdapterKindKey(String adapterKindKey) { + this.adapterKindKey = adapterKindKey; + } + + /** + * getResourceKindKey. + * + * @return resourceKindKey + */ + @JsonProperty("resourceKindKey") + public String getResourceKindKey() { + return resourceKindKey; + } + + /** + * resourceKindKey. + * + * @param resourceKindKey + */ + @JsonProperty("resourceKindKey") + public void setResourceKindKey(String resourceKindKey) { + this.resourceKindKey = resourceKindKey; + } + + /** + * getResourceIdentifiers. + * + * @return resourceIdentifiers + */ + @JsonProperty("resourceIdentifiers") + public List getResourceIdentifiers() { + return resourceIdentifiers; + } + + /** + * setResourceIdentifiers. + * + * @param resourceIdentifiers + */ + @JsonProperty("resourceIdentifiers") + public void setResourceIdentifiers(List resourceIdentifiers) { + this.resourceIdentifiers = resourceIdentifiers; + } + + /** + * getAdditionalProperties. + * + * @return additionalProperties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * setAdditionalProperties. + * + * @param key + * @param val + */ + @JsonAnySetter + public void setAdditionalProperties(String key, Object val) { + this.additionalProperties.put(key, val); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "identifierType", "value" }) + public static final class ResourceIdentifier implements Serializable { + private static final long serialVersionUID = -4631445128052519908L; + + /** + * identifierType. + */ + @JsonProperty("identifierType") + private IdentifierType identifierType; + + /** + * value. + */ + @JsonProperty("value") + private String value; + + /** + * additionalProperties. + */ + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + /** + * getIdentifierType. + * + * @return identifierType + */ + @JsonProperty("identifierType") + public IdentifierType getIdentifierType() { + return identifierType; + } + + /** + * setIdentifierType. + * + * @param identifierType + */ + @JsonProperty("identifierType") + public void setIdentifierType(IdentifierType identifierType) { + this.identifierType = identifierType; + } + + /** + * getValue. + * + * @return value + */ + @JsonProperty("value") + public String getValue() { + return value; + } + + /** + * setValue. + * + * @param value + */ + @JsonProperty("value") + public void setValue(String value) { + this.value = value; + } + + /** + * getAdditionalProperties. + * + * @return additionalProperties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * setAdditionalProperties. + * + * @param key + * @param val + */ + @JsonAnySetter + public void setAdditionalProperties(String key, Object val) { + this.additionalProperties.put(key, val); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "name", "dataType", "isPartOfUniqueness" }) + public static final class IdentifierType implements Serializable { + private static final long serialVersionUID = -1370467208132974903L; + + /** + * name. + */ + @JsonProperty("name") + private String name; + + /** + * dataType. + */ + @JsonProperty("dataType") + private String dataType; + + /** + * isPartOfUniqueness. + */ + @JsonProperty("isPartOfUniqueness") + private Boolean isPartOfUniqueness; + + /** + * additionalProperties. + */ + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + /** + * getName. + * + * @return name + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * setName. + * + * @param name + */ + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + /** + * getDataType. + * + * @return dataType + */ + @JsonProperty("dataType") + public String getDataType() { + return dataType; + } + + /** + * setDataType. + * + * @param dataType + */ + @JsonProperty("dataType") + public void setDataType(String dataType) { + this.dataType = dataType; + } + + /** + * isIsPartOfUniqueness. + * + * @return isPartOfUniqueness + */ + @JsonProperty("isPartOfUniqueness") + public Boolean isIsPartOfUniqueness() { + return isPartOfUniqueness; + } + + /** + * setIsPartOfUniqueness. + * + * @param isPartOfUniqueness + */ + @JsonProperty("isPartOfUniqueness") + public void setIsPartOfUniqueness(Boolean isPartOfUniqueness) { + this.isPartOfUniqueness = isPartOfUniqueness; + } + + /** + * getAdditionalProperties. + * + * @return additionalProperties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + /** + * setAdditionalProperties. + * + * @param key + * @param val + */ + @JsonAnySetter + public void setAdditionalProperties(String key, Object val) { + this.additionalProperties.put(key, val); + } + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/SupermetricDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/SupermetricDTO.java new file mode 100644 index 000000000..b67870c63 --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/SupermetricDTO.java @@ -0,0 +1,146 @@ +/* + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "pageInfo", "links", "superMetrics" }) +@JsonIgnoreProperties({ "pageInfo", "links" }) +public class SupermetricDTO implements Serializable { + private static final long serialVersionUID = 5670765783544505917L; + + @JsonProperty("superMetrics") + private List superMetrics = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("superMetrics") + public List getSuperMetrics() { + return superMetrics; + } + + @JsonProperty("superMetrics") + public void setSuperMetrics(List superMetrics) { + this.superMetrics = superMetrics; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "id", "name", "formula", "description", "modificationTime" }) + public static class SuperMetric implements Serializable { + private static final long serialVersionUID = -4863216664973423038L; + + @JsonProperty("id") + private String id; + + @JsonProperty("name") + private String name; + + @JsonProperty("formula") + private String formula; + + @JsonProperty("description") + private String description; + + @JsonProperty("modificationTime") + private long modificationTime; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("formula") + public String getFormula() { + return formula; + } + + @JsonProperty("formula") + public void setFormula(String formula) { + this.formula = formula; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty("modificationTime") + public long getModificationTime() { + return modificationTime; + } + + @JsonProperty("modificationTime") + public void setModificationTime(long modificationTime) { + this.modificationTime = modificationTime; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/SymptomDefinitionDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/SymptomDefinitionDTO.java new file mode 100644 index 000000000..47040f896 --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/SymptomDefinitionDTO.java @@ -0,0 +1,380 @@ +/* + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "symptomDefinitions" }) +@JsonIgnoreProperties({ "pageInfo", "links" }) +public class SymptomDefinitionDTO implements Serializable { + private static final long serialVersionUID = -8907264880213103337L; + + @JsonProperty("symptomDefinitions") + private List symptomDefinitions = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("symptomDefinitions") + public List getSymptomDefinitions() { + return symptomDefinitions; + } + + @JsonProperty("symptomDefinitions") + public void setSymptomDefinitions(List symptomDefinitions) { + this.symptomDefinitions = symptomDefinitions; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "id", "name", "adapterKindKey", "resourceKindKey", "waitCycles", "cancelCycles", "state" }) + public static class SymptomDefinition implements Serializable { + private static final long serialVersionUID = -5587983216831252144L; + + @JsonProperty("id") + private String id; + + @JsonProperty("name") + private String name; + + @JsonProperty("adapterKindKey") + private String adapterKindKey; + + @JsonProperty("resourceKindKey") + private String resourceKindKey; + + @JsonProperty("waitCycles") + private Integer waitCycles; + + @JsonProperty("cancelCycles") + private Integer cancelCycles; + + @JsonProperty("state") + private State state; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("adapterKindKey") + public String getAdapterKindKey() { + return adapterKindKey; + } + + @JsonProperty("adapterKindKey") + public void setAdapterKindKey(String adapterKindKey) { + this.adapterKindKey = adapterKindKey; + } + + @JsonProperty("resourceKindKey") + public String getResourceKindKey() { + return resourceKindKey; + } + + @JsonProperty("resourceKindKey") + public void setResourceKindKey(String resourceKindKey) { + this.resourceKindKey = resourceKindKey; + } + + @JsonProperty("waitCycles") + public Integer getWaitCycles() { + return waitCycles; + } + + @JsonProperty("waitCycles") + public void setWaitCycles(Integer waitCycles) { + this.waitCycles = waitCycles; + } + + @JsonProperty("cancelCycles") + public Integer getCancelCycles() { + return cancelCycles; + } + + @JsonProperty("cancelCycles") + public void setCancelCycles(Integer cancelCycles) { + this.cancelCycles = cancelCycles; + } + + @JsonProperty("state") + public State getState() { + return state; + } + + @JsonProperty("state") + public void setState(State state) { + this.state = state; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "severity", "condition" }) + public static class State implements Serializable { + private static final long serialVersionUID = -1599769134473820197L; + + @JsonProperty("severity") + private String severity; + + @JsonProperty("condition") + private Condition condition; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("severity") + public String getSeverity() { + return severity; + } + + @JsonProperty("severity") + public void setSeverity(String severity) { + this.severity = severity; + } + + @JsonProperty("condition") + public Condition getCondition() { + return condition; + } + + @JsonProperty("condition") + public void setCondition(Condition condition) { + this.condition = condition; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "type", "key", "operator", "value", "valueType", "instanced", "thresholdType", "stringValue", "eventType", "message", "faultKey" }) + @JsonIgnoreProperties({ "faultEvents", "targetKey", "instanced", "hardThresholdEventType", "statKey" }) + public static class Condition implements Serializable { + private static final long serialVersionUID = 6996617212704194983L; + + @JsonProperty("type") + private String type; + + @JsonProperty("key") + private String key; + + @JsonProperty("operator") + private String operator; + + @JsonProperty("value") + private String value; + + @JsonProperty("valueType") + private String valueType; + + @JsonProperty("instanced") + private Boolean instanced; + + @JsonProperty("thresholdType") + private String thresholdType; + + @JsonProperty("stringValue") + private String stringValue; + + @JsonProperty("eventType") + private String eventType; + + @JsonProperty("message") + private String message; + + @JsonProperty("faultKey") + private String faultKey; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonProperty("type") + public void setType(String type) { + this.type = type; + } + + @JsonProperty("key") + public String getKey() { + return key; + } + + @JsonProperty("key") + public void setKey(String key) { + this.key = key; + } + + @JsonProperty("operator") + public String getOperator() { + return operator; + } + + @JsonProperty("operator") + public void setOperator(String operator) { + this.operator = operator; + } + + @JsonProperty("value") + public String getValue() { + return value; + } + + @JsonProperty("value") + public void setValue(String value) { + this.value = value; + } + + @JsonProperty("valueType") + public String getValueType() { + return valueType; + } + + @JsonProperty("valueType") + public void setValueType(String valueType) { + this.valueType = valueType; + } + + @JsonProperty("instanced") + public Boolean isInstanced() { + return instanced; + } + + @JsonProperty("instanced") + public void setInstanced(Boolean instanced) { + this.instanced = instanced; + } + + @JsonProperty("thresholdType") + public String getThresholdType() { + return thresholdType; + } + + @JsonProperty("thresholdType") + public void setThresholdType(String thresholdType) { + this.thresholdType = thresholdType; + } + + @JsonProperty("stringValue") + public String getStringValue() { + return stringValue; + } + + @JsonProperty("stringValue") + public void setStringValue(String stringValue) { + this.stringValue = stringValue; + } + + @JsonProperty("eventType") + public String getEventType() { + return eventType; + } + + @JsonProperty("eventType") + public void setEventType(String eventType) { + this.eventType = eventType; + } + + @JsonProperty("message") + public String getMessage() { + return message; + } + + @JsonProperty("message") + public void setMessage(String message) { + this.message = message; + } + + @JsonProperty("faultKey") + public String getFaultKey() { + return faultKey; + } + + @JsonProperty("faultKey") + public void setFaultKey(String faultKey) { + this.faultKey = faultKey; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + } + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/ViewDefinitionDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/ViewDefinitionDTO.java new file mode 100644 index 000000000..a6b26ff3f --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/ViewDefinitionDTO.java @@ -0,0 +1,187 @@ +/* + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "pageInfo", "links", "viewDefinitions" }) +@JsonIgnoreProperties({ "pageInfo", "links" }) +public class ViewDefinitionDTO implements Serializable { + private static final long serialVersionUID = -5287778608502410853L; + + @JsonProperty("viewDefinitions") + private List viewDefinitions = new ArrayList<>(); + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("viewDefinitions") + public List getViewDefinitions() { + return viewDefinitions; + } + + @JsonProperty("viewDefinitions") + public void setViewDefinitions(List viewDefinitions) { + this.viewDefinitions = viewDefinitions; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonPropertyOrder({ "name", "description", "type", "presentationType", "subjects", "owner", "active", "links", "id" }) + @JsonIgnoreProperties({ "links" }) + public static class ViewDefinition implements Serializable { + private static final long serialVersionUID = 5175470177444359491L; + + @JsonProperty("name") + private String name; + + @JsonProperty("description") + private String description; + + @JsonProperty("type") + private String type; + + @JsonProperty("presentationType") + private String presentationType; + + @JsonProperty("subjects") + private List subjects = new ArrayList<>(); + + @JsonProperty("owner") + private String owner; + + @JsonProperty("active") + private Boolean active; + + @JsonProperty("id") + private String id; + + @JsonIgnore + private transient Map additionalProperties = new HashMap<>(); + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonProperty("type") + public void setType(String type) { + this.type = type; + } + + @JsonProperty("presentationType") + public String getPresentationType() { + return presentationType; + } + + @JsonProperty("presentationType") + public void setPresentationType(String presentationType) { + this.presentationType = presentationType; + } + + @JsonProperty("subjects") + public List getSubjects() { + return subjects; + } + + @JsonProperty("subjects") + public void setSubjects(List subjects) { + this.subjects = subjects; + } + + @JsonProperty("owner") + public String getOwner() { + return owner; + } + + @JsonProperty("owner") + public void setOwner(String owner) { + this.owner = owner; + } + + @JsonProperty("active") + public Boolean isActive() { + return active; + } + + @JsonProperty("active") + public void setActive(Boolean active) { + this.active = active; + } + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperties(String name, Object value) { + this.additionalProperties.put(name, value); + } + + } +} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/package-info.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/package-info.java new file mode 100644 index 000000000..f55950613 --- /dev/null +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/models/package-info.java @@ -0,0 +1,20 @@ +/*- + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ + +/** + * Package that represents vROPs Rest Model. + * + */ +package com.vmware.pscoe.iac.artifact.aria.operations.models; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientVrops.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVrops.java similarity index 98% rename from common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientVrops.java rename to common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVrops.java index 419362844..e3c5362dd 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientVrops.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVrops.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest; +package com.vmware.pscoe.iac.artifact.aria.operations.rest; import java.io.File; import java.net.URI; @@ -56,28 +56,29 @@ import com.google.gson.GsonBuilder; import com.jayway.jsonpath.JsonPath; import com.vmware.pscoe.iac.artifact.configuration.Configuration; -import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; import com.vmware.pscoe.iac.artifact.model.Version; import com.vmware.pscoe.iac.artifact.model.vrops.VropsPackageMemberType; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.AdapterKindDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.AlertDefinitionDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.AlertDefinitionDTO.AlertDefinition.State; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.AlertDefinitionDTO.AlertDefinition.SymptomSet; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.AuthGroupDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.AuthGroupsDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.AuthUsersDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.AuthUserDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.CustomGroupDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.CustomGroupTypeDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.PolicyCustomGroupAssignmentDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.PolicyDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.RecommendationDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.ReportDefinitionDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.ResourceKindDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.ResourcesDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.SupermetricDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.SymptomDefinitionDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.ViewDefinitionDTO; +import com.vmware.pscoe.iac.artifact.rest.RestClient; +import com.vmware.pscoe.iac.artifact.aria.operations.models.AdapterKindDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.AlertDefinitionDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.AlertDefinitionDTO.AlertDefinition.State; +import com.vmware.pscoe.iac.artifact.aria.operations.models.AlertDefinitionDTO.AlertDefinition.SymptomSet; +import com.vmware.pscoe.iac.artifact.aria.operations.models.AuthGroupDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.AuthGroupsDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.AuthUsersDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.AuthUserDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.CustomGroupDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.CustomGroupTypeDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.PolicyCustomGroupAssignmentDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.PolicyDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.RecommendationDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.ReportDefinitionDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.ResourceKindDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.ResourcesDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.SupermetricDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.SymptomDefinitionDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.ViewDefinitionDTO; @SuppressWarnings("deprecation") public class RestClientVrops extends RestClient { diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientVropsAuthNInterceptor.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVropsAuthNInterceptor.java similarity index 90% rename from common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientVropsAuthNInterceptor.java rename to common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVropsAuthNInterceptor.java index 564d37bad..3b7e648e1 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientVropsAuthNInterceptor.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVropsAuthNInterceptor.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest; +package com.vmware.pscoe.iac.artifact.aria.operations.rest; import java.io.IOException; import java.net.URI; @@ -39,7 +39,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.jsonpath.DocumentContext; import com.jayway.jsonpath.JsonPath; -import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; +import com.vmware.pscoe.iac.artifact.rest.RestClientRequestInterceptor; public class RestClientVropsAuthNInterceptor extends RestClientRequestInterceptor { private static final String VROPS_AUTH_TOKEN_URI = "/suite-api/api/auth/token/acquire"; @@ -74,7 +75,8 @@ public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttp private void acquireToken(HttpRequest request) throws JsonProcessingException { logger.info("Acquiring VROPS auth token."); - final URI vropsTokenUri = UriComponentsBuilder.newInstance().scheme(request.getURI().getScheme()).host(getConfiguration().getHost()) + final URI vropsTokenUri = UriComponentsBuilder.newInstance().scheme(request.getURI().getScheme()) + .host(getConfiguration().getHost()) .port(getConfiguration().getPort()).path(VROPS_AUTH_TOKEN_URI).build().toUri(); logger.info("VROPS Auth Token URL: {}", vropsTokenUri); @@ -87,11 +89,13 @@ private void acquireToken(HttpRequest request) throws JsonProcessingException { payload.put("authSource", getConfiguration().getVropsAuthSource()); final HttpEntity entity = new HttpEntity<>(new ObjectMapper().writeValueAsString(payload), headers); - ResponseEntity response = getRestTemplate().exchange(vropsTokenUri, HttpMethod.POST, entity, String.class); + ResponseEntity response = getRestTemplate().exchange(vropsTokenUri, HttpMethod.POST, entity, + String.class); final DocumentContext responseBody = JsonPath.parse(response.getBody()); final long ttl = responseBody.read("$.validity"); - this.vropsTokenExpirationTime = LocalDateTime.now(ZoneOffset.UTC).plus(ttl, ChronoField.MINUTE_OF_HOUR.getBaseUnit()); + this.vropsTokenExpirationTime = LocalDateTime.now(ZoneOffset.UTC).plus(ttl, + ChronoField.MINUTE_OF_HOUR.getBaseUnit()); this.vropsAuthToken = responseBody.read("$.token"); } diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientVropsBasicAuthInterceptor.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVropsBasicAuthInterceptor.java similarity index 87% rename from common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientVropsBasicAuthInterceptor.java rename to common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVropsBasicAuthInterceptor.java index 24e0c92de..6902bd77c 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientVropsBasicAuthInterceptor.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVropsBasicAuthInterceptor.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest; +package com.vmware.pscoe.iac.artifact.aria.operations.rest; import java.io.IOException; @@ -22,7 +22,8 @@ import org.springframework.http.client.support.BasicAuthenticationInterceptor; import org.springframework.web.client.RestTemplate; -import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; +import com.vmware.pscoe.iac.artifact.rest.RestClientRequestInterceptor; public class RestClientVropsBasicAuthInterceptor extends RestClientRequestInterceptor { diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/VropsPackageStore.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStore.java similarity index 80% rename from common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/VropsPackageStore.java rename to common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStore.java index 825d6a6f4..30ba13e47 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/VropsPackageStore.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStore.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact; +package com.vmware.pscoe.iac.artifact.aria.operations.store; import java.io.File; import java.io.FileFilter; @@ -60,6 +60,9 @@ import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import com.jcraft.jsch.JSchException; +import com.vmware.pscoe.iac.artifact.GenericPackageStore; +import com.vmware.pscoe.iac.artifact.PackageManager; +import com.vmware.pscoe.iac.artifact.PackageStore; import com.vmware.pscoe.iac.artifact.cli.CliManagerVrops; import com.vmware.pscoe.iac.artifact.cli.ZipUtilities; import com.vmware.pscoe.iac.artifact.configuration.ConfigurationException; @@ -70,16 +73,16 @@ import com.vmware.pscoe.iac.artifact.model.vrops.VropsPackageDescriptor; import com.vmware.pscoe.iac.artifact.model.vrops.VropsPackageMemberType; import com.vmware.pscoe.iac.artifact.rest.RestClientVrops; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.AlertDefinitionDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.AuthGroupDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.CustomGroupDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.PolicyDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.RecommendationDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.ReportDefinitionDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.SupermetricDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.SymptomDefinitionDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.ViewDefinitionDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.AuthUserDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.AlertDefinitionDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.AuthGroupDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.CustomGroupDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.PolicyDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.RecommendationDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.ReportDefinitionDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.SupermetricDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.SymptomDefinitionDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.ViewDefinitionDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.AuthUserDTO; /** * This is the class that abstracts the operations for working with vROps @@ -163,7 +166,7 @@ public final class VropsPackageStore extends GenericPackageStore getPackages() { /** * Exports all packages. + * * @param packages the packages to export - * @param dryrun whether it should be dry run + * @param dryrun whether it should be dry run * @return the exported packages */ @Override @@ -254,28 +265,36 @@ public List exportAllPackages(final List packages, final boole /** * Imports all packages. - * @param pkg the packages to import - * @param dryrun whether it should be dry run + * + * @param pkg the packages to import + * @param dryrun whether it should be dry run * @param enableBackup whether it should back up the packages on import * @return the imported package */ @Override public List importAllPackages(final List pkg, final boolean dryrun, final boolean enableBackup) { - return this.importAllPackages(pkg, dryrun, false, enableBackup); + return this.importAllPackages(pkg, dryrun, false, enableBackup); } /** - * Implement the push use case, so push the packages that are packed in the local project ot the remote vROps server and if we are not ia a dryrun mode, then + * Implement the push use case, so push the packages that are packed in the + * local project ot the remote vROps server and if we are not ia a dryrun mode, + * then * effectively import it into vROps. - * @param packages Locally available packages. - * @param dryrun Just test the whole process without actually import the packages in vROps. + * + * @param packages Locally available packages. + * @param dryrun Just test the whole process without actually import the + * packages in vROps. * @param mergePackages Whether to merge the packages - * @param enableBackup Whether to enable backup - * @return The list of pushed packages. The actual package objects may be different, for example the file content they are associated with may be different file on - * the file system. + * @param enableBackup Whether to enable backup + * @return The list of pushed packages. The actual package objects may be + * different, for example the file content they are associated with may + * be different file on + * the file system. */ @Override - public List importAllPackages(final List packages, final boolean dryrun, final boolean mergePackages, final boolean enableBackup) { + public List importAllPackages(final List packages, final boolean dryrun, + final boolean mergePackages, final boolean enableBackup) { validateFilesystem(packages); List sourceEndpointPackages = packages; @@ -292,14 +311,17 @@ public List importAllPackages(final List packages, final boole } /** - * Implement the pull use case, so pull all of the packages described in the {@code vropsPackageDescriptor} (constructed from content.yaml). - * @param vropsPackage vropsPackage + * Implement the pull use case, so pull all of the packages described in the + * {@code vropsPackageDescriptor} (constructed from content.yaml). + * + * @param vropsPackage vropsPackage * @param vropsPackageDescriptor vropsPackageDescriptor - * @param dryrun dryrun + * @param dryrun dryrun * @return package */ @Override - public Package exportPackage(final Package vropsPackage, final VropsPackageDescriptor vropsPackageDescriptor, final boolean dryrun) { + public Package exportPackage(final Package vropsPackage, final VropsPackageDescriptor vropsPackageDescriptor, + final boolean dryrun) { logger.info(String.format(PackageStore.PACKAGE_EXPORT, vropsPackage)); if (!Files.exists(tempVropsExportDir.toPath())) { @@ -382,7 +404,8 @@ public Package exportPackage(final Package vropsPackage, final VropsPackageDescr PackageManager.copyContents(tempVropsExportDir, destDir); } } catch (IOException ioe) { - throw new RuntimeException(String.format("Cannot copy content of downloaded and extracted package from temp dir %s to actual project dir %s : %s", + throw new RuntimeException(String.format( + "Cannot copy content of downloaded and extracted package from temp dir %s to actual project dir %s : %s", tempVropsExportDir.getAbsolutePath(), vropsPackage.getFilesystemPath(), ioe.getMessage())); } finally { try { @@ -398,9 +421,11 @@ public Package exportPackage(final Package vropsPackage, final VropsPackageDescr /** * Export views from vROPs. + * * @param vropsPackage Package to export views to. - * @param viewNames List of views to be exported. - * @throws RuntimeException if there are no views on vROPs server or the export fails. + * @param viewNames List of views to be exported. + * @throws RuntimeException if there are no views on vROPs server or the export + * fails. */ private void exportViews(final Package vropsPackage, final List viewNames) { ViewDefinitionDTO allViewDefinitions = restClient.getAllViewDefinitions(); @@ -422,7 +447,8 @@ private void exportViews(final Package vropsPackage, final List viewName filteredViews.forEach(view -> copyViewToFilesystem(view, viewsDir)); } catch (JSchException e) { String message = "Unable to export views in package '%s', error in connection to '%s'. '%s' : '%s' Use command '%s' for troubleshooting"; - message = String.format(message, vropsPackage.getFQName(), cliManager, e.getClass().getName(), e.getMessage(), cliManager.toSshComand()); + message = String.format(message, vropsPackage.getFQName(), cliManager, e.getClass().getName(), + e.getMessage(), cliManager.toSshComand()); logger.error(message); throw new RuntimeException(message, e); } finally { @@ -432,9 +458,11 @@ private void exportViews(final Package vropsPackage, final List viewName /** * Export super metrics from vROPs. - * @param vropsPackage Package to export super metrics to. - * @param superMetricNames List of super metrics to be exported. - * @throws RuntimeException if there are no super metrics on vROPs server or the export fails. + * + * @param vropsPackage Package to export super metrics to. + * @param superMetricNames List of super metrics to be exported. + * @throws RuntimeException if there are no super metrics on vROPs server or the + * export fails. */ private void exportSuperMetrics(final Package vropsPackage, final List superMetricNames) { SupermetricDTO allSupermetrics = restClient.getAllSupermetrics(); @@ -458,7 +486,8 @@ private void exportSuperMetrics(final Package vropsPackage, final List s filteredSupermetrics.forEach(superMetric -> this.copySuperMetricToFilesystem(superMetric, superMetricsDir)); } catch (JSchException e) { String message = "Unable to export super metrics in package '%s', error in connection to '%s'. '%s' : '%s' Use command '%s' for troubleshooting"; - message = String.format(message, vropsPackage.getFQName(), cliManager, e.getClass().getName(), e.getMessage(), cliManager.toSshComand()); + message = String.format(message, vropsPackage.getFQName(), cliManager, e.getClass().getName(), + e.getMessage(), cliManager.toSshComand()); logger.error(message); throw new RuntimeException(message, e); } finally { @@ -468,7 +497,8 @@ private void exportSuperMetrics(final Package vropsPackage, final List s /** * Export metrics configs from vROPs. - * @param vropsPackage Package to export metric configs to. + * + * @param vropsPackage Package to export metric configs to. * @param metricConfigNames List of metric configs to be exported. * @throws RuntimeException If the the export fails. */ @@ -483,7 +513,9 @@ private void exportMetricConfigs(final Package vropsPackage, final List cliManager.connect(); for (String metricConfigName : metricConfigNames) { if (metricConfigName.contains(WILDCARD_MATCH_SYMBOL)) { - logger.warn("Unable to export metric configs with pattern '{}' as vROPs metric config export does not support regex", metricConfigName); + logger.warn( + "Unable to export metric configs with pattern '{}' as vROPs metric config export does not support regex", + metricConfigName); } else { // Could be stored with or without extension in vROps, so search for both this.copyMetricConfigToFilesystem(metricConfigName, metricConfigsDir); @@ -492,7 +524,8 @@ private void exportMetricConfigs(final Package vropsPackage, final List } } catch (JSchException e) { String message = "Unable to export metric config in package '%s', error in connection to '%s'. '%s' : '%s' Use command '%s' for troubleshooting"; - message = String.format(message, vropsPackage.getFQName(), cliManager, e.getClass().getName(), e.getMessage(), cliManager.toSshComand()); + message = String.format(message, vropsPackage.getFQName(), cliManager, e.getClass().getName(), + e.getMessage(), cliManager.toSshComand()); logger.error(message); throw new RuntimeException(message, e); } finally { @@ -502,18 +535,20 @@ private void exportMetricConfigs(final Package vropsPackage, final List /** * Copy the exported views from vROPs to the local file system. + * * @param view view to be copied. - * @param dir directory where the view to be copied. + * @param dir directory where the view to be copied. * @throws RuntimeException If the the copy fails. */ private void copyViewToFilesystem(final String view, final File dir) { try { - File viewDir = new File(tempDir, "iac-view-" + UUID.randomUUID().toString() + "-" + System.currentTimeMillis()); + File viewDir = new File(tempDir, + "iac-view-" + UUID.randomUUID().toString() + "-" + System.currentTimeMillis()); viewDir.mkdirs(); cliManager.exportView(view, viewDir); File zip = new File(viewDir, view + ".zip"); ZipUtilities.unzip(zip, viewDir); - + File content = new File(viewDir, "content.xml"); moveFile(content, new File(dir, view + ".xml")); zip.delete(); @@ -528,16 +563,18 @@ private void copyViewToFilesystem(final String view, final File dir) { /** * Copy the exported super metric from vROPs to the local file system. + * * @param superMetric super metric to be copied. - * @param dir directory where the view to be copied. + * @param dir directory where the view to be copied. * @throws RuntimeException If the the copy fails. */ private void copySuperMetricToFilesystem(final String superMetric, final File dir) { try { - File superMetricDir = new File(this.tempDir, "iac-supermetric-" + UUID.randomUUID().toString() + "-" + System.currentTimeMillis()); + File superMetricDir = new File(this.tempDir, + "iac-supermetric-" + UUID.randomUUID().toString() + "-" + System.currentTimeMillis()); superMetricDir.mkdirs(); this.cliManager.exportSuperMetric(superMetric, superMetricDir); - File content = new File(superMetricDir, superMetric + ".json"); + File content = new File(superMetricDir, superMetric + ".json"); moveFile(content, new File(dir, superMetric + ".json")); mergeLocalizationResources(new File(superMetricDir, "resources"), new File(dir, "resources")); } catch (JSchException | IOException e) { @@ -550,21 +587,23 @@ private void copySuperMetricToFilesystem(final String superMetric, final File di /** * Copy the exported metric config from vROPs to the local file system. + * * @param metricConfig metric config to be copied. - * @param dir directory where the view to be copied. + * @param dir directory where the view to be copied. * @throws RuntimeException If the the copy fails. */ private void copyMetricConfigToFilesystem(final String metricConfig, final File dir) { try { - File metricConfigsDir = new File(this.tempDir, "iac-metricconfig-" + UUID.randomUUID().toString() + "-" + System.currentTimeMillis()); + File metricConfigsDir = new File(this.tempDir, + "iac-metricconfig-" + UUID.randomUUID().toString() + "-" + System.currentTimeMillis()); metricConfigsDir.mkdirs(); this.cliManager.exportMetricConfig(metricConfig, metricConfigsDir); - File content = new File(metricConfigsDir, metricConfig); + File content = new File(metricConfigsDir, metricConfig); if (content.exists()) { moveFile(content, new File(dir, metricConfig)); } - + } catch (JSchException | IOException e) { String message = "Unable to pull metric config '%s' from remote vROps location '%s' to local filesystem '%s' : '%s'"; message = String.format(message, metricConfig, cliManager, e.getClass().getName(), e.getMessage()); @@ -575,8 +614,9 @@ private void copyMetricConfigToFilesystem(final String metricConfig, final File /** * Export dashboards from vROPs. - * @param vropsPackage Package to export dashboards to. - * @param dashboardNames List of dashboards to be exported. + * + * @param vropsPackage Package to export dashboards to. + * @param dashboardNames List of dashboards to be exported. * @throws RuntimeException if the export fails. */ private void exportDashboards(final Package vropsPackage, final List dashboardNames) { @@ -587,7 +627,9 @@ private void exportDashboards(final Package vropsPackage, final List das cliManager.connect(); for (String dashboardName : dashboardNames) { if (dashboardName.contains(WILDCARD_MATCH_SYMBOL)) { - logger.warn("Unable to export dashboards with pattern '{}' as vROPs dashboard export does not support regex", dashboardName); + logger.warn( + "Unable to export dashboards with pattern '{}' as vROPs dashboard export does not support regex", + dashboardName); } else { copyDashboardToFilesystem(dashboardName, dashboardsDir); } @@ -600,7 +642,8 @@ private void exportDashboards(final Package vropsPackage, final List das storeDashboardActivationMetadata(dashboardsDir, dashboardNames, true); } catch (JSchException e) { String message = "Unable to pull dashboards '%s' from remote vROPs location to local package '%s' : '%s' : '%s' Use command '%s' for troubleshooting remote SSH connection"; - message = String.format(message, String.join(", ", dashboardNames), vropsPackage.getFQName(), e.getClass().getName(), e.getMessage(), + message = String.format(message, String.join(", ", dashboardNames), vropsPackage.getFQName(), + e.getClass().getName(), e.getMessage(), cliManager.toSshComand()); logger.error(message); throw new RuntimeException(message, e); @@ -611,9 +654,11 @@ private void exportDashboards(final Package vropsPackage, final List das /** * Export reports from vROPs. + * * @param vropsPackage Package to export reports to. - * @param reportNames List of reports to be exported. - * @throws RuntimeException if there are no reports on the server or the export fails. + * @param reportNames List of reports to be exported. + * @throws RuntimeException if there are no reports on the server or the export + * fails. */ private void exportReports(final Package vropsPackage, final List reportNames) { ReportDefinitionDTO allReportDefinitions = restClient.getAllReportDefinitions(); @@ -635,7 +680,8 @@ private void exportReports(final Package vropsPackage, final List report filteredReports.forEach(report -> copyReportToFilesystem(report, reportsDir)); } catch (JSchException e) { String message = "Unable to pull reports '%s' from remote vROPs location to local package '%s' : '%s' : '%s' Use command '%s' for troubleshooting remote SSH connection"; - message = String.format(message, String.join(", ", reportNames), vropsPackage.getFQName(), e.getClass().getName(), e.getMessage(), + message = String.format(message, String.join(", ", reportNames), vropsPackage.getFQName(), + e.getClass().getName(), e.getMessage(), cliManager.toSshComand()); logger.error(message); throw new RuntimeException(message, e); @@ -645,9 +691,11 @@ private void exportReports(final Package vropsPackage, final List report } /** - * Import definitions in vROPs. The following definitions are supported: alert definitions, symptom definitions, recommendations. + * Import definitions in vROPs. The following definitions are supported: alert + * definitions, symptom definitions, recommendations. + * * @param vropsPackage Package to export reports to. - * @param tmpDir Directory where the definitions will be read from. + * @param tmpDir Directory where the definitions will be read from. * @throws RuntimeException if the import fails. */ private void importDefinitions(final Package vropsPackage, final File tmpDir) throws IOException { @@ -655,24 +703,29 @@ private void importDefinitions(final Package vropsPackage, final File tmpDir) th ObjectMapper mapper = new ObjectMapper(); Map dependentDefinitionsMap = new HashMap<>(); - List symptomDefinitionFiles = addDefinitionsToImportList(tmpDir, VropsPackageMemberType.SYMPTOM_DEFINITION); + List symptomDefinitionFiles = addDefinitionsToImportList(tmpDir, + VropsPackageMemberType.SYMPTOM_DEFINITION); Map symptomDefinitionsMap = new HashMap<>(); for (File definitionFile : symptomDefinitionFiles) { String defninitionJson; try { defninitionJson = FileUtils.readFileToString(definitionFile, StandardCharsets.UTF_8); - SymptomDefinitionDTO.SymptomDefinition symptomDefinition = mapper.readValue(defninitionJson, SymptomDefinitionDTO.SymptomDefinition.class); + SymptomDefinitionDTO.SymptomDefinition symptomDefinition = mapper.readValue(defninitionJson, + SymptomDefinitionDTO.SymptomDefinition.class); symptomDefinitionsMap.put(symptomDefinition.getId(), symptomDefinition); } catch (IOException e) { - messages.append(String.format("Error reading %s : %s", VropsPackageMemberType.SYMPTOM_DEFINITION, e.getMessage())); + messages.append(String.format("Error reading %s : %s", VropsPackageMemberType.SYMPTOM_DEFINITION, + e.getMessage())); } catch (Exception e) { - messages.append(String.format("Error parsing %s : %s", VropsPackageMemberType.SYMPTOM_DEFINITION, e.getMessage())); + messages.append(String.format("Error parsing %s : %s", VropsPackageMemberType.SYMPTOM_DEFINITION, + e.getMessage())); } } symptomDefinitionsMap.keySet().stream().forEach(item -> { dependentDefinitionsMap.put(item, symptomDefinitionsMap.get(item)); }); - restClient.importDefinitionsInVrops(symptomDefinitionsMap, VropsPackageMemberType.SYMPTOM_DEFINITION, dependentDefinitionsMap); + restClient.importDefinitionsInVrops(symptomDefinitionsMap, VropsPackageMemberType.SYMPTOM_DEFINITION, + dependentDefinitionsMap); List recommendationFiles = addDefinitionsToImportList(tmpDir, VropsPackageMemberType.RECOMMENDATION); Map recommendationsMap = new HashMap<>(); @@ -680,18 +733,22 @@ private void importDefinitions(final Package vropsPackage, final File tmpDir) th String recommendationJson; try { recommendationJson = FileUtils.readFileToString(recommendationFile, StandardCharsets.UTF_8); - RecommendationDTO.Recommendation recommendation = mapper.readValue(recommendationJson, RecommendationDTO.Recommendation.class); + RecommendationDTO.Recommendation recommendation = mapper.readValue(recommendationJson, + RecommendationDTO.Recommendation.class); recommendationsMap.put(recommendation.getId(), recommendation); } catch (IOException e) { - messages.append(String.format("Error reading %s : %s", VropsPackageMemberType.RECOMMENDATION, e.getMessage())); + messages.append( + String.format("Error reading %s : %s", VropsPackageMemberType.RECOMMENDATION, e.getMessage())); } catch (Exception e) { - messages.append(String.format("Error parsing %s : %s", VropsPackageMemberType.RECOMMENDATION, e.getMessage())); + messages.append( + String.format("Error parsing %s : %s", VropsPackageMemberType.RECOMMENDATION, e.getMessage())); } } recommendationsMap.keySet().stream().forEach(item -> { dependentDefinitionsMap.put(item, recommendationsMap.get(item)); }); - restClient.importDefinitionsInVrops(recommendationsMap, VropsPackageMemberType.RECOMMENDATION, dependentDefinitionsMap); + restClient.importDefinitionsInVrops(recommendationsMap, VropsPackageMemberType.RECOMMENDATION, + dependentDefinitionsMap); List alertDefinitionFiles = addDefinitionsToImportList(tmpDir, VropsPackageMemberType.ALERT_DEFINITION); Map alertDefinitionsMap = new HashMap<>(); @@ -699,18 +756,22 @@ private void importDefinitions(final Package vropsPackage, final File tmpDir) th String defninitionJson; try { defninitionJson = FileUtils.readFileToString(definitionFile, StandardCharsets.UTF_8); - AlertDefinitionDTO.AlertDefinition alertDefinition = mapper.readValue(defninitionJson, AlertDefinitionDTO.AlertDefinition.class); + AlertDefinitionDTO.AlertDefinition alertDefinition = mapper.readValue(defninitionJson, + AlertDefinitionDTO.AlertDefinition.class); alertDefinitionsMap.put(alertDefinition.getId(), alertDefinition); } catch (IOException e) { - messages.append(String.format("Error reading %s : %s", VropsPackageMemberType.ALERT_DEFINITION, e.getMessage())); + messages.append(String.format("Error reading %s : %s", VropsPackageMemberType.ALERT_DEFINITION, + e.getMessage())); } catch (Exception e) { - messages.append(String.format("Error parsing %s : %s", VropsPackageMemberType.ALERT_DEFINITION, e.getMessage())); + messages.append(String.format("Error parsing %s : %s", VropsPackageMemberType.ALERT_DEFINITION, + e.getMessage())); } } alertDefinitionsMap.keySet().stream().forEach(item -> { dependentDefinitionsMap.put(item, alertDefinitionsMap.get(item)); }); - restClient.importDefinitionsInVrops(alertDefinitionsMap, VropsPackageMemberType.ALERT_DEFINITION, dependentDefinitionsMap); + restClient.importDefinitionsInVrops(alertDefinitionsMap, VropsPackageMemberType.ALERT_DEFINITION, + dependentDefinitionsMap); if (messages.length() > 0) { throw new IOException(messages.toString()); @@ -718,13 +779,18 @@ private void importDefinitions(final Package vropsPackage, final File tmpDir) th } /** - * Activate / Deactivate dashboards per user or group, based on the data in the activation metadata file. - * @param rootDir Root directory where the dashboards and the metadata files reside. + * Activate / Deactivate dashboards per user or group, based on the data in the + * activation metadata file. + * + * @param rootDir Root directory where the dashboards and the metadata + * files reside. * @param isGroupActivation flag whether group activation is specified. - * @throws RuntimeException if the activation / deactivation per user or group fails. + * @throws RuntimeException if the activation / deactivation per user or group + * fails. */ private void manageDashboardActivation(final File rootDir, final boolean isGroupActivation) { - Map>> activationMetadata = this.getDashboardActivationMetadata(rootDir, isGroupActivation); + Map>> activationMetadata = this.getDashboardActivationMetadata(rootDir, + isGroupActivation); if (activationMetadata.isEmpty()) { return; } @@ -739,26 +805,33 @@ private void manageDashboardActivation(final File rootDir, final boolean isGroup if (resources.isEmpty()) { return; } - // check whether all of the users with that dashboard will be activated / deactivated + // check whether all of the users with that dashboard will be activated / + // deactivated // exist on the target vROPs - List missingResources = isGroupActivation ? this.getMissingGroups(resources) : this.getMissingUsers(resources); + List missingResources = isGroupActivation ? this.getMissingGroups(resources) + : this.getMissingUsers(resources); if (missingResources != null && !missingResources.isEmpty()) { - throw new RuntimeException(String.format("Unable to %s dashboard '%s' as resourcee of type %s '%s' do not exists on target vROPs", action, + throw new RuntimeException(String.format( + "Unable to %s dashboard '%s' as resourcee of type %s '%s' do not exists on target vROPs", + action, dashboard, resourceType, String.join(", ", missingResources.toArray(new String[0])))); } switch (action) { case ACTION_ACTIVATE: { - logger.info("Activating dashboard: '{}' for resource of type {}: '{}'", dashboard, resourceType, String.join(", ", resources)); + logger.info("Activating dashboard: '{}' for resource of type {}: '{}'", dashboard, resourceType, + String.join(", ", resources)); this.cliManager.activateDashboard(dashboard, resources, isGroupActivation); break; } case ACTION_DEACTIVATE: { - logger.info("Deactivating dashboard: '{}' for resource of type {}: '{}'", dashboard, resourceType, String.join(", ", resources)); + logger.info("Deactivating dashboard: '{}' for resource of type {}: '{}'", dashboard, + resourceType, String.join(", ", resources)); this.cliManager.deactivateDashboard(dashboard, resources, isGroupActivation); break; } default: { - logger.warn("Invalid action: '{}' for resource type {}, supported actions 'share, unshare'", action, resourceType); + logger.warn("Invalid action: '{}' for resource type {}, supported actions 'share, unshare'", + action, resourceType); } } }); @@ -767,7 +840,9 @@ private void manageDashboardActivation(final File rootDir, final boolean isGroup /** * Share / un-share dashboards based on the dashboard sharing metadata file. - * @param rootDir Root directory where the dashboards and the metadata file reside. + * + * @param rootDir Root directory where the dashboards and the metadata file + * reside. * @throws RuntimeException if the sharing / unsharing per user or group fails. */ private void manageDashboardSharing(final File rootDir) { @@ -789,17 +864,20 @@ private void manageDashboardSharing(final File rootDir) { // exist on the target vROPs List missingGroups = this.getMissingGroups(groups); if (missingGroups != null && !missingGroups.isEmpty()) { - throw new RuntimeException(String.format("Unable to %s dashboard '%s' as resources of type group '%s' do not exists on target vROPs", - action, dashboard, String.join(", ", missingGroups.toArray(new String[0])))); + throw new RuntimeException(String.format( + "Unable to %s dashboard '%s' as resources of type group '%s' do not exists on target vROPs", + action, dashboard, String.join(", ", missingGroups.toArray(new String[0])))); } switch (action) { case ACTION_SHARE: { - logger.info("Sharing dashboard: '{}' with resources of type group: '{}'", dashboard, String.join(", ", groups)); + logger.info("Sharing dashboard: '{}' with resources of type group: '{}'", dashboard, + String.join(", ", groups)); this.cliManager.shareDashboard(dashboard, groups.toArray(new String[0])); break; } case ACTION_UNSHARE: { - logger.info("Unsharing dashboard: '{}' resources of type group: '{}'", dashboard, String.join(", ", groups)); + logger.info("Unsharing dashboard: '{}' resources of type group: '{}'", dashboard, + String.join(", ", groups)); this.cliManager.unshareDashboard(dashboard, groups.toArray(new String[0])); break; } @@ -812,8 +890,11 @@ private void manageDashboardSharing(final File rootDir) { } /** - * Return the missing groups for dashboard sharing / unsharing / activation / deactivation. - * @param groups List of groups to be checked whether they are present on vROPs server. + * Return the missing groups for dashboard sharing / unsharing / activation / + * deactivation. + * + * @param groups List of groups to be checked whether they are present on vROPs + * server. * @return list of missing groups. */ private List getMissingGroups(final List groups) { @@ -822,12 +903,16 @@ private List getMissingGroups(final List groups) { return groups; } - return groups.stream().filter(group -> foundGroups.stream().noneMatch(t -> t.getDisplayName().equals(group))).collect(Collectors.toList()); + return groups.stream().filter(group -> foundGroups.stream().noneMatch(t -> t.getDisplayName().equals(group))) + .collect(Collectors.toList()); } /** - * Return the missing users for dashboard sharing / unsharing / activation / deactivation. - * @param users List of users to be checked whether they are present on vROPs server. + * Return the missing users for dashboard sharing / unsharing / activation / + * deactivation. + * + * @param users List of users to be checked whether they are present on vROPs + * server. * @return list of missing users. */ private List getMissingUsers(final List users) { @@ -836,11 +921,13 @@ private List getMissingUsers(final List users) { return users; } - return users.stream().filter(user -> foundUsers.stream().noneMatch(t -> t.getUsername().equals(user))).collect(Collectors.toList()); + return users.stream().filter(user -> foundUsers.stream().noneMatch(t -> t.getUsername().equals(user))) + .collect(Collectors.toList()); } /** * Gets policy metadata. + * * @param rootDir * @return policy metadata */ @@ -873,6 +960,7 @@ private Map getPolicyMetadata(final File rootDir) { /** * Gets dashboard sharing metadata. + * * @param rootDir root directory of the dashboard sharing metadata file. * @return the dashboard sharing metadata hashmap. */ @@ -894,30 +982,36 @@ private Map>> getDashboardSharingMetadata(final dashboardSharingMetadataFileName = dashboardShareMetadataFile.getName(); dashboardSharingMetadata = FileUtils.readFileToString(dashboardShareMetadataFile, StandardCharsets.UTF_8); } catch (IOException e) { - throw new RuntimeException(String.format("An error occurred reading file '%s'", dashboardSharingMetadataFileName), e); + throw new RuntimeException( + String.format("An error occurred reading file '%s'", dashboardSharingMetadataFileName), e); } try { return new ObjectMapper().readValue(dashboardSharingMetadata, HashMap.class); } catch (JsonProcessingException e) { - throw new RuntimeException(String.format("An error occurred parsing file '%s'", dashboardSharingMetadataFileName), e); + throw new RuntimeException( + String.format("An error occurred parsing file '%s'", dashboardSharingMetadataFileName), e); } } /** * Gets dashboard activation metadata. - * @param rootDir root directory of the dashboard activation metadata file. + * + * @param rootDir root directory of the dashboard activation metadata + * file. * @param isGroupActivation return the group activation metadata. * @return the dashboard activation metadata hashmap. */ @SuppressWarnings("unchecked") - private Map>> getDashboardActivationMetadata(final File rootDir, final boolean isGroupActivation) { + private Map>> getDashboardActivationMetadata(final File rootDir, + final boolean isGroupActivation) { // get dashboard activation metadata File dashboardsDir = new File(rootDir.getPath(), "dashboards"); if (!dashboardsDir.exists()) { return Collections.emptyMap(); } String dashboardActivationMetadata = ""; - String fileName = isGroupActivation ? DASHBOARD_GROUP_ACTIVATE_METADATA_FILENAME : DASHBOARD_USER_ACTIVATE_METADATA_FILENAME; + String fileName = isGroupActivation ? DASHBOARD_GROUP_ACTIVATE_METADATA_FILENAME + : DASHBOARD_USER_ACTIVATE_METADATA_FILENAME; String resourceType = isGroupActivation ? "group" : "user"; try { File dashboardActivationMetadataFile = new File(dashboardsDir, fileName); @@ -925,20 +1019,26 @@ private Map>> getDashboardActivationMetadata(fi return Collections.emptyMap(); } logger.info("Reading dashboard sharing metadata file '{}' for resource type {}", fileName, resourceType); - dashboardActivationMetadata = FileUtils.readFileToString(dashboardActivationMetadataFile, StandardCharsets.UTF_8); + dashboardActivationMetadata = FileUtils.readFileToString(dashboardActivationMetadataFile, + StandardCharsets.UTF_8); } catch (IOException e) { - throw new RuntimeException(String.format("An error occurred reading file '%s' for resource type %s", fileName, resourceType), e); + throw new RuntimeException( + String.format("An error occurred reading file '%s' for resource type %s", fileName, resourceType), + e); } try { return new ObjectMapper().readValue(dashboardActivationMetadata, HashMap.class); } catch (JsonProcessingException e) { - throw new RuntimeException(String.format("An error occurred parsing file '%s' for resource type %s", fileName, resourceType), e); + throw new RuntimeException( + String.format("An error occurred parsing file '%s' for resource type %s", fileName, resourceType), + e); } } /** * Store the policy metadata file. - * @param rootDir root directory where to store policy metadata file. + * + * @param rootDir root directory where to store policy metadata file. * @param policyMetadata hashmap with policy meta data. */ private void storePolicyMetadata(final File rootDir, final Map policyMetadata) { @@ -950,12 +1050,14 @@ private void storePolicyMetadata(final File rootDir, final Map p policyMetadataContent = policyMetadataContent == null ? "" : policyMetadataContent; Files.write(policyMetadataFile.toPath(), policyMetadataContent.getBytes(), StandardOpenOption.CREATE_NEW); } catch (JsonProcessingException e) { - String message = String.format("Error generating policy metadata file %s : %s", policyMetadataFile.getName(), e.getMessage()); + String message = String.format("Error generating policy metadata file %s : %s", + policyMetadataFile.getName(), e.getMessage()); logger.error(message); throw new RuntimeException(message, e); } catch (IOException e) { - String message = String.format("Error exporting policy metadata file %s : %s", policyMetadataFile.getName(), e.getMessage()); + String message = String.format("Error exporting policy metadata file %s : %s", policyMetadataFile.getName(), + e.getMessage()); logger.error(message); throw new RuntimeException(message, e); @@ -964,7 +1066,9 @@ private void storePolicyMetadata(final File rootDir, final Map p /** * Store the dashboard sharing metadata file. - * @param rootDir root directory where to store the dashboard sharing metadata file. + * + * @param rootDir root directory where to store the dashboard sharing + * metadata file. * @param dashboards list of dashboards to be put in the file. */ private void storeDashboardSharingMetadata(final File rootDir, final List dashboards) { @@ -988,25 +1092,33 @@ private void storeDashboardSharingMetadata(final File rootDir, final List dashboards, final boolean isGroupActivation) { + private void storeDashboardActivationMetadata(final File rootDir, final List dashboards, + final boolean isGroupActivation) { // generate dashboard activation metadata file - String fileName = isGroupActivation ? DASHBOARD_GROUP_ACTIVATE_METADATA_FILENAME : DASHBOARD_USER_ACTIVATE_METADATA_FILENAME; + String fileName = isGroupActivation ? DASHBOARD_GROUP_ACTIVATE_METADATA_FILENAME + : DASHBOARD_USER_ACTIVATE_METADATA_FILENAME; File dashboardActivationMetadataFile = new File(rootDir, fileName); // if file exist return here and do not generate sample contents if (dashboardActivationMetadataFile.exists()) { @@ -1023,24 +1135,31 @@ private void storeDashboardActivationMetadata(final File rootDir, final List policyMetadataMap = getPolicyMetadata(tmpDir); StringBuilder messages = new StringBuilder(); - for (File customGroupFile : FileUtils.listFiles(customGroupsDir, new String[] {"json"}, false)) { + for (File customGroupFile : FileUtils.listFiles(customGroupsDir, new String[] { "json" }, false)) { String customGroup = FilenameUtils.removeExtension(customGroupFile.getName()); try { logger.info("Importing custom group: '{}'", customGroup); @@ -1059,7 +1178,8 @@ private void importCustomGroups(final Package vropsPackage, final File tmpDir) { restClient.importCustomGroupInVrops(customGroup, customGroupPayload, policyMetadataMap); logger.info("Imported custom group: '{}'", customGroup); } catch (Exception e) { - messages.append(String.format("The custom group '%s' could not be imported : %s %n", customGroup, e.getMessage())); + messages.append(String.format("The custom group '%s' could not be imported : %s %n", customGroup, + e.getMessage())); } } @@ -1070,6 +1190,7 @@ private void importCustomGroups(final Package vropsPackage, final File tmpDir) { /** * Read custom group file. + * * @param customGroupFile JSON file to read from. * @return string with JSON data read from file. * @throws IOException if the file cannot be read. @@ -1078,14 +1199,16 @@ private String readCustomGroupFile(final File customGroupFile) throws IOExceptio try { return FileUtils.readFileToString(customGroupFile, StandardCharsets.UTF_8); } catch (IOException e) { - throw new IOException(String.format("An error occurred reading file %s : %s %n", customGroupFile.getName(), e.getMessage())); + throw new IOException(String.format("An error occurred reading file %s : %s %n", customGroupFile.getName(), + e.getMessage())); } } /** * Import policies to vROPs. + * * @param vropsPackage package to read policies from. - * @param tmpDir temporary dir where to unwrap polices to. + * @param tmpDir temporary dir where to unwrap polices to. * @throws RuntimeException if the polices cannot be imported. */ private void importPolicies(final Package vropsPackage, final File tmpDir) { @@ -1095,14 +1218,15 @@ private void importPolicies(final Package vropsPackage, final File tmpDir) { } StringBuilder messages = new StringBuilder(); - for (File policy : FileUtils.listFiles(policiesDir, new String[] {"zip"}, Boolean.FALSE)) { + for (File policy : FileUtils.listFiles(policiesDir, new String[] { "zip" }, Boolean.FALSE)) { String policyName = FilenameUtils.removeExtension(policy.getName()); try { logger.info("Importing policy: '{}'", policyName); restClient.importPolicyFromZip(policyName, policy, Boolean.TRUE); logger.info("Imported policy: '{}'", policyName); } catch (Exception e) { - String message = String.format("The policy '%s' could not be imported : '%s'", policyName, e.getMessage()); + String message = String.format("The policy '%s' could not be imported : '%s'", policyName, + e.getMessage()); logger.error(message); messages.append(message); } @@ -1117,8 +1241,9 @@ private void importPolicies(final Package vropsPackage, final File tmpDir) { * Set the default policy in vROPs. Note it will not do anything if: * 1. vROPs version is below 8.12 (as it is not supported by the vROPS API). * 2. No default policy is set in the content.yaml file. + * * @param vropsPackage package to read policies from. - * @param tmpDir temporary directory where the content.yaml file resides. + * @param tmpDir temporary directory where the content.yaml file resides. * @throws RuntimeException if the default policy cannot be set. */ private void setDefaultPolicy(final Package vropsPackage, final File tmpDir) { @@ -1142,12 +1267,15 @@ private void setDefaultPolicy(final Package vropsPackage, final File tmpDir) { } /** - * Set the policy priorities. The ordering of the policies in the content.yaml file - * will define policy priorities (first will be with top priority, last with least priority). + * Set the policy priorities. The ordering of the policies in the content.yaml + * file + * will define policy priorities (first will be with top priority, last with + * least priority). * Note it will not do anything if: vROPs version is below 8.17.0. * (as it is not supported by the vROPS API). + * * @param vropsPackage package to read policies from. - * @param tmpDir temporary directory where the content.yaml file resides. + * @param tmpDir temporary directory where the content.yaml file resides. * @throws RuntimeException if the policy priorities cannot be set. */ private void setPolicyPriorities(final Package vropsPackage, final File tmpDir) { @@ -1160,8 +1288,10 @@ private void setPolicyPriorities(final Package vropsPackage, final File tmpDir) if (descriptor.getPolicy() == null || descriptor.getPolicy().isEmpty()) { return; } - // if the policies contain wild card then skip setting priorities (as the ordering cannot be guaranteed) - boolean hasWildCard = descriptor.getPolicy().stream().allMatch(policy -> policy.endsWith(WILDCARD_MATCH_SYMBOL)); + // if the policies contain wild card then skip setting priorities (as the + // ordering cannot be guaranteed) + boolean hasWildCard = descriptor.getPolicy().stream() + .allMatch(policy -> policy.endsWith(WILDCARD_MATCH_SYMBOL)); if (hasWildCard) { return; } @@ -1174,8 +1304,10 @@ private void setPolicyPriorities(final Package vropsPackage, final File tmpDir) /** * Parse the content.yaml file. + * * @param contentYamlFile content.yaml file handle. - * @return VropsPackageDescriptor POJO with the populated values from the content.yaml file. + * @return VropsPackageDescriptor POJO with the populated values from the + * content.yaml file. * @throws RuntimeException if the content yaml cannot be parsed. */ private VropsPackageDescriptor parseContentYamlFile(final File contentYamlFile) { @@ -1184,14 +1316,18 @@ private VropsPackageDescriptor parseContentYamlFile(final File contentYamlFile) try { return mapper.readValue(contentYamlFile, VropsPackageDescriptor.class); } catch (Exception e) { - throw new RuntimeException(String.format("Unable to load vROps Package Descriptor ['%s'] : %s", contentYamlFile.getName(), e.getMessage())); + throw new RuntimeException(String.format("Unable to load vROps Package Descriptor ['%s'] : %s", + contentYamlFile.getName(), e.getMessage())); } } /** - * Export definitions from vrops (alert definitions, symptom definitions definitions, recommendations). - * @param definitionType definition type to be exported (aler, symptom, recommendation). - * @param definitions list of definitions to be exported. + * Export definitions from vrops (alert definitions, symptom definitions + * definitions, recommendations). + * + * @param definitionType definition type to be exported (aler, symptom, + * recommendation). + * @param definitions list of definitions to be exported. * @throws RuntimeException if the export fails. */ private void exportDefinitions(final VropsPackageMemberType definitionType, final List definitions) { @@ -1219,50 +1355,60 @@ private void exportDefinitions(final VropsPackageMemberType definitionType, fina Object allDefinitions = restClient.exportDefinitionsFromVrops(definitionType); logger.info("Extracted definitions of type '{}' to '{}'", definitionType, definitionsDir.getAbsolutePath()); - Map definitionsJsonMap = this.generateDefinitionsJsonMap(allDefinitions, definitions, definitionType); + Map definitionsJsonMap = this.generateDefinitionsJsonMap(allDefinitions, definitions, + definitionType); generateDefinitionsFile(definitionsJsonMap, definitionsDir); } /** * Generate the definitions JSON mapping. + * * @param definitionData the definition data. - * @param definitions list of definitions (alert, symptom or recommendation). + * @param definitions list of definitions (alert, symptom or recommendation). * @param definitionType type of the definition. * @return Mapping of definition name and data. */ - private Map generateDefinitionsJsonMap(final Object definitionData, final List definitions, final VropsPackageMemberType definitionType) { + private Map generateDefinitionsJsonMap(final Object definitionData, final List definitions, + final VropsPackageMemberType definitionType) { Map retVal = new HashMap<>(); if (definitionData instanceof AlertDefinitionDTO) { - for (AlertDefinitionDTO.AlertDefinition definition : ((AlertDefinitionDTO) definitionData).getAlertDefinitions()) { + for (AlertDefinitionDTO.AlertDefinition definition : ((AlertDefinitionDTO) definitionData) + .getAlertDefinitions()) { if (definitions.stream().anyMatch(name -> this.isPackageAssetMatching(name, definition.getName()))) { String payload = this.serializeObject(definition); if (!StringUtils.isEmpty(payload)) { retVal.put(definition.getName(), payload); - logger.info("Exporting definition '{}' (Type: '{}')", definition.getName(), definitionType.name()); + logger.info("Exporting definition '{}' (Type: '{}')", definition.getName(), + definitionType.name()); } } } } if (definitionData instanceof SymptomDefinitionDTO) { - for (SymptomDefinitionDTO.SymptomDefinition definition : ((SymptomDefinitionDTO) definitionData).getSymptomDefinitions()) { + for (SymptomDefinitionDTO.SymptomDefinition definition : ((SymptomDefinitionDTO) definitionData) + .getSymptomDefinitions()) { if (definitions.stream().anyMatch(name -> this.isPackageAssetMatching(name, definition.getName()))) { String payload = this.serializeObject(definition); if (!StringUtils.isEmpty(payload)) { retVal.put(definition.getName(), payload); - logger.info("Exporting definition '{}' (Type: '{}')", definition.getName(), definitionType.name()); + logger.info("Exporting definition '{}' (Type: '{}')", definition.getName(), + definitionType.name()); } } } } if (definitionData instanceof RecommendationDTO) { - for (RecommendationDTO.Recommendation definition : ((RecommendationDTO) definitionData).getRecommendations()) { - if (definitions.stream().anyMatch(name -> this.isPackageAssetMatching(name, definition.getDescription()))) { + for (RecommendationDTO.Recommendation definition : ((RecommendationDTO) definitionData) + .getRecommendations()) { + if (definitions.stream() + .anyMatch(name -> this.isPackageAssetMatching(name, definition.getDescription()))) { String payload = this.serializeObject(definition); if (!StringUtils.isEmpty(payload)) { retVal.put(definition.getDescription(), payload); - logger.info("Exporting definition '{}' (Type: '{}')", definition.getDescription(), definitionType.name()); + logger.info("Exporting definition '{}' (Type: '{}')", definition.getDescription(), + definitionType.name()); } } } @@ -1273,8 +1419,9 @@ private Map generateDefinitionsJsonMap(final Object definitionDa /** * Generate the definition file based on definition data. + * * @param definitionJson mapping of the definition JSON data. - * @param dir directory where to put generated file. + * @param dir directory where to put generated file. * @throws IOException if the writing of the file fails. */ private void generateDefinitionsFile(final Map definitionJson, final File dir) { @@ -1283,14 +1430,16 @@ private void generateDefinitionsFile(final Map definitionJson, f try { FileUtils.write(definitionFile, definition.getValue(), StandardCharsets.UTF_8); } catch (IOException e) { - logger.error("Error generating definitions file file '{}', message {}.", definitionFile, e.getMessage()); + logger.error("Error generating definitions file file '{}', message {}.", definitionFile, + e.getMessage()); } } } /** * Export custom groups from vROPs server. - * @param vropsPackage package where to put the custom groups to. + * + * @param vropsPackage package where to put the custom groups to. * @param customGroupNames names of the custom groups to be exported. * @throws RuntimeException if the export fails. */ @@ -1306,22 +1455,25 @@ private void exportCustomGroups(final Package vropsPackage, final List c logger.error("No custom groups found in vROPs"); return; } - + StringBuilder messages = new StringBuilder(); for (CustomGroupDTO.Group customGroup : customGroups) { - if (customGroupNames.stream().anyMatch(name -> this.isPackageAssetMatching(name, customGroup.getResourceKey().getName()))) { + if (customGroupNames.stream() + .anyMatch(name -> this.isPackageAssetMatching(name, customGroup.getResourceKey().getName()))) { String payload = this.serializeObject(customGroup); - if (!StringUtils.isEmpty(payload)) { + if (!StringUtils.isEmpty(payload)) { logger.info("Exporting custom group '{}'", customGroup.getResourceKey().getName()); - File customGroupFile = new File(customGroupTargetDir, customGroup.getResourceKey().getName() + ".json"); + File customGroupFile = new File(customGroupTargetDir, + customGroup.getResourceKey().getName() + ".json"); try { Files.write(customGroupFile.toPath(), payload.getBytes(), StandardOpenOption.CREATE_NEW); } catch (IOException e) { - messages.append(String.format("Error writing file %s : %s", customGroupFile.getName(), e.getMessage())); - } + messages.append( + String.format("Error writing file %s : %s", customGroupFile.getName(), e.getMessage())); + } } } - } + } if (messages.length() > 0) { throw new RuntimeException(messages.toString()); @@ -1330,7 +1482,8 @@ private void exportCustomGroups(final Package vropsPackage, final List c /** * Export policies from vROPs server. - * @param vropsPackage package where to put the exported polices to. + * + * @param vropsPackage package where to put the exported polices to. * @param policyEntries names the polices to be exported. * @throws RuntimeException if the export fails. */ @@ -1369,28 +1522,31 @@ private void exportPolicies(final Package vropsPackage, final List polic /** * Copy dashboard contents to the file system. + * * @param dashboard dashboard name to be copied. - * @param dir directory where dashboard to be copied to. + * @param dir directory where dashboard to be copied to. * @throws IOException | JSchException if copy fails. */ private void copyDashboardToFilesystem(final String dashboard, final File dir) { try { File dashboardDir = new File(tempDir, "iac-dash-" + UUID.randomUUID().toString() + "-" - + System.currentTimeMillis()); + + System.currentTimeMillis()); dashboardDir.mkdirs(); cliManager.exportDashboard(dashboard, dashboardDir); File zip = new File(dashboardDir, dashboard + ".zip"); ZipUtilities.unzip(zip, dashboardDir); File subdir = new File(dashboardDir, "dashboard"); - File content = new File(subdir, "dashboard.json"); + File content = new File(subdir, "dashboard.json"); moveFile(content, new File(dir, dashboard + ".json")); zip.delete(); mergeLocalizationResources(new File(subdir, "resources"), new File(dir, "resources")); } catch (IOException | JSchException e) { - String message = String.format("Unable to pull dashboard '%s' from remote vROps location '%s' to local filesystem dir '%s' : %s : %s", dashboard, + String message = String.format( + "Unable to pull dashboard '%s' from remote vROps location '%s' to local filesystem dir '%s' : %s : %s", + dashboard, cliManager, dir.getAbsolutePath(), e.getClass().getName(), e.getMessage()); logger.error(message); logger.debug(message, e); @@ -1400,28 +1556,31 @@ private void copyDashboardToFilesystem(final String dashboard, final File dir) { /** * Copy report contents to the file system. + * * @param report report name to be copied. - * @param dir directory where report to be copied to. + * @param dir directory where report to be copied to. * @throws IOException | JSchException if copy fails. */ private void copyReportToFilesystem(final String report, final File dir) { try { File reportDir = new File(tempDir, "iac-dash-" + UUID.randomUUID().toString() + "-" - + System.currentTimeMillis()); - + + System.currentTimeMillis()); + reportDir.mkdirs(); cliManager.exportReport(report, reportDir); File zip = new File(reportDir, report + ".zip"); File contentDir = new File(reportDir, report); ZipUtilities.unzip(zip, contentDir); - File content = new File(reportDir, "content.xml"); + File content = new File(reportDir, "content.xml"); content.renameTo(new File(contentDir, report)); FileUtils.copyDirectory(contentDir, new File(dir, report)); zip.delete(); } catch (IOException | JSchException e) { - String message = String.format("Unable to pull report '%s' from remote vROps location '%s' to local filesystem dir '%s' : %s : %s", report, + String message = String.format( + "Unable to pull report '%s' from remote vROps location '%s' to local filesystem dir '%s' : %s : %s", + report, cliManager, dir.getAbsolutePath(), e.getClass().getName(), e.getMessage()); logger.error(message); logger.debug(message, e); @@ -1431,7 +1590,8 @@ private void copyReportToFilesystem(final String report, final File dir) { /** * Exports a package. - * @param pkg the package to export + * + * @param pkg the package to export * @param dryrun whether it should be a dry run * @return the exported package */ @@ -1442,9 +1602,10 @@ public Package exportPackage(final Package pkg, final boolean dryrun) { /** * Exports a package. - * @param pkg the package to export + * + * @param pkg the package to export * @param exportDescriptor the descriptor of the package to export - * @param dryrun whether it should be dry run + * @param dryrun whether it should be dry run * @return the exported package */ @Override @@ -1456,8 +1617,9 @@ public Package exportPackage(final Package pkg, final File exportDescriptor, fin /** * Imports a package. - * @param pkg the package to import - * @param dryrun whether it should be dry run + * + * @param pkg the package to import + * @param dryrun whether it should be dry run * @param mergePackages whether to merge the packages * @return the imported package */ @@ -1476,23 +1638,23 @@ public Package importPackage(final Package pkg, final boolean dryrun, final bool try { new PackageManager(pkg).unpack(tmpDir); - + addViewToImportList(pkg, tmpDir); addDashboardToImportList(pkg, tmpDir); addReportToImportList(pkg, tmpDir); addSuperMetricToImportList(pkg, tmpDir); addMetricConfigToImportList(pkg, tmpDir); - + if (cliManager.hasAnyCommands()) { cliManager.connect(); cliManager.importFilesToVrops(); } - + importDefinitions(pkg, tmpDir); importPolicies(pkg, tmpDir); importCustomGroups(pkg, tmpDir); // manage dashboard sharing per groups - manageDashboardSharing(tmpDir); + manageDashboardSharing(tmpDir); // manage dashboard activation per groups manageDashboardActivation(tmpDir, true); // manage dashboard activation per users @@ -1502,7 +1664,8 @@ public Package importPackage(final Package pkg, final boolean dryrun, final bool // set policy priorities setPolicyPriorities(pkg, tmpDir); } catch (IOException | JSchException | ConfigurationException e) { - String message = String.format("Unable to push package '%s' to vROps Server '%s' : %s : %s", pkg.getFQName(), cliManager, e.getClass().getName(), + String message = String.format("Unable to push package '%s' to vROps Server '%s' : %s : %s", + pkg.getFQName(), cliManager, e.getClass().getName(), e.getMessage()); logger.error(message); logger.debug(message, e); @@ -1515,12 +1678,13 @@ public Package importPackage(final Package pkg, final boolean dryrun, final bool FileUtils.deleteDirectory(tmpDir); } } catch (IOException ioe) { - String message = String.format("Cannot delete temporary directory '%s' : %s , leaving it there", tmpDir.getAbsolutePath(), ioe.getMessage()); + String message = String.format("Cannot delete temporary directory '%s' : %s , leaving it there", + tmpDir.getAbsolutePath(), ioe.getMessage()); logger.warn(message); logger.debug(message, ioe); } } - + return pkg; } @@ -1546,7 +1710,7 @@ private void addViewToImportList(final Package pkg, final File tmp) throws IOExc if (!viewsFolder.exists()) { return; } - for (File view : FileUtils.listFiles(viewsFolder, new String[] {"xml"}, false)) { + for (File view : FileUtils.listFiles(viewsFolder, new String[] { "xml" }, false)) { File viewZip = createViewZip(view); cliManager.addViewToImportList(viewZip); } @@ -1569,14 +1733,15 @@ private List addDefinitionsToImportList(final File tmpDir, final VropsPack break; } default: - throw new RuntimeException(String.format("Definition type %s is not supported!", definitionType.name())); + throw new RuntimeException( + String.format("Definition type %s is not supported!", definitionType.name())); } File definitionsDir = new File(tmpDir.getPath(), definitionsSubDir); if (!definitionsDir.exists()) { return definitions; } - FileUtils.listFiles(definitionsDir, new String[] {"json"}, false).stream().forEach(definitions::add); - + FileUtils.listFiles(definitionsDir, new String[] { "json" }, false).stream().forEach(definitions::add); + return definitions; } @@ -1585,7 +1750,7 @@ private void addDashboardToImportList(final Package pkg, final File tmp) throws if (!dashboardsFolder.exists()) { return; } - for (File dashboard : FileUtils.listFiles(dashboardsFolder, new String[] {"json"}, false)) { + for (File dashboard : FileUtils.listFiles(dashboardsFolder, new String[] { "json" }, false)) { // skip dashboard sharing metadata file if (dashboard.getName().contains(DASHBOARD_SHARE_METADATA_FILENAME)) { continue; @@ -1611,7 +1776,7 @@ private void addSuperMetricToImportList(final Package pkg, final File tmp) throw if (!superMetricsFolder.exists()) { return; } - for (File superMetric : FileUtils.listFiles(superMetricsFolder, new String[] {"json"}, false)) { + for (File superMetric : FileUtils.listFiles(superMetricsFolder, new String[] { "json" }, false)) { this.cliManager.addSuperMetricsToImportList(superMetric); } } @@ -1631,13 +1796,15 @@ private void mergeLocalizationResources(final File srcDir, final File destDir) { return; } if (!srcDir.canRead()) { - getLogger().warn("Cannot copy content of directory \"" + srcDir.getAbsolutePath() + "\" to \"" + destDir.getAbsolutePath() + getLogger().warn("Cannot copy content of directory \"" + srcDir.getAbsolutePath() + "\" to \"" + + destDir.getAbsolutePath() + "\". Source directory is not readable. Skipping dir."); return; } destDir.mkdirs(); if (!destDir.exists() || !destDir.canWrite()) { - getLogger().warn("Cannot copy content of directory \"" + srcDir.getAbsolutePath() + "\" to \"" + destDir.getAbsolutePath() + getLogger().warn("Cannot copy content of directory \"" + srcDir.getAbsolutePath() + "\" to \"" + + destDir.getAbsolutePath() + "\". Destination directory cannot be created or is not writable. Skipping dir."); return; } @@ -1653,15 +1820,17 @@ private void mergeLocalizationResources(final File srcDir, final File destDir) { os.write('\n'); } } catch (IOException ioe) { - getLogger().warn("Error merging content of \"" + resource.getAbsolutePath() + "\" to \"" + destFile.getAbsolutePath() + "\" : " + ioe.getLocalizedMessage() - + "; Continuing with other resource files if any."); + getLogger().warn("Error merging content of \"" + resource.getAbsolutePath() + "\" to \"" + + destFile.getAbsolutePath() + "\" : " + ioe.getLocalizedMessage() + + "; Continuing with other resource files if any."); } } } private static void moveFile(final File source, final File dest) throws IOException { if (!source.exists()) { - throw new IOException("Source file \"" + source.getAbsolutePath() + "\" does not exist. Cannot move/rename it to \"" + dest.getAbsolutePath() + "\"."); + throw new IOException("Source file \"" + source.getAbsolutePath() + + "\" does not exist. Cannot move/rename it to \"" + dest.getAbsolutePath() + "\"."); } boolean success = source.renameTo(dest); if (!success) { @@ -1688,7 +1857,7 @@ private File createViewZip(final File view) throws ConfigurationException, IOExc File resourcesDir = new File(view.getParent(), "resources"); if (resourcesDir.exists()) { - for (File propfile : FileUtils.listFiles(resourcesDir, new String[] {"properties"}, false)) { + for (File propfile : FileUtils.listFiles(resourcesDir, new String[] { "properties" }, false)) { ZipEntry propEntry = new ZipEntry("resources/" + propfile.getName()); zipOut.putNextEntry(propEntry); fileCopyFiltering(propfile, "view." + id, zipOut); @@ -1703,7 +1872,7 @@ private File createDashboardZip(final File dashboard) throws IOException { logger.info("Dashboard absolute path: {}", dashboard.getAbsolutePath()); String name = FilenameUtils.removeExtension(dashboard.getName()); logger.info("Dashboard name {}", name); - File dashboardZip = new File(dashboard.getParent(), name + ".zip"); + File dashboardZip = new File(dashboard.getParent(), name + ".zip"); try ( FileOutputStream fos = new FileOutputStream(dashboardZip); ZipOutputStream zipOut = new ZipOutputStream(fos);) { @@ -1718,7 +1887,7 @@ private File createDashboardZip(final File dashboard) throws IOException { File resourcesDir = new File(dashboard.getParent(), "resources"); if (resourcesDir.exists()) { logger.info("Resources directory: {}", resourcesDir.getAbsolutePath()); - for (File propfile : FileUtils.listFiles(resourcesDir, new String[]{"properties"}, false)) { + for (File propfile : FileUtils.listFiles(resourcesDir, new String[] { "properties" }, false)) { ZipEntry propEntry = new ZipEntry("dashboard/resources/" + propfile.getName()); zipOut.putNextEntry(propEntry); fileCopyFiltering(propfile, name, zipOut); @@ -1733,7 +1902,7 @@ private File createReportZip(final File report) throws IOException { logger.info("Report absolute path: {}", report.getAbsolutePath()); String name = FilenameUtils.removeExtension(report.getName()); logger.info("Report name {} ", name); - File reportZip = new File(report.getParent(), name + ".zip"); + File reportZip = new File(report.getParent(), name + ".zip"); try ( FileOutputStream fos = new FileOutputStream(reportZip); ZipOutputStream zipOut = new ZipOutputStream(fos);) { @@ -1748,7 +1917,7 @@ private File createReportZip(final File report) throws IOException { File resourcesDir = new File(report, "resources"); if (resourcesDir.exists()) { logger.info("Resources directory: {}", resourcesDir.getAbsolutePath()); - for (File resource : FileUtils.listFiles(resourcesDir, new String[]{"properties"}, false)) { + for (File resource : FileUtils.listFiles(resourcesDir, new String[] { "properties" }, false)) { ZipEntry propEntry = new ZipEntry("resources/" + resource.getName()); zipOut.putNextEntry(propEntry); fileCopyFiltering(resource, name, zipOut); @@ -1780,16 +1949,17 @@ private String serializeObject(final Object object) { /** * * @param propFile Properties file - * @param prefix Properties prefix - * @param out Output stream + * @param prefix Properties prefix + * @param out Output stream * @throws IOException throws IO exception if input stream not available */ - public static void fileCopyFiltering(final File propFile, final String prefix, final OutputStream out) throws IOException { - Properties filtered = new Properties(); + public static void fileCopyFiltering(final File propFile, final String prefix, final OutputStream out) + throws IOException { + Properties filtered = new Properties(); Properties props = new Properties(); try (InputStream in = new FileInputStream(propFile);) { props.load(in); - props.forEach((key, value) -> { + props.forEach((key, value) -> { if (("" + key).startsWith(prefix)) { filtered.setProperty("" + key, "" + value); } @@ -1803,8 +1973,10 @@ public static void fileCopyFiltering(final File propFile, final String prefix, f * * @param view View file * @return Returns View ID - * @throws ConfigurationException throws configuration exception incase of parsing error - * @throws IOException throws IO exception if input stream not available + * @throws ConfigurationException throws configuration exception incase of + * parsing error + * @throws IOException throws IO exception if input stream not + * available */ public static String getViewId(final File view) throws ConfigurationException, IOException { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); @@ -1814,15 +1986,18 @@ public static String getViewId(final File view) throws ConfigurationException, I dBuilder = dbFactory.newDocumentBuilder(); doc = dBuilder.parse(view); } catch (ParserConfigurationException e) { - throw new ConfigurationException("The view file \"" + view.getAbsolutePath() + "\" cannot be parsed as XML file because of serious configuration error " + throw new ConfigurationException("The view file \"" + view.getAbsolutePath() + + "\" cannot be parsed as XML file because of serious configuration error " + e.getLocalizedMessage(), e); } catch (SAXException e) { - throw new ConfigurationException("The view file \"" + view.getAbsolutePath() + "\" has invalid format. It is not a correct XML file. " + throw new ConfigurationException("The view file \"" + view.getAbsolutePath() + + "\" has invalid format. It is not a correct XML file. " + e.getLocalizedMessage(), e); } Element root = doc.getDocumentElement(); if (!"Content".equalsIgnoreCase(root.getNodeName())) { - throw new ConfigurationException("The view file \"" + view.getAbsolutePath() + "\" is not in the expected format. It is a valid XML file, bu the root " + throw new ConfigurationException("The view file \"" + view.getAbsolutePath() + + "\" is not in the expected format. It is a valid XML file, bu the root " + "element is \"" + root.getNodeName() + "\" while the expected one is \"Content\"."); } NodeList views = root.getChildNodes(); @@ -1835,22 +2010,26 @@ public static String getViewId(final File view) throws ConfigurationException, I viewsNode = viewsNode.getNextSibling(); } if (viewsNode == null || !"Views".equalsIgnoreCase(viewsNode.getNodeName())) { - throw new ConfigurationException("The view file \"" + view.getAbsolutePath() + "\" is not in the expected format. First child element under \"Content\" is " - + (viewsNode == null ? "UNKNOWN" : "\"" + viewsNode.getNodeName() + "\"") + ", expected: \"Views\"."); + throw new ConfigurationException("The view file \"" + view.getAbsolutePath() + + "\" is not in the expected format. First child element under \"Content\" is " + + (viewsNode == null ? "UNKNOWN" : "\"" + viewsNode.getNodeName() + "\"") + + ", expected: \"Views\"."); } Node viewDefNode = viewsNode.getFirstChild(); while (viewDefNode != null && "#text".equalsIgnoreCase(viewDefNode.getNodeName())) { viewDefNode = viewDefNode.getNextSibling(); } if (viewDefNode == null || !"ViewDef".equalsIgnoreCase(viewDefNode.getNodeName())) { - throw new ConfigurationException("The view file \"" + view.getAbsolutePath() + "\" has invalid format. Child node under \"Content\" -> \"Views\" is " + throw new ConfigurationException("The view file \"" + view.getAbsolutePath() + + "\" has invalid format. Child node under \"Content\" -> \"Views\" is " + (viewDefNode == null ? "NOT PRESENT" : "\"" + viewDefNode + "\"") + ", expected \"ViewDef\""); } NamedNodeMap attributes = viewDefNode.getAttributes(); Node id = attributes.getNamedItem("id"); if (id == null || id.getNodeValue().trim().length() == 0) { throw new ConfigurationException("The view file \"" + view.getAbsolutePath() - + "\" has invalid format. No XML id attribute available for \"Content\" - > \"Views\" -> " + "\"ViewDef\"."); + + "\" has invalid format. No XML id attribute available for \"Content\" - > \"Views\" -> " + + "\"ViewDef\"."); } return id.getNodeValue().trim(); } diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/cli/CliManagerFactory.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/cli/CliManagerFactory.java index b24414336..d60d0ea63 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/cli/CliManagerFactory.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/cli/CliManagerFactory.java @@ -14,7 +14,7 @@ */ package com.vmware.pscoe.iac.artifact.cli; -import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; public class CliManagerFactory { diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/cli/CliManagerVrops.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/cli/CliManagerVrops.java index 24c486755..7fae7b8c3 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/cli/CliManagerVrops.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/cli/CliManagerVrops.java @@ -17,8 +17,7 @@ import java.io.File; import java.util.ArrayList; import java.util.List; -import java.util.UUID;import java.util.function.Function; -import java.util.stream.Collectors; +import java.util.UUID; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,7 +25,7 @@ import com.jcraft.jsch.JSchException; import com.jcraft.jsch.Session; import com.jcraft.jsch.SftpException; -import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; import com.vmware.pscoe.iac.artifact.ssh.SshClient; public class CliManagerVrops implements AutoCloseable { @@ -36,14 +35,14 @@ public class CliManagerVrops implements AutoCloseable { private static final String REPORT = "report"; private static final String FILE = "file"; private static final String METRIC_CONFIG = "reskndmetric"; - private static final String EXPORT = "export"; + private static final String EXPORT = "export"; private static final String IMPORT = "import"; private static final String SHARE = "share"; private static final String UNSHARE = "unshare"; private static final String ACTIVATE = "show"; private static final String DEACTIVATE = "hide"; - private static final String SHARING_DEFAULT_USER= "admin"; + private static final String SHARING_DEFAULT_USER = "admin"; private static final String FORCE = "--force"; private static final String ALL_POLICIES = "--policies all"; @@ -121,8 +120,8 @@ public void cleanup() { public void addViewToImportList(File file) { String remoteFilePath = importRemotePath + UNIX_PATH_SEPARATOR + file.getName(); String command = String.format(VROPS_SSH_COMMAND_1, - escapeShellCharacters(OPSCLI_PATH), escapeShellCharacters(VIEW), - escapeShellCharacters(IMPORT), escapeShellCharacters(remoteFilePath), + escapeShellCharacters(OPSCLI_PATH), escapeShellCharacters(VIEW), + escapeShellCharacters(IMPORT), escapeShellCharacters(remoteFilePath), escapeShellCharacters(FORCE)); cmdList.add(command); @@ -132,8 +131,8 @@ public void addViewToImportList(File file) { public void addDashboardToImportList(File file) { String remoteFilePath = importRemotePath + UNIX_PATH_SEPARATOR + file.getName(); String command = String.format(VROPS_SSH_COMMAND_2, - escapeShellCharacters(OPSCLI_PATH), escapeShellCharacters(DASHBOARD), - escapeShellCharacters(IMPORT), "all", + escapeShellCharacters(OPSCLI_PATH), escapeShellCharacters(DASHBOARD), + escapeShellCharacters(IMPORT), "all", escapeShellCharacters(remoteFilePath), escapeShellCharacters(FORCE)); cmdList.add(command); @@ -174,7 +173,7 @@ public void activateDashboard(String dashboard, List resources, boolean if (isGroupResource) { commands.add(String.format(VROPS_SSH_COMMAND_1, escapeShellCharacters(OPSCLI_PATH), escapeShellCharacters(DASHBOARD), - escapeShellCharacters(ACTIVATE), "group:"+escapeShellCharacters(resource), + escapeShellCharacters(ACTIVATE), "group:" + escapeShellCharacters(resource), escapeShellCharacters(dashboard))); } else { commands.add(String.format(VROPS_SSH_COMMAND_1, @@ -198,7 +197,7 @@ public void deactivateDashboard(String dashboard, List resources, boolea if (isGroupResource) { commands.add(String.format(VROPS_SSH_COMMAND_1, escapeShellCharacters(OPSCLI_PATH), escapeShellCharacters(DASHBOARD), - escapeShellCharacters(DEACTIVATE), "group:"+escapeShellCharacters(resource), + escapeShellCharacters(DEACTIVATE), "group:" + escapeShellCharacters(resource), escapeShellCharacters(dashboard))); } else { commands.add(String.format(VROPS_SSH_COMMAND_1, @@ -221,7 +220,7 @@ public void addReportToImportList(File file) { String remoteFilePath = importRemotePath + UNIX_PATH_SEPARATOR + file.getName(); String command = String.format(VROPS_SSH_COMMAND_1, escapeShellCharacters(OPSCLI_PATH), escapeShellCharacters(REPORT), - escapeShellCharacters(IMPORT), escapeShellCharacters(remoteFilePath), + escapeShellCharacters(IMPORT), escapeShellCharacters(remoteFilePath), escapeShellCharacters(FORCE)); cmdList.add(command); @@ -232,7 +231,8 @@ public void addSuperMetricsToImportList(File file) { String remoteFilePath = importRemotePath + UNIX_PATH_SEPARATOR + file.getName(); String command = String.format(VROPS_SSH_COMMAND_3, escapeShellCharacters(OPSCLI_PATH), escapeShellCharacters(SUPER_METRIC), - escapeShellCharacters(IMPORT), escapeShellCharacters(remoteFilePath), escapeShellCharacters(FORCE), ALL_POLICIES, CHECK_FALSE); + escapeShellCharacters(IMPORT), escapeShellCharacters(remoteFilePath), escapeShellCharacters(FORCE), + ALL_POLICIES, CHECK_FALSE); this.cmdList.add(command); this.fileList.add(file); @@ -243,11 +243,11 @@ public void addMetricConfigsToImportList(File file) { String command = String.format(VROPS_SSH_COMMAND_4, escapeShellCharacters(OPSCLI_PATH), escapeShellCharacters(FILE), - escapeShellCharacters(IMPORT), + escapeShellCharacters(IMPORT), escapeShellCharacters(METRIC_CONFIG), - escapeShellCharacters(remoteFilePath), - escapeShellCharacters(FORCE), - ALL_POLICIES, + escapeShellCharacters(remoteFilePath), + escapeShellCharacters(FORCE), + ALL_POLICIES, CHECK_FALSE); this.cmdList.add(command); @@ -301,8 +301,8 @@ public void exportView(String viewName, File localDir) throws JSchException { public void exportDashboard(String dashboardName, File localDir) throws JSchException { String remoteFilePath = exportRemotePath + UNIX_PATH_SEPARATOR + "dashboards"; String command = String.format(VROPS_SSH_COMMAND_2, - escapeShellCharacters(OPSCLI_PATH), escapeShellCharacters(DASHBOARD), - escapeShellCharacters(EXPORT), escapeShellCharacters(config.getVropsDashboardUser()), + escapeShellCharacters(OPSCLI_PATH), escapeShellCharacters(DASHBOARD), + escapeShellCharacters(EXPORT), escapeShellCharacters(config.getVropsDashboardUser()), escapeShellCharacters(dashboardName), escapeShellCharacters(remoteFilePath)); logger.info(VROPS_SSH_COMMAND_INFO, command); @@ -320,7 +320,8 @@ public void exportSuperMetric(String superMetricName, File localDir) throws JSch String remoteFilePath = exportRemotePath + UNIX_PATH_SEPARATOR + "supermetrics"; String command = String.format(VROPS_SSH_COMMAND_1, escapeShellCharacters(OPSCLI_PATH), escapeShellCharacters(SUPER_METRIC), - escapeShellCharacters(EXPORT), escapeShellCharacters(superMetricName), escapeShellCharacters(remoteFilePath)); + escapeShellCharacters(EXPORT), escapeShellCharacters(superMetricName), + escapeShellCharacters(remoteFilePath)); logger.info(VROPS_SSH_COMMAND_INFO, command); reconnect(); @@ -351,7 +352,7 @@ public void exportMetricConfig(String metricConfigName, File localDir) throws JS List files = new ArrayList<>(); files.add(remoteFilePath + UNIX_PATH_SEPARATOR + metricConfigName); - + SshClient.copyRemoteToLocal(session, files, localDir); } @@ -382,7 +383,6 @@ public String toSshComand() { return "ssh \'" + getSshUsername() + "@" + config.getHost() + "' -p " + getSshPort(); } - private String escapeShellCharacters(String str) { if (str == null) { return null; @@ -390,7 +390,7 @@ private String escapeShellCharacters(String str) { if (str.indexOf('\'') == -1) { return "'" + str + "'"; } - final char[] special = {'\'', '~', '`', '#', '$', '&', '*', '(', ')', '\\', '|', '[', ']', '{', '}', ';', '"', + final char[] special = { '\'', '~', '`', '#', '$', '&', '*', '(', ')', '\\', '|', '[', ']', '{', '}', ';', '"', '<', '>', '?', '!' }; StringBuilder buffer = new StringBuilder("\""); for (int i = 0; i < str.length(); i++) { diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientFactory.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientFactory.java index 48bd4068d..783058eba 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientFactory.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientFactory.java @@ -56,7 +56,7 @@ import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVrli; import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVro; import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVroNg; -import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; import com.vmware.pscoe.iac.artifact.configuration.ConfigurationCs; public final class RestClientFactory { diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/AbstractRestClientVrli.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/AbstractRestClientVrli.java index acbf00515..b4097c237 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/AbstractRestClientVrli.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/AbstractRestClientVrli.java @@ -19,7 +19,7 @@ import com.vmware.pscoe.iac.artifact.configuration.Configuration; import com.vmware.pscoe.iac.artifact.configuration.ConfigurationException; import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVrli; -import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; import com.vmware.pscoe.iac.artifact.rest.RestClient; import com.vmware.pscoe.iac.artifact.rest.RestClientVrops; import org.slf4j.Logger; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/RestClientVrliV1.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/RestClientVrliV1.java index f8cd89912..9e9fa8dfe 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/RestClientVrliV1.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/RestClientVrliV1.java @@ -42,7 +42,7 @@ import com.vmware.pscoe.iac.artifact.rest.model.vrli.v1.AlertDTO; import com.vmware.pscoe.iac.artifact.rest.model.vrli.v1.ContentPackDTO; import com.vmware.pscoe.iac.artifact.rest.model.vrli.v1.ContentPackMetadataListDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.ResourcesDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.ResourcesDTO; public class RestClientVrliV1 extends AbstractRestClientVrli { /** diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/RestClientVrliV2.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/RestClientVrliV2.java index 78069afc8..7ab4b1f57 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/RestClientVrliV2.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/RestClientVrliV2.java @@ -42,7 +42,7 @@ import com.vmware.pscoe.iac.artifact.rest.model.vrli.v2.AlertDTO; import com.vmware.pscoe.iac.artifact.rest.model.vrli.v2.ContentPackDTO; import com.vmware.pscoe.iac.artifact.rest.model.vrli.v2.ContentPackMetadataListDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.ResourcesDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.ResourcesDTO; public class RestClientVrliV2 extends AbstractRestClientVrli { /** diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AdapterKindDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AdapterKindDTO.java index fd1e09650..c58b25ddc 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AdapterKindDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AdapterKindDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.io.Serializable; import java.util.ArrayList; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AlertDefinitionDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AlertDefinitionDTO.java index e1a4d1725..ae6248bd5 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AlertDefinitionDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AlertDefinitionDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.io.Serializable; import java.util.ArrayList; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthGroupDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthGroupDTO.java index 12125ab7a..667182bf5 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthGroupDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthGroupDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.io.Serializable; import java.util.ArrayList; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthGroupsDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthGroupsDTO.java index 2bf0b4036..dd6f69f31 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthGroupsDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthGroupsDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.io.Serializable; import java.util.ArrayList; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthUserDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthUserDTO.java index 25b091fe7..4b298864c 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthUserDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthUserDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.util.LinkedHashMap; import java.util.List; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthUsersDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthUsersDTO.java index a0231dea3..3d03384da 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthUsersDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthUsersDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.util.LinkedHashMap; import java.util.List; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/CustomGroupDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/CustomGroupDTO.java index dc24eccef..97ab6f432 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/CustomGroupDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/CustomGroupDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.io.Serializable; import java.util.ArrayList; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/CustomGroupTypeDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/CustomGroupTypeDTO.java index eb6eabcf4..aadeab8ec 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/CustomGroupTypeDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/CustomGroupTypeDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.io.Serializable; import java.util.ArrayList; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyCustomGroupAssignmentDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyCustomGroupAssignmentDTO.java index 42408975b..c4c6f0083 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyCustomGroupAssignmentDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyCustomGroupAssignmentDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.io.Serializable; import java.util.LinkedHashMap; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyDTO.java index 3fc6c3666..d0d27cdc5 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.util.HashMap; import java.util.List; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyImportResultDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyImportResultDTO.java index 9ce023cf5..a0b7b13e7 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyImportResultDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyImportResultDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.io.Serializable; import java.util.ArrayList; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/RecommendationDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/RecommendationDTO.java index 625ce8a7a..f409f4629 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/RecommendationDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/RecommendationDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.io.Serializable; import java.util.ArrayList; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ReportDefinitionDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ReportDefinitionDTO.java index db5030fc7..172d7cfec 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ReportDefinitionDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ReportDefinitionDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.io.Serializable; import java.util.ArrayList; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ResourceKindDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ResourceKindDTO.java index 1176ea2a2..00804d4e0 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ResourceKindDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ResourceKindDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.io.Serializable; import java.util.ArrayList; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ResourcesDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ResourcesDTO.java index 4ea10717d..927d6af7f 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ResourcesDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ResourcesDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.io.Serializable; import java.util.ArrayList; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/SupermetricDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/SupermetricDTO.java index d1dd645ff..b67870c63 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/SupermetricDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/SupermetricDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.io.Serializable; import java.util.ArrayList; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/SymptomDefinitionDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/SymptomDefinitionDTO.java index a519f6aa7..47040f896 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/SymptomDefinitionDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/SymptomDefinitionDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.io.Serializable; import java.util.ArrayList; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ViewDefinitionDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ViewDefinitionDTO.java index cfce452b2..a6b26ff3f 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ViewDefinitionDTO.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ViewDefinitionDTO.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; import java.io.Serializable; import java.util.ArrayList; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/package-info.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/package-info.java index 7601efde1..f55950613 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/package-info.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/package-info.java @@ -17,4 +17,4 @@ * Package that represents vROPs Rest Model. * */ -package com.vmware.pscoe.iac.artifact.rest.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.models; diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/configuration/ConfigurationVropsTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/configuration/ConfigurationVropsTest.java index 1a1dbded1..c7610a8af 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/configuration/ConfigurationVropsTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/configuration/ConfigurationVropsTest.java @@ -17,6 +17,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; + +import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; + import java.net.UnknownHostException; import java.util.Properties; import static org.junit.jupiter.api.Assertions.assertSame; @@ -62,7 +65,6 @@ public void testValidateShouldNotBeNullHost() throws Exception { assertSame(configurationVrops.getHost(), "localhost"); } - @Test public void testValidateShouldNotBeNullVropDashboardUser() throws Exception { this.configurationVrops.validate(true); diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/store/vrops/VropsPackageStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/store/vrops/VropsPackageStoreTest.java index ec89b777c..9206ca98d 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/store/vrops/VropsPackageStoreTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/store/vrops/VropsPackageStoreTest.java @@ -35,7 +35,7 @@ import com.jcraft.jsch.JSchException; import com.vmware.pscoe.iac.artifact.PackageMocked; -import com.vmware.pscoe.iac.artifact.VropsPackageStore; +import com.vmware.pscoe.iac.artifact.aria.operations.store.VropsPackageStore; import com.vmware.pscoe.iac.artifact.cli.CliManagerVrops; import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.model.PackageFactory; @@ -43,12 +43,12 @@ import com.vmware.pscoe.iac.artifact.model.vrops.VropsPackageDescriptor; import com.vmware.pscoe.iac.artifact.model.vrops.VropsPackageMemberType; import com.vmware.pscoe.iac.artifact.rest.RestClientVrops; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.AuthGroupDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.AuthUserDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.PolicyDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.ReportDefinitionDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.SupermetricDTO; -import com.vmware.pscoe.iac.artifact.rest.model.vrops.ViewDefinitionDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.AuthGroupDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.AuthUserDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.PolicyDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.ReportDefinitionDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.SupermetricDTO; +import com.vmware.pscoe.iac.artifact.aria.operations.models.ViewDefinitionDTO; public class VropsPackageStoreTest { private static String VROPS_VERSION_8_17 = "8.17.0"; diff --git a/maven/plugins/vrops/src/main/java/com/vmware/pscoe/maven/plugins/PackageMojo.java b/maven/plugins/vrops/src/main/java/com/vmware/pscoe/maven/plugins/PackageMojo.java index a3810001c..fa3fdf6a9 100644 --- a/maven/plugins/vrops/src/main/java/com/vmware/pscoe/maven/plugins/PackageMojo.java +++ b/maven/plugins/vrops/src/main/java/com/vmware/pscoe/maven/plugins/PackageMojo.java @@ -34,7 +34,7 @@ import org.apache.maven.project.MavenProject; import com.vmware.pscoe.iac.artifact.PackageManager; -import com.vmware.pscoe.iac.artifact.VropsPackageStore; +import com.vmware.pscoe.iac.artifact.aria.operations.store.VropsPackageStore; import com.vmware.pscoe.iac.artifact.configuration.ConfigurationException; import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.model.PackageFactory; diff --git a/package-installer/src/main/java/com/vmware/pscoe/iac/installer/Installer.java b/package-installer/src/main/java/com/vmware/pscoe/iac/installer/Installer.java index 091ed176e..f6b98b562 100644 --- a/package-installer/src/main/java/com/vmware/pscoe/iac/installer/Installer.java +++ b/package-installer/src/main/java/com/vmware/pscoe/iac/installer/Installer.java @@ -63,7 +63,7 @@ import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVrli; import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVro; import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVroNg; -import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.model.PackageFactory; import com.vmware.pscoe.iac.artifact.model.PackageType; From 46690a11d8d9f1632663b6917823238636a9d0ca Mon Sep 17 00:00:00 2001 From: Stefan Genov Date: Thu, 16 Jan 2025 08:55:57 +0200 Subject: [PATCH 02/10] refactor(vrops): Removed old models Signed-off-by: Stefan Genov --- .../rest/model/vrops/AdapterKindDTO.java | 172 --- .../rest/model/vrops/AlertDefinitionDTO.java | 500 ------- .../rest/model/vrops/AuthGroupDTO.java | 408 ------ .../rest/model/vrops/AuthGroupsDTO.java | 59 - .../rest/model/vrops/AuthUserDTO.java | 327 ----- .../rest/model/vrops/AuthUsersDTO.java | 56 - .../rest/model/vrops/CustomGroupDTO.java | 720 ---------- .../rest/model/vrops/CustomGroupTypeDTO.java | 46 - .../vrops/PolicyCustomGroupAssignmentDTO.java | 111 -- .../artifact/rest/model/vrops/PolicyDTO.java | 277 ---- .../model/vrops/PolicyImportResultDTO.java | 131 -- .../rest/model/vrops/RecommendationDTO.java | 189 --- .../rest/model/vrops/ReportDefinitionDTO.java | 288 ---- .../rest/model/vrops/ResourceKindDTO.java | 231 ---- .../rest/model/vrops/ResourcesDTO.java | 1171 ----------------- .../rest/model/vrops/SupermetricDTO.java | 146 -- .../model/vrops/SymptomDefinitionDTO.java | 380 ------ .../rest/model/vrops/ViewDefinitionDTO.java | 187 --- .../rest/model/vrops/package-info.java | 20 - 19 files changed, 5419 deletions(-) delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AdapterKindDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AlertDefinitionDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthGroupDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthGroupsDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthUserDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthUsersDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/CustomGroupDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/CustomGroupTypeDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyCustomGroupAssignmentDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyImportResultDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/RecommendationDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ReportDefinitionDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ResourceKindDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ResourcesDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/SupermetricDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/SymptomDefinitionDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ViewDefinitionDTO.java delete mode 100644 common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/package-info.java diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AdapterKindDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AdapterKindDTO.java deleted file mode 100644 index c58b25ddc..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AdapterKindDTO.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "adapter-kind" }) -public class AdapterKindDTO implements Serializable { - private static final long serialVersionUID = 1068047698436844558L; - - @JsonProperty("adapter-kind") - private List adapterKind = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("adapter-kind") - public List getAdapterKind() { - return adapterKind; - } - - @JsonProperty("adapter-kind") - public void setAdapterKind(List adapterKind) { - this.adapterKind = adapterKind; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "key", "name", "description", "adapterKindType", "describeVersion", "identifiers", "resourceKinds", "links" }) - @JsonIgnoreProperties({ "links" }) - public static class AdapterKind implements Serializable { - private static final long serialVersionUID = -6414593808503585818L; - - @JsonProperty("key") - private String key; - - @JsonProperty("name") - private String name; - - @JsonProperty("description") - private String description; - - @JsonProperty("adapterKindType") - private String adapterKindType; - - @JsonProperty("describeVersion") - private Integer describeVersion; - - @JsonProperty("identifiers") - private List identifiers = new ArrayList<>(); - - @JsonProperty("resourceKinds") - private List resourceKinds = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("key") - public String getKey() { - return key; - } - - @JsonProperty("key") - public void setKey(String key) { - this.key = key; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("description") - public String getDescription() { - return description; - } - - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - @JsonProperty("adapterKindType") - public String getAdapterKindType() { - return adapterKindType; - } - - @JsonProperty("adapterKindType") - public void setAdapterKindType(String adapterKindType) { - this.adapterKindType = adapterKindType; - } - - @JsonProperty("describeVersion") - public Integer getDescribeVersion() { - return describeVersion; - } - - @JsonProperty("describeVersion") - public void setDescribeVersion(Integer describeVersion) { - this.describeVersion = describeVersion; - } - - @JsonProperty("identifiers") - public List getIdentifiers() { - return identifiers; - } - - @JsonProperty("identifiers") - public void setIdentifiers(List identifiers) { - this.identifiers = identifiers; - } - - @JsonProperty("resourceKinds") - public List getResourceKinds() { - return resourceKinds; - } - - @JsonProperty("resourceKinds") - public void setResourceKinds(List resourceKinds) { - this.resourceKinds = resourceKinds; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AlertDefinitionDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AlertDefinitionDTO.java deleted file mode 100644 index ae6248bd5..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AlertDefinitionDTO.java +++ /dev/null @@ -1,500 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "alertDefinitions", "pageInfo", "links" }) -@JsonIgnoreProperties({ "pageInfo", "links" }) -public class AlertDefinitionDTO implements Serializable { - private static final long serialVersionUID = -8907264880213106337L; - - @JsonProperty("alertDefinitions") - private List alertDefinitions = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("alertDefinitions") - public List getAlertDefinitions() { - return alertDefinitions; - } - - @JsonProperty("alertDefinitions") - public void setAlertDefinitions(List alertDefinitions) { - this.alertDefinitions = alertDefinitions; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "id", "name", "description", "adapterKindKey", "resourceKindKey", "waitCycles", "cancelCycles", "type", "subType", "states" }) - public static class AlertDefinition implements Serializable { - private static final long serialVersionUID = -5556208274143439935L; - - @JsonProperty("id") - private String id; - - @JsonProperty("name") - private String name; - - @JsonProperty("description") - private String description; - - @JsonProperty("adapterKindKey") - private String adapterKindKey; - - @JsonProperty("resourceKindKey") - private String resourceKindKey; - - @JsonProperty("waitCycles") - private Integer waitCycles; - - @JsonProperty("cancelCycles") - private Integer cancelCycles; - - @JsonProperty("type") - private Integer type; - - @JsonProperty("subType") - private Integer subType; - - @JsonProperty("states") - private List states = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("id") - public void setId(String id) { - this.id = id; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @JsonProperty("adapterKindKey") - public String getAdapterKindKey() { - return adapterKindKey; - } - - @JsonProperty("adapterKindKey") - public void setAdapterKindKey(String adapterKindKey) { - this.adapterKindKey = adapterKindKey; - } - - @JsonProperty("resourceKindKey") - public String getResourceKindKey() { - return resourceKindKey; - } - - @JsonProperty("resourceKindKey") - public void setResourceKindKey(String resourceKindKey) { - this.resourceKindKey = resourceKindKey; - } - - @JsonProperty("waitCycles") - public Integer getWaitCycles() { - return waitCycles; - } - - @JsonProperty("waitCycles") - public void setWaitCycles(Integer waitCycles) { - this.waitCycles = waitCycles; - } - - @JsonProperty("cancelCycles") - public Integer getCancelCycles() { - return cancelCycles; - } - - @JsonProperty("cancelCycles") - public void setCancelCycles(Integer cancelCycles) { - this.cancelCycles = cancelCycles; - } - - @JsonProperty("type") - public Integer getType() { - return type; - } - - @JsonProperty("type") - public void setType(Integer type) { - this.type = type; - } - - @JsonProperty("subType") - public Integer getSubType() { - return subType; - } - - @JsonProperty("subType") - public void setSubType(Integer subType) { - this.subType = subType; - } - - @JsonProperty("states") - public List getStates() { - return states; - } - - @JsonProperty("states") - public void setStates(List states) { - this.states = states; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "type", "relation", "aggregation", "symptomSetOperator", "symptomDefinitionIds", "symptomSets" }) - public static class BaseSymptomSet implements Serializable { - private static final long serialVersionUID = 7061962708255866132L; - - @JsonProperty("type") - private String type; - - @JsonProperty("relation") - private String relation; - - @JsonProperty("aggregation") - private String aggregation; - - @JsonProperty("symptomSetOperator") - private String symptomSetOperator; - - @JsonProperty("symptomDefinitionIds") - private List symptomDefinitionIds = new ArrayList<>(); - - @JsonProperty("symptomSets") - private List symptomSets = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("type") - public String getType() { - return type; - } - - @JsonProperty("type") - public void setType(String type) { - this.type = type; - } - - @JsonProperty("relation") - public String getRelation() { - return relation; - } - - @JsonProperty("relation") - public void setRelation(String relation) { - this.relation = relation; - } - - @JsonProperty("aggregation") - public String getAggregation() { - return aggregation; - } - - @JsonProperty("aggregation") - public void setAggregation(String aggregation) { - this.aggregation = aggregation; - } - - @JsonProperty("symptomSetOperator") - public String getSymptomSetOperator() { - return symptomSetOperator; - } - - @JsonProperty("symptomSetOperator") - public void setSymptomSetOperator(String symptomSetOperator) { - this.symptomSetOperator = symptomSetOperator; - } - - @JsonProperty("symptomDefinitionIds") - public List getSymptomDefinitionIds() { - return symptomDefinitionIds; - } - - @JsonProperty("symptomDefinitionIds") - public void setSymptomDefinitionIds(List symptomDefinitionIds) { - this.symptomDefinitionIds = symptomDefinitionIds; - } - - @JsonProperty("symptomSets") - public List getSymptomSets() { - return symptomSets; - } - - @JsonProperty("symptomSets") - public void setSymptomSets(List symptomSets) { - this.symptomSets = symptomSets; - } - - @JsonAnySetter - public void setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "type", "relation", "aggregation", "symptomSetOperator", "symptomDefinitionIds" }) - public static class SymptomSet implements Serializable { - private static final long serialVersionUID = 7061962708255866132L; - - @JsonProperty("type") - private String type; - - @JsonProperty("relation") - private String relation; - - @JsonProperty("aggregation") - private String aggregation; - - @JsonProperty("symptomSetOperator") - private String symptomSetOperator; - - @JsonProperty("symptomDefinitionIds") - private List symptomDefinitionIds = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("type") - public String getType() { - return type; - } - - @JsonProperty("type") - public void setType(String type) { - this.type = type; - } - - @JsonProperty("relation") - public String getRelation() { - return relation; - } - - @JsonProperty("relation") - public void setRelation(String relation) { - this.relation = relation; - } - - @JsonProperty("aggregation") - public String getAggregation() { - return aggregation; - } - - @JsonProperty("aggregation") - public void setAggregation(String aggregation) { - this.aggregation = aggregation; - } - - @JsonProperty("symptomSetOperator") - public String getSymptomSetOperator() { - return symptomSetOperator; - } - - @JsonProperty("symptomSetOperator") - public void setSymptomSetOperator(String symptomSetOperator) { - this.symptomSetOperator = symptomSetOperator; - } - - @JsonProperty("symptomDefinitionIds") - public List getSymptomDefinitionIds() { - return symptomDefinitionIds; - } - - @JsonProperty("symptomDefinitionIds") - public void setSymptomDefinitionIds(List symptomDefinitionIds) { - this.symptomDefinitionIds = symptomDefinitionIds; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "impactType", "detail" }) - public static class Impact implements Serializable { - private static final long serialVersionUID = 8675023498733072632L; - - @JsonProperty("impactType") - private String impactType; - - @JsonProperty("detail") - private String detail; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("impactType") - public String getImpactType() { - return impactType; - } - - @JsonProperty("impactType") - public void setImpactType(String impactType) { - this.impactType = impactType; - } - - @JsonProperty("detail") - public String getDetail() { - return detail; - } - - @JsonProperty("detail") - public void setDetail(String detail) { - this.detail = detail; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "severity", "base-symptom-set", "impact", "recommendationPriorityMap" }) - @JsonIgnoreProperties({ "recommendationPriorityMap" }) - public static class State implements Serializable { - private static final long serialVersionUID = -4167387367232110038L; - - @JsonProperty("severity") - private String severity; - - @JsonProperty("base-symptom-set") - private BaseSymptomSet baseSymptomSet; - - @JsonProperty("impact") - private Impact impact; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("severity") - public String getSeverity() { - return severity; - } - - @JsonProperty("severity") - public void setSeverity(String severity) { - this.severity = severity; - } - - @JsonProperty("base-symptom-set") - public BaseSymptomSet getBaseSymptomSet() { - return baseSymptomSet; - } - - @JsonProperty("base-symptom-set") - public void setBaseSymptomSet(BaseSymptomSet baseSymptomSet) { - this.baseSymptomSet = baseSymptomSet; - } - - @JsonProperty("impact") - public Impact getImpact() { - return impact; - } - - @JsonProperty("impact") - public void setImpact(Impact impact) { - this.impact = impact; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - } - -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthGroupDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthGroupDTO.java deleted file mode 100644 index 667182bf5..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthGroupDTO.java +++ /dev/null @@ -1,408 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "id", "authSourceId", "name", "description", "displayName", "userIds", "roleNames", "role-permissions", "links" }) -public class AuthGroupDTO implements Serializable { - private static final long serialVersionUID = -5001015063559031411L; - - @JsonProperty("id") - private String id; - - @JsonProperty("authSourceId") - private String authSourceId; - - @JsonProperty("name") - private String name; - - @JsonProperty("description") - private String description; - - @JsonProperty("displayName") - private String displayName; - - @JsonProperty("userIds") - private List userIds = new ArrayList<>(); - - @JsonProperty("roleNames") - private List roleNames = new ArrayList<>(); - - @JsonProperty("role-permissions") - private List rolePermissions = new ArrayList<>(); - - @JsonProperty("links") - private List links = new ArrayList<>(); - - @JsonIgnore - private Map additionalProperties = new HashMap<>(); - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("id") - public void setId(String id) { - this.id = id; - } - - @JsonProperty("authSourceId") - public String getAuthSourceId() { - return authSourceId; - } - - @JsonProperty("authSourceId") - public void setAuthSourceId(String authSourceId) { - this.authSourceId = authSourceId; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("description") - public String getDescription() { - return description; - } - - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - @JsonProperty("displayName") - public String getDisplayName() { - return displayName; - } - - @JsonProperty("displayName") - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - @JsonProperty("userIds") - public List getUserIds() { - return userIds; - } - - @JsonProperty("userIds") - public void setUserIds(List userIds) { - this.userIds = userIds; - } - - @JsonProperty("roleNames") - public List getRoleNames() { - return roleNames; - } - - @JsonProperty("roleNames") - public void setRoleNames(List roleNames) { - this.roleNames = roleNames; - } - - @JsonProperty("role-permissions") - public List getRolePermissions() { - return rolePermissions; - } - - @JsonProperty("role-permissions") - public void setRolePermissions(List rolePermissions) { - this.rolePermissions = rolePermissions; - } - - @JsonProperty("links") - public List getLinks() { - return links; - } - - @JsonProperty("links") - public void setLinks(List links) { - this.links = links; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "roleName", "traversal-spec-instances", "allowAllObjects" }) - public static class RolePermission implements Serializable { - private static final long serialVersionUID = -8932971877839018059L; - - @JsonProperty("roleName") - private String roleName; - - @JsonProperty("traversal-spec-instances") - private List traversalSpecInstances = new ArrayList<>(); - - @JsonProperty("allowAllObjects") - private Boolean allowAllObjects; - - @JsonIgnore - private Map additionalProperties = new HashMap<>(); - - @JsonProperty("roleName") - public String getRoleName() { - return roleName; - } - - @JsonProperty("roleName") - public void setRoleName(String roleName) { - this.roleName = roleName; - } - - @JsonProperty("traversal-spec-instances") - public List getTraversalSpecInstances() { - return traversalSpecInstances; - } - - @JsonProperty("traversal-spec-instances") - public void setTraversalSpecInstances(List traversalSpecInstances) { - this.traversalSpecInstances = traversalSpecInstances; - } - - @JsonProperty("allowAllObjects") - public Boolean getAllowAllObjects() { - return allowAllObjects; - } - - @JsonProperty("allowAllObjects") - public void setAllowAllObjects(Boolean allowAllObjects) { - this.allowAllObjects = allowAllObjects; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "adapterKind", "resourceKind", "name", "resourceSelection", "selectAllResources" }) - public static class TraversalSpecInstance implements Serializable { - private static final long serialVersionUID = -4749828660631156039L; - - @JsonProperty("adapterKind") - private String adapterKind; - - @JsonProperty("resourceKind") - private String resourceKind; - - @JsonProperty("name") - private String name; - - @JsonProperty("resourceSelection") - private List resourceSelection = new ArrayList<>(); - - @JsonProperty("selectAllResources") - private Boolean selectAllResources; - - @JsonIgnore - private Map additionalProperties = new HashMap<>(); - - @JsonProperty("adapterKind") - public String getAdapterKind() { - return adapterKind; - } - - @JsonProperty("adapterKind") - public void setAdapterKind(String adapterKind) { - this.adapterKind = adapterKind; - } - - @JsonProperty("resourceKind") - public String getResourceKind() { - return resourceKind; - } - - @JsonProperty("resourceKind") - public void setResourceKind(String resourceKind) { - this.resourceKind = resourceKind; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("resourceSelection") - public List getResourceSelection() { - return resourceSelection; - } - - @JsonProperty("resourceSelection") - public void setResourceSelection(List resourceSelection) { - this.resourceSelection = resourceSelection; - } - - @JsonProperty("selectAllResources") - public Boolean getSelectAllResources() { - return selectAllResources; - } - - @JsonProperty("selectAllResources") - public void setSelectAllResources(Boolean selectAllResources) { - this.selectAllResources = selectAllResources; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "type", "resourceId" }) - public static class ResourceSelection implements Serializable { - private static final long serialVersionUID = 757388741865799633L; - - @JsonProperty("type") - private String type; - - @JsonProperty("resourceId") - private List resourceId = new ArrayList<>(); - - @JsonIgnore - private Map additionalProperties = new HashMap<>(); - - @JsonProperty("type") - public String getType() { - return type; - } - - @JsonProperty("type") - public void setType(String type) { - this.type = type; - } - - @JsonProperty("resourceId") - public List getResourceId() { - return resourceId; - } - - @JsonProperty("resourceId") - public void setResourceId(List resourceId) { - this.resourceId = resourceId; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "href", "rel", "name" }) - public static class Link implements Serializable { - private static final long serialVersionUID = 5366630360818372853L; - - @JsonProperty("href") - private String href; - - @JsonProperty("rel") - private String rel; - - @JsonProperty("name") - private String name; - - @JsonIgnore - private Map additionalProperties = new HashMap<>(); - - @JsonProperty("href") - public String getHref() { - return href; - } - - @JsonProperty("href") - public void setHref(String href) { - this.href = href; - } - - @JsonProperty("rel") - public String getRel() { - return rel; - } - - @JsonProperty("rel") - public void setRel(String rel) { - this.rel = rel; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthGroupsDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthGroupsDTO.java deleted file mode 100644 index dd6f69f31..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthGroupsDTO.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "userGroups" }) -public class AuthGroupsDTO implements Serializable { - private static final long serialVersionUID = -1418134583655271586L; - - @JsonProperty("userGroups") - private List userGroups = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("userGroups") - public List getUserGroups() { - return userGroups; - } - - @JsonProperty("userGroups") - public void setUserGroups(List userGroups) { - this.userGroups = userGroups; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthUserDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthUserDTO.java deleted file mode 100644 index 4b298864c..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthUserDTO.java +++ /dev/null @@ -1,327 +0,0 @@ -/*- - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "id", "username", "firstName", "lastName", "password", "emailAddress", "distinguishedName", "enabled", "groupIds", "roleNames", - "role-permissions", "lastLoginTime", "links" }) -public class AuthUserDTO { - - @JsonProperty("id") - private String id; - - @JsonProperty("username") - private String username; - - @JsonProperty("firstName") - private String firstName; - - @JsonProperty("lastName") - private String lastName; - - @JsonProperty("password") - private Object password; - - @JsonProperty("emailAddress") - private String emailAddress; - - @JsonProperty("distinguishedName") - private String distinguishedName; - - @JsonProperty("enabled") - private Boolean enabled; - - @JsonProperty("groupIds") - private List groupIds; - - @JsonProperty("roleNames") - private List roleNames; - - @JsonProperty("role-permissions") - private List rolePermissions; - - @JsonProperty("lastLoginTime") - private Long lastLoginTime; - - @JsonProperty("links") - private List links; - - @JsonIgnore - private Map additionalProperties = new LinkedHashMap(); - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("id") - public void setId(String id) { - this.id = id; - } - - @JsonProperty("username") - public String getUsername() { - return username; - } - - @JsonProperty("username") - public void setUsername(String username) { - this.username = username; - } - - @JsonProperty("firstName") - public String getFirstName() { - return firstName; - } - - @JsonProperty("firstName") - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - @JsonProperty("lastName") - public String getLastName() { - return lastName; - } - - @JsonProperty("lastName") - public void setLastName(String lastName) { - this.lastName = lastName; - } - - @JsonProperty("password") - public Object getPassword() { - return password; - } - - @JsonProperty("password") - public void setPassword(Object password) { - this.password = password; - } - - @JsonProperty("emailAddress") - public String getEmailAddress() { - return emailAddress; - } - - @JsonProperty("emailAddress") - public void setEmailAddress(String emailAddress) { - this.emailAddress = emailAddress; - } - - @JsonProperty("distinguishedName") - public String getDistinguishedName() { - return distinguishedName; - } - - @JsonProperty("distinguishedName") - public void setDistinguishedName(String distinguishedName) { - this.distinguishedName = distinguishedName; - } - - @JsonProperty("enabled") - public Boolean getEnabled() { - return enabled; - } - - @JsonProperty("enabled") - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - @JsonProperty("groupIds") - public List getGroupIds() { - return groupIds; - } - - @JsonProperty("groupIds") - public void setGroupIds(List groupIds) { - this.groupIds = groupIds; - } - - @JsonProperty("roleNames") - public List getRoleNames() { - return roleNames; - } - - @JsonProperty("roleNames") - public void setRoleNames(List roleNames) { - this.roleNames = roleNames; - } - - @JsonProperty("role-permissions") - public List getRolePermissions() { - return rolePermissions; - } - - @JsonProperty("role-permissions") - public void setRolePermissions(List rolePermissions) { - this.rolePermissions = rolePermissions; - } - - @JsonProperty("lastLoginTime") - public Long getLastLoginTime() { - return lastLoginTime; - } - - @JsonProperty("lastLoginTime") - public void setLastLoginTime(Long lastLoginTime) { - this.lastLoginTime = lastLoginTime; - } - - @JsonProperty("links") - public List getLinks() { - return links; - } - - @JsonProperty("links") - public void setLinks(List links) { - this.links = links; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "roleName", "scopeId", "allowAllObjects" }) - public static class RolePermission { - - @JsonProperty("roleName") - private String roleName; - - @JsonProperty("scopeId") - private String scopeId; - - @JsonProperty("allowAllObjects") - private Boolean allowAllObjects; - @JsonIgnore - private Map additionalProperties = new LinkedHashMap(); - - @JsonProperty("roleName") - public String getRoleName() { - return roleName; - } - - @JsonProperty("roleName") - public void setRoleName(String roleName) { - this.roleName = roleName; - } - - @JsonProperty("scopeId") - public String getScopeId() { - return scopeId; - } - - @JsonProperty("scopeId") - public void setScopeId(String scopeId) { - this.scopeId = scopeId; - } - - @JsonProperty("allowAllObjects") - public Boolean getAllowAllObjects() { - return allowAllObjects; - } - - @JsonProperty("allowAllObjects") - public void setAllowAllObjects(Boolean allowAllObjects) { - this.allowAllObjects = allowAllObjects; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "href", "rel", "name" }) - public static class Link { - - @JsonProperty("href") - private String href; - - @JsonProperty("rel") - private String rel; - - @JsonProperty("name") - private String name; - - @JsonIgnore - private Map additionalProperties = new LinkedHashMap(); - - @JsonProperty("href") - public String getHref() { - return href; - } - - @JsonProperty("href") - public void setHref(String href) { - this.href = href; - } - - @JsonProperty("rel") - public String getRel() { - return rel; - } - - @JsonProperty("rel") - public void setRel(String rel) { - this.rel = rel; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthUsersDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthUsersDTO.java deleted file mode 100644 index 3d03384da..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/AuthUsersDTO.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "users" }) -public class AuthUsersDTO { - - @JsonProperty("users") - private List users; - - @JsonIgnore - private Map additionalProperties = new LinkedHashMap(); - - @JsonProperty("users") - public List getUsers() { - return users; - } - - @JsonProperty("users") - public void setUsers(List users) { - this.users = users; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/CustomGroupDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/CustomGroupDTO.java deleted file mode 100644 index 97ab6f432..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/CustomGroupDTO.java +++ /dev/null @@ -1,720 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "groups" }) -public class CustomGroupDTO implements Serializable { - private static final long serialVersionUID = -8907264880213106297L; - - @JsonProperty("groups") - private List groups = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("groups") - public List getGroups() { - return groups; - } - - @JsonProperty("groups") - public void setGroups(List groups) { - this.groups = groups; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "id", "identifier", "resourceKey", "policy", "autoResolveMembership", "membershipDefinition", "links" }) - @JsonIgnoreProperties({ "links" }) - public static class Group implements Serializable { - private static final long serialVersionUID = -3051771900705327803L; - - @JsonProperty("id") - private String id; - - @JsonProperty("identifier") - private String identifier; - - @JsonProperty("resourceKey") - private ResourceKey resourceKey; - - @JsonProperty("policy") - private String policy; - - @JsonProperty("autoResolveMembership") - private Boolean autoResolveMembership; - - @JsonProperty("membershipDefinition") - private MembershipDefinition membershipDefinition; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("id") - public void setId(String id) { - this.id = id; - } - - @JsonProperty("identifier") - public String getIdentifier() { - return identifier; - } - - @JsonProperty("identifier") - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - @JsonProperty("resourceKey") - public ResourceKey getResourceKey() { - return resourceKey; - } - - @JsonProperty("resourceKey") - public void setResourceKey(ResourceKey resourceKey) { - this.resourceKey = resourceKey; - } - - @JsonProperty("policy") - public String getPolicy() { - return policy; - } - - @JsonProperty("policy") - public void setPolicy(String policy) { - this.policy = policy; - } - - @JsonProperty("autoResolveMembership") - public Boolean isAutoResolveMembership() { - return autoResolveMembership; - } - - @JsonProperty("autoResolveMembership") - public void setAutoResolveMembership(Boolean autoResolveMembership) { - this.autoResolveMembership = autoResolveMembership; - } - - @JsonProperty("membershipDefinition") - public MembershipDefinition getMembershipDefinition() { - return membershipDefinition; - } - - @JsonProperty("membershipDefinition") - public void setMembershipDefinition(MembershipDefinition membershipDefinition) { - this.membershipDefinition = membershipDefinition; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "includedResources", "excludedResources", "custom-group-properties", "rules" }) - public static class MembershipDefinition implements Serializable { - private static final long serialVersionUID = 7552803338575289017L; - - @JsonProperty("includedResources") - private List includedResources = new ArrayList<>(); - - @JsonProperty("excludedResources") - private List excludedResources = new ArrayList<>(); - - @JsonProperty("custom-group-properties") - private List customGroupProperties = new ArrayList<>(); - - @JsonProperty("rules") - private List rules = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("includedResources") - public List getIncludedResources() { - return includedResources; - } - - @JsonProperty("includedResources") - public void setIncludedResources(List includedResources) { - this.includedResources = includedResources; - } - - @JsonProperty("excludedResources") - public List getExcludedResources() { - return excludedResources; - } - - @JsonProperty("excludedResources") - public void setExcludedResources(List excludedResources) { - this.excludedResources = excludedResources; - } - - @JsonProperty("custom-group-properties") - public List getCustomGroupProperties() { - return customGroupProperties; - } - - @JsonProperty("custom-group-properties") - public void setCustomGroupProperties(List customGroupProperties) { - this.customGroupProperties = customGroupProperties; - } - - @JsonProperty("rules") - public List getRules() { - return rules; - } - - @JsonProperty("rules") - public void setRules(List rules) { - this.rules = rules; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "resourceKindKey", "statConditionRules", "propertyConditionRules", "resourceNameConditionRules", "relationshipConditionRules" }) - public static class Rule implements Serializable { - private static final long serialVersionUID = 2858223788988040394L; - - @JsonProperty("resourceKindKey") - private ResourceKindKey resourceKindKey; - - @JsonProperty("statConditionRules") - private List statConditionRules = new ArrayList<>(); - - @JsonProperty("propertyConditionRules") - private List propertyConditionRules = new ArrayList<>(); - - @JsonProperty("resourceNameConditionRules") - private List resourceNameConditionRules = new ArrayList<>(); - - @JsonProperty("relationshipConditionRules") - private List relationshipConditionRules = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("resourceKindKey") - public ResourceKindKey getResourceKindKey() { - return resourceKindKey; - } - - @JsonProperty("resourceKindKey") - public void setResourceKindKey(ResourceKindKey resourceKindKey) { - this.resourceKindKey = resourceKindKey; - } - - @JsonProperty("statConditionRules") - public List getStatConditionRules() { - return statConditionRules; - } - - @JsonProperty("statConditionRules") - public void setStatConditionRules(List statConditionRules) { - this.statConditionRules = statConditionRules; - } - - @JsonProperty("propertyConditionRules") - public List getPropertyConditionRules() { - return propertyConditionRules; - } - - @JsonProperty("propertyConditionRules") - public void setPropertyConditionRules(List propertyConditionRules) { - this.propertyConditionRules = propertyConditionRules; - } - - @JsonProperty("resourceNameConditionRules") - public List getResourceNameConditionRules() { - return resourceNameConditionRules; - } - - @JsonProperty("resourceNameConditionRules") - public void setResourceNameConditionRules(List resourceNameConditionRules) { - this.resourceNameConditionRules = resourceNameConditionRules; - } - - @JsonProperty("relationshipConditionRules") - public List getRelationshipConditionRules() { - return relationshipConditionRules; - } - - @JsonProperty("relationshipConditionRules") - public void setRelationshipConditionRules(List relationshipConditionRules) { - this.relationshipConditionRules = relationshipConditionRules; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "key", "stringValue", "doubleValue", "compareOperator" }) - public static class StatConditionRule implements Serializable { - private static final long serialVersionUID = -5386165550764511301L; - - @JsonProperty("key") - private String key; - - @JsonProperty("stringValue") - private String stringValue; - - @JsonProperty("doubleValue") - private Double doubleValue; - - @JsonProperty("compareOperator") - private String compareOperator; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("key") - public String getKey() { - return key; - } - - @JsonProperty("key") - public void setKey(String key) { - this.key = key; - } - - @JsonProperty("stringValue") - public String getStringValue() { - return stringValue; - } - - @JsonProperty("stringValue") - public void setStringValue(String stringValue) { - this.stringValue = stringValue; - } - - @JsonProperty("doubleValue") - public Double getDoubleValue() { - return doubleValue; - } - - @JsonProperty("doubleValue") - public void setDoubleValue(Double doubleValue) { - this.doubleValue = doubleValue; - } - - @JsonProperty("compareOperator") - public String getCompareOperator() { - return compareOperator; - } - - @JsonProperty("compareOperator") - public void setCompareOperator(String compareOperator) { - this.compareOperator = compareOperator; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "name", "compareOperator" }) - public static class ResourceNameConditionRule implements Serializable { - private static final long serialVersionUID = -7089630077528662679L; - - @JsonProperty("name") - private String name; - - @JsonProperty("compareOperator") - private String compareOperator; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("compareOperator") - public String getCompareOperator() { - return compareOperator; - } - - @JsonProperty("compareOperator") - public void setCompareOperator(String compareOperator) { - this.compareOperator = compareOperator; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "relation", "name", "compareOperator", "travesalSpecId" }) - public static class RelationshipConditionRule implements Serializable { - private static final long serialVersionUID = -750100357961113288L; - - @JsonProperty("relation") - private String relation; - - @JsonProperty("name") - private String name; - - @JsonProperty("compareOperator") - private String compareOperator; - - @JsonProperty("travesalSpecId") - private String travesalSpecId; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("relation") - public String getRelation() { - return relation; - } - - @JsonProperty("relation") - public void setRelation(String relation) { - this.relation = relation; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("compareOperator") - public String getCompareOperator() { - return compareOperator; - } - - @JsonProperty("compareOperator") - public void setCompareOperator(String compareOperator) { - this.compareOperator = compareOperator; - } - - @JsonProperty("travesalSpecId") - public String getTravesalSpecId() { - return travesalSpecId; - } - - @JsonProperty("travesalSpecId") - public void setTravesalSpecId(String travesalSpecId) { - this.travesalSpecId = travesalSpecId; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "resourceKind", "adapterKind" }) - public static class ResourceKindKey implements Serializable { - private static final long serialVersionUID = -1575312205325925888L; - - @JsonProperty("resourceKind") - private String resourceKind; - - @JsonProperty("adapterKind") - private String adapterKind; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("resourceKind") - public String getResourceKind() { - return resourceKind; - } - - @JsonProperty("resourceKind") - public void setResourceKind(String resourceKind) { - this.resourceKind = resourceKind; - } - - @JsonProperty("adapterKind") - public String getAdapterKind() { - return adapterKind; - } - - @JsonProperty("adapterKind") - public void setAdapterKind(String adapterKind) { - this.adapterKind = adapterKind; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "name", "adapterKindKey", "resourceKindKey", "resourceIdentifiers" }) - public static class ResourceKey implements Serializable { - private static final long serialVersionUID = 1936847230252766216L; - - @JsonProperty("name") - private String name; - - @JsonProperty("adapterKindKey") - private String adapterKindKey; - - @JsonProperty("resourceKindKey") - private String resourceKindKey; - - @JsonProperty("resourceIdentifiers") - private List resourceIdentifiers = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("adapterKindKey") - public String getAdapterKindKey() { - return adapterKindKey; - } - - @JsonProperty("adapterKindKey") - public void setAdapterKindKey(String adapterKindKey) { - this.adapterKindKey = adapterKindKey; - } - - @JsonProperty("resourceKindKey") - public String getResourceKindKey() { - return resourceKindKey; - } - - @JsonProperty("resourceKindKey") - public void setResourceKindKey(String resourceKindKey) { - this.resourceKindKey = resourceKindKey; - } - - @JsonProperty("resourceIdentifiers") - public List getResourceIdentifiers() { - return resourceIdentifiers; - } - - @JsonProperty("resourceIdentifiers") - public void setResourceIdentifiers(List resourceIdentifiers) { - this.resourceIdentifiers = resourceIdentifiers; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "identifierType", "value" }) - public static class ResourceIdentifier implements Serializable { - private static final long serialVersionUID = -4631445128052519908L; - - @JsonProperty("identifierType") - private IdentifierType identifierType; - - @JsonProperty("value") - private String value; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("identifierType") - public IdentifierType getIdentifierType() { - return identifierType; - } - - @JsonProperty("identifierType") - public void setIdentifierType(IdentifierType identifierType) { - this.identifierType = identifierType; - } - - @JsonProperty("value") - public String getValue() { - return value; - } - - @JsonProperty("value") - public void setValue(String value) { - this.value = value; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "name", "dataType", "isPartOfUniqueness" }) - public static class IdentifierType implements Serializable { - private static final long serialVersionUID = -1370467208132974903L; - - @JsonProperty("name") - private String name; - - @JsonProperty("dataType") - private String dataType; - - @JsonProperty("isPartOfUniqueness") - private Boolean isPartOfUniqueness; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("dataType") - public String getDataType() { - return dataType; - } - - @JsonProperty("dataType") - public void setDataType(String dataType) { - this.dataType = dataType; - } - - @JsonProperty("isPartOfUniqueness") - public Boolean isIsPartOfUniqueness() { - return isPartOfUniqueness; - } - - @JsonProperty("isPartOfUniqueness") - public void setIsPartOfUniqueness(Boolean isPartOfUniqueness) { - this.isPartOfUniqueness = isPartOfUniqueness; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/CustomGroupTypeDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/CustomGroupTypeDTO.java deleted file mode 100644 index aadeab8ec..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/CustomGroupTypeDTO.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonPropertyOrder({ "name" }) -public class CustomGroupTypeDTO { - - @JsonProperty("name") - private String name; - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyCustomGroupAssignmentDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyCustomGroupAssignmentDTO.java deleted file mode 100644 index c4c6f0083..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyCustomGroupAssignmentDTO.java +++ /dev/null @@ -1,111 +0,0 @@ -/*- - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.io.Serializable; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "id", "groups" }) -public class PolicyCustomGroupAssignmentDTO implements Serializable { - private static final long serialVersionUID = -8042756118741033913L; - - /** - * id. - */ - @JsonProperty("id") - private String id; - - /** - * groups. - */ - @JsonProperty("groups") - private List groups; - - /** - * additionalProperties. - */ - @JsonIgnore - private Map additionalProperties = new LinkedHashMap(); - - /** - * getId(). - * - * @return policy id. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * setId(). - * - * @param id policy id to be set. - */ - @JsonProperty("id") - public void setId(String id) { - this.id = id; - } - - /** - * getGroups(). - * - * @return list of assigned groups. - */ - @JsonProperty("groups") - public List getGroups() { - return groups; - } - - /** - * setGroups(). - * - * @param groups to be assigned policy to. - */ - @JsonProperty("groups") - public void setGroups(List groups) { - this.groups = groups; - } - - /** - * getAdditionalProperties(). - * - * @return map of additional properties. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * setAdditionalProperties(). - * - * @param name the name of the property. - * @param value the value of the property. - */ - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyDTO.java deleted file mode 100644 index d0d27cdc5..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyDTO.java +++ /dev/null @@ -1,277 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * PolicyDTO. - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class PolicyDTO { - - /** - * policies. - */ - @JsonProperty("policy-summaries") - private List policies; - - /** - * policySummaries. - */ - @JsonProperty("policySummaries") - private List policySummaries; - - /** - * additionalProperties. - */ - @JsonIgnore - private Map additionalProperties = new HashMap<>(); - - /** - * getPolicies(). - * - * @return list of policies. - */ - @JsonProperty("policy-summaries") - public List getPolicies() { - return this.policies; - } - - /** - * setPolicySummaries(). - * - * @param policySummaries policies to be set. - */ - @JsonProperty("policySummaries") - public void setPolicySummaries(List policySummaries) { - this.policySummaries = policySummaries; - } - - /** - * policySummaries(). - * - * @return list of policySummaries. - */ - @JsonProperty("policySummaries") - public List getPolicySummaries() { - return this.policySummaries; - } - - /** - * setPolicies(). - * - * @param policies policies to be set. - */ - @JsonProperty("policy-summaries") - public void setPolicies(List policies) { - this.policies = policies; - } - - /** - * getAdditionalProperties(). - * - * @return map of additional properties. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * setAdditionalProperties(). - * - * @param propName name of the property. - * @param value value of the property. - */ - @JsonAnySetter - public void setAdditionalProperties(String propName, Object value) { - this.additionalProperties.put(propName, value); - } - - /** - * Policy. - */ - @JsonPropertyOrder({ "id", "name", "defaultPolicy", "priority" }) - @JsonIgnoreProperties(ignoreUnknown = true) - public static class Policy { - - /** - * id. - */ - @JsonProperty("id") - private String id; - - /** - * name. - */ - @JsonProperty("name") - private String name; - - /** - * zipFile. - */ - @JsonIgnore - private byte[] zipFile; - - /** - * defaultPolicy. - */ - @JsonProperty("defaultPolicy") - private boolean defaultPolicy; - - /** - * priority. - */ - @JsonProperty("priority") - private Long priority; - - /** - * additionalProperties. - */ - @JsonIgnore - private Map additionalProperties = new HashMap<>(); - - /** - * getId(). - * - * @return string with id. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * setId(). - * - * @param id id to be set. - */ - @JsonProperty("id") - public void setId(String id) { - this.id = id; - } - - /** - * getName(). - * - * @return string with name. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * setName(). - * - * @param name name of the policy. - */ - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - /** - * setZipFile(). - * - * @param file byte array of the file. - */ - @JsonIgnore - public void setZipFile(byte[] file) { - this.zipFile = file; - } - - /** - * getZipFile(). - * - * @return byte array of the file. - */ - @JsonIgnore - public byte[] getZipFile() { - return this.zipFile; - } - - /** - * getDefaultPolicy(). - * - * @return whether it is default policy. - */ - @JsonProperty("defaultPolicy") - public boolean getDefaultPolicy() { - return defaultPolicy; - } - - /** - * setDefaultPolicy(). - * - * @param defaultPolicy default policy flag. - */ - @JsonProperty("defaultPolicy") - public void setDefaultPolicy(boolean defaultPolicy) { - this.defaultPolicy = defaultPolicy; - } - - /** - * getPriority(). - * - * @return policy priority (if applicable). - */ - @JsonProperty("priority") - public Long getPriority() { - return priority; - } - - /** - * setPriority(). - * - * @param priority set policy priority. - */ - @JsonProperty("priority") - public void setPriority(Long priority) { - this.priority = priority; - } - - /** - * getAdditionalProperties(). - * - * @return map with additional properties. - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * setAdditionalProperties(). - * - * @param propName name of the property. - * @param value value of the property. - */ - @JsonAnySetter - public void setAdditionalProperties(String propName, Object value) { - this.additionalProperties.put(propName, value); - } - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyImportResultDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyImportResultDTO.java deleted file mode 100644 index a0b7b13e7..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/PolicyImportResultDTO.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "created-policies", "updated-policies", "skipped-policies" }) -public class PolicyImportResultDTO implements Serializable { - private static final long serialVersionUID = -8042756118741022913L; - - @JsonProperty("created-policies") - private List createdPolicies = new ArrayList<>(); - - @JsonProperty("updated-policies") - private List updatedPolicies = new ArrayList<>(); - - @JsonProperty("skipped-policies") - private List skippedPolicies = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("created-policies") - public List getCreatedPolicies() { - return createdPolicies; - } - - @JsonProperty("created-policies") - public void setCreatedPolicies(List createdPolicies) { - this.createdPolicies = createdPolicies; - } - - @JsonProperty("updated-policies") - public List getUpdatedPolicies() { - return updatedPolicies; - } - - @JsonProperty("updated-policies") - public void setUpdatedPolicies(List updatedPolicies) { - this.updatedPolicies = updatedPolicies; - } - - @JsonProperty("skipped-policies") - public List getSkippedPolicies() { - return skippedPolicies; - } - - @JsonProperty("skipped-policies") - public void setSkippedPolicies(List skippedPolicies) { - this.skippedPolicies = skippedPolicies; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "id", "name" }) - public static class Policy implements Serializable { - private static final long serialVersionUID = 6102066058193690851L; - - @JsonProperty("id") - private String id; - - @JsonProperty("name") - private String name; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("id") - public void setId(String id) { - this.id = id; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/RecommendationDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/RecommendationDTO.java deleted file mode 100644 index f409f4629..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/RecommendationDTO.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "recommendations" }) -public class RecommendationDTO implements Serializable { - private static final long serialVersionUID = -8907264880213103337L; - - @JsonProperty("recommendations") - private List recommendations = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("recommendations") - public List getRecommendations() { - return recommendations; - } - - @JsonProperty("symptomDefinitions") - public void setRecommendations(List recommendations) { - this.recommendations = recommendations; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "id", "description", "action" }) - public static class Recommendation implements Serializable { - private static final long serialVersionUID = 7776106897722096326L; - - @JsonProperty("id") - private String id; - - @JsonProperty("description") - private String description; - - @JsonProperty("action") - private Action action; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("id") - public void setId(String id) { - this.id = id; - } - - @JsonProperty("description") - public String getDescription() { - return description; - } - - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - @JsonProperty("action") - public Action getAction() { - return action; - } - - @JsonProperty("action") - public void setAction(Action action) { - this.action = action; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "actionAdapterKindId", "targetAdapterKindId", "targetResourceKindId", "targetMethod" }) - public static class Action implements Serializable { - private static final long serialVersionUID = -3341905633826439983L; - - @JsonProperty("actionAdapterKindId") - private String actionAdapterKindId; - - @JsonProperty("targetAdapterKindId") - private String targetAdapterKindId; - - @JsonProperty("targetResourceKindId") - private String targetResourceKindId; - - @JsonProperty("targetMethod") - private String targetMethod; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("actionAdapterKindId") - public String getActionAdapterKindId() { - return actionAdapterKindId; - } - - @JsonProperty("actionAdapterKindId") - public void setActionAdapterKindId(String actionAdapterKindId) { - this.actionAdapterKindId = actionAdapterKindId; - } - - @JsonProperty("targetAdapterKindId") - public String getTargetAdapterKindId() { - return targetAdapterKindId; - } - - @JsonProperty("targetAdapterKindId") - public void setTargetAdapterKindId(String targetAdapterKindId) { - this.targetAdapterKindId = targetAdapterKindId; - } - - @JsonProperty("targetResourceKindId") - public String getTargetResourceKindId() { - return targetResourceKindId; - } - - @JsonProperty("targetResourceKindId") - public void setTargetResourceKindId(String targetResourceKindId) { - this.targetResourceKindId = targetResourceKindId; - } - - @JsonProperty("targetMethod") - public String getTargetMethod() { - return targetMethod; - } - - @JsonProperty("targetMethod") - public void setTargetMethod(String targetMethod) { - this.targetMethod = targetMethod; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ReportDefinitionDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ReportDefinitionDTO.java deleted file mode 100644 index 172d7cfec..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ReportDefinitionDTO.java +++ /dev/null @@ -1,288 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "pageInfo", "links", "reportDefinitions" }) -@JsonIgnoreProperties({ "pageInfo", "links" }) -public class ReportDefinitionDTO implements Serializable { - private static final long serialVersionUID = -8001968595944498757L; - - @JsonProperty("reportDefinitions") - private List reportDefinitions = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("reportDefinitions") - public List getReportDefinitions() { - return reportDefinitions; - } - - @JsonProperty("reportDefinitions") - public void setReportDefinitions(List reportDefinitions) { - this.reportDefinitions = reportDefinitions; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "id", "name", "description", "subject", "traversal-specs", "active", "owner" }) - public static class ReportDefinition implements Serializable { - private static final long serialVersionUID = 5524309873790715075L; - - @JsonProperty("id") - private String id; - - @JsonProperty("name") - private String name; - - @JsonProperty("description") - private String description; - - @JsonProperty("subject") - private List subject = new ArrayList<>(); - - @JsonProperty("traversal-specs") - private TraversalSpecs traversalSpecs; - - @JsonProperty("active") - private Boolean active; - - @JsonProperty("owner") - private String owner; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("id") - public void setId(String id) { - this.id = id; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("description") - public String getDescription() { - return description; - } - - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - @JsonProperty("subject") - public List getSubject() { - return subject; - } - - @JsonProperty("subject") - public void setSubject(List subject) { - this.subject = subject; - } - - @JsonProperty("traversal-specs") - public TraversalSpecs getTraversalSpecs() { - return traversalSpecs; - } - - @JsonProperty("traversal-specs") - public void setTraversalSpecs(TraversalSpecs traversalSpecs) { - this.traversalSpecs = traversalSpecs; - } - - @JsonProperty("active") - public Boolean isActive() { - return active; - } - - @JsonProperty("active") - public void setActive(Boolean active) { - this.active = active; - } - - @JsonProperty("owner") - public String getOwner() { - return owner; - } - - @JsonProperty("owner") - public void setOwner(String owner) { - this.owner = owner; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "specs" }) - public static class TraversalSpecs implements Serializable { - private static final long serialVersionUID = 5055582582989558793L; - - @JsonProperty("specs") - private List specs = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("specs") - public List getSpecs() { - return specs; - } - - @JsonProperty("specs") - public void setSpecs(List specs) { - this.specs = specs; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "name", "description", "rootAdapterKindKey", "rootResourceKindKey", "adapterInstanceAssociation" }) - public static class Spec implements Serializable { - private static final long serialVersionUID = 4779483169838434664L; - - @JsonProperty("name") - private String name; - - @JsonProperty("description") - private String description; - - @JsonProperty("rootAdapterKindKey") - private String rootAdapterKindKey; - - @JsonProperty("rootResourceKindKey") - private String rootResourceKindKey; - - @JsonProperty("adapterInstanceAssociation") - private Boolean adapterInstanceAssociation; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("description") - public String getDescription() { - return description; - } - - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - @JsonProperty("rootAdapterKindKey") - public String getRootAdapterKindKey() { - return rootAdapterKindKey; - } - - @JsonProperty("rootAdapterKindKey") - public void setRootAdapterKindKey(String rootAdapterKindKey) { - this.rootAdapterKindKey = rootAdapterKindKey; - } - - @JsonProperty("rootResourceKindKey") - public String getRootResourceKindKey() { - return rootResourceKindKey; - } - - @JsonProperty("rootResourceKindKey") - public void setRootResourceKindKey(String rootResourceKindKey) { - this.rootResourceKindKey = rootResourceKindKey; - } - - @JsonProperty("adapterInstanceAssociation") - public Boolean isAdapterInstanceAssociation() { - return adapterInstanceAssociation; - } - - @JsonProperty("adapterInstanceAssociation") - public void setAdapterInstanceAssociation(Boolean adapterInstanceAssociation) { - this.adapterInstanceAssociation = adapterInstanceAssociation; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - } - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ResourceKindDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ResourceKindDTO.java deleted file mode 100644 index 00804d4e0..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ResourceKindDTO.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "pageInfo", "links", "resource-kind" }) -@JsonIgnoreProperties({ "pageInfo", "links" }) -public class ResourceKindDTO implements Serializable { - private static final long serialVersionUID = 6493081292177966190L; - - @JsonProperty("resource-kind") - private List resourceKind = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("resource-kind") - public List getResourceKind() { - return resourceKind; - } - - @JsonProperty("resource-kind") - public void setResourceKind(List resourceKind) { - this.resourceKind = resourceKind; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "key", "name", "adapterKind", "adapterKindName", "resourceKindType", "resourceKindSubType", "resourceIdentifierTypes", "links" }) - @JsonIgnoreProperties({ "links" }) - public static class ResourceKind implements Serializable { - private static final long serialVersionUID = -4211567276552123736L; - - @JsonProperty("key") - private String key; - - @JsonProperty("name") - private String name; - - @JsonProperty("adapterKind") - private String adapterKind; - - @JsonProperty("adapterKindName") - private String adapterKindName; - - @JsonProperty("resourceKindType") - private String resourceKindType; - - @JsonProperty("resourceKindSubType") - private String resourceKindSubType; - - @JsonProperty("resourceIdentifierTypes") - private List resourceIdentifierTypes = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("key") - public String getKey() { - return key; - } - - @JsonProperty("key") - public void setKey(String key) { - this.key = key; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("adapterKind") - public String getAdapterKind() { - return adapterKind; - } - - @JsonProperty("adapterKind") - public void setAdapterKind(String adapterKind) { - this.adapterKind = adapterKind; - } - - @JsonProperty("adapterKindName") - public String getAdapterKindName() { - return adapterKindName; - } - - @JsonProperty("adapterKindName") - public void setAdapterKindName(String adapterKindName) { - this.adapterKindName = adapterKindName; - } - - @JsonProperty("resourceKindType") - public String getResourceKindType() { - return resourceKindType; - } - - @JsonProperty("resourceKindType") - public void setResourceKindType(String resourceKindType) { - this.resourceKindType = resourceKindType; - } - - @JsonProperty("resourceKindSubType") - public String getResourceKindSubType() { - return resourceKindSubType; - } - - @JsonProperty("resourceKindSubType") - public void setResourceKindSubType(String resourceKindSubType) { - this.resourceKindSubType = resourceKindSubType; - } - - @JsonProperty("resourceIdentifierTypes") - public List getResourceIdentifierTypes() { - return resourceIdentifierTypes; - } - - @JsonProperty("resourceIdentifierTypes") - public void setResourceIdentifierTypes(List resourceIdentifierTypes) { - this.resourceIdentifierTypes = resourceIdentifierTypes; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "name", "dataType", "isPartOfUniqueness" }) - public static class ResourceIdentifierType implements Serializable { - private static final long serialVersionUID = -7009149651340736012L; - - @JsonProperty("name") - private String name; - - @JsonProperty("dataType") - private String dataType; - - @JsonProperty("isPartOfUniqueness") - private Boolean isPartOfUniqueness; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("dataType") - public String getDataType() { - return dataType; - } - - @JsonProperty("dataType") - public void setDataType(String dataType) { - this.dataType = dataType; - } - - @JsonProperty("isPartOfUniqueness") - public Boolean isIsPartOfUniqueness() { - return isPartOfUniqueness; - } - - @JsonProperty("isPartOfUniqueness") - public void setIsPartOfUniqueness(Boolean isPartOfUniqueness) { - this.isPartOfUniqueness = isPartOfUniqueness; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ResourcesDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ResourcesDTO.java deleted file mode 100644 index 927d6af7f..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ResourcesDTO.java +++ /dev/null @@ -1,1171 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "pageInfo", "links", "resourceList" }) -public final class ResourcesDTO implements Serializable { - private static final long serialVersionUID = -4565701751149713687L; - - /** - * pageInfo. - */ - @JsonProperty("pageInfo") - private PageInfo pageInfo; - - /** - * links. - */ - @JsonProperty("links") - private List links; - - /** - * resourceList. - */ - @JsonProperty("resourceList") - private List resourceList = new ArrayList<>(); - - /** - * additionalProperties. - */ - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - /** - * getPageInfo. - * - * @return pageInfo - */ - @JsonProperty("pageInfo") - public PageInfo getPageInfo() { - return pageInfo; - } - - /** - * setPageInfo. - * - * @param pageInfo - */ - @JsonProperty("pageInfo") - public void setPageInfo(PageInfo pageInfo) { - this.pageInfo = pageInfo; - } - - /** - * getLinks. - * - * @return links - */ - @JsonProperty("links") - public List getLinks() { - return links; - } - - /** - * setLinks. - * - * @param links - */ - @JsonProperty("links") - public void setLinks(List links) { - this.links = links; - } - - /** - * getResourceList. - * - * @return resourceList - */ - @JsonProperty("resourceList") - public List getResourceList() { - return resourceList; - } - - /** - * setResourceList. - * - * @param resourceList - */ - @JsonProperty("resourceList") - public void setResourceList(List resourceList) { - this.resourceList = resourceList; - } - - /** - * getAdditionalProperties. - * - * @return additionalProperties - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * setAdditionalProperties. - * - * @param key - * @param val - */ - @JsonAnySetter - public void setAdditionalProperties(String key, Object val) { - this.additionalProperties.put(key, val); - } - - @JsonPropertyOrder({ "totalCount", "page", "pageSize" }) - public static final class PageInfo { - /** - * totalCount. - */ - @JsonProperty("totalCount") - private Long totalCount; - - /** - * page. - */ - @JsonProperty("page") - private Long page; - - /** - * pageSize. - */ - @JsonProperty("pageSize") - private Long pageSize; - - /** - * additionalProperties. - */ - @JsonIgnore - private transient Map additionalProperties = new LinkedHashMap(); - - /** - * getTotalCount. - * - * @return totalCount - */ - @JsonProperty("totalCount") - public Long getTotalCount() { - return totalCount; - } - - /** - * setTotalCount. - * - * @param totalCount - */ - @JsonProperty("totalCount") - public void setTotalCount(Long totalCount) { - this.totalCount = totalCount; - } - - /** - * getPage. - * - * @return page - */ - @JsonProperty("page") - public Long getPage() { - return page; - } - - /** - * setPage. - * - * @param page - */ - @JsonProperty("page") - public void setPage(Long page) { - this.page = page; - } - - /** - * getPageSize. - * - * @return pageSize - */ - @JsonProperty("pageSize") - public Long getPageSize() { - return pageSize; - } - - /** - * setPageSize. - * - * @param pageSize - */ - @JsonProperty("pageSize") - public void setPageSize(Long pageSize) { - this.pageSize = pageSize; - } - - /** - * getAdditionalProperties. - * - * @return additionalProperties - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * setAdditionalProperty. - * - * @param key - * @param val - */ - @JsonAnySetter - public void setAdditionalProperty(String key, Object val) { - this.additionalProperties.put(key, val); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "href", "rel", "name" }) - public static final class Link { - /** - * href. - */ - @JsonProperty("href") - private String href; - - /** - * rel. - */ - @JsonProperty("rel") - private String rel; - - /** - * name. - */ - @JsonProperty("name") - private String name; - - /** - * additionalProperties. - */ - @JsonIgnore - private transient Map additionalProperties = new LinkedHashMap(); - - /** - * getHref. - * - * @return href - */ - @JsonProperty("href") - public String getHref() { - return href; - } - - /** - * setHref. - * - * @param href - */ - @JsonProperty("href") - public void setHref(String href) { - this.href = href; - } - - /** - * getRel. - * - * @return getRel - */ - @JsonProperty("rel") - public String getRel() { - return rel; - } - - /** - * setRel. - * - * @param rel - */ - @JsonProperty("rel") - public void setRel(String rel) { - this.rel = rel; - } - - /** - * getName. - * - * @return name - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * setName. - * - * @param name - */ - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - /** - * getAdditionalProperties. - * - * @return additionalProperties - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * setAdditionalProperty. - * - * @param key - * @param val - */ - @JsonAnySetter - public void setAdditionalProperty(String key, Object val) { - this.additionalProperties.put(key, val); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "creationTime", "resourceKey", "resourceStatusStates", "resourceHealth", "resourceHealthValue", "dtEnabled", "monitoringInterval", - "badges", "relatedResources", "links", "identifier" }) - @JsonIgnoreProperties({ "links" }) - public static final class ResourceList implements Serializable { - private static final long serialVersionUID = -7272621081244854723L; - - /** - * creationTime. - */ - @JsonProperty("creationTime") - private long creationTime; - - /** - * credentialInstanceId. - */ - @JsonProperty("credentialInstanceId") - private String credentialInstanceId; - - /** - * description. - */ - @JsonProperty("description") - private String description; - - /** - * resourceKey. - */ - @JsonProperty("resourceKey") - private ResourceKey resourceKey; - - /** - * resourceStatusStates. - */ - @JsonProperty("resourceStatusStates") - private List resourceStatusStates = new ArrayList<>(); - - /** - * resourceHealth. - */ - @JsonProperty("resourceHealth") - private String resourceHealth; - - /** - * resourceHealthValue. - */ - @JsonProperty("resourceHealthValue") - private Double resourceHealthValue; - - /** - * dtEnabled. - */ - @JsonProperty("dtEnabled") - private Boolean dtEnabled; - - /** - * monitoringInterval. - */ - @JsonProperty("monitoringInterval") - private Integer monitoringInterval; - - /** - * badges. - */ - @JsonProperty("badges") - private List badges = new ArrayList<>(); - - /** - * relatedResources. - */ - @JsonProperty("relatedResources") - private List relatedResources = new ArrayList<>(); - - /** - * identifier. - */ - @JsonProperty("identifier") - private String identifier; - - /** - * additionalProperties. - */ - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - /** - * getCreationTime. - * - * @return creationTime - */ - @JsonProperty("creationTime") - public long getCreationTime() { - return creationTime; - } - - /** - * setCreationTime. - * - * @param creationTime - */ - @JsonProperty("creationTime") - public void setCreationTime(long creationTime) { - this.creationTime = creationTime; - } - - /** - * getCredentialInstanceId. - * - * @return credentialInstanceId - */ - public String getCredentialInstanceId() { - return credentialInstanceId; - } - - /** - * setCredentialInstanceId. - * - * @param credentialInstanceId - */ - public void setCredentialInstanceId(String credentialInstanceId) { - this.credentialInstanceId = credentialInstanceId; - } - - /** - * getDescription. - * - * @return description - */ - public String getDescription() { - return description; - } - - /** - * setDescription. - * - * @param description - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * getResourceKey. - * - * @return resourceKey - */ - @JsonProperty("resourceKey") - public ResourceKey getResourceKey() { - return resourceKey; - } - - /** - * setResourceKey. - * - * @param resourceKey - */ - @JsonProperty("resourceKey") - public void setResourceKey(ResourceKey resourceKey) { - this.resourceKey = resourceKey; - } - - /** - * getResourceStatusStates. - * - * @return resourceStatusStates - */ - @JsonProperty("resourceStatusStates") - public List getResourceStatusStates() { - return resourceStatusStates; - } - - /** - * setResourceStatusStates. - * - * @param resourceStatusStates - */ - @JsonProperty("resourceStatusStates") - public void setResourceStatusStates(List resourceStatusStates) { - this.resourceStatusStates = resourceStatusStates; - } - - /** - * getResourceHealth. - * - * @return resourceHealth - */ - @JsonProperty("resourceHealth") - public String getResourceHealth() { - return resourceHealth; - } - - /** - * setResourceHealth. - * - * @param resourceHealth - */ - @JsonProperty("resourceHealth") - public void setResourceHealth(String resourceHealth) { - this.resourceHealth = resourceHealth; - } - - /** - * getResourceHealthValue. - * - * @return resourceHealthValue - */ - @JsonProperty("resourceHealthValue") - public Double getResourceHealthValue() { - return resourceHealthValue; - } - - /** - * setResourceHealthValue. - * - * @param resourceHealthValue - */ - @JsonProperty("resourceHealthValue") - public void setResourceHealthValue(Double resourceHealthValue) { - this.resourceHealthValue = resourceHealthValue; - } - - /** - * isDtEnabled. - * - * @return dtEnabled - */ - @JsonProperty("dtEnabled") - public Boolean isDtEnabled() { - return dtEnabled; - } - - /** - * setDtEnabled. - * - * @param dtEnabled - */ - @JsonProperty("dtEnabled") - public void setDtEnabled(Boolean dtEnabled) { - this.dtEnabled = dtEnabled; - } - - /** - * getMonitoringInterval. - * - * @return monitoringInterval - */ - @JsonProperty("monitoringInterval") - public Integer getMonitoringInterval() { - return monitoringInterval; - } - - /** - * setMonitoringInterval. - * - * @param monitoringInterval - */ - @JsonProperty("monitoringInterval") - public void setMonitoringInterval(Integer monitoringInterval) { - this.monitoringInterval = monitoringInterval; - } - - /** - * getBadges. - * - * @return badges - */ - @JsonProperty("badges") - public List getBadges() { - return badges; - } - - /** - * setBadges. - * - * @param badges - */ - @JsonProperty("badges") - public void setBadges(List badges) { - this.badges = badges; - } - - /** - * getRelatedResources. - * - * @return relatedResources - */ - @JsonProperty("relatedResources") - public List getRelatedResources() { - return relatedResources; - } - - /** - * setRelatedResources. - * - * @param relatedResources - */ - @JsonProperty("relatedResources") - public void setRelatedResources(List relatedResources) { - this.relatedResources = relatedResources; - } - - /** - * getIdentifier. - * - * @return identifier - */ - @JsonProperty("identifier") - public String getIdentifier() { - return identifier; - } - - /** - * setIdentifier. - * - * @param identifier - */ - @JsonProperty("identifier") - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * getAdditionalProperties. - * - * @return additionalProperties - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * setAdditionalProperties. - * - * @param key - * @param val - */ - @JsonAnySetter - public void setAdditionalProperties(String key, Object val) { - this.additionalProperties.put(key, val); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "adapterInstanceId", "resourceStatus", "resourceState", "statusMessage" }) - public static final class ResourceStatusState implements Serializable { - private static final long serialVersionUID = -787582647822155817L; - - /** - * adapterInstanceId. - */ - @JsonProperty("adapterInstanceId") - private String adapterInstanceId; - - /** - * resourceStatus. - */ - @JsonProperty("resourceStatus") - private String resourceStatus; - - /** - * resourceState. - */ - @JsonProperty("resourceState") - private String resourceState; - - /** - * statusMessage. - */ - @JsonProperty("statusMessage") - private String statusMessage; - - /** - * additionalProperties. - */ - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - /** - * getAdapterInstanceId. - * - * @return adapterInstanceId - */ - @JsonProperty("adapterInstanceId") - public String getAdapterInstanceId() { - return adapterInstanceId; - } - - /** - * setAdapterInstanceId. - * - * @param adapterInstanceId - */ - @JsonProperty("adapterInstanceId") - public void setAdapterInstanceId(String adapterInstanceId) { - this.adapterInstanceId = adapterInstanceId; - } - - /** - * getResourceStatus. - * - * @return adapterInstanceId - */ - @JsonProperty("resourceStatus") - public String getResourceStatus() { - return resourceStatus; - } - - /** - * setResourceStatus. - * - * @param resourceStatus - */ - @JsonProperty("resourceStatus") - public void setResourceStatus(String resourceStatus) { - this.resourceStatus = resourceStatus; - } - - /** - * getResourceState. - * - * @return resourceState - */ - @JsonProperty("resourceState") - public String getResourceState() { - return resourceState; - } - - /** - * setResourceState. - * - * @param resourceState - */ - @JsonProperty("resourceState") - public void setResourceState(String resourceState) { - this.resourceState = resourceState; - } - - /** - * getStatusMessage. - * - * @return statusMessage - */ - @JsonProperty("statusMessage") - public String getStatusMessage() { - return statusMessage; - } - - /** - * statusMessage. - * - * @param statusMessage - */ - @JsonProperty("statusMessage") - public void setStatusMessage(String statusMessage) { - this.statusMessage = statusMessage; - } - - /** - * getAdditionalProperties. - * - * @return additionalProperties - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * setAdditionalProperties. - * - * @param key - * @param val - */ - @JsonAnySetter - public void setAdditionalProperties(String key, Object val) { - this.additionalProperties.put(key, val); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "name", "adapterKindKey", "resourceKindKey", "resourceIdentifiers" }) - public static final class ResourceKey implements Serializable { - private static final long serialVersionUID = -7173935404365000209L; - - /** - * name. - */ - @JsonProperty("name") - private String name; - - /** - * adapterKindKey. - */ - @JsonProperty("adapterKindKey") - private String adapterKindKey; - - /** - * resourceKindKey. - */ - @JsonProperty("resourceKindKey") - private String resourceKindKey; - - /** - * resourceIdentifiers. - */ - @JsonProperty("resourceIdentifiers") - private List resourceIdentifiers = new ArrayList<>(); - - /** - * additionalProperties. - */ - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - /** - * getName. - * - * @return name - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * setName. - * - * @param name - */ - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - /** - * getAdapterKindKey. - * - * @return adapterKindKey - */ - @JsonProperty("adapterKindKey") - public String getAdapterKindKey() { - return adapterKindKey; - } - - /** - * setAdapterKindKey. - * - * @param adapterKindKey - */ - @JsonProperty("adapterKindKey") - public void setAdapterKindKey(String adapterKindKey) { - this.adapterKindKey = adapterKindKey; - } - - /** - * getResourceKindKey. - * - * @return resourceKindKey - */ - @JsonProperty("resourceKindKey") - public String getResourceKindKey() { - return resourceKindKey; - } - - /** - * resourceKindKey. - * - * @param resourceKindKey - */ - @JsonProperty("resourceKindKey") - public void setResourceKindKey(String resourceKindKey) { - this.resourceKindKey = resourceKindKey; - } - - /** - * getResourceIdentifiers. - * - * @return resourceIdentifiers - */ - @JsonProperty("resourceIdentifiers") - public List getResourceIdentifiers() { - return resourceIdentifiers; - } - - /** - * setResourceIdentifiers. - * - * @param resourceIdentifiers - */ - @JsonProperty("resourceIdentifiers") - public void setResourceIdentifiers(List resourceIdentifiers) { - this.resourceIdentifiers = resourceIdentifiers; - } - - /** - * getAdditionalProperties. - * - * @return additionalProperties - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * setAdditionalProperties. - * - * @param key - * @param val - */ - @JsonAnySetter - public void setAdditionalProperties(String key, Object val) { - this.additionalProperties.put(key, val); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "identifierType", "value" }) - public static final class ResourceIdentifier implements Serializable { - private static final long serialVersionUID = -4631445128052519908L; - - /** - * identifierType. - */ - @JsonProperty("identifierType") - private IdentifierType identifierType; - - /** - * value. - */ - @JsonProperty("value") - private String value; - - /** - * additionalProperties. - */ - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - /** - * getIdentifierType. - * - * @return identifierType - */ - @JsonProperty("identifierType") - public IdentifierType getIdentifierType() { - return identifierType; - } - - /** - * setIdentifierType. - * - * @param identifierType - */ - @JsonProperty("identifierType") - public void setIdentifierType(IdentifierType identifierType) { - this.identifierType = identifierType; - } - - /** - * getValue. - * - * @return value - */ - @JsonProperty("value") - public String getValue() { - return value; - } - - /** - * setValue. - * - * @param value - */ - @JsonProperty("value") - public void setValue(String value) { - this.value = value; - } - - /** - * getAdditionalProperties. - * - * @return additionalProperties - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * setAdditionalProperties. - * - * @param key - * @param val - */ - @JsonAnySetter - public void setAdditionalProperties(String key, Object val) { - this.additionalProperties.put(key, val); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "name", "dataType", "isPartOfUniqueness" }) - public static final class IdentifierType implements Serializable { - private static final long serialVersionUID = -1370467208132974903L; - - /** - * name. - */ - @JsonProperty("name") - private String name; - - /** - * dataType. - */ - @JsonProperty("dataType") - private String dataType; - - /** - * isPartOfUniqueness. - */ - @JsonProperty("isPartOfUniqueness") - private Boolean isPartOfUniqueness; - - /** - * additionalProperties. - */ - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - /** - * getName. - * - * @return name - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * setName. - * - * @param name - */ - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - /** - * getDataType. - * - * @return dataType - */ - @JsonProperty("dataType") - public String getDataType() { - return dataType; - } - - /** - * setDataType. - * - * @param dataType - */ - @JsonProperty("dataType") - public void setDataType(String dataType) { - this.dataType = dataType; - } - - /** - * isIsPartOfUniqueness. - * - * @return isPartOfUniqueness - */ - @JsonProperty("isPartOfUniqueness") - public Boolean isIsPartOfUniqueness() { - return isPartOfUniqueness; - } - - /** - * setIsPartOfUniqueness. - * - * @param isPartOfUniqueness - */ - @JsonProperty("isPartOfUniqueness") - public void setIsPartOfUniqueness(Boolean isPartOfUniqueness) { - this.isPartOfUniqueness = isPartOfUniqueness; - } - - /** - * getAdditionalProperties. - * - * @return additionalProperties - */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - /** - * setAdditionalProperties. - * - * @param key - * @param val - */ - @JsonAnySetter - public void setAdditionalProperties(String key, Object val) { - this.additionalProperties.put(key, val); - } - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/SupermetricDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/SupermetricDTO.java deleted file mode 100644 index b67870c63..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/SupermetricDTO.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "pageInfo", "links", "superMetrics" }) -@JsonIgnoreProperties({ "pageInfo", "links" }) -public class SupermetricDTO implements Serializable { - private static final long serialVersionUID = 5670765783544505917L; - - @JsonProperty("superMetrics") - private List superMetrics = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("superMetrics") - public List getSuperMetrics() { - return superMetrics; - } - - @JsonProperty("superMetrics") - public void setSuperMetrics(List superMetrics) { - this.superMetrics = superMetrics; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "id", "name", "formula", "description", "modificationTime" }) - public static class SuperMetric implements Serializable { - private static final long serialVersionUID = -4863216664973423038L; - - @JsonProperty("id") - private String id; - - @JsonProperty("name") - private String name; - - @JsonProperty("formula") - private String formula; - - @JsonProperty("description") - private String description; - - @JsonProperty("modificationTime") - private long modificationTime; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("id") - public void setId(String id) { - this.id = id; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("formula") - public String getFormula() { - return formula; - } - - @JsonProperty("formula") - public void setFormula(String formula) { - this.formula = formula; - } - - @JsonProperty("description") - public String getDescription() { - return description; - } - - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - @JsonProperty("modificationTime") - public long getModificationTime() { - return modificationTime; - } - - @JsonProperty("modificationTime") - public void setModificationTime(long modificationTime) { - this.modificationTime = modificationTime; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/SymptomDefinitionDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/SymptomDefinitionDTO.java deleted file mode 100644 index 47040f896..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/SymptomDefinitionDTO.java +++ /dev/null @@ -1,380 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "symptomDefinitions" }) -@JsonIgnoreProperties({ "pageInfo", "links" }) -public class SymptomDefinitionDTO implements Serializable { - private static final long serialVersionUID = -8907264880213103337L; - - @JsonProperty("symptomDefinitions") - private List symptomDefinitions = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("symptomDefinitions") - public List getSymptomDefinitions() { - return symptomDefinitions; - } - - @JsonProperty("symptomDefinitions") - public void setSymptomDefinitions(List symptomDefinitions) { - this.symptomDefinitions = symptomDefinitions; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "id", "name", "adapterKindKey", "resourceKindKey", "waitCycles", "cancelCycles", "state" }) - public static class SymptomDefinition implements Serializable { - private static final long serialVersionUID = -5587983216831252144L; - - @JsonProperty("id") - private String id; - - @JsonProperty("name") - private String name; - - @JsonProperty("adapterKindKey") - private String adapterKindKey; - - @JsonProperty("resourceKindKey") - private String resourceKindKey; - - @JsonProperty("waitCycles") - private Integer waitCycles; - - @JsonProperty("cancelCycles") - private Integer cancelCycles; - - @JsonProperty("state") - private State state; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("id") - public void setId(String id) { - this.id = id; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("adapterKindKey") - public String getAdapterKindKey() { - return adapterKindKey; - } - - @JsonProperty("adapterKindKey") - public void setAdapterKindKey(String adapterKindKey) { - this.adapterKindKey = adapterKindKey; - } - - @JsonProperty("resourceKindKey") - public String getResourceKindKey() { - return resourceKindKey; - } - - @JsonProperty("resourceKindKey") - public void setResourceKindKey(String resourceKindKey) { - this.resourceKindKey = resourceKindKey; - } - - @JsonProperty("waitCycles") - public Integer getWaitCycles() { - return waitCycles; - } - - @JsonProperty("waitCycles") - public void setWaitCycles(Integer waitCycles) { - this.waitCycles = waitCycles; - } - - @JsonProperty("cancelCycles") - public Integer getCancelCycles() { - return cancelCycles; - } - - @JsonProperty("cancelCycles") - public void setCancelCycles(Integer cancelCycles) { - this.cancelCycles = cancelCycles; - } - - @JsonProperty("state") - public State getState() { - return state; - } - - @JsonProperty("state") - public void setState(State state) { - this.state = state; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "severity", "condition" }) - public static class State implements Serializable { - private static final long serialVersionUID = -1599769134473820197L; - - @JsonProperty("severity") - private String severity; - - @JsonProperty("condition") - private Condition condition; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("severity") - public String getSeverity() { - return severity; - } - - @JsonProperty("severity") - public void setSeverity(String severity) { - this.severity = severity; - } - - @JsonProperty("condition") - public Condition getCondition() { - return condition; - } - - @JsonProperty("condition") - public void setCondition(Condition condition) { - this.condition = condition; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "type", "key", "operator", "value", "valueType", "instanced", "thresholdType", "stringValue", "eventType", "message", "faultKey" }) - @JsonIgnoreProperties({ "faultEvents", "targetKey", "instanced", "hardThresholdEventType", "statKey" }) - public static class Condition implements Serializable { - private static final long serialVersionUID = 6996617212704194983L; - - @JsonProperty("type") - private String type; - - @JsonProperty("key") - private String key; - - @JsonProperty("operator") - private String operator; - - @JsonProperty("value") - private String value; - - @JsonProperty("valueType") - private String valueType; - - @JsonProperty("instanced") - private Boolean instanced; - - @JsonProperty("thresholdType") - private String thresholdType; - - @JsonProperty("stringValue") - private String stringValue; - - @JsonProperty("eventType") - private String eventType; - - @JsonProperty("message") - private String message; - - @JsonProperty("faultKey") - private String faultKey; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("type") - public String getType() { - return type; - } - - @JsonProperty("type") - public void setType(String type) { - this.type = type; - } - - @JsonProperty("key") - public String getKey() { - return key; - } - - @JsonProperty("key") - public void setKey(String key) { - this.key = key; - } - - @JsonProperty("operator") - public String getOperator() { - return operator; - } - - @JsonProperty("operator") - public void setOperator(String operator) { - this.operator = operator; - } - - @JsonProperty("value") - public String getValue() { - return value; - } - - @JsonProperty("value") - public void setValue(String value) { - this.value = value; - } - - @JsonProperty("valueType") - public String getValueType() { - return valueType; - } - - @JsonProperty("valueType") - public void setValueType(String valueType) { - this.valueType = valueType; - } - - @JsonProperty("instanced") - public Boolean isInstanced() { - return instanced; - } - - @JsonProperty("instanced") - public void setInstanced(Boolean instanced) { - this.instanced = instanced; - } - - @JsonProperty("thresholdType") - public String getThresholdType() { - return thresholdType; - } - - @JsonProperty("thresholdType") - public void setThresholdType(String thresholdType) { - this.thresholdType = thresholdType; - } - - @JsonProperty("stringValue") - public String getStringValue() { - return stringValue; - } - - @JsonProperty("stringValue") - public void setStringValue(String stringValue) { - this.stringValue = stringValue; - } - - @JsonProperty("eventType") - public String getEventType() { - return eventType; - } - - @JsonProperty("eventType") - public void setEventType(String eventType) { - this.eventType = eventType; - } - - @JsonProperty("message") - public String getMessage() { - return message; - } - - @JsonProperty("message") - public void setMessage(String message) { - this.message = message; - } - - @JsonProperty("faultKey") - public String getFaultKey() { - return faultKey; - } - - @JsonProperty("faultKey") - public void setFaultKey(String faultKey) { - this.faultKey = faultKey; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - } - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ViewDefinitionDTO.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ViewDefinitionDTO.java deleted file mode 100644 index a6b26ff3f..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/ViewDefinitionDTO.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ "pageInfo", "links", "viewDefinitions" }) -@JsonIgnoreProperties({ "pageInfo", "links" }) -public class ViewDefinitionDTO implements Serializable { - private static final long serialVersionUID = -5287778608502410853L; - - @JsonProperty("viewDefinitions") - private List viewDefinitions = new ArrayList<>(); - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("viewDefinitions") - public List getViewDefinitions() { - return viewDefinitions; - } - - @JsonProperty("viewDefinitions") - public void setViewDefinitions(List viewDefinitions) { - this.viewDefinitions = viewDefinitions; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonPropertyOrder({ "name", "description", "type", "presentationType", "subjects", "owner", "active", "links", "id" }) - @JsonIgnoreProperties({ "links" }) - public static class ViewDefinition implements Serializable { - private static final long serialVersionUID = 5175470177444359491L; - - @JsonProperty("name") - private String name; - - @JsonProperty("description") - private String description; - - @JsonProperty("type") - private String type; - - @JsonProperty("presentationType") - private String presentationType; - - @JsonProperty("subjects") - private List subjects = new ArrayList<>(); - - @JsonProperty("owner") - private String owner; - - @JsonProperty("active") - private Boolean active; - - @JsonProperty("id") - private String id; - - @JsonIgnore - private transient Map additionalProperties = new HashMap<>(); - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("name") - public void setName(String name) { - this.name = name; - } - - @JsonProperty("description") - public String getDescription() { - return description; - } - - @JsonProperty("description") - public void setDescription(String description) { - this.description = description; - } - - @JsonProperty("type") - public String getType() { - return type; - } - - @JsonProperty("type") - public void setType(String type) { - this.type = type; - } - - @JsonProperty("presentationType") - public String getPresentationType() { - return presentationType; - } - - @JsonProperty("presentationType") - public void setPresentationType(String presentationType) { - this.presentationType = presentationType; - } - - @JsonProperty("subjects") - public List getSubjects() { - return subjects; - } - - @JsonProperty("subjects") - public void setSubjects(List subjects) { - this.subjects = subjects; - } - - @JsonProperty("owner") - public String getOwner() { - return owner; - } - - @JsonProperty("owner") - public void setOwner(String owner) { - this.owner = owner; - } - - @JsonProperty("active") - public Boolean isActive() { - return active; - } - - @JsonProperty("active") - public void setActive(Boolean active) { - this.active = active; - } - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("id") - public void setId(String id) { - this.id = id; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperties(String name, Object value) { - this.additionalProperties.put(name, value); - } - - } -} diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/package-info.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/package-info.java deleted file mode 100644 index f55950613..000000000 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/model/vrops/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/*- - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ - -/** - * Package that represents vROPs Rest Model. - * - */ -package com.vmware.pscoe.iac.artifact.aria.operations.models; From b6f95e9121004b510b136d47bc31a9e43c882fda Mon Sep 17 00:00:00 2001 From: Stefan Genov Date: Thu, 16 Jan 2025 09:02:36 +0200 Subject: [PATCH 03/10] fix(vrops): Importedt the VROPS classes everywhere needed Signed-off-by: Stefan Genov --- .../com/vmware/pscoe/iac/artifact/PackageStoreFactory.java | 1 + .../aria/operations/rest/RestClientVropsAuthNInterceptor.java | 2 +- .../operations/rest/RestClientVropsBasicAuthInterceptor.java | 2 +- .../iac/artifact/aria/operations/store/VropsPackageStore.java | 2 +- .../com/vmware/pscoe/iac/artifact/rest/RestClientFactory.java | 3 +++ .../iac/artifact/rest/client/vrli/AbstractRestClientVrli.java | 2 +- .../pscoe/iac/artifact/rest/client/vrli/RestClientVrliV1.java | 2 +- .../pscoe/iac/artifact/rest/client/vrli/RestClientVrliV2.java | 2 +- .../pscoe/iac/artifact/store/vrops/VropsPackageStoreTest.java | 2 +- 9 files changed, 11 insertions(+), 7 deletions(-) diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/PackageStoreFactory.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/PackageStoreFactory.java index d7fc2d0dc..408c716ef 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/PackageStoreFactory.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/PackageStoreFactory.java @@ -27,6 +27,7 @@ import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.rest.RestClientVrops; import com.vmware.pscoe.iac.artifact.aria.operations.store.VropsPackageStore; import com.vmware.pscoe.iac.artifact.aria.automation.configuration.ConfigurationVraNg; import com.vmware.pscoe.iac.artifact.aria.automation.pack.VraNgPackageStore; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVropsAuthNInterceptor.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVropsAuthNInterceptor.java index 3b7e648e1..dc2a419eb 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVropsAuthNInterceptor.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVropsAuthNInterceptor.java @@ -52,7 +52,7 @@ public class RestClientVropsAuthNInterceptor extends RestClientRequestIntercepto private String vropsAuthToken; private LocalDateTime vropsTokenExpirationTime; - protected RestClientVropsAuthNInterceptor(ConfigurationVrops configuration, RestTemplate restTemplate) { + public RestClientVropsAuthNInterceptor(ConfigurationVrops configuration, RestTemplate restTemplate) { super(configuration, restTemplate); } diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVropsBasicAuthInterceptor.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVropsBasicAuthInterceptor.java index 6902bd77c..879695283 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVropsBasicAuthInterceptor.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVropsBasicAuthInterceptor.java @@ -27,7 +27,7 @@ public class RestClientVropsBasicAuthInterceptor extends RestClientRequestInterceptor { - protected RestClientVropsBasicAuthInterceptor(ConfigurationVrops configuration, RestTemplate restTemplate) { + public RestClientVropsBasicAuthInterceptor(ConfigurationVrops configuration, RestTemplate restTemplate) { super(configuration, restTemplate); } diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStore.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStore.java index 30ba13e47..dd9d948dd 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStore.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStore.java @@ -72,7 +72,7 @@ import com.vmware.pscoe.iac.artifact.model.Version; import com.vmware.pscoe.iac.artifact.model.vrops.VropsPackageDescriptor; import com.vmware.pscoe.iac.artifact.model.vrops.VropsPackageMemberType; -import com.vmware.pscoe.iac.artifact.rest.RestClientVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.rest.RestClientVrops; import com.vmware.pscoe.iac.artifact.aria.operations.models.AlertDefinitionDTO; import com.vmware.pscoe.iac.artifact.aria.operations.models.AuthGroupDTO; import com.vmware.pscoe.iac.artifact.aria.operations.models.CustomGroupDTO; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientFactory.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientFactory.java index 783058eba..2ed4c4dee 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientFactory.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/RestClientFactory.java @@ -57,6 +57,9 @@ import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVro; import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVroNg; import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.rest.RestClientVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.rest.RestClientVropsAuthNInterceptor; +import com.vmware.pscoe.iac.artifact.aria.operations.rest.RestClientVropsBasicAuthInterceptor; import com.vmware.pscoe.iac.artifact.configuration.ConfigurationCs; public final class RestClientFactory { diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/AbstractRestClientVrli.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/AbstractRestClientVrli.java index b4097c237..e0c806974 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/AbstractRestClientVrli.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/AbstractRestClientVrli.java @@ -21,7 +21,7 @@ import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVrli; import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; import com.vmware.pscoe.iac.artifact.rest.RestClient; -import com.vmware.pscoe.iac.artifact.rest.RestClientVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.rest.RestClientVrops; import org.slf4j.Logger; import org.springframework.http.*; import org.springframework.web.client.HttpClientErrorException; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/RestClientVrliV1.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/RestClientVrliV1.java index 9e9fa8dfe..579c1ad17 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/RestClientVrliV1.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/RestClientVrliV1.java @@ -22,7 +22,7 @@ import java.util.Optional; import java.util.stream.Collectors; -import com.vmware.pscoe.iac.artifact.rest.RestClientVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.rest.RestClientVrops; import com.vmware.pscoe.iac.artifact.rest.client.messages.Errors; import org.apache.commons.lang3.StringUtils; import org.slf4j.LoggerFactory; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/RestClientVrliV2.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/RestClientVrliV2.java index 7ab4b1f57..8ba66e831 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/RestClientVrliV2.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/RestClientVrliV2.java @@ -37,7 +37,7 @@ import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.vmware.pscoe.iac.artifact.configuration.ConfigurationVrli; -import com.vmware.pscoe.iac.artifact.rest.RestClientVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.rest.RestClientVrops; import com.vmware.pscoe.iac.artifact.rest.client.messages.Errors; import com.vmware.pscoe.iac.artifact.rest.model.vrli.v2.AlertDTO; import com.vmware.pscoe.iac.artifact.rest.model.vrli.v2.ContentPackDTO; diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/store/vrops/VropsPackageStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/store/vrops/VropsPackageStoreTest.java index 9206ca98d..4b1da1d52 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/store/vrops/VropsPackageStoreTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/store/vrops/VropsPackageStoreTest.java @@ -42,7 +42,7 @@ import com.vmware.pscoe.iac.artifact.model.PackageType; import com.vmware.pscoe.iac.artifact.model.vrops.VropsPackageDescriptor; import com.vmware.pscoe.iac.artifact.model.vrops.VropsPackageMemberType; -import com.vmware.pscoe.iac.artifact.rest.RestClientVrops; +import com.vmware.pscoe.iac.artifact.aria.operations.rest.RestClientVrops; import com.vmware.pscoe.iac.artifact.aria.operations.models.AuthGroupDTO; import com.vmware.pscoe.iac.artifact.aria.operations.models.AuthUserDTO; import com.vmware.pscoe.iac.artifact.aria.operations.models.PolicyDTO; From 09c86d63ec4550ea3ad3ba27cf36e1f2307755b1 Mon Sep 17 00:00:00 2001 From: Stefan Genov Date: Thu, 16 Jan 2025 11:39:43 +0200 Subject: [PATCH 04/10] feat(vrang): Moved tests and store models to the correct place Signed-off-by: Stefan Genov --- .../automation/pack/VraNgPackageStore.java | 6 +- .../automation/store/AbstractVraNgStore.java | 2 +- .../store/VraNgContentSourceStore.java | 2 +- .../store/VraNgCustomResourceStore.java | 2 +- .../store/VraNgEntitlementStore.java | 2 +- .../store/VraNgPropertyGroupStore.java | 2 +- .../store/VraNgSubscriptionStore.java | 2 +- .../store/VraNgTypeStoreFactory.java | 32 +- .../models/VraNgPackageAdapter.java | 2 +- .../models/VraNgPackageContent.java | 2 +- .../models/VraNgPackageDescriptor.java | 2 +- .../models/VraNgPackageMemberType.java | 2 +- .../{ => store}/models/VraNgPolicy.java | 2 +- .../rest/RestClientVraNgPrimitiveTest.java | 0 .../store/VraNgApprovalPolicyStoreTest.java | 8 +- .../store/VraNgBlueprintStoreTest.java | 69 +- .../store/VraNgCatalogItemStoreTest.java | 1026 +++++++++++++++++ .../VraNgContentSharingPolicyStoreTest.java | 2 +- .../store/VraNgContentSourceStoreTest.java | 169 +++ .../store/VraNgCustomFormTest.java | 0 .../store/VraNgCustomResourceStoreTest.java | 4 +- .../VraNgDay2ActionsPolicyStoreTest.java | 1 + .../VraNgDeploymentLimitPolicyStoreTest.java | 1 + .../store/VraNgEntitlementStoreTest.java | 108 +- .../store/VraNgLeasePolicyStoreTest.java | 1 + .../store/VraNgPropertyGroupStoreTest.java | 2 +- .../store/VraNgReleaseManagerTest.java | 0 .../store/VraNgResourceActionStoreTest.java | 2 +- .../VraNgResourceQuotaPolicyStoreTest.java | 1 + .../store/VraNgSubscriptionStoreTest.java | 2 +- .../utils/VraNgProjectUtilTest.java | 0 .../{ => automation}/utils/package-info.java | 0 .../aria/store/VraNgCatalogItemStoreTest.java | 1013 ---------------- .../store/VraNgContentSourceStoreTest.java | 167 --- 34 files changed, 1329 insertions(+), 1307 deletions(-) rename common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/{ => store}/models/VraNgPackageAdapter.java (96%) rename common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/{ => store}/models/VraNgPackageContent.java (97%) rename common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/{ => store}/models/VraNgPackageDescriptor.java (99%) rename common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/{ => store}/models/VraNgPackageMemberType.java (95%) rename common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/{ => store}/models/VraNgPolicy.java (98%) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/rest/RestClientVraNgPrimitiveTest.java (100%) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/store/VraNgApprovalPolicyStoreTest.java (98%) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/store/VraNgBlueprintStoreTest.java (85%) create mode 100644 common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgCatalogItemStoreTest.java rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/store/VraNgContentSharingPolicyStoreTest.java (99%) create mode 100644 common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgContentSourceStoreTest.java rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/store/VraNgCustomFormTest.java (100%) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/store/VraNgCustomResourceStoreTest.java (99%) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/store/VraNgDay2ActionsPolicyStoreTest.java (99%) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/store/VraNgDeploymentLimitPolicyStoreTest.java (99%) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/store/VraNgEntitlementStoreTest.java (60%) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/store/VraNgLeasePolicyStoreTest.java (99%) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/store/VraNgPropertyGroupStoreTest.java (99%) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/store/VraNgReleaseManagerTest.java (100%) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/store/VraNgResourceActionStoreTest.java (98%) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/store/VraNgResourceQuotaPolicyStoreTest.java (99%) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/store/VraNgSubscriptionStoreTest.java (99%) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/utils/VraNgProjectUtilTest.java (100%) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/{ => automation}/utils/package-info.java (100%) delete mode 100644 common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgCatalogItemStoreTest.java delete mode 100644 common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgContentSourceStoreTest.java diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/pack/VraNgPackageStore.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/pack/VraNgPackageStore.java index 37b6d750b..f6d41410b 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/pack/VraNgPackageStore.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/pack/VraNgPackageStore.java @@ -31,9 +31,9 @@ import com.vmware.pscoe.iac.artifact.aria.automation.configuration.ConfigurationVraNg; import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.model.PackageContent.Content; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageAdapter; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageContent; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageAdapter; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageContent; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageDescriptor; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; import com.vmware.pscoe.iac.artifact.aria.automation.store.VraNgTypeStoreFactory; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/AbstractVraNgStore.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/AbstractVraNgStore.java index a05387a2c..32a61911f 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/AbstractVraNgStore.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/AbstractVraNgStore.java @@ -18,7 +18,7 @@ import com.vmware.pscoe.iac.artifact.aria.automation.configuration.ConfigurationVraNg; import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgIntegration; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageDescriptor; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; import com.vmware.pscoe.iac.artifact.aria.automation.utils.VraNgIntegrationUtils; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgContentSourceStore.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgContentSourceStore.java index 31d58aa87..39907828d 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgContentSourceStore.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgContentSourceStore.java @@ -31,7 +31,7 @@ import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgContentSourceBase; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgContentSourceType; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgIntegration; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageDescriptor; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgWorkflow; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgWorkflowContentSource; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgCustomResourceStore.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgCustomResourceStore.java index 17be5c335..27a358ec6 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgCustomResourceStore.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgCustomResourceStore.java @@ -24,7 +24,7 @@ import com.vmware.pscoe.iac.artifact.aria.automation.configuration.ConfigurationVraNg; import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgCustomResource; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageDescriptor; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; import com.vmware.pscoe.iac.artifact.store.filters.CustomFolderFileFilter; import com.vmware.pscoe.iac.artifact.aria.automation.utils.VraNgOrganizationUtil; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgEntitlementStore.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgEntitlementStore.java index cf358d420..375425664 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgEntitlementStore.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgEntitlementStore.java @@ -37,7 +37,7 @@ import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgCatalogItem; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgContentSourceBase; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgContentSourceType; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageDescriptor; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgProject; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; import com.vmware.pscoe.iac.artifact.store.filters.CustomFolderFileFilter; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgPropertyGroupStore.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgPropertyGroupStore.java index e9d33e71d..f1aa4ab41 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgPropertyGroupStore.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgPropertyGroupStore.java @@ -29,7 +29,7 @@ import com.google.gson.stream.JsonReader; import com.vmware.pscoe.iac.artifact.aria.automation.configuration.ConfigurationVraNg; import com.vmware.pscoe.iac.artifact.model.Package; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageDescriptor; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPropertyGroup; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgSubscriptionStore.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgSubscriptionStore.java index ebaafc60c..a3509ab61 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgSubscriptionStore.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgSubscriptionStore.java @@ -23,7 +23,7 @@ import com.vmware.pscoe.iac.artifact.aria.automation.configuration.ConfigurationVraNg; import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.model.abx.AbxAction; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageDescriptor; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgProject; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgSubscription; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgTypeStoreFactory.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgTypeStoreFactory.java index dd22be904..b0a7bc486 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgTypeStoreFactory.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgTypeStoreFactory.java @@ -20,24 +20,24 @@ import com.vmware.pscoe.iac.artifact.aria.automation.configuration.ConfigurationVraNg; import com.vmware.pscoe.iac.artifact.model.Package; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageContent; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageContent; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageDescriptor; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; -import static com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageContent.ContentType.APPROVAL_POLICY; -import static com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageContent.ContentType.BLUEPRINT; -import static com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageContent.ContentType.CATALOG_ENTITLEMENT; -import static com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageContent.ContentType.CATALOG_ITEM; -import static com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageContent.ContentType.CONTENT_SHARING_POLICY; -import static com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageContent.ContentType.CONTENT_SOURCE; -import static com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageContent.ContentType.CUSTOM_RESOURCE; -import static com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageContent.ContentType.DAY2_ACTIONS_POLICY; -import static com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageContent.ContentType.DEPLOYMENT_LIMIT_POLICY; -import static com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageContent.ContentType.LEASE_POLICY; -import static com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageContent.ContentType.PROPERTY_GROUP; -import static com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageContent.ContentType.RESOURCE_ACTION; -import static com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageContent.ContentType.RESOURCE_QUOTA_POLICY; -import static com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageContent.ContentType.SUBSCRIPTION; +import static com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageContent.ContentType.APPROVAL_POLICY; +import static com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageContent.ContentType.BLUEPRINT; +import static com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageContent.ContentType.CATALOG_ENTITLEMENT; +import static com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageContent.ContentType.CATALOG_ITEM; +import static com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageContent.ContentType.CONTENT_SHARING_POLICY; +import static com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageContent.ContentType.CONTENT_SOURCE; +import static com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageContent.ContentType.CUSTOM_RESOURCE; +import static com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageContent.ContentType.DAY2_ACTIONS_POLICY; +import static com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageContent.ContentType.DEPLOYMENT_LIMIT_POLICY; +import static com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageContent.ContentType.LEASE_POLICY; +import static com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageContent.ContentType.PROPERTY_GROUP; +import static com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageContent.ContentType.RESOURCE_ACTION; +import static com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageContent.ContentType.RESOURCE_QUOTA_POLICY; +import static com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageContent.ContentType.SUBSCRIPTION; /** * Factory to select and setup the store (handler) and determine the order of diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/models/VraNgPackageAdapter.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/models/VraNgPackageAdapter.java similarity index 96% rename from common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/models/VraNgPackageAdapter.java rename to common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/models/VraNgPackageAdapter.java index f0e852f6d..009b13bfd 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/models/VraNgPackageAdapter.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/models/VraNgPackageAdapter.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.aria.automation.models; +package com.vmware.pscoe.iac.artifact.aria.automation.store.models; import java.io.IOException; import java.nio.file.Files; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/models/VraNgPackageContent.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/models/VraNgPackageContent.java similarity index 97% rename from common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/models/VraNgPackageContent.java rename to common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/models/VraNgPackageContent.java index c1215d468..dd03b29c3 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/models/VraNgPackageContent.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/models/VraNgPackageContent.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.aria.automation.models; +package com.vmware.pscoe.iac.artifact.aria.automation.store.models; import java.util.List; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/models/VraNgPackageDescriptor.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/models/VraNgPackageDescriptor.java similarity index 99% rename from common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/models/VraNgPackageDescriptor.java rename to common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/models/VraNgPackageDescriptor.java index 0631d3e5a..5add71907 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/models/VraNgPackageDescriptor.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/models/VraNgPackageDescriptor.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.aria.automation.models; +package com.vmware.pscoe.iac.artifact.aria.automation.store.models; import java.io.File; import java.util.ArrayList; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/models/VraNgPackageMemberType.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/models/VraNgPackageMemberType.java similarity index 95% rename from common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/models/VraNgPackageMemberType.java rename to common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/models/VraNgPackageMemberType.java index 530c4a2a1..6eacaa1d6 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/models/VraNgPackageMemberType.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/models/VraNgPackageMemberType.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.aria.automation.models; +package com.vmware.pscoe.iac.artifact.aria.automation.store.models; public enum VraNgPackageMemberType { BLUEPRINT("blueprint"), diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/models/VraNgPolicy.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/models/VraNgPolicy.java similarity index 98% rename from common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/models/VraNgPolicy.java rename to common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/models/VraNgPolicy.java index 9e4fb02e0..17bbb8cd5 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/models/VraNgPolicy.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/automation/store/models/VraNgPolicy.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.aria.automation.models; +package com.vmware.pscoe.iac.artifact.aria.automation.store.models; import java.util.List; import java.util.ArrayList; diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/rest/RestClientVraNgPrimitiveTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/rest/RestClientVraNgPrimitiveTest.java similarity index 100% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/rest/RestClientVraNgPrimitiveTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/rest/RestClientVraNgPrimitiveTest.java diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgApprovalPolicyStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgApprovalPolicyStoreTest.java similarity index 98% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgApprovalPolicyStoreTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgApprovalPolicyStoreTest.java index 7e3c5c430..b19e66a41 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgApprovalPolicyStoreTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgApprovalPolicyStoreTest.java @@ -14,8 +14,6 @@ */ package com.vmware.pscoe.iac.artifact.aria.automation.store; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; import com.vmware.pscoe.iac.artifact.aria.automation.configuration.ConfigurationVraNg; import com.vmware.pscoe.iac.artifact.helpers.AssertionsHelper; @@ -25,8 +23,8 @@ import com.vmware.pscoe.iac.artifact.model.PackageType; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgApprovalPolicy; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgOrganization; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageDescriptor; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPolicy; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPolicy; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; import org.junit.Rule; import org.junit.jupiter.api.AfterEach; @@ -39,9 +37,7 @@ import java.io.File; import java.io.IOException; -import java.nio.file.Files; import java.nio.file.Paths; -import java.nio.file.StandardOpenOption; import java.util.Arrays; import java.util.Collections; import java.util.List; diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgBlueprintStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgBlueprintStoreTest.java similarity index 85% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgBlueprintStoreTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgBlueprintStoreTest.java index 7b4e36396..0caaac60c 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgBlueprintStoreTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgBlueprintStoreTest.java @@ -22,15 +22,13 @@ import com.vmware.pscoe.iac.artifact.model.PackageFactory; import com.vmware.pscoe.iac.artifact.model.PackageType; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgBlueprint; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageDescriptor; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; import org.junit.Rule; -import org.junit.internal.runners.statements.ExpectException; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; import org.mockito.Mockito; @@ -50,7 +48,8 @@ import static org.mockito.Mockito.anyString; /** - * NOTE: This does not test duplicate names from one content source, since the Store is not responsible for that kind of logic. + * NOTE: This does not test duplicate names from one content source, since the + * Store is not responsible for that kind of logic. */ public class VraNgBlueprintStoreTest { @@ -100,16 +99,15 @@ void tearDown() { System.out.println("=========================================================="); } - @Test void testExportContentWithNoBlueprints() { - //GIVEN + // GIVEN when(vraNgPackageDescriptor.getBlueprint()).thenReturn(new ArrayList()); - //TEST + // TEST store.exportContent(); - //VERIFY + // VERIFY verify(restClient, never()).getAllBlueprints(); verify(restClient, never()).getBlueprintVersions(anyString()); @@ -118,7 +116,7 @@ void testExportContentWithNoBlueprints() { @Test void testExportContentWithAllBlueprints() { - //GIVEN + // GIVEN List blueprints = new ArrayList<>(); BlueprintMockBuilder mockBuilder = new BlueprintMockBuilder("ngnix"); @@ -127,20 +125,21 @@ void testExportContentWithAllBlueprints() { when(vraNgPackageDescriptor.getBlueprint()).thenReturn(null); when(restClient.getAllBlueprints()).thenReturn(blueprints); - //TEST + // TEST store.exportContent(); - String[] expectedBlueprints = {"ngnix"}; - String[] expectedBlueprintFiles = {"content.yaml", "details.json"}; + String[] expectedBlueprints = { "ngnix" }; + String[] expectedBlueprintFiles = { "content.yaml", "details.json" }; // VERIFY AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), expectedBlueprints); - AssertionsHelper.assertFolderContainsFiles(fsMocks.findItemByNameInFolder(fsMocks.getTempFolderProjectPath(), "ngnix"), expectedBlueprintFiles); + AssertionsHelper.assertFolderContainsFiles( + fsMocks.findItemByNameInFolder(fsMocks.getTempFolderProjectPath(), "ngnix"), expectedBlueprintFiles); } @Test void testExportContentWithSpecificBlueprints() { - //GIVEN + // GIVEN List blueprints = new ArrayList<>(); BlueprintMockBuilder ngnixMockBuilder = new BlueprintMockBuilder("ngnix"); BlueprintMockBuilder tomcatMockBuilder = new BlueprintMockBuilder("tomcat"); @@ -154,20 +153,21 @@ void testExportContentWithSpecificBlueprints() { when(vraNgPackageDescriptor.getBlueprint()).thenReturn(blueprintNames); when(restClient.getAllBlueprints()).thenReturn(blueprints); - //TEST + // TEST store.exportContent(); - String[] expectedBlueprints = {"ngnix"}; - String[] expectedBlueprintFiles = {"content.yaml", "details.json"}; + String[] expectedBlueprints = { "ngnix" }; + String[] expectedBlueprintFiles = { "content.yaml", "details.json" }; // VERIFY AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), expectedBlueprints); - AssertionsHelper.assertFolderContainsFiles(fsMocks.findItemByNameInFolder(fsMocks.getTempFolderProjectPath(), "ngnix"), expectedBlueprintFiles); + AssertionsHelper.assertFolderContainsFiles( + fsMocks.findItemByNameInFolder(fsMocks.getTempFolderProjectPath(), "ngnix"), expectedBlueprintFiles); } - + @Test void testExportContentWithNonExistingBlueprint() { - //GIVEN + // GIVEN List blueprints = new ArrayList<>(); BlueprintMockBuilder ngnixMockBuilder = new BlueprintMockBuilder("ngnix"); @@ -179,7 +179,7 @@ void testExportContentWithNonExistingBlueprint() { when(vraNgPackageDescriptor.getBlueprint()).thenReturn(blueprintNames); when(restClient.getAllBlueprints()).thenReturn(blueprints); - //TEST + // TEST assertThrows(IllegalStateException.class, () -> store.exportContent()); } @@ -196,8 +196,11 @@ void testImportContentWithDotInName() { fsMocks.blueprintFsMocks().addBlueprint(blueprint); - AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), new String[]{"nginx 8.x test"}); - AssertionsHelper.assertFolderContainsFiles(fsMocks.findItemByNameInFolder(fsMocks.getTempFolderProjectPath(), "nginx 8.x test"), new String[]{"content.yaml", "details.json"}); + AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), + new String[] { "nginx 8.x test" }); + AssertionsHelper.assertFolderContainsFiles( + fsMocks.findItemByNameInFolder(fsMocks.getTempFolderProjectPath(), "nginx 8.x test"), + new String[] { "content.yaml", "details.json" }); List bluePrintsOnServer = new ArrayList<>(); @@ -225,8 +228,10 @@ void testImportContent() throws IOException, ParseException { fsMocks.blueprintFsMocks().addBlueprint(blueprint); - AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), new String[]{"nginx"}); - AssertionsHelper.assertFolderContainsFiles(fsMocks.findItemByNameInFolder(fsMocks.getTempFolderProjectPath(), "nginx"), new String[]{"content.yaml", "details.json"}); + AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), new String[] { "nginx" }); + AssertionsHelper.assertFolderContainsFiles( + fsMocks.findItemByNameInFolder(fsMocks.getTempFolderProjectPath(), "nginx"), + new String[] { "content.yaml", "details.json" }); List bluePrintsOnServer = new ArrayList<>(); @@ -254,8 +259,10 @@ void testImportContentWhenDuplicateBlueprintsExistOnServer() throws IOException, fsMocks.blueprintFsMocks().addBlueprint(blueprint); - AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), new String[]{"nginx"}); - AssertionsHelper.assertFolderContainsFiles(fsMocks.findItemByNameInFolder(fsMocks.getTempFolderProjectPath(), "nginx"), new String[]{"content.yaml", "details.json"}); + AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), new String[] { "nginx" }); + AssertionsHelper.assertFolderContainsFiles( + fsMocks.findItemByNameInFolder(fsMocks.getTempFolderProjectPath(), "nginx"), + new String[] { "content.yaml", "details.json" }); List bluePrintsOnServer = new ArrayList<>(); bluePrintsOnServer.add(blueprint); @@ -286,9 +293,11 @@ void testImportContentForNonExistingBlueprintsInConfiguration() throws IOExcepti VraNgBlueprint blueprint = builder.build(); fsMocks.blueprintFsMocks().addBlueprint(blueprint); - - AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), new String[]{"nginx"}); - AssertionsHelper.assertFolderContainsFiles(fsMocks.findItemByNameInFolder(fsMocks.getTempFolderProjectPath(), "nginx"), new String[]{"content.yaml", "details.json"}); + + AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), new String[] { "nginx" }); + AssertionsHelper.assertFolderContainsFiles( + fsMocks.findItemByNameInFolder(fsMocks.getTempFolderProjectPath(), "nginx"), + new String[] { "content.yaml", "details.json" }); List bluePrintsOnServer = new ArrayList<>(); diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgCatalogItemStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgCatalogItemStoreTest.java new file mode 100644 index 000000000..b4984f0e9 --- /dev/null +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgCatalogItemStoreTest.java @@ -0,0 +1,1026 @@ +/* + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.automation.store; + +import com.google.gson.JsonArray; + +import com.vmware.pscoe.iac.artifact.aria.automation.configuration.ConfigurationVraNg; +import com.vmware.pscoe.iac.artifact.helpers.AssertionsHelper; +import com.vmware.pscoe.iac.artifact.helpers.FsMocks; +import com.vmware.pscoe.iac.artifact.helpers.GeneralMocks; +import com.vmware.pscoe.iac.artifact.helpers.stubs.CatalogItemMockBuilder; +import com.vmware.pscoe.iac.artifact.helpers.stubs.ContentSourceBaseMockBuilder; +import com.vmware.pscoe.iac.artifact.helpers.stubs.CustomFormMockBuilder; +import com.vmware.pscoe.iac.artifact.model.Package; +import com.vmware.pscoe.iac.artifact.model.PackageFactory; +import com.vmware.pscoe.iac.artifact.model.PackageType; +import com.vmware.pscoe.iac.artifact.aria.automation.models.*; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.*; +import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageDescriptor; + +import org.junit.Rule; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.rules.TemporaryFolder; +import org.mockito.Mockito; +import org.springframework.http.ResponseEntity; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +/** + * NOTE: This does not test duplicate names from one content source, since the + * Store is not responsible for that kind of logic. + */ +public class VraNgCatalogItemStoreTest { + /** + * Temp Folder. + */ + @Rule + public TemporaryFolder tempFolder = new TemporaryFolder(); + /** + * store. + */ + protected VraNgCatalogItemStore store; + /** + * restClient. + */ + protected RestClientVraNg restClient; + /** + * pkg. + */ + protected Package pkg; + /** + * config. + */ + protected ConfigurationVraNg config; + /** + * vraNgPackageDescriptor. + */ + protected VraNgPackageDescriptor vraNgPackageDescriptor; + /** + * fsMocks. + */ + protected FsMocks fsMocks; + /** + * Example project id. + */ + protected static String PROJECT_ID = "projectId"; + /** + * Mocked source id. + */ + protected static String CONTENT_SOURCE_ID = "mockedSourceId"; + /** + * Mocked catalog item id. + */ + protected static String CATALOG_ITEM_ID = "mockedItemId"; + + /** + * Init method called before each test. + */ + @BeforeEach + void init() { + try { + tempFolder.create(); + } catch (IOException e) { + throw new RuntimeException("Could not create a temp folder"); + } + + fsMocks = new FsMocks(tempFolder.getRoot()); + store = new VraNgCatalogItemStore(); + restClient = Mockito.mock(RestClientVraNg.class); + pkg = PackageFactory.getInstance(PackageType.VRANG, tempFolder.getRoot()); + config = Mockito.mock(ConfigurationVraNg.class); + vraNgPackageDescriptor = Mockito.mock(VraNgPackageDescriptor.class); + + store.init(restClient, pkg, config, vraNgPackageDescriptor); + System.out.println("=========================================================="); + System.out.println("START"); + System.out.println("=========================================================="); + } + + /** + * Cleanup method called after each test. + */ + @AfterEach + void tearDown() { + tempFolder.delete(); + + System.out.println("=========================================================="); + System.out.println("END"); + System.out.println("=========================================================="); + } + + @Test + void testExportContentWithAllCatalogItemsWhenNoItems() { + // GIVEN + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(null); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(new ArrayList<>()); + + // START TEST + store.exportContent(); + + // VERIFY + verify(vraNgPackageDescriptor, times(1)).getCatalogItem(); + verify(restClient, times(1)).getCatalogItemsForProject(anyString()); + verify(restClient, times(1)).getProjectId(); + verify(restClient, never()).getContentSource(anyString()); + verify(restClient, never()).getCustomFormByTypeAndSource(anyString(), anyString()); + } + + @Test + void testExportContentWithAllCatalogItemsWhenItemsArePresentFromOneSource() { + // GIVEN + ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); + String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); + + VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); + List mockedCatalogItems = new ArrayList<>(); + CatalogItemMockBuilder builderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + CatalogItemMockBuilder builderTwo = new CatalogItemMockBuilder("catalogItemTwo", "contentSourceNameOne"); + + VraNgCatalogItem catalogItemOne = builderOne.build(); + VraNgCatalogItem catalogItemTwo = builderTwo.build(); + + mockedCatalogItems.add(catalogItemOne); + mockedCatalogItems.add(catalogItemTwo); + + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(null); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.getContentSource(CONTENT_SOURCE_ID)).thenReturn(contentSource); + when(contentSource.getType()).thenReturn(VraNgContentSourceType.VRO_WORKFLOW); + when(restClient.getCustomFormByTypeAndSource(contentSourceType, CATALOG_ITEM_ID)).thenReturn(null); + + // START TEST + store.exportContent(); + + // VERIFY + verify(vraNgPackageDescriptor, times(1)).getCatalogItem(); + verify(restClient, times(1)).getCatalogItemsForProject(anyString()); + verify(restClient, times(1)).getProjectId(); + verify(restClient, times(2)).getContentSource(anyString()); + verify(restClient, times(2)).getCustomFormByTypeAndSource(anyString(), anyString()); + assertEquals(1, tempFolder.getRoot().listFiles().length); + assertEquals(2, fsMocks.getTempFolderProjectPath().listFiles().length); + + String[] expectedFiles = { "contentSourceNameOne__catalogItemOne.json", + "contentSourceNameOne__catalogItemTwo.json" }; + + AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), expectedFiles); + } + + @Test + void testExportContentWithAllCatalogItemsWhenItemsArePresentButFilteringIsEmpty() { + // GIVEN + List mockedCatalogItems = new ArrayList<>(); + CatalogItemMockBuilder builderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + CatalogItemMockBuilder builderTwo = new CatalogItemMockBuilder("catalogItemTwo", "contentSourceNameOne"); + VraNgCatalogItem catalogItemOne = builderOne.build(); + VraNgCatalogItem catalogItemTwo = builderTwo.build(); + + mockedCatalogItems.add(catalogItemOne); + mockedCatalogItems.add(catalogItemTwo); + + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(new ArrayList<>()); + + // START TEST + store.exportContent(); + + // VERIFY + verify(vraNgPackageDescriptor, times(1)).getCatalogItem(); + verify(restClient, never()).getCatalogItemsForProject(anyString()); + verify(restClient, never()).getProjectId(); + verify(restClient, never()).getContentSource(anyString()); + verify(restClient, never()).getCustomFormByTypeAndSource(anyString(), anyString()); + assertEquals(0, tempFolder.getRoot().listFiles().length); + } + + @Test + void testExportContentWithSomeCatalogItemsWhenItemsArePresentFromOneSource() { + // GIVEN + ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); + String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); + VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); + List mockCatalogItemNames = new ArrayList<>(); + mockCatalogItemNames.add("contentSourceNameOne__catalogItemOne"); + + List mockedCatalogItems = new ArrayList<>(); + CatalogItemMockBuilder builderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + CatalogItemMockBuilder builderTwo = new CatalogItemMockBuilder("catalogItemTwo", "contentSourceNameOne"); + VraNgCatalogItem catalogItemOne = builderOne.build(); + VraNgCatalogItem catalogItemTwo = builderTwo.build(); + + mockedCatalogItems.add(catalogItemOne); + mockedCatalogItems.add(catalogItemTwo); + + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(mockCatalogItemNames); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.getContentSource(CONTENT_SOURCE_ID)).thenReturn(contentSource); + when(contentSource.getType()).thenReturn(VraNgContentSourceType.VRO_WORKFLOW); + when(restClient.getCustomFormByTypeAndSource(contentSourceType, CATALOG_ITEM_ID)).thenReturn(null); + + // START TEST + store.exportContent(); + + // VERIFY + verify(vraNgPackageDescriptor, times(1)).getCatalogItem(); + verify(restClient, times(1)).getCatalogItemsForProject(anyString()); + verify(restClient, times(1)).getProjectId(); + verify(restClient, times(1)).getContentSource(anyString()); + verify(restClient, times(1)).getCustomFormByTypeAndSource(anyString(), anyString()); + assertEquals(1, tempFolder.getRoot().listFiles().length); + assertEquals(fsMocks.getTempFolderProjectPath().listFiles().length, 1); + + String[] expectedFiles = { "contentSourceNameOne__catalogItemOne.json" }; + + assertArrayEquals(fsMocks.getTempFolderProjectPath().list(), expectedFiles); + } + + @Test + void testExportContentWithSomeCatalogItemsWhenItemNameHasIncorrectFormat() { + // GIVEN + ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); + String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); + + VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); + List mockCatalogItemNames = new ArrayList<>(); + mockCatalogItemNames.add("wrongFormat"); + + List mockedCatalogItems = new ArrayList<>(); + CatalogItemMockBuilder builderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + CatalogItemMockBuilder builderTwo = new CatalogItemMockBuilder("catalogItemTwo", "contentSourceNameOne"); + VraNgCatalogItem catalogItemOne = builderOne.build(); + VraNgCatalogItem catalogItemTwo = builderTwo.build(); + + mockedCatalogItems.add(catalogItemOne); + mockedCatalogItems.add(catalogItemTwo); + + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(mockCatalogItemNames); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.getContentSource(CONTENT_SOURCE_ID)).thenReturn(contentSource); + when(contentSource.getType()).thenReturn(VraNgContentSourceType.VRO_WORKFLOW); + when(restClient.getCustomFormByTypeAndSource(contentSourceType, CATALOG_ITEM_ID)).thenReturn(null); + + // START TEST + assertThrows(RuntimeException.class, () -> { + store.exportContent(); + }); + + // VERIFY + verify(vraNgPackageDescriptor, times(1)).getCatalogItem(); + verify(restClient, times(1)).getCatalogItemsForProject(anyString()); + verify(restClient, times(1)).getProjectId(); + verify(restClient, never()).getContentSource(anyString()); + verify(restClient, never()).getCustomFormByTypeAndSource(anyString(), anyString()); + } + + @Test + void testExportContentWithSomeCatalogItemsWhenContentSourceDoesNotExist() { + // GIVEN + ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); + String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); + VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); + List mockCatalogItemNames = new ArrayList<>(); + mockCatalogItemNames.add("contentSourceNameOne__catalogItemOne"); + + List mockedCatalogItems = new ArrayList<>(); + CatalogItemMockBuilder builderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + CatalogItemMockBuilder builderTwo = new CatalogItemMockBuilder("catalogItemTwo", "contentSourceNameOne"); + VraNgCatalogItem catalogItemOne = builderOne.build(); + VraNgCatalogItem catalogItemTwo = builderTwo.build(); + + mockedCatalogItems.add(catalogItemOne); + mockedCatalogItems.add(catalogItemTwo); + + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(mockCatalogItemNames); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.getContentSource(CONTENT_SOURCE_ID)).thenReturn(null); + when(contentSource.getType()).thenReturn(VraNgContentSourceType.VRO_WORKFLOW); + when(restClient.getCustomFormByTypeAndSource(contentSourceType, CATALOG_ITEM_ID)).thenReturn(null); + + // START TEST + assertThrows(RuntimeException.class, () -> { + store.exportContent(); + }); + + // VERIFY + verify(vraNgPackageDescriptor, times(1)).getCatalogItem(); + verify(restClient, times(1)).getCatalogItemsForProject(anyString()); + verify(restClient, times(1)).getProjectId(); + verify(restClient, times(1)).getContentSource(anyString()); + verify(restClient, never()).getCustomFormByTypeAndSource(anyString(), anyString()); + } + + @Test + void testExportContentWithNoNExistingCatalogItems() { + // GIVEN + ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); + String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); + VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); + List mockCatalogItemNames = new ArrayList<>(); + mockCatalogItemNames.add("contentSourceNameOne__nonExisting"); + + List mockedCatalogItems = new ArrayList<>(); + CatalogItemMockBuilder builderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + CatalogItemMockBuilder builderTwo = new CatalogItemMockBuilder("catalogItemTwo", "contentSourceNameOne"); + VraNgCatalogItem catalogItemOne = builderOne.build(); + VraNgCatalogItem catalogItemTwo = builderTwo.build(); + + mockedCatalogItems.add(catalogItemOne); + mockedCatalogItems.add(catalogItemTwo); + + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(mockCatalogItemNames); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.getContentSource(CONTENT_SOURCE_ID)).thenReturn(null); + when(contentSource.getType()).thenReturn(VraNgContentSourceType.VRO_WORKFLOW); + when(restClient.getCustomFormByTypeAndSource(contentSourceType, CATALOG_ITEM_ID)).thenReturn(null); + + // START TEST + assertThrows(IllegalStateException.class, () -> { + store.exportContent(); + }); + } + + @Test + void testExportContentWithAllCatalogItemsWhenItemsArePresentFromOneSourceWithForm() { + // GIVEN + ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); + + String formIdOne = "formIdCatalogItemOne"; + String formIdTwo = "formIdCatalogItemTwo"; + CustomFormMockBuilder builderOne = new CustomFormMockBuilder("nameOne"); + CustomFormMockBuilder builderTwo = new CustomFormMockBuilder("nameTwo"); + VraNgCustomForm mockedFormOne = builderOne.setId(formIdOne).build(); + VraNgCustomForm mockedFormTwo = builderTwo.setId(formIdTwo).build(); + String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); + VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); + List mockedCatalogItems = new ArrayList<>(); + + CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + VraNgCatalogItem catalogItemOne = catalogBuilderOne.setCustomFormId(formIdOne).build(); + + CatalogItemMockBuilder catalogBuilderTwo = new CatalogItemMockBuilder("catalogItemTwo", "contentSourceNameOne"); + VraNgCatalogItem catalogItemTwo = catalogBuilderTwo.setCustomFormId(formIdTwo).build(); + + mockedCatalogItems.add(catalogItemOne); + mockedCatalogItems.add(catalogItemTwo); + + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(null); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.getContentSource(CONTENT_SOURCE_ID)).thenReturn(contentSource); + when(contentSource.getType()).thenReturn(VraNgContentSourceType.VRO_WORKFLOW); + when( + restClient.getCustomFormByTypeAndSource(contentSourceType, CATALOG_ITEM_ID)) + .thenReturn(mockedFormOne, mockedFormTwo); + + // START TEST + store.exportContent(); + + // VERIFY + verify(vraNgPackageDescriptor, times(1)).getCatalogItem(); + verify(restClient, times(1)).getCatalogItemsForProject(anyString()); + verify(restClient, times(1)).getProjectId(); + verify(restClient, times(2)).getContentSource(anyString()); + verify(restClient, times(2)).getCustomFormByTypeAndSource(anyString(), anyString()); + assertEquals(1, tempFolder.getRoot().listFiles().length); + + String[] expectedFilesAndFolders = { + "contentSourceNameOne__catalogItemOne.json", + "forms", + "contentSourceNameOne__catalogItemTwo.json" + }; + + String[] expectedFormNames = { + "contentSourceNameOne__catalogItemOne.json", + "contentSourceNameOne__catalogItemOne__FormData.json", + "contentSourceNameOne__catalogItemTwo.json", + "contentSourceNameOne__catalogItemTwo__FormData.json" + }; + + AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), expectedFilesAndFolders); + + for (File file : fsMocks.getTempFolderProjectPath().listFiles()) { + if (file.getName().equalsIgnoreCase("forms")) { + AssertionsHelper.assertFolderContainsFiles(file, expectedFormNames); + } + } + } + + @SuppressWarnings("unchecked") + @Test + void testExportContentWithAllCatalogItemsWhenItemsArePresentFromOneSourceWithFormAndIcon() { + // GIVEN + ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); + + String iconIdOne = "iconIdCatalogItemOne"; + String formIdOne = "formIdCatalogItemOne"; + String formIdTwo = "formIdCatalogItemTwo"; + String iconIdTwo = "iconIdCatalogItemTwo"; + Map headers = new HashMap<>(); + headers.put("Content-Type", "image/png"); + + ResponseEntity iconOneResponse = GeneralMocks.mockResponseEntity( + "iconBodyOne".getBytes(), + 200, + headers); + ResponseEntity iconTwoResponse = GeneralMocks.mockResponseEntity( + "iconBodyTwo".getBytes(), + 200, + headers); + + CustomFormMockBuilder builderOne = new CustomFormMockBuilder("nameOne"); + CustomFormMockBuilder builderTwo = new CustomFormMockBuilder("nameTwo"); + VraNgCustomForm mockedFormOne = builderOne.setId(formIdOne).build(); + VraNgCustomForm mockedFormTwo = builderTwo.setId(formIdTwo).build(); + String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); + VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); + List mockedCatalogItems = new ArrayList<>(); + + CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + VraNgCatalogItem catalogItemOne = catalogBuilderOne.setIconId(iconIdOne).setIconExt("png") + .setCustomFormId(formIdOne).build(); + + CatalogItemMockBuilder catalogBuilderTwo = new CatalogItemMockBuilder("catalogItemTwo", "contentSourceNameOne"); + VraNgCatalogItem catalogItemTwo = catalogBuilderTwo.setIconId(iconIdTwo).setIconExt("png") + .setCustomFormId(formIdTwo).build(); + + mockedCatalogItems.add(catalogItemOne); + mockedCatalogItems.add(catalogItemTwo); + + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(null); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.getContentSource(CONTENT_SOURCE_ID)).thenReturn(contentSource); + when(restClient.downloadIcon(anyString())).thenReturn(iconOneResponse, iconTwoResponse); + when(contentSource.getType()).thenReturn(VraNgContentSourceType.VRO_WORKFLOW); + when( + restClient.getCustomFormByTypeAndSource(contentSourceType, CATALOG_ITEM_ID)) + .thenReturn(mockedFormOne, mockedFormTwo); + + // START TEST + store.exportContent(); + + // VERIFY + verify(vraNgPackageDescriptor, times(1)).getCatalogItem(); + verify(restClient, times(1)).getCatalogItemsForProject(anyString()); + verify(restClient, times(1)).getProjectId(); + verify(restClient, times(2)).getContentSource(anyString()); + verify(restClient, times(2)).getCustomFormByTypeAndSource(anyString(), anyString()); + assertEquals(1, tempFolder.getRoot().listFiles().length); + + String[] expectedFilesAndFolders = { + "contentSourceNameOne__catalogItemOne.json", + "forms", + "icons", + "contentSourceNameOne__catalogItemTwo.json" + }; + + String[] expectedFormNames = { + "contentSourceNameOne__catalogItemOne.json", + "contentSourceNameOne__catalogItemOne__FormData.json", + "contentSourceNameOne__catalogItemTwo.json", + "contentSourceNameOne__catalogItemTwo__FormData.json", + }; + + String[] expectedIconNames = { + "contentSourceNameOne__catalogItemOne.png", + "contentSourceNameOne__catalogItemTwo.png" + }; + + AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), expectedFilesAndFolders); + + AssertionsHelper.assertFolderContainsFiles( + fsMocks.findItemByNameInFolder(fsMocks.getTempFolderProjectPath(), "forms"), + expectedFormNames); + + AssertionsHelper.assertFolderContainsFiles( + fsMocks.findItemByNameInFolder(fsMocks.getTempFolderProjectPath(), "icons"), + expectedIconNames); + } + + @Test + void testExportContentWithAllCatalogItemsWhenItemsArePresentFromOneSourceButIconDoesNotExist() { + // GIVEN + ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); + + String iconIdOne = "iconIdCatalogItemOne"; + String formIdOne = "formIdCatalogItemOne"; + String formIdTwo = "formIdCatalogItemTwo"; + String iconIdTwo = "iconIdCatalogItemTwo"; + + ResponseEntity iconOneResponse = GeneralMocks.mockResponseEntity( + "iconBodyOne".getBytes(), + 500); + CustomFormMockBuilder builderOne = new CustomFormMockBuilder("nameOne"); + CustomFormMockBuilder builderTwo = new CustomFormMockBuilder("nameTwo"); + VraNgCustomForm mockedFormOne = builderOne.setId(formIdOne).build(); + VraNgCustomForm mockedFormTwo = builderTwo.setId(formIdTwo).build(); + String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); + VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); + List mockedCatalogItems = new ArrayList<>(); + + CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + VraNgCatalogItem catalogItemOne = catalogBuilderOne.setIconId(iconIdOne).setIconExt("png") + .setCustomFormId(formIdOne).build(); + + CatalogItemMockBuilder catalogBuilderTwo = new CatalogItemMockBuilder("catalogItemTwo", "contentSourceNameOne"); + VraNgCatalogItem catalogItemTwo = catalogBuilderTwo.setIconId(iconIdTwo).setIconExt("png") + .setCustomFormId(formIdTwo).build(); + + mockedCatalogItems.add(catalogItemOne); + mockedCatalogItems.add(catalogItemTwo); + + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(null); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.getContentSource(CONTENT_SOURCE_ID)).thenReturn(contentSource); + when(restClient.downloadIcon(anyString())).thenReturn(iconOneResponse); + when(contentSource.getType()).thenReturn(VraNgContentSourceType.VRO_WORKFLOW); + when( + restClient.getCustomFormByTypeAndSource(contentSourceType, CATALOG_ITEM_ID)) + .thenReturn(mockedFormOne, mockedFormTwo); + + // START TEST + assertThrows(RuntimeException.class, () -> store.exportContent()); + + // VERIFY + verify(vraNgPackageDescriptor, times(1)).getCatalogItem(); + verify(restClient, times(1)).getCatalogItemsForProject(anyString()); + verify(restClient, times(1)).getProjectId(); + verify(restClient, times(1)).getContentSource(anyString()); + verify(restClient, times(1)).getCustomFormByTypeAndSource(anyString(), anyString()); + } + + @Test + void testExportContentWithAllCatalogItemsWhenItemsArePresentFromOneSourceWithFormAndSameIcon() { + // GIVEN + ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); + + String iconId = "iconId"; + String formIdOne = "formIdCatalogItemOne"; + String formIdTwo = "formIdCatalogItemTwo"; + Map headers = new HashMap<>(); + headers.put("Content-Type", "image/png"); + + ResponseEntity iconOneResponse = GeneralMocks.mockResponseEntity( + "iconBody".getBytes(), + 200, + headers); + CustomFormMockBuilder builderOne = new CustomFormMockBuilder("nameOne"); + CustomFormMockBuilder builderTwo = new CustomFormMockBuilder("nameTwo"); + VraNgCustomForm mockedFormOne = builderOne.setId(formIdOne).build(); + VraNgCustomForm mockedFormTwo = builderTwo.setId(formIdTwo).build(); + String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); + VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); + List mockedCatalogItems = new ArrayList<>(); + CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + VraNgCatalogItem catalogItemOne = catalogBuilderOne.setIconId(iconId).setIconExt("png") + .setCustomFormId(formIdOne).build(); + + CatalogItemMockBuilder catalogBuilderTwo = new CatalogItemMockBuilder("catalogItemTwo", "contentSourceNameOne"); + VraNgCatalogItem catalogItemTwo = catalogBuilderTwo.setIconId(iconId).setIconExt("png") + .setCustomFormId(formIdTwo).build(); + + mockedCatalogItems.add(catalogItemOne); + mockedCatalogItems.add(catalogItemTwo); + + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(null); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.getContentSource(CONTENT_SOURCE_ID)).thenReturn(contentSource); + when(restClient.downloadIcon(anyString())).thenReturn(iconOneResponse); + when(contentSource.getType()).thenReturn(VraNgContentSourceType.VRO_WORKFLOW); + when( + restClient.getCustomFormByTypeAndSource(contentSourceType, CATALOG_ITEM_ID)) + .thenReturn(mockedFormOne, mockedFormTwo); + + // START TEST + store.exportContent(); + + // VERIFY + verify(vraNgPackageDescriptor, times(1)).getCatalogItem(); + verify(restClient, times(1)).getCatalogItemsForProject(anyString()); + verify(restClient, times(1)).getProjectId(); + verify(restClient, times(2)).getContentSource(anyString()); + verify(restClient, times(2)).getCustomFormByTypeAndSource(anyString(), anyString()); + assertEquals(1, tempFolder.getRoot().listFiles().length); + + String[] expectedFilesAndFolders = { + "contentSourceNameOne__catalogItemOne.json", + "forms", + "icons", + "contentSourceNameOne__catalogItemTwo.json" + }; + + String[] expectedFormNames = { + "contentSourceNameOne__catalogItemOne.json", + "contentSourceNameOne__catalogItemOne__FormData.json", + "contentSourceNameOne__catalogItemTwo.json", + "contentSourceNameOne__catalogItemTwo__FormData.json" + }; + + String[] expectedIconNames = { + "contentSourceNameOne__catalogItemOne.png", + "contentSourceNameOne__catalogItemTwo.png", + }; + + AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), expectedFilesAndFolders); + + AssertionsHelper.assertFolderContainsFiles( + fsMocks.findItemByNameInFolder(fsMocks.getTempFolderProjectPath(), "forms"), + expectedFormNames); + + AssertionsHelper.assertFolderContainsFiles( + fsMocks.findItemByNameInFolder(fsMocks.getTempFolderProjectPath(), "icons"), + expectedIconNames); + } + + @Test + void testExportContentWithAllCatalogItemsWhenItemsArePresentFromTwoSources() { + // GIVEN + ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); + String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); + VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); + List mockedCatalogItems = new ArrayList<>(); + + CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + VraNgCatalogItem catalogItemOne = catalogBuilderOne.build(); + + CatalogItemMockBuilder catalogBuilderTwo = new CatalogItemMockBuilder("catalogItemTwo", "contentSourceNameTwo"); + VraNgCatalogItem catalogItemTwo = catalogBuilderTwo.build(); + + mockedCatalogItems.add(catalogItemOne); + mockedCatalogItems.add(catalogItemTwo); + + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(null); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.getContentSource(CONTENT_SOURCE_ID)).thenReturn(contentSource); + when(contentSource.getType()).thenReturn(VraNgContentSourceType.VRO_WORKFLOW); + when(restClient.getCustomFormByTypeAndSource(contentSourceType, CATALOG_ITEM_ID)).thenReturn(null); + + // START TEST + store.exportContent(); + + // VERIFY + verify(vraNgPackageDescriptor, times(1)).getCatalogItem(); + verify(restClient, times(1)).getCatalogItemsForProject(anyString()); + verify(restClient, times(1)).getProjectId(); + verify(restClient, times(2)).getContentSource(anyString()); + verify(restClient, times(2)).getCustomFormByTypeAndSource(anyString(), anyString()); + assertEquals(1, tempFolder.getRoot().listFiles().length); + assertEquals(2, fsMocks.getTempFolderProjectPath().listFiles().length); + + String[] expectedFiles = { "contentSourceNameOne__catalogItemOne.json", + "contentSourceNameTwo__catalogItemTwo.json" }; + + AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), expectedFiles); + } + + @Test + void testExportContentWithAllCatalogItemsWhenItemsArePresentFromTwoSourcesWithSameName() { + // GIVEN + ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); + String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); + + VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); + List mockedCatalogItems = new ArrayList<>(); + CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + VraNgCatalogItem catalogItemOne = catalogBuilderOne.build(); + + CatalogItemMockBuilder catalogBuilderTwo = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameTwo"); + VraNgCatalogItem catalogItemTwo = catalogBuilderTwo.build(); + + mockedCatalogItems.add(catalogItemOne); + mockedCatalogItems.add(catalogItemTwo); + + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(null); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.getContentSource(CONTENT_SOURCE_ID)).thenReturn(contentSource); + when(contentSource.getType()).thenReturn(VraNgContentSourceType.VRO_WORKFLOW); + when(restClient.getCustomFormByTypeAndSource(contentSourceType, CATALOG_ITEM_ID)).thenReturn(null); + + // START TEST + store.exportContent(); + + // VERIFY + verify(vraNgPackageDescriptor, times(1)).getCatalogItem(); + verify(restClient, times(1)).getCatalogItemsForProject(anyString()); + verify(restClient, times(1)).getProjectId(); + verify(restClient, times(2)).getContentSource(anyString()); + verify(restClient, times(2)).getCustomFormByTypeAndSource(anyString(), anyString()); + assertEquals(1, tempFolder.getRoot().listFiles().length); + assertEquals(2, fsMocks.getTempFolderProjectPath().listFiles().length); + + String[] expectedFiles = { "contentSourceNameOne__catalogItemOne.json", + "contentSourceNameTwo__catalogItemOne.json" }; + + AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), expectedFiles); + } + + @Test + void testExportContentWithAllCatalogItemsWhenItemsArePresentFromSameSourceWithSameNames() { + // GIVEN + ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); + + String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); + VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); + List mockedCatalogItems = new ArrayList<>(); + CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + VraNgCatalogItem catalogItemOne = catalogBuilderOne.build(); + + CatalogItemMockBuilder catalogBuilderTwo = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + VraNgCatalogItem catalogItemTwo = catalogBuilderTwo.build(); + + mockedCatalogItems.add(catalogItemOne); + mockedCatalogItems.add(catalogItemTwo); + + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(null); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.getContentSource(CONTENT_SOURCE_ID)).thenReturn(contentSource); + when(contentSource.getType()).thenReturn(VraNgContentSourceType.VRO_WORKFLOW); + when(restClient.getCustomFormByTypeAndSource(contentSourceType, CATALOG_ITEM_ID)).thenReturn(null); + + // START TEST + store.exportContent(); + + // VERIFY + verify(vraNgPackageDescriptor, times(1)).getCatalogItem(); + verify(restClient, times(1)).getCatalogItemsForProject(anyString()); + verify(restClient, times(1)).getProjectId(); + verify(restClient, times(2)).getContentSource(anyString()); + verify(restClient, times(2)).getCustomFormByTypeAndSource(anyString(), anyString()); + assertEquals(1, tempFolder.getRoot().listFiles().length); + assertEquals(fsMocks.getTempFolderProjectPath().listFiles().length, 1); + + // Gets overwritten by the last one + String[] expectedFiles = { "contentSourceNameOne__catalogItemOne.json" }; + + AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), expectedFiles); + } + + @Test + void testImportContentWithNoIconsOrForms() { + // GIVEN + CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + VraNgCatalogItem catalogItem = catalogBuilderOne.build(); + fsMocks.catalogItemFsMocks().addCatalogItem(catalogItem); + + List mockedCatalogItems = new ArrayList<>(); + mockedCatalogItems.add(catalogItem); + + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + + // START TEST + store.importContent(tempFolder.getRoot()); + + // VERIFY + verify(restClient, never()).importCustomForm(any(), anyString()); + verify(restClient, never()).uploadIcon(any()); + } + + @Test + void testImportContentWithAnIconAndNoForms() { + // GIVEN + List mockCatalogItemNames = new ArrayList<>(); + mockCatalogItemNames.add("contentSourceNameOne__catalogItemOne"); + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(mockCatalogItemNames); + + String iconId = "iconId"; + CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + VraNgCatalogItem catalogItem = catalogBuilderOne.setIconId(iconId).setIconExt("png").build(); + + Map headers = new HashMap<>(); + headers.put("Location", "/some/path/iconId"); + ResponseEntity response = GeneralMocks.mockResponseEntity("", 201, headers); + + List mockedCatalogItems = new ArrayList<>(); + mockedCatalogItems.add(catalogItem); + + fsMocks.catalogItemFsMocks().addCatalogItem(catalogItem); + fsMocks.catalogItemFsMocks().addCatalogItemIcon(catalogItem); + when(restClient.getCatalogItemByBlueprintName(anyString())).thenReturn(catalogItem); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.uploadIcon(any())).thenReturn(response); + + // START TEST + store.importContent(tempFolder.getRoot()); + + // VERIFY + verify(restClient, never()).importCustomForm(any(), anyString()); + verify(restClient, times(1)).uploadIcon(any()); + } + + @Test + void testImportContentWithAnIconAndForms() { + // GIVEN + List mockCatalogItemNames = new ArrayList<>(); + mockCatalogItemNames.add("contentSourceNameOne__catalogItemOne"); + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(mockCatalogItemNames); + + String iconId = "iconId"; + CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + VraNgCatalogItem catalogItem = catalogBuilderOne.setIconId(iconId).setIconExt("png").setCustomFormId("formId") + .build(); + + Map headers = new HashMap<>(); + headers.put("Location", "/some/path/iconId"); + ResponseEntity response = GeneralMocks.mockResponseEntity("", 201, headers); + + List mockedCatalogItems = new ArrayList<>(); + mockedCatalogItems.add(catalogItem); + + fsMocks.catalogItemFsMocks().addCatalogItem(catalogItem); + fsMocks.catalogItemFsMocks().addCatalogItemIcon(catalogItem); + fsMocks.catalogItemFsMocks().addCatalogItemForm(catalogItem); + when(restClient.getCatalogItemByBlueprintName(anyString())).thenReturn(catalogItem); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.uploadIcon(any())).thenReturn(response); + doNothing().when(restClient).importCustomForm(any(), anyString()); + + // START TEST + store.importContent(tempFolder.getRoot()); + + // VERIFY + verify(restClient, times(1)).importCustomForm(any(), anyString()); + verify(restClient, times(1)).uploadIcon(any()); + } + + @Test + void testImportContentWithAnIconAndFormsWithDotInName() { + // GIVEN + List mockCatalogItemNames = new ArrayList<>(); + mockCatalogItemNames.add("contentSource. NameOne__catalogItem One.x"); + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(mockCatalogItemNames); + + String iconId = "iconId"; + CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItem One.x", + "contentSource. NameOne"); + VraNgCatalogItem catalogItem = catalogBuilderOne.setIconId(iconId).setIconExt("png").setCustomFormId("formId") + .build(); + + Map headers = new HashMap<>(); + headers.put("Location", "/some/path/iconId"); + ResponseEntity response = GeneralMocks.mockResponseEntity("", 201, headers); + + List mockedCatalogItems = new ArrayList<>(); + mockedCatalogItems.add(catalogItem); + + fsMocks.catalogItemFsMocks().addCatalogItem(catalogItem); + fsMocks.catalogItemFsMocks().addCatalogItemIcon(catalogItem); + fsMocks.catalogItemFsMocks().addCatalogItemForm(catalogItem); + when(restClient.getCatalogItemByBlueprintName(anyString())).thenReturn(catalogItem); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.uploadIcon(any())).thenReturn(response); + doNothing().when(restClient).importCustomForm(any(), anyString()); + + // START TEST + store.importContent(tempFolder.getRoot()); + + // VERIFY + verify(restClient, times(1)).importCustomForm(any(), anyString()); + verify(restClient, times(1)).uploadIcon(any()); + } + + @Test + void testImportContentWithoutAnIconAndWithForms() { + // GIVEN + List mockCatalogItemNames = new ArrayList<>(); + mockCatalogItemNames.add("contentSourceNameOne__catalogItemOne"); + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(mockCatalogItemNames); + + CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + VraNgCatalogItem catalogItem = catalogBuilderOne.setCustomFormId("formId").build(); + + List mockedCatalogItems = new ArrayList<>(); + mockedCatalogItems.add(catalogItem); + + fsMocks.catalogItemFsMocks().addCatalogItem(catalogItem); + fsMocks.catalogItemFsMocks().addCatalogItemForm(catalogItem); + when(restClient.getCatalogItemByBlueprintName(anyString())).thenReturn(catalogItem); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + doNothing().when(restClient).importCustomForm(any(), anyString()); + + // START TEST + store.importContent(tempFolder.getRoot()); + + // VERIFY + verify(restClient, times(1)).importCustomForm(any(), anyString()); + } + + @Test + void testImportContentWithAnIconAndFormsWithVraAbove812() { + // GIVEN + List mockCatalogItemNames = new ArrayList<>(); + mockCatalogItemNames.add("contentSourceNameOne__catalogItemOne"); + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(mockCatalogItemNames); + + String iconId = "iconId"; + CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + VraNgCatalogItemType bpCatalogItem = new VraNgCatalogItemType(VraNgContentSourceType.BLUEPRINT, null, null); + VraNgCatalogItem catalogItem = catalogBuilderOne.setIconId(iconId).setIconExt("png").setCustomFormId("formId") + .setType(bpCatalogItem).build(); + + Map headers = new HashMap<>(); + headers.put("Location", "/some/path/iconId"); + ResponseEntity response = GeneralMocks.mockResponseEntity("", 201, headers); + + List mockedCatalogItems = new ArrayList<>(); + mockedCatalogItems.add(catalogItem); + + fsMocks.catalogItemFsMocks().addCatalogItem(catalogItem); + fsMocks.catalogItemFsMocks().addCatalogItemIcon(catalogItem); + fsMocks.catalogItemFsMocks().addCatalogItemForm(catalogItem); + when(restClient.getCatalogItemByBlueprintName(anyString())).thenReturn(catalogItem); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.uploadIcon(any())).thenReturn(response); + when(restClient.getIsVraAbove812()).thenReturn(true); + when(restClient.getCatalogItemVersions(catalogItem.getId())).thenReturn(new JsonArray()); + + doNothing().when(restClient).importCustomForm(any(), anyString()); + VraNgCatalogItemStore vra812Store = (VraNgCatalogItemStore812) new VraNgTypeStoreFactory(restClient, pkg, + config, vraNgPackageDescriptor) + .getStoreForType(VraNgPackageContent.ContentType.CATALOG_ITEM); + + // START TEST + vra812Store.importContent(tempFolder.getRoot()); + + // VERIFY + verify(restClient, times(1)).importCustomForm(any(), anyString()); + verify(restClient, times(1)).uploadIcon(any()); + } + + @Test + void testImportContentWithAnIconAndFormsWithVraBelow812() { + // GIVEN + List mockCatalogItemNames = new ArrayList<>(); + mockCatalogItemNames.add("contentSourceNameOne__catalogItemOne"); + when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(mockCatalogItemNames); + + String iconId = "iconId"; + CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); + VraNgCatalogItem catalogItem = catalogBuilderOne.setIconId(iconId).setIconExt("png").setCustomFormId("formId") + .build(); + + Map headers = new HashMap<>(); + headers.put("Location", "/some/path/iconId"); + ResponseEntity response = GeneralMocks.mockResponseEntity("", 201, headers); + + List mockedCatalogItems = new ArrayList<>(); + mockedCatalogItems.add(catalogItem); + + fsMocks.catalogItemFsMocks().addCatalogItem(catalogItem); + fsMocks.catalogItemFsMocks().addCatalogItemIcon(catalogItem); + fsMocks.catalogItemFsMocks().addCatalogItemForm(catalogItem); + when(restClient.getCatalogItemByBlueprintName(anyString())).thenReturn(catalogItem); + when(restClient.getProjectId()).thenReturn(PROJECT_ID); + when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + when(restClient.uploadIcon(any())).thenReturn(response); + when(restClient.getIsVraAbove812()).thenReturn(false); + + doNothing().when(restClient).importCustomForm(any(), anyString()); + + // START TEST + store.importContent(tempFolder.getRoot()); + + // VERIFY + verify(restClient, times(1)).importCustomForm(any(), anyString()); + verify(restClient, times(1)).uploadIcon(any()); + } +} diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgContentSharingPolicyStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgContentSharingPolicyStoreTest.java similarity index 99% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgContentSharingPolicyStoreTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgContentSharingPolicyStoreTest.java index 9eaf11652..7a3ed632d 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgContentSharingPolicyStoreTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgContentSharingPolicyStoreTest.java @@ -26,12 +26,12 @@ import java.io.File; import java.io.IOException; import java.nio.file.Paths; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Objects; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.*; import com.vmware.pscoe.iac.artifact.aria.automation.models.*; import org.junit.Rule; import org.junit.jupiter.api.AfterEach; diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgContentSourceStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgContentSourceStoreTest.java new file mode 100644 index 000000000..255bed7a8 --- /dev/null +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgContentSourceStoreTest.java @@ -0,0 +1,169 @@ +/* + * #%L + * artifact-manager + * %% + * Copyright (C) 2023 VMware + * %% + * Build Tools for VMware Aria + * Copyright 2023 VMware, Inc. + * + * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. + * + * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. + * #L% + */ +package com.vmware.pscoe.iac.artifact.aria.automation.store; + +import com.vmware.pscoe.iac.artifact.aria.automation.configuration.ConfigurationVraNg; +import com.vmware.pscoe.iac.artifact.helpers.AssertionsHelper; +import com.vmware.pscoe.iac.artifact.helpers.FsMocks; +import com.vmware.pscoe.iac.artifact.helpers.stubs.ContentSourceBaseMockBuilder; +import com.vmware.pscoe.iac.artifact.model.Package; +import com.vmware.pscoe.iac.artifact.model.PackageFactory; +import com.vmware.pscoe.iac.artifact.model.PackageType; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.*; +import com.vmware.pscoe.iac.artifact.aria.automation.models.*; +import com.vmware.pscoe.iac.artifact.rest.RestClient; +import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; + +import org.junit.Rule; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.rules.TemporaryFolder; +import org.mockito.Mockito; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +public class VraNgContentSourceStoreTest { + + @Rule + public TemporaryFolder tempFolder = new TemporaryFolder(); + protected static String PROJECT_ID = "projectId"; + protected VraNgContentSourceStore store; + protected RestClientVraNg restClient; + protected Package pkg; + protected ConfigurationVraNg config; + protected VraNgPackageDescriptor vraNgPackageDescriptor; + protected FsMocks fsMocks; + + @BeforeEach + void init() { + try { + tempFolder.create(); + } catch (IOException e) { + throw new RuntimeException("Could not create a temp folder"); + } + + fsMocks = new FsMocks(tempFolder.getRoot()); + store = new VraNgContentSourceStore(); + restClient = Mockito.mock(RestClientVraNg.class); + pkg = PackageFactory.getInstance(PackageType.VRANG, tempFolder.getRoot()); + config = Mockito.mock(ConfigurationVraNg.class); + vraNgPackageDescriptor = Mockito.mock(VraNgPackageDescriptor.class); + + store.init(restClient, pkg, config, vraNgPackageDescriptor); + System.out.println("=========================================================="); + System.out.println("START"); + System.out.println("=========================================================="); + } + + @AfterEach + void tearDown() { + tempFolder.delete(); + + System.out.println("=========================================================="); + System.out.println("END"); + System.out.println("=========================================================="); + } + + @Test + void testExportContentWithNoContentSource() { + // GIVEN + ArrayList data = new ArrayList<>(); + data.add("nothing"); + + List mockedCatalogItems = new ArrayList<>(); + ContentSourceBaseMockBuilder builderOne = new ContentSourceBaseMockBuilder(); + VraNgContentSourceBase contentSourceOne = builderOne.setName("thing1").build(); + ContentSourceBaseMockBuilder builderTwo = new ContentSourceBaseMockBuilder(); + VraNgContentSourceBase contentSourceTwo = builderOne.setName("thing2").build(); + mockedCatalogItems.add(contentSourceOne); + mockedCatalogItems.add(contentSourceTwo); + + when(vraNgPackageDescriptor.getContentSource()).thenReturn(data); + when(restClient.getContentSourcesForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); + // TEST + assertThrows(IllegalStateException.class, () -> store.exportContent()); + + // VERIFY + verify(restClient, never()).getContentSourcesForProject(anyString()); + + assertEquals(0, tempFolder.getRoot().listFiles().length); + } + + @Test + void testExportContentThatDoesNotExistOnTheServer() { + // GIVEN + when(vraNgPackageDescriptor.getContentSource()).thenReturn(new ArrayList()); + + // TEST + store.exportContent(); + + // VERIFY + verify(restClient, never()).getContentSourcesForProject(anyString()); + + assertEquals(0, tempFolder.getRoot().listFiles().length); + } + + @Test + void testExportContentWithNullValue() { + + when(vraNgPackageDescriptor.getContentSource()).thenReturn(null); + // TEST + assertDoesNotThrow(() -> store.exportContent()); + + } + + // TODO not easy to implement the test because the VraNgContentSourceBase is too + // complext to be mocked. VraNgContentSourceBase is casted dynamically to other + // classes + // @Test + // void testExportContentWithAllContentSources() { + // //GIVEN + // when( restClient.getProjectId()).thenReturn("mockedProjectId"); + // VraNgContentSourceStore store1 = new VraNgContentSourceStore(); + // store1.init( restClient, pkg, config, vraNgPackageDescriptor ); + + // List contentSources = new ArrayList<>(); + // ContentSourceBaseMockBuilder builder = new ContentSourceBaseMockBuilder(); + + // contentSources.add( builder.setName("mockContentSource1").build()); + + // when( vraNgPackageDescriptor.getContentSource()).thenReturn(null); + // when( restClient.getContentSourcesForProject("mockedProjectId")).thenReturn( + // contentSources ); + + // //TEST + // store1.exportContent(); + + // String[] expectedContentSources = { "mockContentSource1.json" }; + + // // VERIFY + // verify(restClient, times(1)).getContentSourcesForProject("mockedProjectId"); + // AssertionsHelper.assertFolderContainsFiles( + // fsMocks.getTempFolderProjectPath(), expectedContentSources ); + // } + + // @Test + // void testExportContentWithSpecificContentSources() {} + +} diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgCustomFormTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgCustomFormTest.java similarity index 100% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgCustomFormTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgCustomFormTest.java diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgCustomResourceStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgCustomResourceStoreTest.java similarity index 99% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgCustomResourceStoreTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgCustomResourceStoreTest.java index dfccddebc..522950654 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgCustomResourceStoreTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgCustomResourceStoreTest.java @@ -23,8 +23,6 @@ import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgOrganization; import com.google.gson.*; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; import org.mockito.ArgumentCaptor; import org.springframework.http.HttpStatus; import org.springframework.web.client.HttpClientErrorException; @@ -42,7 +40,7 @@ import com.vmware.pscoe.iac.artifact.model.PackageType; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgCustomResource; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgIntegration; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageDescriptor; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; import org.apache.commons.io.FileUtils; diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgDay2ActionsPolicyStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgDay2ActionsPolicyStoreTest.java similarity index 99% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgDay2ActionsPolicyStoreTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgDay2ActionsPolicyStoreTest.java index 7cc66d2b2..8200691cf 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgDay2ActionsPolicyStoreTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgDay2ActionsPolicyStoreTest.java @@ -21,6 +21,7 @@ import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.model.PackageFactory; import com.vmware.pscoe.iac.artifact.model.PackageType; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.*; import com.vmware.pscoe.iac.artifact.aria.automation.models.*; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; import org.junit.Rule; diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgDeploymentLimitPolicyStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgDeploymentLimitPolicyStoreTest.java similarity index 99% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgDeploymentLimitPolicyStoreTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgDeploymentLimitPolicyStoreTest.java index 945a40f9c..e87a73a1b 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgDeploymentLimitPolicyStoreTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgDeploymentLimitPolicyStoreTest.java @@ -21,6 +21,7 @@ import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.model.PackageFactory; import com.vmware.pscoe.iac.artifact.model.PackageType; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.*; import com.vmware.pscoe.iac.artifact.aria.automation.models.*; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; import org.junit.Rule; diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgEntitlementStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgEntitlementStoreTest.java similarity index 60% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgEntitlementStoreTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgEntitlementStoreTest.java index ecd2c9596..5f7ce1015 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgEntitlementStoreTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgEntitlementStoreTest.java @@ -21,6 +21,7 @@ import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.model.PackageFactory; import com.vmware.pscoe.iac.artifact.model.PackageType; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.*; import com.vmware.pscoe.iac.artifact.aria.automation.models.*; import com.vmware.pscoe.iac.artifact.rest.RestClient; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; @@ -41,82 +42,81 @@ public class VraNgEntitlementStoreTest { @Rule - public TemporaryFolder tempFolder = new TemporaryFolder(); + public TemporaryFolder tempFolder = new TemporaryFolder(); - protected VraNgEntitlementStore store; - protected RestClientVraNg restClient; - protected Package pkg; - protected ConfigurationVraNg config; - protected VraNgPackageDescriptor vraNgPackageDescriptor; - protected FsMocks fsMocks; + protected VraNgEntitlementStore store; + protected RestClientVraNg restClient; + protected Package pkg; + protected ConfigurationVraNg config; + protected VraNgPackageDescriptor vraNgPackageDescriptor; + protected FsMocks fsMocks; @BeforeEach void init() { try { tempFolder.create(); - } - catch ( IOException e ) { - throw new RuntimeException( "Could not create a temp folder" ); + } catch (IOException e) { + throw new RuntimeException("Could not create a temp folder"); } - fsMocks = new FsMocks( tempFolder.getRoot() ); - store = new VraNgEntitlementStore(); - restClient = Mockito.mock( RestClientVraNg.class ); - pkg = PackageFactory.getInstance( PackageType.VRANG, tempFolder.getRoot() ); - config = Mockito.mock( ConfigurationVraNg.class ); - vraNgPackageDescriptor = Mockito.mock( VraNgPackageDescriptor.class ); - - store.init( restClient, pkg, config, vraNgPackageDescriptor ); - System.out.println( "==========================================================" ); - System.out.println( "START" ); - System.out.println( "==========================================================" ); + fsMocks = new FsMocks(tempFolder.getRoot()); + store = new VraNgEntitlementStore(); + restClient = Mockito.mock(RestClientVraNg.class); + pkg = PackageFactory.getInstance(PackageType.VRANG, tempFolder.getRoot()); + config = Mockito.mock(ConfigurationVraNg.class); + vraNgPackageDescriptor = Mockito.mock(VraNgPackageDescriptor.class); + + store.init(restClient, pkg, config, vraNgPackageDescriptor); + System.out.println("=========================================================="); + System.out.println("START"); + System.out.println("=========================================================="); } @AfterEach void tearDown() { tempFolder.delete(); - System.out.println( "==========================================================" ); - System.out.println( "END" ); - System.out.println( "==========================================================" ); + System.out.println("=========================================================="); + System.out.println("END"); + System.out.println("=========================================================="); } @Test void testExportContentWithNoEntitlements() { - //GIVEN - when( vraNgPackageDescriptor.getCatalogEntitlement() ).thenReturn(new ArrayList()); + // GIVEN + when(vraNgPackageDescriptor.getCatalogEntitlement()).thenReturn(new ArrayList()); - //TEST + // TEST store.exportContent(); - //VERIFY - verify( restClient, never() ).getAllCatalogEntitlements(); - assertEquals( 0, tempFolder.getRoot().listFiles().length ); + // VERIFY + verify(restClient, never()).getAllCatalogEntitlements(); + assertEquals(0, tempFolder.getRoot().listFiles().length); } @Test void testExportContentWithAllEntitlements() { - //GIVEN + // GIVEN when(vraNgPackageDescriptor.getCatalogEntitlement()).thenReturn(null); List entitlements = new ArrayList<>(); CatalogEntitlementMockBuilder builder = new CatalogEntitlementMockBuilder("entitlement1"); entitlements.add(builder.build()); - when( restClient.getAllCatalogEntitlements() ).thenReturn( entitlements ); + when(restClient.getAllCatalogEntitlements()).thenReturn(entitlements); - //TEST + // TEST store.exportContent(); - String[] expectedEntitlementsFile = { "entitlement1.yaml" }; + String[] expectedEntitlementsFile = { "entitlement1.yaml" }; - //VERIFY - verify( restClient, times(1) ).getAllCatalogEntitlements(); - AssertionsHelper.assertFolderContainsFiles( fsMocks.getTempFolderProjectPath(), expectedEntitlementsFile ); + // VERIFY + verify(restClient, times(1)).getAllCatalogEntitlements(); + AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), expectedEntitlementsFile); } @Test void testExportContentWithSpecificEntitlements() { - //GIVEN + // GIVEN List entitlements = new ArrayList<>(); CatalogEntitlementMockBuilder builder1 = new CatalogEntitlementMockBuilder("entitlement1"); CatalogEntitlementMockBuilder builder2 = new CatalogEntitlementMockBuilder("entitlement2"); @@ -127,21 +127,21 @@ void testExportContentWithSpecificEntitlements() { List entitlementsNames = new ArrayList<>(); entitlementsNames.add("entitlement1"); - when( vraNgPackageDescriptor.getCatalogEntitlement() ).thenReturn(entitlementsNames); + when(vraNgPackageDescriptor.getCatalogEntitlement()).thenReturn(entitlementsNames); - //TEST + // TEST store.exportContent(); - String[] expectedEntitlementsFile = { "entitlement1.yaml" }; + String[] expectedEntitlementsFile = { "entitlement1.yaml" }; - //VERIFY - verify( restClient, times(1) ).getAllCatalogEntitlements(); - AssertionsHelper.assertFolderContainsFiles( fsMocks.getTempFolderProjectPath(), expectedEntitlementsFile ); + // VERIFY + verify(restClient, times(1)).getAllCatalogEntitlements(); + AssertionsHelper.assertFolderContainsFiles(fsMocks.getTempFolderProjectPath(), expectedEntitlementsFile); } @Test void testImportContentExcludingFromConfiguration() { - //GIVEN + // GIVEN CatalogEntitlementMockBuilder builder1 = new CatalogEntitlementMockBuilder("entitlement1"); CatalogEntitlementMockBuilder builder2 = new CatalogEntitlementMockBuilder("entitlement2"); @@ -150,18 +150,18 @@ void testImportContentExcludingFromConfiguration() { List entitlementsNames = new ArrayList<>(); entitlementsNames.add("entitlement"); - when( vraNgPackageDescriptor.getCatalogEntitlement() ).thenReturn(entitlementsNames); + when(vraNgPackageDescriptor.getCatalogEntitlement()).thenReturn(entitlementsNames); - //TEST + // TEST store.importContent(tempFolder.getRoot()); - //VERIFY - verify( restClient, times(0) ).createCatalogEntitlement(any(), any()); + // VERIFY + verify(restClient, times(0)).createCatalogEntitlement(any(), any()); } @Test void testExportContentWithNoExistingEntitlement() { - //GIVEN + // GIVEN List entitlements = new ArrayList<>(); CatalogEntitlementMockBuilder builder1 = new CatalogEntitlementMockBuilder("entitlement1"); CatalogEntitlementMockBuilder builder2 = new CatalogEntitlementMockBuilder("entitlement2"); @@ -172,12 +172,12 @@ void testExportContentWithNoExistingEntitlement() { List entitlementsNames = new ArrayList<>(); entitlementsNames.add("noting"); - when( vraNgPackageDescriptor.getCatalogEntitlement() ).thenReturn(entitlementsNames); + when(vraNgPackageDescriptor.getCatalogEntitlement()).thenReturn(entitlementsNames); - //TEST + // TEST assertThrows(IllegalStateException.class, () -> store.exportContent()); - //VERIFY - verify( restClient, times(1)).getAllCatalogEntitlements(); + // VERIFY + verify(restClient, times(1)).getAllCatalogEntitlements(); } } diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgLeasePolicyStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgLeasePolicyStoreTest.java similarity index 99% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgLeasePolicyStoreTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgLeasePolicyStoreTest.java index 78c2cf3a5..6ab9b911a 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgLeasePolicyStoreTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgLeasePolicyStoreTest.java @@ -21,6 +21,7 @@ import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.model.PackageFactory; import com.vmware.pscoe.iac.artifact.model.PackageType; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.*; import com.vmware.pscoe.iac.artifact.aria.automation.models.*; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; import org.junit.Rule; diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgPropertyGroupStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgPropertyGroupStoreTest.java similarity index 99% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgPropertyGroupStoreTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgPropertyGroupStoreTest.java index 96a11db8c..1d9eb4593 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgPropertyGroupStoreTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgPropertyGroupStoreTest.java @@ -22,7 +22,7 @@ import com.vmware.pscoe.iac.artifact.model.PackageFactory; import com.vmware.pscoe.iac.artifact.model.PackageType; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgOrganization; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageDescriptor; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPropertyGroup; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; import org.junit.Rule; diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgReleaseManagerTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgReleaseManagerTest.java similarity index 100% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgReleaseManagerTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgReleaseManagerTest.java diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgResourceActionStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgResourceActionStoreTest.java similarity index 98% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgResourceActionStoreTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgResourceActionStoreTest.java index df8258eda..5b0312dc3 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgResourceActionStoreTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgResourceActionStoreTest.java @@ -21,7 +21,7 @@ import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.model.PackageFactory; import com.vmware.pscoe.iac.artifact.model.PackageType; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageDescriptor; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgResourceAction; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgResourceQuotaPolicyStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgResourceQuotaPolicyStoreTest.java similarity index 99% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgResourceQuotaPolicyStoreTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgResourceQuotaPolicyStoreTest.java index 433d4bff4..da2837a49 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgResourceQuotaPolicyStoreTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgResourceQuotaPolicyStoreTest.java @@ -21,6 +21,7 @@ import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.model.PackageFactory; import com.vmware.pscoe.iac.artifact.model.PackageType; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.*; import com.vmware.pscoe.iac.artifact.aria.automation.models.*; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; import org.junit.Rule; diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgSubscriptionStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgSubscriptionStoreTest.java similarity index 99% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgSubscriptionStoreTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgSubscriptionStoreTest.java index 16fbaa9ad..6961d6a19 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgSubscriptionStoreTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/store/VraNgSubscriptionStoreTest.java @@ -53,7 +53,7 @@ import com.vmware.pscoe.iac.artifact.model.PackageType; import com.vmware.pscoe.iac.artifact.model.abx.AbxAction; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgOrganization; -import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.automation.store.models.VraNgPackageDescriptor; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgProject; import com.vmware.pscoe.iac.artifact.aria.automation.models.VraNgSubscription; import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/utils/VraNgProjectUtilTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/utils/VraNgProjectUtilTest.java similarity index 100% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/utils/VraNgProjectUtilTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/utils/VraNgProjectUtilTest.java diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/utils/package-info.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/utils/package-info.java similarity index 100% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/utils/package-info.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/automation/utils/package-info.java diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgCatalogItemStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgCatalogItemStoreTest.java deleted file mode 100644 index c2c87646b..000000000 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgCatalogItemStoreTest.java +++ /dev/null @@ -1,1013 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.automation.store; - -import com.google.gson.JsonArray; - -import com.vmware.pscoe.iac.artifact.aria.automation.configuration.ConfigurationVraNg; -import com.vmware.pscoe.iac.artifact.helpers.AssertionsHelper; -import com.vmware.pscoe.iac.artifact.helpers.FsMocks; -import com.vmware.pscoe.iac.artifact.helpers.GeneralMocks; -import com.vmware.pscoe.iac.artifact.helpers.stubs.CatalogItemMockBuilder; -import com.vmware.pscoe.iac.artifact.helpers.stubs.ContentSourceBaseMockBuilder; -import com.vmware.pscoe.iac.artifact.helpers.stubs.CustomFormMockBuilder; -import com.vmware.pscoe.iac.artifact.model.Package; -import com.vmware.pscoe.iac.artifact.model.PackageFactory; -import com.vmware.pscoe.iac.artifact.model.PackageType; -import com.vmware.pscoe.iac.artifact.aria.automation.models.*; -import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; -import org.junit.Rule; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.rules.TemporaryFolder; -import org.mockito.Mockito; -import org.springframework.http.ResponseEntity; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.*; - -/** - * NOTE: This does not test duplicate names from one content source, since the Store is not responsible for that kind of logic. - */ -public class VraNgCatalogItemStoreTest { - /** - * Temp Folder. - */ - @Rule - public TemporaryFolder tempFolder = new TemporaryFolder(); - /** - * store. - */ - protected VraNgCatalogItemStore store; - /** - * restClient. - */ - protected RestClientVraNg restClient; - /** - * pkg. - */ - protected Package pkg; - /** - * config. - */ - protected ConfigurationVraNg config; - /** - * vraNgPackageDescriptor. - */ - protected VraNgPackageDescriptor vraNgPackageDescriptor; - /** - * fsMocks. - */ - protected FsMocks fsMocks; - /** - * Example project id. - */ - protected static String PROJECT_ID = "projectId"; - /** - * Mocked source id. - */ - protected static String CONTENT_SOURCE_ID = "mockedSourceId"; - /** - * Mocked catalog item id. - */ - protected static String CATALOG_ITEM_ID = "mockedItemId"; - - /** - * Init method called before each test. - */ - @BeforeEach - void init() { - try { - tempFolder.create(); - } - catch ( IOException e ) { - throw new RuntimeException( "Could not create a temp folder" ); - } - - fsMocks = new FsMocks( tempFolder.getRoot() ); - store = new VraNgCatalogItemStore(); - restClient = Mockito.mock( RestClientVraNg.class ); - pkg = PackageFactory.getInstance( PackageType.VRANG, tempFolder.getRoot() ); - config = Mockito.mock( ConfigurationVraNg.class ); - vraNgPackageDescriptor = Mockito.mock( VraNgPackageDescriptor.class ); - - store.init( restClient, pkg, config, vraNgPackageDescriptor ); - System.out.println( "==========================================================" ); - System.out.println( "START" ); - System.out.println( "==========================================================" ); - } - - /** - * Cleanup method called after each test. - */ - @AfterEach - void tearDown() { - tempFolder.delete(); - - System.out.println( "==========================================================" ); - System.out.println( "END" ); - System.out.println( "==========================================================" ); - } - - @Test - void testExportContentWithAllCatalogItemsWhenNoItems() { - // GIVEN - when( vraNgPackageDescriptor.getCatalogItem() ).thenReturn( null ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( new ArrayList<>() ); - - // START TEST - store.exportContent(); - - // VERIFY - verify( vraNgPackageDescriptor, times( 1 ) ).getCatalogItem(); - verify( restClient, times( 1 ) ).getCatalogItemsForProject( anyString() ); - verify( restClient, times( 1 ) ).getProjectId(); - verify( restClient, never() ).getContentSource( anyString() ); - verify( restClient, never() ).getCustomFormByTypeAndSource( anyString(), anyString() ); - } - - @Test - void testExportContentWithAllCatalogItemsWhenItemsArePresentFromOneSource() { - // GIVEN - ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); - String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); - - VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); - List mockedCatalogItems = new ArrayList<>(); - CatalogItemMockBuilder builderOne = new CatalogItemMockBuilder( "catalogItemOne", "contentSourceNameOne" ); - CatalogItemMockBuilder builderTwo = new CatalogItemMockBuilder( "catalogItemTwo", "contentSourceNameOne" ); - - VraNgCatalogItem catalogItemOne = builderOne.build(); - VraNgCatalogItem catalogItemTwo = builderTwo.build(); - - mockedCatalogItems.add( catalogItemOne ); - mockedCatalogItems.add( catalogItemTwo ); - - when( vraNgPackageDescriptor.getCatalogItem() ).thenReturn( null ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - when( restClient.getContentSource( CONTENT_SOURCE_ID ) ).thenReturn( contentSource ); - when( contentSource.getType() ).thenReturn( VraNgContentSourceType.VRO_WORKFLOW ); - when( restClient.getCustomFormByTypeAndSource( contentSourceType, CATALOG_ITEM_ID ) ).thenReturn( null ); - - // START TEST - store.exportContent(); - - // VERIFY - verify( vraNgPackageDescriptor, times( 1 ) ).getCatalogItem(); - verify( restClient, times( 1 ) ).getCatalogItemsForProject( anyString() ); - verify( restClient, times( 1 ) ).getProjectId(); - verify( restClient, times( 2 ) ).getContentSource( anyString() ); - verify( restClient, times( 2 ) ).getCustomFormByTypeAndSource( anyString(), anyString() ); - assertEquals( 1, tempFolder.getRoot().listFiles().length ); - assertEquals( 2, fsMocks.getTempFolderProjectPath().listFiles().length ); - - String[] expectedFiles = { "contentSourceNameOne__catalogItemOne.json", "contentSourceNameOne__catalogItemTwo.json" }; - - AssertionsHelper.assertFolderContainsFiles( fsMocks.getTempFolderProjectPath(), expectedFiles ); - } - - @Test - void testExportContentWithAllCatalogItemsWhenItemsArePresentButFilteringIsEmpty() { - // GIVEN - List mockedCatalogItems = new ArrayList<>(); - CatalogItemMockBuilder builderOne = new CatalogItemMockBuilder( "catalogItemOne", "contentSourceNameOne" ); - CatalogItemMockBuilder builderTwo = new CatalogItemMockBuilder( "catalogItemTwo", "contentSourceNameOne" ); - VraNgCatalogItem catalogItemOne = builderOne.build(); - VraNgCatalogItem catalogItemTwo = builderTwo.build(); - - mockedCatalogItems.add( catalogItemOne ); - mockedCatalogItems.add( catalogItemTwo ); - - when( vraNgPackageDescriptor.getCatalogItem() ).thenReturn( new ArrayList<>() ); - - // START TEST - store.exportContent(); - - // VERIFY - verify( vraNgPackageDescriptor, times( 1 ) ).getCatalogItem(); - verify( restClient, never() ).getCatalogItemsForProject( anyString() ); - verify( restClient, never() ).getProjectId(); - verify( restClient, never() ).getContentSource( anyString() ); - verify( restClient, never() ).getCustomFormByTypeAndSource( anyString(), anyString() ); - assertEquals( 0, tempFolder.getRoot().listFiles().length ); - } - - @Test - void testExportContentWithSomeCatalogItemsWhenItemsArePresentFromOneSource() { - // GIVEN - ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); - String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); - VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); - List mockCatalogItemNames = new ArrayList<>(); - mockCatalogItemNames.add( "contentSourceNameOne__catalogItemOne" ); - - List mockedCatalogItems = new ArrayList<>(); - CatalogItemMockBuilder builderOne = new CatalogItemMockBuilder( "catalogItemOne", "contentSourceNameOne" ); - CatalogItemMockBuilder builderTwo = new CatalogItemMockBuilder( "catalogItemTwo", "contentSourceNameOne" ); - VraNgCatalogItem catalogItemOne = builderOne.build(); - VraNgCatalogItem catalogItemTwo = builderTwo.build(); - - mockedCatalogItems.add( catalogItemOne ); - mockedCatalogItems.add( catalogItemTwo ); - - when( vraNgPackageDescriptor.getCatalogItem() ).thenReturn( mockCatalogItemNames ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - when( restClient.getContentSource( CONTENT_SOURCE_ID ) ).thenReturn( contentSource ); - when( contentSource.getType() ).thenReturn( VraNgContentSourceType.VRO_WORKFLOW ); - when( restClient.getCustomFormByTypeAndSource( contentSourceType, CATALOG_ITEM_ID ) ).thenReturn( null ); - - // START TEST - store.exportContent(); - - // VERIFY - verify( vraNgPackageDescriptor, times( 1 ) ).getCatalogItem(); - verify( restClient, times( 1 ) ).getCatalogItemsForProject( anyString() ); - verify( restClient, times( 1 ) ).getProjectId(); - verify( restClient, times( 1 ) ).getContentSource( anyString() ); - verify( restClient, times( 1 ) ).getCustomFormByTypeAndSource( anyString(), anyString() ); - assertEquals( 1, tempFolder.getRoot().listFiles().length ); - assertEquals( fsMocks.getTempFolderProjectPath().listFiles().length, 1 ); - - String[] expectedFiles = { "contentSourceNameOne__catalogItemOne.json" }; - - assertArrayEquals( fsMocks.getTempFolderProjectPath().list(), expectedFiles ); - } - - @Test - void testExportContentWithSomeCatalogItemsWhenItemNameHasIncorrectFormat() { - // GIVEN - ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); - String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); - - VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); - List mockCatalogItemNames = new ArrayList<>(); - mockCatalogItemNames.add( "wrongFormat" ); - - List mockedCatalogItems = new ArrayList<>(); - CatalogItemMockBuilder builderOne = new CatalogItemMockBuilder( "catalogItemOne", "contentSourceNameOne" ); - CatalogItemMockBuilder builderTwo = new CatalogItemMockBuilder( "catalogItemTwo", "contentSourceNameOne" ); - VraNgCatalogItem catalogItemOne = builderOne.build(); - VraNgCatalogItem catalogItemTwo = builderTwo.build(); - - mockedCatalogItems.add( catalogItemOne ); - mockedCatalogItems.add( catalogItemTwo ); - - when( vraNgPackageDescriptor.getCatalogItem() ).thenReturn( mockCatalogItemNames ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - when( restClient.getContentSource( CONTENT_SOURCE_ID ) ).thenReturn( contentSource ); - when( contentSource.getType() ).thenReturn( VraNgContentSourceType.VRO_WORKFLOW ); - when( restClient.getCustomFormByTypeAndSource( contentSourceType, CATALOG_ITEM_ID ) ).thenReturn( null ); - - - // START TEST - assertThrows( RuntimeException.class, () -> { store.exportContent(); } ); - - // VERIFY - verify( vraNgPackageDescriptor, times( 1 ) ).getCatalogItem(); - verify( restClient, times( 1 ) ).getCatalogItemsForProject( anyString() ); - verify( restClient, times( 1 ) ).getProjectId(); - verify( restClient, never() ).getContentSource( anyString() ); - verify( restClient, never() ).getCustomFormByTypeAndSource( anyString(), anyString() ); - } - - @Test - void testExportContentWithSomeCatalogItemsWhenContentSourceDoesNotExist() { - // GIVEN - ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); - String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); - VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); - List mockCatalogItemNames = new ArrayList<>(); - mockCatalogItemNames.add( "contentSourceNameOne__catalogItemOne" ); - - List mockedCatalogItems = new ArrayList<>(); - CatalogItemMockBuilder builderOne = new CatalogItemMockBuilder( "catalogItemOne", "contentSourceNameOne" ); - CatalogItemMockBuilder builderTwo = new CatalogItemMockBuilder( "catalogItemTwo", "contentSourceNameOne" ); - VraNgCatalogItem catalogItemOne = builderOne.build(); - VraNgCatalogItem catalogItemTwo = builderTwo.build(); - - mockedCatalogItems.add( catalogItemOne ); - mockedCatalogItems.add( catalogItemTwo ); - - when( vraNgPackageDescriptor.getCatalogItem() ).thenReturn( mockCatalogItemNames ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - when( restClient.getContentSource( CONTENT_SOURCE_ID ) ).thenReturn( null ); - when( contentSource.getType() ).thenReturn( VraNgContentSourceType.VRO_WORKFLOW ); - when( restClient.getCustomFormByTypeAndSource( contentSourceType, CATALOG_ITEM_ID ) ).thenReturn( null ); - - - // START TEST - assertThrows( RuntimeException.class, () -> { store.exportContent(); } ); - - // VERIFY - verify( vraNgPackageDescriptor, times( 1 ) ).getCatalogItem(); - verify( restClient, times( 1 ) ).getCatalogItemsForProject( anyString() ); - verify( restClient, times( 1 ) ).getProjectId(); - verify( restClient, times( 1 ) ).getContentSource( anyString() ); - verify( restClient, never() ).getCustomFormByTypeAndSource( anyString(), anyString() ); - } - @Test - void testExportContentWithNoNExistingCatalogItems() { - // GIVEN - ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); - String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); - VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); - List mockCatalogItemNames = new ArrayList<>(); - mockCatalogItemNames.add( "contentSourceNameOne__nonExisting" ); - - List mockedCatalogItems = new ArrayList<>(); - CatalogItemMockBuilder builderOne = new CatalogItemMockBuilder( "catalogItemOne", "contentSourceNameOne" ); - CatalogItemMockBuilder builderTwo = new CatalogItemMockBuilder( "catalogItemTwo", "contentSourceNameOne" ); - VraNgCatalogItem catalogItemOne = builderOne.build(); - VraNgCatalogItem catalogItemTwo = builderTwo.build(); - - mockedCatalogItems.add( catalogItemOne ); - mockedCatalogItems.add( catalogItemTwo ); - - when( vraNgPackageDescriptor.getCatalogItem() ).thenReturn( mockCatalogItemNames ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - when( restClient.getContentSource( CONTENT_SOURCE_ID ) ).thenReturn( null ); - when( contentSource.getType() ).thenReturn( VraNgContentSourceType.VRO_WORKFLOW ); - when( restClient.getCustomFormByTypeAndSource( contentSourceType, CATALOG_ITEM_ID ) ).thenReturn( null ); - - // START TEST - assertThrows( IllegalStateException.class, () -> { store.exportContent(); } ); - } - - @Test - void testExportContentWithAllCatalogItemsWhenItemsArePresentFromOneSourceWithForm() { - // GIVEN - ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); - - String formIdOne = "formIdCatalogItemOne"; - String formIdTwo = "formIdCatalogItemTwo"; - CustomFormMockBuilder builderOne = new CustomFormMockBuilder("nameOne"); - CustomFormMockBuilder builderTwo = new CustomFormMockBuilder("nameTwo"); - VraNgCustomForm mockedFormOne = builderOne.setId(formIdOne).build(); - VraNgCustomForm mockedFormTwo = builderTwo.setId(formIdTwo).build(); - String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); - VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); - List mockedCatalogItems = new ArrayList<>(); - - CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder( "catalogItemOne", "contentSourceNameOne" ); - VraNgCatalogItem catalogItemOne = catalogBuilderOne.setCustomFormId( formIdOne ).build(); - - CatalogItemMockBuilder catalogBuilderTwo = new CatalogItemMockBuilder("catalogItemTwo", "contentSourceNameOne"); - VraNgCatalogItem catalogItemTwo = catalogBuilderTwo.setCustomFormId( formIdTwo ).build(); - - mockedCatalogItems.add( catalogItemOne ); - mockedCatalogItems.add( catalogItemTwo ); - - when( vraNgPackageDescriptor.getCatalogItem() ).thenReturn( null ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - when( restClient.getContentSource( CONTENT_SOURCE_ID ) ).thenReturn( contentSource ); - when( contentSource.getType() ).thenReturn( VraNgContentSourceType.VRO_WORKFLOW ); - when( - restClient.getCustomFormByTypeAndSource( contentSourceType, CATALOG_ITEM_ID ) - ).thenReturn( mockedFormOne, mockedFormTwo ); - - // START TEST - store.exportContent(); - - // VERIFY - verify( vraNgPackageDescriptor, times( 1 ) ).getCatalogItem(); - verify( restClient, times( 1 ) ).getCatalogItemsForProject( anyString() ); - verify( restClient, times( 1 ) ).getProjectId(); - verify( restClient, times( 2 ) ).getContentSource( anyString() ); - verify( restClient, times( 2 ) ).getCustomFormByTypeAndSource( anyString(), anyString() ); - assertEquals( 1, tempFolder.getRoot().listFiles().length ); - - String[] expectedFilesAndFolders = { - "contentSourceNameOne__catalogItemOne.json", - "forms", - "contentSourceNameOne__catalogItemTwo.json" - }; - - String[] expectedFormNames = { - "contentSourceNameOne__catalogItemOne.json", - "contentSourceNameOne__catalogItemOne__FormData.json", - "contentSourceNameOne__catalogItemTwo.json", - "contentSourceNameOne__catalogItemTwo__FormData.json" - }; - - AssertionsHelper.assertFolderContainsFiles( fsMocks.getTempFolderProjectPath(), expectedFilesAndFolders ); - - for ( File file: fsMocks.getTempFolderProjectPath().listFiles() ) { - if ( file.getName().equalsIgnoreCase( "forms" ) ){ - AssertionsHelper.assertFolderContainsFiles( file, expectedFormNames ); - } - } - } - - @SuppressWarnings("unchecked") - @Test - void testExportContentWithAllCatalogItemsWhenItemsArePresentFromOneSourceWithFormAndIcon() { - // GIVEN - ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); - - String iconIdOne = "iconIdCatalogItemOne"; - String formIdOne = "formIdCatalogItemOne"; - String formIdTwo = "formIdCatalogItemTwo"; - String iconIdTwo = "iconIdCatalogItemTwo"; - Map headers = new HashMap<>(); - headers.put( "Content-Type", "image/png" ); - - ResponseEntity iconOneResponse = GeneralMocks.mockResponseEntity( - "iconBodyOne".getBytes(), - 200, - headers - ); - ResponseEntity iconTwoResponse = GeneralMocks.mockResponseEntity( - "iconBodyTwo".getBytes(), - 200, - headers - ); - - CustomFormMockBuilder builderOne = new CustomFormMockBuilder("nameOne"); - CustomFormMockBuilder builderTwo = new CustomFormMockBuilder("nameTwo"); - VraNgCustomForm mockedFormOne = builderOne.setId(formIdOne).build(); - VraNgCustomForm mockedFormTwo = builderTwo.setId(formIdTwo).build(); - String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); - VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); - List mockedCatalogItems = new ArrayList<>(); - - CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); - VraNgCatalogItem catalogItemOne = catalogBuilderOne.setIconId(iconIdOne).setIconExt("png").setCustomFormId(formIdOne).build(); - - CatalogItemMockBuilder catalogBuilderTwo = new CatalogItemMockBuilder("catalogItemTwo", "contentSourceNameOne"); - VraNgCatalogItem catalogItemTwo = catalogBuilderTwo.setIconId(iconIdTwo).setIconExt("png").setCustomFormId(formIdTwo).build(); - - mockedCatalogItems.add( catalogItemOne ); - mockedCatalogItems.add( catalogItemTwo ); - - when( vraNgPackageDescriptor.getCatalogItem() ).thenReturn( null ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - when( restClient.getContentSource( CONTENT_SOURCE_ID ) ).thenReturn( contentSource ); - when( restClient.downloadIcon( anyString() ) ).thenReturn( iconOneResponse, iconTwoResponse ); - when( contentSource.getType() ).thenReturn( VraNgContentSourceType.VRO_WORKFLOW ); - when( - restClient.getCustomFormByTypeAndSource( contentSourceType, CATALOG_ITEM_ID ) - ).thenReturn( mockedFormOne, mockedFormTwo ); - - // START TEST - store.exportContent(); - - // VERIFY - verify( vraNgPackageDescriptor, times( 1 ) ).getCatalogItem(); - verify( restClient, times( 1 ) ).getCatalogItemsForProject( anyString() ); - verify( restClient, times( 1 ) ).getProjectId(); - verify( restClient, times( 2 ) ).getContentSource( anyString() ); - verify( restClient, times( 2 ) ).getCustomFormByTypeAndSource( anyString(), anyString() ); - assertEquals( 1, tempFolder.getRoot().listFiles().length ); - - String[] expectedFilesAndFolders = { - "contentSourceNameOne__catalogItemOne.json", - "forms", - "icons", - "contentSourceNameOne__catalogItemTwo.json" - }; - - String[] expectedFormNames = { - "contentSourceNameOne__catalogItemOne.json", - "contentSourceNameOne__catalogItemOne__FormData.json", - "contentSourceNameOne__catalogItemTwo.json", - "contentSourceNameOne__catalogItemTwo__FormData.json", - }; - - String[] expectedIconNames = { - "contentSourceNameOne__catalogItemOne.png", - "contentSourceNameOne__catalogItemTwo.png" - }; - - AssertionsHelper.assertFolderContainsFiles( fsMocks.getTempFolderProjectPath(), expectedFilesAndFolders ); - - AssertionsHelper.assertFolderContainsFiles( - fsMocks.findItemByNameInFolder( fsMocks.getTempFolderProjectPath(), "forms" ), - expectedFormNames - ); - - AssertionsHelper.assertFolderContainsFiles( - fsMocks.findItemByNameInFolder( fsMocks.getTempFolderProjectPath(), "icons" ), - expectedIconNames - ); - } - - @Test - void testExportContentWithAllCatalogItemsWhenItemsArePresentFromOneSourceButIconDoesNotExist() { - // GIVEN - ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); - - String iconIdOne = "iconIdCatalogItemOne"; - String formIdOne = "formIdCatalogItemOne"; - String formIdTwo = "formIdCatalogItemTwo"; - String iconIdTwo = "iconIdCatalogItemTwo"; - - ResponseEntity iconOneResponse = GeneralMocks.mockResponseEntity( - "iconBodyOne".getBytes(), - 500 - ); - CustomFormMockBuilder builderOne = new CustomFormMockBuilder("nameOne"); - CustomFormMockBuilder builderTwo = new CustomFormMockBuilder("nameTwo"); - VraNgCustomForm mockedFormOne = builderOne.setId(formIdOne).build(); - VraNgCustomForm mockedFormTwo = builderTwo.setId(formIdTwo).build(); - String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); - VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); - List mockedCatalogItems = new ArrayList<>(); - - CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); - VraNgCatalogItem catalogItemOne = catalogBuilderOne.setIconId(iconIdOne).setIconExt("png").setCustomFormId(formIdOne).build(); - - CatalogItemMockBuilder catalogBuilderTwo = new CatalogItemMockBuilder("catalogItemTwo", "contentSourceNameOne"); - VraNgCatalogItem catalogItemTwo = catalogBuilderTwo.setIconId(iconIdTwo).setIconExt("png").setCustomFormId(formIdTwo).build(); - - mockedCatalogItems.add( catalogItemOne ); - mockedCatalogItems.add( catalogItemTwo ); - - when( vraNgPackageDescriptor.getCatalogItem() ).thenReturn( null ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - when( restClient.getContentSource( CONTENT_SOURCE_ID ) ).thenReturn( contentSource ); - when( restClient.downloadIcon( anyString() ) ).thenReturn( iconOneResponse ); - when( contentSource.getType() ).thenReturn( VraNgContentSourceType.VRO_WORKFLOW ); - when( - restClient.getCustomFormByTypeAndSource( contentSourceType, CATALOG_ITEM_ID ) - ).thenReturn( mockedFormOne, mockedFormTwo ); - - // START TEST - assertThrows( RuntimeException.class, () -> store.exportContent() ); - - // VERIFY - verify( vraNgPackageDescriptor, times( 1 ) ).getCatalogItem(); - verify( restClient, times( 1 ) ).getCatalogItemsForProject( anyString() ); - verify( restClient, times( 1 ) ).getProjectId(); - verify( restClient, times( 1 ) ).getContentSource( anyString() ); - verify( restClient, times( 1 ) ).getCustomFormByTypeAndSource( anyString(), anyString() ); - } - - @Test - void testExportContentWithAllCatalogItemsWhenItemsArePresentFromOneSourceWithFormAndSameIcon() { - // GIVEN - ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); - - String iconId = "iconId"; - String formIdOne = "formIdCatalogItemOne"; - String formIdTwo = "formIdCatalogItemTwo"; - Map headers = new HashMap<>(); - headers.put( "Content-Type", "image/png" ); - - ResponseEntity iconOneResponse = GeneralMocks.mockResponseEntity( - "iconBody".getBytes(), - 200, - headers - ); - CustomFormMockBuilder builderOne = new CustomFormMockBuilder("nameOne"); - CustomFormMockBuilder builderTwo = new CustomFormMockBuilder("nameTwo"); - VraNgCustomForm mockedFormOne = builderOne.setId(formIdOne).build(); - VraNgCustomForm mockedFormTwo = builderTwo.setId(formIdTwo).build(); - String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); - VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); - List mockedCatalogItems = new ArrayList<>(); - CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); - VraNgCatalogItem catalogItemOne = catalogBuilderOne.setIconId(iconId).setIconExt("png").setCustomFormId(formIdOne).build(); - - CatalogItemMockBuilder catalogBuilderTwo = new CatalogItemMockBuilder("catalogItemTwo", "contentSourceNameOne"); - VraNgCatalogItem catalogItemTwo = catalogBuilderTwo.setIconId(iconId).setIconExt("png").setCustomFormId(formIdTwo).build(); - - - mockedCatalogItems.add( catalogItemOne ); - mockedCatalogItems.add( catalogItemTwo ); - - when( vraNgPackageDescriptor.getCatalogItem() ).thenReturn( null ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - when( restClient.getContentSource( CONTENT_SOURCE_ID ) ).thenReturn( contentSource ); - when( restClient.downloadIcon( anyString() ) ).thenReturn( iconOneResponse ); - when( contentSource.getType() ).thenReturn( VraNgContentSourceType.VRO_WORKFLOW ); - when( - restClient.getCustomFormByTypeAndSource( contentSourceType, CATALOG_ITEM_ID ) - ).thenReturn( mockedFormOne, mockedFormTwo ); - - // START TEST - store.exportContent(); - - // VERIFY - verify( vraNgPackageDescriptor, times( 1 ) ).getCatalogItem(); - verify( restClient, times( 1 ) ).getCatalogItemsForProject( anyString() ); - verify( restClient, times( 1 ) ).getProjectId(); - verify( restClient, times( 2 ) ).getContentSource( anyString() ); - verify( restClient, times( 2 ) ).getCustomFormByTypeAndSource( anyString(), anyString() ); - assertEquals( 1, tempFolder.getRoot().listFiles().length ); - - String[] expectedFilesAndFolders = { - "contentSourceNameOne__catalogItemOne.json", - "forms", - "icons", - "contentSourceNameOne__catalogItemTwo.json" - }; - - String[] expectedFormNames = { - "contentSourceNameOne__catalogItemOne.json", - "contentSourceNameOne__catalogItemOne__FormData.json", - "contentSourceNameOne__catalogItemTwo.json", - "contentSourceNameOne__catalogItemTwo__FormData.json" - }; - - String[] expectedIconNames = { - "contentSourceNameOne__catalogItemOne.png", - "contentSourceNameOne__catalogItemTwo.png", - }; - - AssertionsHelper.assertFolderContainsFiles( fsMocks.getTempFolderProjectPath(), expectedFilesAndFolders ); - - AssertionsHelper.assertFolderContainsFiles( - fsMocks.findItemByNameInFolder( fsMocks.getTempFolderProjectPath(), "forms" ), - expectedFormNames - ); - - AssertionsHelper.assertFolderContainsFiles( - fsMocks.findItemByNameInFolder( fsMocks.getTempFolderProjectPath(), "icons" ), - expectedIconNames - ); - } - - @Test - void testExportContentWithAllCatalogItemsWhenItemsArePresentFromTwoSources() { - // GIVEN - ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); - String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); - VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); - List mockedCatalogItems = new ArrayList<>(); - - CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder( "catalogItemOne", "contentSourceNameOne" ); - VraNgCatalogItem catalogItemOne = catalogBuilderOne.build(); - - CatalogItemMockBuilder catalogBuilderTwo = new CatalogItemMockBuilder("catalogItemTwo", "contentSourceNameTwo"); - VraNgCatalogItem catalogItemTwo = catalogBuilderTwo.build(); - - mockedCatalogItems.add( catalogItemOne ); - mockedCatalogItems.add( catalogItemTwo ); - - when( vraNgPackageDescriptor.getCatalogItem() ).thenReturn( null ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - when( restClient.getContentSource( CONTENT_SOURCE_ID ) ).thenReturn( contentSource ); - when( contentSource.getType() ).thenReturn( VraNgContentSourceType.VRO_WORKFLOW ); - when( restClient.getCustomFormByTypeAndSource( contentSourceType, CATALOG_ITEM_ID ) ).thenReturn( null ); - - // START TEST - store.exportContent(); - - // VERIFY - verify( vraNgPackageDescriptor, times( 1 ) ).getCatalogItem(); - verify( restClient, times( 1 ) ).getCatalogItemsForProject( anyString() ); - verify( restClient, times( 1 ) ).getProjectId(); - verify( restClient, times( 2 ) ).getContentSource( anyString() ); - verify( restClient, times( 2 ) ).getCustomFormByTypeAndSource( anyString(), anyString() ); - assertEquals( 1, tempFolder.getRoot().listFiles().length ); - assertEquals( 2, fsMocks.getTempFolderProjectPath().listFiles().length ); - - String[] expectedFiles = { "contentSourceNameOne__catalogItemOne.json", "contentSourceNameTwo__catalogItemTwo.json" }; - - AssertionsHelper.assertFolderContainsFiles( fsMocks.getTempFolderProjectPath(), expectedFiles ); - } - - @Test - void testExportContentWithAllCatalogItemsWhenItemsArePresentFromTwoSourcesWithSameName() { - // GIVEN - ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); - String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); - - VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); - List mockedCatalogItems = new ArrayList<>(); - CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder( "catalogItemOne", "contentSourceNameOne" ); - VraNgCatalogItem catalogItemOne = catalogBuilderOne.build(); - - CatalogItemMockBuilder catalogBuilderTwo = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameTwo"); - VraNgCatalogItem catalogItemTwo = catalogBuilderTwo.build(); - - mockedCatalogItems.add( catalogItemOne ); - mockedCatalogItems.add( catalogItemTwo ); - - when( vraNgPackageDescriptor.getCatalogItem() ).thenReturn( null ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - when( restClient.getContentSource( CONTENT_SOURCE_ID ) ).thenReturn( contentSource ); - when( contentSource.getType() ).thenReturn( VraNgContentSourceType.VRO_WORKFLOW ); - when( restClient.getCustomFormByTypeAndSource( contentSourceType, CATALOG_ITEM_ID ) ).thenReturn( null ); - - // START TEST - store.exportContent(); - - // VERIFY - verify( vraNgPackageDescriptor, times( 1 ) ).getCatalogItem(); - verify( restClient, times( 1 ) ).getCatalogItemsForProject( anyString() ); - verify( restClient, times( 1 ) ).getProjectId(); - verify( restClient, times( 2 ) ).getContentSource( anyString() ); - verify( restClient, times( 2 ) ).getCustomFormByTypeAndSource( anyString(), anyString() ); - assertEquals( 1, tempFolder.getRoot().listFiles().length ); - assertEquals( 2, fsMocks.getTempFolderProjectPath().listFiles().length ); - - String[] expectedFiles = { "contentSourceNameOne__catalogItemOne.json", "contentSourceNameTwo__catalogItemOne.json" }; - - AssertionsHelper.assertFolderContainsFiles( fsMocks.getTempFolderProjectPath(), expectedFiles ); - } - - @Test - void testExportContentWithAllCatalogItemsWhenItemsArePresentFromSameSourceWithSameNames() { - // GIVEN - ContentSourceBaseMockBuilder contentSourceBuilder = new ContentSourceBaseMockBuilder(); - - String contentSourceType = VraNgContentSourceType.VRO_WORKFLOW.toString(); - VraNgContentSourceBase contentSource = spy(contentSourceBuilder.setTypeId(contentSourceType).build()); - List mockedCatalogItems = new ArrayList<>(); - CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder( "catalogItemOne", "contentSourceNameOne" ); - VraNgCatalogItem catalogItemOne = catalogBuilderOne.build(); - - CatalogItemMockBuilder catalogBuilderTwo = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); - VraNgCatalogItem catalogItemTwo = catalogBuilderTwo.build(); - - mockedCatalogItems.add( catalogItemOne ); - mockedCatalogItems.add( catalogItemTwo ); - - when( vraNgPackageDescriptor.getCatalogItem() ).thenReturn( null ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - when( restClient.getContentSource( CONTENT_SOURCE_ID ) ).thenReturn( contentSource ); - when( contentSource.getType() ).thenReturn( VraNgContentSourceType.VRO_WORKFLOW ); - when( restClient.getCustomFormByTypeAndSource( contentSourceType, CATALOG_ITEM_ID ) ).thenReturn( null ); - - // START TEST - store.exportContent(); - - // VERIFY - verify( vraNgPackageDescriptor, times( 1 ) ).getCatalogItem(); - verify( restClient, times( 1 ) ).getCatalogItemsForProject( anyString() ); - verify( restClient, times( 1 ) ).getProjectId(); - verify( restClient, times( 2 ) ).getContentSource( anyString() ); - verify( restClient, times( 2 ) ).getCustomFormByTypeAndSource( anyString(), anyString() ); - assertEquals( 1, tempFolder.getRoot().listFiles().length ); - assertEquals( fsMocks.getTempFolderProjectPath().listFiles().length, 1 ); - - // Gets overwritten by the last one - String[] expectedFiles = { "contentSourceNameOne__catalogItemOne.json" }; - - AssertionsHelper.assertFolderContainsFiles( fsMocks.getTempFolderProjectPath(), expectedFiles ); - } - - @Test - void testImportContentWithNoIconsOrForms() { - // GIVEN - CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder( "catalogItemOne", "contentSourceNameOne" ); - VraNgCatalogItem catalogItem = catalogBuilderOne.build(); - fsMocks.catalogItemFsMocks().addCatalogItem( catalogItem ); - - List mockedCatalogItems = new ArrayList<>(); - mockedCatalogItems.add( catalogItem ); - - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - - // START TEST - store.importContent( tempFolder.getRoot() ); - - // VERIFY - verify( restClient, never() ).importCustomForm( any(), anyString() ); - verify( restClient, never() ).uploadIcon( any() ); - } - - - @Test - void testImportContentWithAnIconAndNoForms() { - // GIVEN - List mockCatalogItemNames = new ArrayList<>(); - mockCatalogItemNames.add("contentSourceNameOne__catalogItemOne"); - when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(mockCatalogItemNames); - - String iconId = "iconId"; - CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder( "catalogItemOne", "contentSourceNameOne" ); - VraNgCatalogItem catalogItem = catalogBuilderOne.setIconId(iconId).setIconExt("png").build(); - - Map headers = new HashMap<>(); - headers.put( "Location", "/some/path/iconId" ); - ResponseEntity response = GeneralMocks.mockResponseEntity( "", 201, headers ); - - List mockedCatalogItems = new ArrayList<>(); - mockedCatalogItems.add( catalogItem ); - - fsMocks.catalogItemFsMocks().addCatalogItem( catalogItem ); - fsMocks.catalogItemFsMocks().addCatalogItemIcon( catalogItem ); - when( restClient.getCatalogItemByBlueprintName( anyString() ) ).thenReturn( catalogItem ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.uploadIcon( any() ) ).thenReturn( response ); - - // START TEST - store.importContent( tempFolder.getRoot() ); - - // VERIFY - verify( restClient, never() ).importCustomForm( any(), anyString() ); - verify( restClient, times( 1 ) ).uploadIcon( any() ); - } - - @Test - void testImportContentWithAnIconAndForms() { - // GIVEN - List mockCatalogItemNames = new ArrayList<>(); - mockCatalogItemNames.add("contentSourceNameOne__catalogItemOne"); - when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(mockCatalogItemNames); - - String iconId = "iconId"; - CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder( "catalogItemOne", "contentSourceNameOne" ); - VraNgCatalogItem catalogItem = catalogBuilderOne.setIconId(iconId).setIconExt("png").setCustomFormId("formId").build(); - - Map headers = new HashMap<>(); - headers.put( "Location", "/some/path/iconId" ); - ResponseEntity response = GeneralMocks.mockResponseEntity( "", 201, headers ); - - List mockedCatalogItems = new ArrayList<>(); - mockedCatalogItems.add( catalogItem ); - - fsMocks.catalogItemFsMocks().addCatalogItem( catalogItem ); - fsMocks.catalogItemFsMocks().addCatalogItemIcon( catalogItem ); - fsMocks.catalogItemFsMocks().addCatalogItemForm( catalogItem ); - when( restClient.getCatalogItemByBlueprintName( anyString() ) ).thenReturn( catalogItem ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - when( restClient.uploadIcon( any() ) ).thenReturn( response ); - doNothing().when( restClient ).importCustomForm( any(), anyString() ); - - // START TEST - store.importContent( tempFolder.getRoot() ); - - // VERIFY - verify( restClient, times( 1 ) ).importCustomForm( any(), anyString() ); - verify( restClient, times( 1 ) ).uploadIcon( any() ); - } - - @Test - void testImportContentWithAnIconAndFormsWithDotInName() { - // GIVEN - List mockCatalogItemNames = new ArrayList<>(); - mockCatalogItemNames.add("contentSource. NameOne__catalogItem One.x"); - when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(mockCatalogItemNames); - - String iconId = "iconId"; - CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder( "catalogItem One.x", "contentSource. NameOne" ); - VraNgCatalogItem catalogItem = catalogBuilderOne.setIconId(iconId).setIconExt("png").setCustomFormId("formId").build(); - - Map headers = new HashMap<>(); - headers.put( "Location", "/some/path/iconId" ); - ResponseEntity response = GeneralMocks.mockResponseEntity( "", 201, headers ); - - List mockedCatalogItems = new ArrayList<>(); - mockedCatalogItems.add( catalogItem ); - - fsMocks.catalogItemFsMocks().addCatalogItem( catalogItem ); - fsMocks.catalogItemFsMocks().addCatalogItemIcon( catalogItem ); - fsMocks.catalogItemFsMocks().addCatalogItemForm( catalogItem ); - when( restClient.getCatalogItemByBlueprintName( anyString() ) ).thenReturn( catalogItem ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - when( restClient.uploadIcon( any() ) ).thenReturn( response ); - doNothing().when( restClient ).importCustomForm( any(), anyString() ); - - // START TEST - store.importContent( tempFolder.getRoot() ); - - // VERIFY - verify( restClient, times( 1 ) ).importCustomForm( any(), anyString() ); - verify( restClient, times( 1 ) ).uploadIcon( any() ); - } - - @Test - void testImportContentWithoutAnIconAndWithForms() { - // GIVEN - List mockCatalogItemNames = new ArrayList<>(); - mockCatalogItemNames.add("contentSourceNameOne__catalogItemOne"); - when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(mockCatalogItemNames); - - CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder( "catalogItemOne", "contentSourceNameOne" ); - VraNgCatalogItem catalogItem = catalogBuilderOne.setCustomFormId("formId").build(); - - List mockedCatalogItems = new ArrayList<>(); - mockedCatalogItems.add( catalogItem ); - - fsMocks.catalogItemFsMocks().addCatalogItem( catalogItem ); - fsMocks.catalogItemFsMocks().addCatalogItemForm( catalogItem ); - when( restClient.getCatalogItemByBlueprintName( anyString() ) ).thenReturn( catalogItem ); - when( restClient.getProjectId() ).thenReturn( PROJECT_ID ); - when( restClient.getCatalogItemsForProject( PROJECT_ID ) ).thenReturn( mockedCatalogItems ); - doNothing().when( restClient ).importCustomForm( any(), anyString() ); - - // START TEST - store.importContent( tempFolder.getRoot() ); - - // VERIFY - verify( restClient, times( 1 ) ).importCustomForm( any(), anyString() ); - } - - @Test - void testImportContentWithAnIconAndFormsWithVraAbove812() { - // GIVEN - List mockCatalogItemNames = new ArrayList<>(); - mockCatalogItemNames.add("contentSourceNameOne__catalogItemOne"); - when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(mockCatalogItemNames); - - String iconId = "iconId"; - CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); - VraNgCatalogItemType bpCatalogItem = new VraNgCatalogItemType(VraNgContentSourceType.BLUEPRINT, null, null); - VraNgCatalogItem catalogItem = catalogBuilderOne.setIconId(iconId).setIconExt("png").setCustomFormId("formId").setType(bpCatalogItem).build(); - - Map headers = new HashMap<>(); - headers.put("Location", "/some/path/iconId"); - ResponseEntity response = GeneralMocks.mockResponseEntity("", 201, headers); - - List mockedCatalogItems = new ArrayList<>(); - mockedCatalogItems.add(catalogItem); - - fsMocks.catalogItemFsMocks().addCatalogItem(catalogItem); - fsMocks.catalogItemFsMocks().addCatalogItemIcon(catalogItem); - fsMocks.catalogItemFsMocks().addCatalogItemForm(catalogItem); - when(restClient.getCatalogItemByBlueprintName(anyString())).thenReturn(catalogItem); - when(restClient.getProjectId()).thenReturn(PROJECT_ID); - when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); - when(restClient.uploadIcon(any())).thenReturn(response); - when(restClient.getIsVraAbove812()).thenReturn(true); - when(restClient.getCatalogItemVersions(catalogItem.getId())).thenReturn(new JsonArray()); - - doNothing().when(restClient).importCustomForm(any(), anyString()); - VraNgCatalogItemStore vra812Store = (VraNgCatalogItemStore812) new VraNgTypeStoreFactory(restClient, pkg, config, vraNgPackageDescriptor) - .getStoreForType(VraNgPackageContent.ContentType.CATALOG_ITEM); - - // START TEST - vra812Store.importContent(tempFolder.getRoot()); - - // VERIFY - verify(restClient, times(1)).importCustomForm(any(), anyString()); - verify(restClient, times(1)).uploadIcon(any()); - } - - @Test - void testImportContentWithAnIconAndFormsWithVraBelow812() { - // GIVEN - List mockCatalogItemNames = new ArrayList<>(); - mockCatalogItemNames.add("contentSourceNameOne__catalogItemOne"); - when(vraNgPackageDescriptor.getCatalogItem()).thenReturn(mockCatalogItemNames); - - String iconId = "iconId"; - CatalogItemMockBuilder catalogBuilderOne = new CatalogItemMockBuilder("catalogItemOne", "contentSourceNameOne"); - VraNgCatalogItem catalogItem = catalogBuilderOne.setIconId(iconId).setIconExt("png").setCustomFormId("formId").build(); - - Map headers = new HashMap<>(); - headers.put("Location", "/some/path/iconId"); - ResponseEntity response = GeneralMocks.mockResponseEntity("", 201, headers); - - List mockedCatalogItems = new ArrayList<>(); - mockedCatalogItems.add(catalogItem); - - fsMocks.catalogItemFsMocks().addCatalogItem(catalogItem); - fsMocks.catalogItemFsMocks().addCatalogItemIcon(catalogItem); - fsMocks.catalogItemFsMocks().addCatalogItemForm(catalogItem); - when(restClient.getCatalogItemByBlueprintName(anyString())).thenReturn(catalogItem); - when(restClient.getProjectId()).thenReturn(PROJECT_ID); - when(restClient.getCatalogItemsForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); - when(restClient.uploadIcon(any())).thenReturn(response); - when(restClient.getIsVraAbove812()).thenReturn(false); - - doNothing().when(restClient).importCustomForm(any(), anyString()); - - // START TEST - store.importContent(tempFolder.getRoot()); - - // VERIFY - verify(restClient, times(1)).importCustomForm(any(), anyString()); - verify(restClient, times(1)).uploadIcon(any()); - } -} diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgContentSourceStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgContentSourceStoreTest.java deleted file mode 100644 index bbff3702d..000000000 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/store/VraNgContentSourceStoreTest.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * #%L - * artifact-manager - * %% - * Copyright (C) 2023 VMware - * %% - * Build Tools for VMware Aria - * Copyright 2023 VMware, Inc. - * - * This product is licensed to you under the BSD-2 license (the "License"). You may not use this product except in compliance with the BSD-2 License. - * - * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. - * #L% - */ -package com.vmware.pscoe.iac.artifact.aria.automation.store; - -import com.vmware.pscoe.iac.artifact.aria.automation.configuration.ConfigurationVraNg; -import com.vmware.pscoe.iac.artifact.helpers.AssertionsHelper; -import com.vmware.pscoe.iac.artifact.helpers.FsMocks; -import com.vmware.pscoe.iac.artifact.helpers.stubs.ContentSourceBaseMockBuilder; -import com.vmware.pscoe.iac.artifact.model.Package; -import com.vmware.pscoe.iac.artifact.model.PackageFactory; -import com.vmware.pscoe.iac.artifact.model.PackageType; -import com.vmware.pscoe.iac.artifact.aria.automation.models.*; -import com.vmware.pscoe.iac.artifact.rest.RestClient; -import com.vmware.pscoe.iac.artifact.aria.automation.rest.RestClientVraNg; - -import org.junit.Rule; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.rules.TemporaryFolder; -import org.mockito.Mockito; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.*; - -public class VraNgContentSourceStoreTest{ - - @Rule - public TemporaryFolder tempFolder = new TemporaryFolder(); - protected static String PROJECT_ID = "projectId"; - protected VraNgContentSourceStore store; - protected RestClientVraNg restClient; - protected Package pkg; - protected ConfigurationVraNg config; - protected VraNgPackageDescriptor vraNgPackageDescriptor; - protected FsMocks fsMocks; - - @BeforeEach - void init() { - try { - tempFolder.create(); - } - catch ( IOException e ) { - throw new RuntimeException( "Could not create a temp folder" ); - } - - fsMocks = new FsMocks( tempFolder.getRoot() ); - store = new VraNgContentSourceStore(); - restClient = Mockito.mock( RestClientVraNg.class ); - pkg = PackageFactory.getInstance( PackageType.VRANG, tempFolder.getRoot() ); - config = Mockito.mock( ConfigurationVraNg.class ); - vraNgPackageDescriptor = Mockito.mock( VraNgPackageDescriptor.class ); - - store.init( restClient, pkg, config, vraNgPackageDescriptor ); - System.out.println( "==========================================================" ); - System.out.println( "START" ); - System.out.println( "==========================================================" ); - } - - @AfterEach - void tearDown() { - tempFolder.delete(); - - System.out.println( "==========================================================" ); - System.out.println( "END" ); - System.out.println( "==========================================================" ); - } - - - @Test - void testExportContentWithNoContentSource() { - //GIVEN - ArrayList data = new ArrayList<>(); - data.add("nothing"); - - List mockedCatalogItems = new ArrayList<>(); - ContentSourceBaseMockBuilder builderOne = new ContentSourceBaseMockBuilder(); - VraNgContentSourceBase contentSourceOne = builderOne.setName("thing1").build(); - ContentSourceBaseMockBuilder builderTwo = new ContentSourceBaseMockBuilder(); - VraNgContentSourceBase contentSourceTwo = builderOne.setName("thing2").build(); - mockedCatalogItems.add( contentSourceOne ); - mockedCatalogItems.add( contentSourceTwo ); - - when( vraNgPackageDescriptor.getContentSource()).thenReturn(data); - when(restClient.getContentSourcesForProject(PROJECT_ID)).thenReturn(mockedCatalogItems); - //TEST - assertThrows(IllegalStateException.class, () -> store.exportContent()); - - //VERIFY - verify( restClient, never() ).getContentSourcesForProject(anyString()); - - assertEquals( 0, tempFolder.getRoot().listFiles().length ); - } - - @Test - void testExportContentThatDoesNotExistOnTheServer() { - //GIVEN - when( vraNgPackageDescriptor.getContentSource()).thenReturn(new ArrayList()); - - //TEST - store.exportContent(); - - //VERIFY - verify( restClient, never() ).getContentSourcesForProject(anyString()); - - assertEquals( 0, tempFolder.getRoot().listFiles().length ); - } - - @Test - void testExportContentWithNullValue() { - - when( vraNgPackageDescriptor.getContentSource()).thenReturn(null); - //TEST - assertDoesNotThrow(() -> store.exportContent()); - - } - - //TODO not easy to implement the test because the VraNgContentSourceBase is too complext to be mocked. VraNgContentSourceBase is casted dynamically to other classes - // @Test - // void testExportContentWithAllContentSources() { - // //GIVEN - // when( restClient.getProjectId()).thenReturn("mockedProjectId"); - // VraNgContentSourceStore store1 = new VraNgContentSourceStore(); - // store1.init( restClient, pkg, config, vraNgPackageDescriptor ); - - // List contentSources = new ArrayList<>(); - // ContentSourceBaseMockBuilder builder = new ContentSourceBaseMockBuilder(); - - // contentSources.add( builder.setName("mockContentSource1").build()); - - // when( vraNgPackageDescriptor.getContentSource()).thenReturn(null); - // when( restClient.getContentSourcesForProject("mockedProjectId")).thenReturn( contentSources ); - - // //TEST - // store1.exportContent(); - - // String[] expectedContentSources = { "mockContentSource1.json" }; - - // // VERIFY - // verify(restClient, times(1)).getContentSourcesForProject("mockedProjectId"); - // AssertionsHelper.assertFolderContainsFiles( fsMocks.getTempFolderProjectPath(), expectedContentSources ); - // } - - // @Test - // void testExportContentWithSpecificContentSources() {} - - -} From af4def4bec52218bfc49789da58a4940b4a6eb13 Mon Sep 17 00:00:00 2001 From: Stefan Genov Date: Thu, 16 Jan 2025 11:42:12 +0200 Subject: [PATCH 05/10] refactor(vrops-tests): Moved to correct place Signed-off-by: Stefan Genov --- .../configuration/ConfigurationVropsTest.java | 4 +-- .../store}/VropsPackageStoreTest.java | 27 +++++++++++-------- 2 files changed, 18 insertions(+), 13 deletions(-) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/{ => aria/operations}/configuration/ConfigurationVropsTest.java (94%) rename common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/{store/vrops => aria/operations/store}/VropsPackageStoreTest.java (92%) diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/configuration/ConfigurationVropsTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/operations/configuration/ConfigurationVropsTest.java similarity index 94% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/configuration/ConfigurationVropsTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/operations/configuration/ConfigurationVropsTest.java index c7610a8af..0003ffce0 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/configuration/ConfigurationVropsTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/operations/configuration/ConfigurationVropsTest.java @@ -12,13 +12,13 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.configuration; +package com.vmware.pscoe.iac.artifact.aria.operations.configuration; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; +import com.vmware.pscoe.iac.artifact.configuration.ConfigurationException; import java.net.UnknownHostException; import java.util.Properties; diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/store/vrops/VropsPackageStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStoreTest.java similarity index 92% rename from common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/store/vrops/VropsPackageStoreTest.java rename to common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStoreTest.java index 4b1da1d52..c4e2a4f17 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/store/vrops/VropsPackageStoreTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStoreTest.java @@ -12,13 +12,12 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.store.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.store; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.ArgumentMatchers.any; import java.io.File; @@ -35,7 +34,6 @@ import com.jcraft.jsch.JSchException; import com.vmware.pscoe.iac.artifact.PackageMocked; -import com.vmware.pscoe.iac.artifact.aria.operations.store.VropsPackageStore; import com.vmware.pscoe.iac.artifact.cli.CliManagerVrops; import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.model.PackageFactory; @@ -174,20 +172,27 @@ private void importVropsPackage(String vropsVersion) throws Exception { Mockito.doReturn(vropsVersion).when(restClientMock).getVersion(); Mockito.doReturn(allGroups).when(restClientMock).findAllAuthGroups(); Mockito.doReturn(allUsers).when(restClientMock).findAllAuthUsers(); - Mockito.doReturn(allGroups).when(restClientMock).findAuthGroupsByNames(Arrays.asList(new String[] { existingGroup })); - Mockito.doReturn(allUsers).when(restClientMock).findAuthUsersByNames(Arrays.asList(new String[] { existingUser })); - - Mockito.doNothing().when(restClientMock).importDefinitionsInVrops(new HashMap<>(), VropsPackageMemberType.ALERT_DEFINITION, new HashMap<>()); - Mockito.doNothing().when(restClientMock).importDefinitionsInVrops(new HashMap<>(), VropsPackageMemberType.SYMPTOM_DEFINITION, new HashMap<>()); - Mockito.doNothing().when(restClientMock).importDefinitionsInVrops(new HashMap<>(), VropsPackageMemberType.RECOMMENDATION, new HashMap<>()); - Mockito.doNothing().when(restClientMock).importCustomGroupInVrops(testCustomGroupName, testCustomGroupPayload, new HashMap<>()); + Mockito.doReturn(allGroups).when(restClientMock) + .findAuthGroupsByNames(Arrays.asList(new String[] { existingGroup })); + Mockito.doReturn(allUsers).when(restClientMock) + .findAuthUsersByNames(Arrays.asList(new String[] { existingUser })); + + Mockito.doNothing().when(restClientMock).importDefinitionsInVrops(new HashMap<>(), + VropsPackageMemberType.ALERT_DEFINITION, new HashMap<>()); + Mockito.doNothing().when(restClientMock).importDefinitionsInVrops(new HashMap<>(), + VropsPackageMemberType.SYMPTOM_DEFINITION, new HashMap<>()); + Mockito.doNothing().when(restClientMock).importDefinitionsInVrops(new HashMap<>(), + VropsPackageMemberType.RECOMMENDATION, new HashMap<>()); + Mockito.doNothing().when(restClientMock).importCustomGroupInVrops(testCustomGroupName, testCustomGroupPayload, + new HashMap<>()); Mockito.doNothing().when(restClientMock).setDefaultPolicy(defaultPolicy); Mockito.doNothing().when(restClientMock).setPolicyPriorities(Arrays.asList(new String[] { policyId })); Mockito.doNothing().when(restClientMock).importPolicyFromZip(any(), Mockito.isA(File.class), anyBoolean()); VropsPackageStore store = new VropsPackageStore(cliMock, restClientMock, tempFolder.newFolder()); - File packageZip = PackageMocked.createSamplePackageZip(tempFolder.newFolder(), "ViewName", "viewid123", existingDashboard, "AlertDefinitions"); + File packageZip = PackageMocked.createSamplePackageZip(tempFolder.newFolder(), "ViewName", "viewid123", + existingDashboard, "AlertDefinitions"); Package vropsPkg = PackageFactory.getInstance(PackageType.VROPS, packageZip); List packages = new ArrayList<>(); packages.add(vropsPkg); From b6ece6a7e164c9c17179b0351bd71afb4bceafe9 Mon Sep 17 00:00:00 2001 From: Stefan Genov Date: Thu, 16 Jan 2025 11:48:29 +0200 Subject: [PATCH 06/10] refactor(vrops): Moved vrops store models to the correct place Signed-off-by: Stefan Genov --- .../iac/artifact/aria/operations/rest/RestClientVrops.java | 2 +- .../iac/artifact/aria/operations/store/VropsPackageStore.java | 4 ++-- .../operations/store/models}/VropsPackageContent.java | 2 +- .../operations/store/models}/VropsPackageDescriptor.java | 2 +- .../operations/store/models}/VropsPackageMemberType.java | 2 +- .../vrops => aria/operations/store/models}/package-info.java | 2 +- .../artifact/aria/operations/store/VropsPackageStoreTest.java | 4 ++-- .../main/java/com/vmware/pscoe/maven/plugins/PackageMojo.java | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) rename common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/{model/vrops => aria/operations/store/models}/VropsPackageContent.java (93%) rename common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/{model/vrops => aria/operations/store/models}/VropsPackageDescriptor.java (99%) rename common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/{model/vrops => aria/operations/store/models}/VropsPackageMemberType.java (96%) rename common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/{model/vrops => aria/operations/store/models}/package-info.java (89%) diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVrops.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVrops.java index e3c5362dd..70e3f4a42 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVrops.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/rest/RestClientVrops.java @@ -58,7 +58,7 @@ import com.vmware.pscoe.iac.artifact.configuration.Configuration; import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; import com.vmware.pscoe.iac.artifact.model.Version; -import com.vmware.pscoe.iac.artifact.model.vrops.VropsPackageMemberType; +import com.vmware.pscoe.iac.artifact.aria.operations.store.models.VropsPackageMemberType; import com.vmware.pscoe.iac.artifact.rest.RestClient; import com.vmware.pscoe.iac.artifact.aria.operations.models.AdapterKindDTO; import com.vmware.pscoe.iac.artifact.aria.operations.models.AlertDefinitionDTO; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStore.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStore.java index dd9d948dd..1569497a0 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStore.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStore.java @@ -70,8 +70,8 @@ import com.vmware.pscoe.iac.artifact.model.PackageContent; import com.vmware.pscoe.iac.artifact.model.PackageContent.Content; import com.vmware.pscoe.iac.artifact.model.Version; -import com.vmware.pscoe.iac.artifact.model.vrops.VropsPackageDescriptor; -import com.vmware.pscoe.iac.artifact.model.vrops.VropsPackageMemberType; +import com.vmware.pscoe.iac.artifact.aria.operations.store.models.VropsPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.operations.store.models.VropsPackageMemberType; import com.vmware.pscoe.iac.artifact.aria.operations.rest.RestClientVrops; import com.vmware.pscoe.iac.artifact.aria.operations.models.AlertDefinitionDTO; import com.vmware.pscoe.iac.artifact.aria.operations.models.AuthGroupDTO; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/model/vrops/VropsPackageContent.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/models/VropsPackageContent.java similarity index 93% rename from common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/model/vrops/VropsPackageContent.java rename to common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/models/VropsPackageContent.java index 611a83aba..ff02ec718 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/model/vrops/VropsPackageContent.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/models/VropsPackageContent.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.store.models; import java.util.List; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/model/vrops/VropsPackageDescriptor.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/models/VropsPackageDescriptor.java similarity index 99% rename from common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/model/vrops/VropsPackageDescriptor.java rename to common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/models/VropsPackageDescriptor.java index bcc11f33b..e12173275 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/model/vrops/VropsPackageDescriptor.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/models/VropsPackageDescriptor.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.store.models; import java.io.File; import java.util.List; diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/model/vrops/VropsPackageMemberType.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/models/VropsPackageMemberType.java similarity index 96% rename from common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/model/vrops/VropsPackageMemberType.java rename to common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/models/VropsPackageMemberType.java index 22da2bbed..abdaf9571 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/model/vrops/VropsPackageMemberType.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/models/VropsPackageMemberType.java @@ -12,7 +12,7 @@ * This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file. * #L% */ -package com.vmware.pscoe.iac.artifact.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.store.models; /** * VropsPackageMemberType defines the asset types that vROPs package supports. diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/model/vrops/package-info.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/models/package-info.java similarity index 89% rename from common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/model/vrops/package-info.java rename to common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/models/package-info.java index 46be1d787..e2c434697 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/model/vrops/package-info.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/aria/operations/store/models/package-info.java @@ -17,4 +17,4 @@ * Package that represents vROPs 8 model. * */ -package com.vmware.pscoe.iac.artifact.model.vrops; +package com.vmware.pscoe.iac.artifact.aria.operations.store.models; diff --git a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStoreTest.java b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStoreTest.java index c4e2a4f17..47331b62d 100644 --- a/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStoreTest.java +++ b/common/artifact-manager/src/test/java/com/vmware/pscoe/iac/artifact/aria/operations/store/VropsPackageStoreTest.java @@ -38,8 +38,8 @@ import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.model.PackageFactory; import com.vmware.pscoe.iac.artifact.model.PackageType; -import com.vmware.pscoe.iac.artifact.model.vrops.VropsPackageDescriptor; -import com.vmware.pscoe.iac.artifact.model.vrops.VropsPackageMemberType; +import com.vmware.pscoe.iac.artifact.aria.operations.store.models.VropsPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.operations.store.models.VropsPackageMemberType; import com.vmware.pscoe.iac.artifact.aria.operations.rest.RestClientVrops; import com.vmware.pscoe.iac.artifact.aria.operations.models.AuthGroupDTO; import com.vmware.pscoe.iac.artifact.aria.operations.models.AuthUserDTO; diff --git a/maven/plugins/vrops/src/main/java/com/vmware/pscoe/maven/plugins/PackageMojo.java b/maven/plugins/vrops/src/main/java/com/vmware/pscoe/maven/plugins/PackageMojo.java index fa3fdf6a9..efb8e6dcd 100644 --- a/maven/plugins/vrops/src/main/java/com/vmware/pscoe/maven/plugins/PackageMojo.java +++ b/maven/plugins/vrops/src/main/java/com/vmware/pscoe/maven/plugins/PackageMojo.java @@ -39,7 +39,7 @@ import com.vmware.pscoe.iac.artifact.model.Package; import com.vmware.pscoe.iac.artifact.model.PackageFactory; import com.vmware.pscoe.iac.artifact.model.PackageType; -import com.vmware.pscoe.iac.artifact.model.vrops.VropsPackageDescriptor; +import com.vmware.pscoe.iac.artifact.aria.operations.store.models.VropsPackageDescriptor; import edu.emory.mathcs.backport.java.util.Arrays; From f21c20dddc24525f5a790714a84ab6f7049db152 Mon Sep 17 00:00:00 2001 From: Stefan Genov Date: Thu, 16 Jan 2025 12:24:10 +0200 Subject: [PATCH 07/10] fix: Import for mojo Signed-off-by: Stefan Genov --- .../java/com/vmware/pscoe/maven/plugins/AbstractIacMojo.java | 1 + 1 file changed, 1 insertion(+) diff --git a/maven/plugins/common/src/main/java/com/vmware/pscoe/maven/plugins/AbstractIacMojo.java b/maven/plugins/common/src/main/java/com/vmware/pscoe/maven/plugins/AbstractIacMojo.java index 2cae76698..25cb10f6b 100644 --- a/maven/plugins/common/src/main/java/com/vmware/pscoe/maven/plugins/AbstractIacMojo.java +++ b/maven/plugins/common/src/main/java/com/vmware/pscoe/maven/plugins/AbstractIacMojo.java @@ -16,6 +16,7 @@ import com.vmware.pscoe.iac.artifact.configuration.*; import com.vmware.pscoe.iac.artifact.aria.automation.configuration.ConfigurationVraNg; +import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; import com.vmware.pscoe.iac.artifact.model.PackageType; import com.vmware.pscoe.iac.artifact.rest.RestClientFactory; import com.vmware.pscoe.iac.artifact.rest.RestClientVro; From f83940a959c496e5b6b287fd3bc1b32436d77d2f Mon Sep 17 00:00:00 2001 From: Stefan Genov Date: Thu, 16 Jan 2025 12:24:16 +0200 Subject: [PATCH 08/10] docs: Release docs Signed-off-by: Stefan Genov --- docs/versions/latest/Release.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/versions/latest/Release.md b/docs/versions/latest/Release.md index 514ad3c6e..1418df4b7 100644 --- a/docs/versions/latest/Release.md +++ b/docs/versions/latest/Release.md @@ -122,7 +122,11 @@ The question is updated: ### *Moved Aria Automation components to own folder* -This is jut an internal restructuring effort, no functionality was changed. +This is just an internal restructuring effort, no functionality was changed. + +### *Moved Aria Operations components to own folder* + +This is just an internal restructuring effort, no functionality was changed. ## Upgrade procedure From 61f43b591c100103b12cedd5e2addd05f2648ab7 Mon Sep 17 00:00:00 2001 From: Stefan Genov Date: Thu, 16 Jan 2025 12:33:46 +0200 Subject: [PATCH 09/10] style(lint): Cleared lint from the codeql report Signed-off-by: Stefan Genov --- .../iac/artifact/cli/CliManagerFactory.java | 3 ++ .../client/vrli/AbstractRestClientVrli.java | 46 +++++++++++++------ 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/cli/CliManagerFactory.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/cli/CliManagerFactory.java index d60d0ea63..c38147921 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/cli/CliManagerFactory.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/cli/CliManagerFactory.java @@ -18,6 +18,9 @@ public class CliManagerFactory { + private CliManagerFactory() { + } + public static CliManagerVrops getVropsCliManager(ConfigurationVrops config) { return new CliManagerVrops(config); } diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/AbstractRestClientVrli.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/AbstractRestClientVrli.java index e0c806974..3a727db07 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/AbstractRestClientVrli.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/rest/client/vrli/AbstractRestClientVrli.java @@ -43,7 +43,7 @@ public abstract class AbstractRestClientVrli extends RestClient { protected static final String ALERTS_API = "/alerts"; private static final String OVERWRITE_MODE = "OVERWRITE"; - protected AbstractRestClientVrli (String apiPrefix, ConfigurationVrli configuration, RestTemplate restTemplate) { + protected AbstractRestClientVrli(String apiPrefix, ConfigurationVrli configuration, RestTemplate restTemplate) { this.apiPrefix = apiPrefix; this.restTemplate = restTemplate; this.configuration = configuration; @@ -57,7 +57,8 @@ public String getVersion() { } URI url = getURI(getURIBuilder().setPath(this.apiPrefix + "/version")); - ResponseEntity response = restTemplate.exchange(url, HttpMethod.GET, getDefaultHttpEntity(), String.class); + ResponseEntity response = restTemplate.exchange(url, HttpMethod.GET, getDefaultHttpEntity(), + String.class); this.vrliVersion = JsonPath.parse(response.getBody()).read("$.version"); return this.vrliVersion; @@ -77,9 +78,11 @@ public String getContentPack(String contentPackNamespace) { response = restTemplate.exchange(url, HttpMethod.GET, getDefaultHttpEntity(), String.class); } catch (HttpClientErrorException e) { if (HttpStatus.NOT_FOUND.equals(e.getStatusCode())) { - throw new RuntimeException(String.format("Content pack '%s' does not exist: %s", contentPackNamespace, e.getMessage())); + throw new RuntimeException( + String.format("Content pack '%s' does not exist: %s", contentPackNamespace, e.getMessage())); } - throw new RuntimeException(String.format("Error fetching content pack data for content pack '%s': %s", contentPackNamespace, e.getMessage())); + throw new RuntimeException(String.format("Error fetching content pack data for content pack '%s': %s", + contentPackNamespace, e.getMessage())); } // reformat the output JSON to be readable @@ -87,9 +90,11 @@ public String getContentPack(String contentPackNamespace) { try { jsonObject = JsonParser.parseString(response.getBody()).getAsJsonObject(); } catch (JsonSyntaxException e) { - throw new RuntimeException(String.format("Error verifying data of content pack '%s': %s", contentPackNamespace, e.getMessage())); + throw new RuntimeException(String.format("Error verifying data of content pack '%s': %s", + contentPackNamespace, e.getMessage())); } catch (JsonIOException e) { - throw new RuntimeException(String.format("Error reading and verifying data of content pack '%s': %s", contentPackNamespace, e.getMessage())); + throw new RuntimeException(String.format("Error reading and verifying data of content pack '%s': %s", + contentPackNamespace, e.getMessage())); } Gson gson = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().setLenient().serializeNulls().create(); @@ -99,7 +104,8 @@ public String getContentPack(String contentPackNamespace) { public void importContentPack(String contentPackName, String contentPackJson) { Boolean overwrite = configuration.getPackageImportOverwriteMode().equals(Boolean.TRUE.toString()) || configuration.getPackageImportOverwriteMode().contains(OVERWRITE_MODE); - URI url = getURI(getURIBuilder().setPath(this.apiPrefix + CONTENT_PACKS_API).addParameter("overwrite", overwrite.toString())); + URI url = getURI(getURIBuilder().setPath(this.apiPrefix + CONTENT_PACKS_API).addParameter("overwrite", + overwrite.toString())); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON_UTF8); @@ -108,15 +114,20 @@ public void importContentPack(String contentPackName, String contentPackJson) { restTemplate.exchange(url, HttpMethod.POST, entity, String.class); } catch (HttpClientErrorException e) { if (HttpStatus.CONFLICT.equals(e.getStatusCode())) { - logger.warn("The content pack '{}' already exists on the target system, please uninstall it before importing again.", contentPackName); + logger.warn( + "The content pack '{}' already exists on the target system, please uninstall it before importing again.", + contentPackName); return; } if (HttpStatus.BAD_REQUEST.equals(e.getStatusCode())) { - throw new RuntimeException(String.format("Data validation error of the content pack '%s' to VRLI: %s", contentPackName, e.getMessage())); + throw new RuntimeException(String.format("Data validation error of the content pack '%s' to VRLI: %s", + contentPackName, e.getMessage())); } - throw new RuntimeException(String.format("Error importing content pack '%s' to VRLI: %s", contentPackName, e.getMessage())); + throw new RuntimeException( + String.format("Error importing content pack '%s' to VRLI: %s", contentPackName, e.getMessage())); } catch (RestClientException e) { - throw new RuntimeException(String.format("REST client error during import of content pack '%s' to VRLI: %s", contentPackName, e.getMessage())); + throw new RuntimeException(String.format("REST client error during import of content pack '%s' to VRLI: %s", + contentPackName, e.getMessage())); } } @@ -131,18 +142,23 @@ protected RestClientVrops getVropsRestClient() { vropsConfigProperties.put(Configuration.PORT, configuration.getIntegrationVropsAuthPort()); vropsConfigProperties.put(Configuration.USERNAME, configuration.getIntegrationVropsAuthUser()); vropsConfigProperties.put(Configuration.PASSWORD, configuration.getIntegrationVropsAuthPassword()); - vropsConfigProperties.put(ConfigurationVrli.INTEGRATION_VROPS_AUTH_SOURCE, configuration.getIntegrationVropsAuthSource()); + vropsConfigProperties.put(ConfigurationVrli.INTEGRATION_VROPS_AUTH_SOURCE, + configuration.getIntegrationVropsAuthSource()); vropsConfigProperties.put(ConfigurationVrops.VROPS_DASHBOARD_USER, "admin"); vropsConfigProperties.put(ConfigurationVrops.VROPS_REST_USER, configuration.getIntegrationVropsAuthUser()); - vropsConfigProperties.put(ConfigurationVrops.VROPS_REST_PASSWORD, configuration.getIntegrationVropsAuthPassword()); - vropsConfigProperties.put(ConfigurationVrops.VROPS_REST_AUTH_SOURCE, configuration.getIntegrationVropsAuthSource()); + vropsConfigProperties.put(ConfigurationVrops.VROPS_REST_PASSWORD, + configuration.getIntegrationVropsAuthPassword()); + vropsConfigProperties.put(ConfigurationVrops.VROPS_REST_AUTH_SOURCE, + configuration.getIntegrationVropsAuthSource()); vropsConfigProperties.put(ConfigurationVrops.SSH_PORT, "22"); try { vropsConfiguration = ConfigurationVrops.fromProperties(vropsConfigProperties); } catch (ConfigurationException e) { throw new RuntimeException( - String.format("Unable to update vCOPs integration for alert, vROPs integration configuration failed with message: %s", e.getMessage())); + String.format( + "Unable to update vCOPs integration for alert, vROPs integration configuration failed with message: %s", + e.getMessage())); } return new RestClientVrops(vropsConfiguration, restTemplate); From 23e4f1cb095145374c0e0fd8775c89c4a75f3908 Mon Sep 17 00:00:00 2001 From: Stefan Genov Date: Thu, 16 Jan 2025 12:37:13 +0200 Subject: [PATCH 10/10] style(lint): Declared CliManagerFactory as final Signed-off-by: Stefan Genov --- .../com/vmware/pscoe/iac/artifact/cli/CliManagerFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/cli/CliManagerFactory.java b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/cli/CliManagerFactory.java index c38147921..78734248a 100644 --- a/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/cli/CliManagerFactory.java +++ b/common/artifact-manager/src/main/java/com/vmware/pscoe/iac/artifact/cli/CliManagerFactory.java @@ -16,7 +16,7 @@ import com.vmware.pscoe.iac.artifact.aria.operations.configuration.ConfigurationVrops; -public class CliManagerFactory { +public final class CliManagerFactory { private CliManagerFactory() { }