diff --git a/.classpath b/.classpath new file mode 100644 index 0000000000000000000000000000000000000000..3bc452ee9e9d1755c11e3e7c24e3ceeaa9a6c4da --- /dev/null +++ b/.classpath @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" output="target/classes" path="src/main/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="src" output="target/test-classes" path="src/test/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + <attribute name="test" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + <attribute name="test" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="output" path="target/classes"/> +</classpath> diff --git a/.project b/.project new file mode 100644 index 0000000000000000000000000000000000000000..a6e6159ac10890258362a26296e9792a866a1368 --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.etsi.osl.model.k8s</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + </natures> +</projectDescription> diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000000000000000000000000000000000..18308defdbd17a8bd5837fef98d92d04e0014ed4 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=utf-8 +encoding//src/main/resources=utf-8 +encoding//src/test/java=utf-8 +encoding//src/test/resources=utf-8 +encoding/<project>=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..cf2cd4590a7b37a700141633a3f00c030130be1e --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=17 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..f897a7f1cb2389f85fe6381425d29f0a9866fb65 --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..4ebdae8b88626f4efc425da4f8d75d743175053d --- /dev/null +++ b/pom.xml @@ -0,0 +1,36 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.etsi.osl</groupId> + <artifactId>org.etsi.osl.main</artifactId> + <version>1.2.0-SNAPSHOT</version> + <relativePath>../org.etsi.osl.main</relativePath> + </parent> + + + <artifactId>org.etsi.osl.model.k8s</artifactId> + + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <lombok-version>1.18.28</lombok-version> + </properties> + + <dependencies> + + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <scope>provided</scope> + <version>${lombok-version}</version> + </dependency> + <dependency> + <groupId>org.etsi.osl</groupId> + <artifactId>org.etsi.osl.model.tmf</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> +</project> \ No newline at end of file diff --git a/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDProperty.java b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDProperty.java new file mode 100644 index 0000000000000000000000000000000000000000..f67d484e478e0892441a40cbd97a286e01d72c91 --- /dev/null +++ b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDProperty.java @@ -0,0 +1,35 @@ +package org.etsi.osl.domain.model.kubernetes; + +import java.util.HashMap; +import java.util.Map; + +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +/** + * @author ctranoris + */ +@Getter +@Setter +@Builder +public class KubernetesCRDProperty { + + String name; + String valueType; + String defaultValue; + String description; + Map<String, KubernetesCRDProperty> properties; + + public Map<String, KubernetesCRDProperty> getProperties() { + if ( properties == null) { + this.properties = new HashMap<>(); + } + return properties; + } + + + + + +} diff --git a/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java new file mode 100644 index 0000000000000000000000000000000000000000..07c17ac6462ea1f52f07414e216532d9eedc2da2 --- /dev/null +++ b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRDV1.java @@ -0,0 +1,244 @@ +package org.etsi.osl.domain.model.kubernetes; + +import java.util.HashMap; +import java.util.Map; +import org.etsi.osl.domain.model.DomainModelDefinition; +import org.etsi.osl.domain.model.ITMFRCM634_ModelTransformer; +import org.etsi.osl.domain.model.ITMFRI639_ModelTransformer; +import org.etsi.osl.tmf.common.model.ELifecycle; +import org.etsi.osl.tmf.common.model.EValueType; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecification; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationCreate; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationUpdate; +import org.etsi.osl.tmf.ri639.model.ResourceCreate; +import org.etsi.osl.tmf.ri639.model.ResourceOperationalStateType; +import org.etsi.osl.tmf.ri639.model.ResourceStatusType; +import org.etsi.osl.tmf.ri639.model.ResourceUpdate; +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +/** + * @author ctranoris + */ +@Getter +@Setter +public class KubernetesCRDV1 extends DomainModelDefinition + implements ITMFRCM634_ModelTransformer, ITMFRI639_ModelTransformer { + + public static final String OSL_KUBCRD_RSPEC_NAME = "kubernetes-crd.openslice.io"; + public static final String OSL_KUBCRD_RSPEC_VERSION = "0.0.3"; + public static final String OSL_KUBCRD_RSPEC_CATEGORY = "KubernetesCRD-apiextensions.k8s.io/v1"; + public static final String OSL_KUBCRD_RESOURCE_CATEGORY = "KubernetesCRD-apiextensions.k8s.io/v1"; + public static final String OSL_KUBCRD_RSPEC_TYPE = "LogicalResourceSpecification"; + public static final String OSL_KUBCRD_RSPEC_DESCRIPTION = "This Specification is used to describe a generic KubernetesCRD"; + + private String osl_KUBCRD_RSPEC_UUID = null; //this is assigned by the system through the DB for a specific instance + + private String clusterMasterURL; + private String currentContextCluster; + private String fullResourceName; + private String kind; + private String apiGroup; + private String UID; + private String metadata; + private String yaml; + private String json; + private Map<String, KubernetesCRDProperty> properties; + private Map<String, KubernetesCRDProperty> additionalProperties; + private String cr_spec; + private String statusCheckFieldName; + private String statusCheckValueStandby; + private String statusCheckValueAlarm; + private String statusCheckValueAvailable; + private String statusCheckValueReserved; + private String statusCheckValueUnknown; + private String statusCheckValueSuspended; + + + @Builder + public KubernetesCRDV1(String osl_KUBCRD_RSPEC_UUID, String uuid, String name, String version, String description, String category, + String clusterMasterURL, String currentContextCluster, String fullResourceName, + String kind, String apiGroup, String uID, + String metadata, + String yaml, + String json) { + super(uuid, name, version, description, category); + this.osl_KUBCRD_RSPEC_UUID = osl_KUBCRD_RSPEC_UUID; + this.clusterMasterURL = clusterMasterURL; + this.currentContextCluster = currentContextCluster; + this.fullResourceName = fullResourceName; + this.kind = kind; + this.apiGroup = apiGroup; + this.UID = uID; + this.metadata = metadata; + this.yaml = yaml; + this.json = json; + this.properties = new HashMap<>(); + this.additionalProperties = new HashMap<>(); + } + + + + @Override + public ResourceSpecificationCreate toRSpecCreate_InitRepo() { + + ResourceSpecificationCreate rsc = this.toRSpecCreate(); + rsc.setName( OSL_KUBCRD_RSPEC_NAME ); + rsc.setCategory( OSL_KUBCRD_RSPEC_CATEGORY ); + rsc.setVersion(OSL_KUBCRD_RSPEC_VERSION); + rsc.setDescription( OSL_KUBCRD_RSPEC_DESCRIPTION ); + rsc.setType( OSL_KUBCRD_RSPEC_TYPE ); + + + + return rsc; + } + + @Override + public ResourceSpecificationCreate toRSpecCreate() { + + ResourceSpecificationCreate rsc = new ResourceSpecificationCreate(); + rsc.setName( this.name ); + rsc.setCategory( OSL_KUBCRD_RSPEC_CATEGORY ); + rsc.setVersion( this.version ); + rsc.setDescription( this.version ); + rsc.setType( OSL_KUBCRD_RSPEC_TYPE ); + + rsc.setLifecycleStatus( ELifecycle.ACTIVE.getValue() ); + rsc.addResourceSpecificationCharacteristicItemShort("clusterMasterURL", this.clusterMasterURL, EValueType.TEXT.getValue(), "URL of cluster", false); + rsc.addResourceSpecificationCharacteristicItemShort("currentContextCluster", this.currentContextCluster, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("fullResourceName", this.fullResourceName, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("Kind", this.kind, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("apiGroup", this.apiGroup, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("UID", this.UID, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("metadata", this.metadata, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("yaml", this.yaml, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("json", this.json, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_SPEC", "", EValueType.TEXT.getValue(), "Used for providing the json Custom Resource description to apply", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECK_FIELD", "", EValueType.TEXT.getValue(), "Used for providing the field that need to be checked for the resource status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_STANDBY", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the standby status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_ALARM", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the alarm status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_AVAILABLE", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the available status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_RESERVED", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the reserved status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_UNKNOWN", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the unknown status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_SUSPENDED", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the suspended status", false); + +// rsc.addResourceSpecificationCharacteristicItemShort( "properties", "", EValueType.SET.getValue()); +// rsc.addResourceSpecificationCharacteristicItemShort( "additionalProperties", "", EValueType.SET.getValue()); + if (this.properties != null) + this.properties.forEach((kPropName, vProVal) -> { + + EValueType etype; + if ( vProVal.getValueType().equalsIgnoreCase("boolean")) { + etype = EValueType.BOOLEAN; + } else if ( vProVal.getValueType().equalsIgnoreCase("integer")) { + etype = EValueType.INTEGER; + } else if ( vProVal.getValueType().equalsIgnoreCase("object")) { + etype = EValueType.OBJECT; + } else + etype = EValueType.TEXT; + + rsc.addResourceSpecificationCharacteristicItemShort(kPropName , vProVal.getDefaultValue(), etype.getValue(), vProVal.getDescription(), false); + + }); + + if (this.additionalProperties != null ) { + this.additionalProperties.forEach((kPropName, vProVal) -> { + rsc.addResourceSpecificationCharacteristicItemShort("additionalProperty." + kPropName, vProVal.getDefaultValue(), EValueType.TEXT.getValue(), vProVal.getDescription(), false); + + }); + } + + return rsc; + } + + @Override + public ResourceSpecificationUpdate toRSpecUpdate() { + return this.toRSpecCreate(); + } + + @Override + public KubernetesCRDV1 fromRSpec(ResourceSpecification rSpec) { + this.osl_KUBCRD_RSPEC_UUID = rSpec.getUuid(); + return this; + } + + @Override + public ResourceCreate toResourceCreate() { + + if (osl_KUBCRD_RSPEC_UUID == null) { + return null; + } + + ResourceSpecificationRef rSpecRef = new ResourceSpecificationRef(); + rSpecRef.setId( osl_KUBCRD_RSPEC_UUID ); + rSpecRef.setName( OSL_KUBCRD_RSPEC_NAME ); + rSpecRef.setVersion( OSL_KUBCRD_RSPEC_VERSION ); + + ResourceCreate rs = new ResourceCreate(); + rs.name( this.name ) + .category( OSL_KUBCRD_RESOURCE_CATEGORY ) + .description( this.description ) + .resourceStatus( ResourceStatusType.AVAILABLE ) + .operationalState( ResourceOperationalStateType.ENABLE ) + .resourceSpecification( rSpecRef ) + .resourceVersion( this.version); + + rs.addResourceCharacteristicItemShort("clusterMasterURL", this.clusterMasterURL, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("currentContextCluster", this.currentContextCluster, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("fullResourceName", this.fullResourceName, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("Kind", this.kind, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("apiGroup", this.apiGroup, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("UID", this.UID, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("metadata", this.metadata, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("yaml", this.yaml, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("json", this.json, EValueType.TEXT.getValue()); + + rs.addResourceCharacteristicItemShort("_CR_SPEC", this.cr_spec, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECK_FIELD", this.statusCheckFieldName, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_STANDBY", this.statusCheckValueStandby, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_ALARM", this.statusCheckValueAlarm, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_AVAILABLE", this.statusCheckValueAvailable, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_RESERVED", this.statusCheckValueReserved, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_UNKNOWN", this.statusCheckValueUnknown, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_SUSPENDED", this.statusCheckValueSuspended, EValueType.TEXT.getValue()); + + + + if (this.properties != null) + this.properties.forEach((kPropName, vProVal) -> { + + EValueType etype; + if ( vProVal.getValueType().equalsIgnoreCase("boolean")) { + etype = EValueType.BOOLEAN; + } else if ( vProVal.getValueType().equalsIgnoreCase("integer")) { + etype = EValueType.INTEGER; + } else if ( vProVal.getValueType().equalsIgnoreCase("object")) { + etype = EValueType.OBJECT; + } else + etype = EValueType.TEXT; + + rs.addResourceCharacteristicItemShort(kPropName , "", etype.getValue()); + + }); + + if (this.additionalProperties != null ) { + this.additionalProperties.forEach((kPropName, vProVal) -> { + rs.addResourceCharacteristicItemShort("additionalProperty." + kPropName, "", EValueType.TEXT.getValue()); + + }); + } + + + return rs; + } + + @Override + public ResourceUpdate toResourceUpdate() { + + return this.toResourceCreate(); + } + +} diff --git a/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRV1.java b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRV1.java new file mode 100644 index 0000000000000000000000000000000000000000..ec06b718e09ebd177c8ccebd8a39853d13680240 --- /dev/null +++ b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesCRV1.java @@ -0,0 +1,219 @@ +package org.etsi.osl.domain.model.kubernetes; + +import java.util.HashMap; +import java.util.Map; +import org.etsi.osl.domain.model.DomainModelDefinition; +import org.etsi.osl.domain.model.ITMFRCM634_ModelTransformer; +import org.etsi.osl.domain.model.ITMFRI639_ModelTransformer; +import org.etsi.osl.tmf.common.model.ELifecycle; +import org.etsi.osl.tmf.common.model.EValueType; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecification; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationCreate; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationUpdate; +import org.etsi.osl.tmf.ri639.model.ResourceCreate; +import org.etsi.osl.tmf.ri639.model.ResourceOperationalStateType; +import org.etsi.osl.tmf.ri639.model.ResourceStatusType; +import org.etsi.osl.tmf.ri639.model.ResourceUpdate; +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +/** + * @author ctranoris + */ +@Getter +@Setter +public class KubernetesCRV1 extends DomainModelDefinition + implements ITMFRCM634_ModelTransformer, ITMFRI639_ModelTransformer { + + public static final String OSL_KUBCRV1_RSPEC_NAME = "kubernetes-cr-v1.openslice.io"; + public static final String OSL_KUBCRV1_RSPEC_VERSION = "0.0.4"; + public static final String OSL_KUBCRV1_RSPEC_CATEGORY = "KubernetesCRV1-apiextensions.k8s.io/v1"; + public static final String OSL_KUBCRV1_RSPEC_TYPE = "LogicalResourceSpecification"; + public static final String OSL_KUBCRV1_RSPEC_DESCRIPTION = "This Specification is used to describe a generic KubernetesCRV1"; + + private String osl_KUBCRV1_RSPEC_UUID = null; //this is assigned by the system through the DB for a specific instance + + private String clusterMasterURL; + private String currentContextCluster; + private String fullResourceName; + private String kind; + private String apiGroup; + private String namespace; + private String UID; + private String metadata; + private String yaml; + private String json; + private Map<String, String> properties; + private Map<String, String> additionalProperties; + private String cr_spec_applied; + private String statusCheckFieldName; + private String statusCheckValueStandby; + private String statusCheckValueAlarm; + private String statusCheckValueAvailable; + private String statusCheckValueReserved; + private String statusCheckValueUnknown; + private String statusCheckValueSuspended; + private ResourceStatusType statusValue; + + @Builder + public KubernetesCRV1(String osl_KUBCRV1_RSPEC_UUID, String uuid, String name, String version, String description, String category, + String clusterMasterURL, String currentContextCluster, String fullResourceName, String namespace, + String kind, String apiGroup, String uID, String metadata, ResourceStatusType statusValue, + String yaml, + String json) { + super(uuid, name, version, description, category); + this.osl_KUBCRV1_RSPEC_UUID = osl_KUBCRV1_RSPEC_UUID; + this.clusterMasterURL = clusterMasterURL; + this.currentContextCluster = currentContextCluster; + this.fullResourceName = fullResourceName; + this.kind = kind; + this.apiGroup = apiGroup; + this.namespace = namespace; + this.UID = uID; + this.metadata = metadata; + this.yaml = yaml; + this.json = json; + this.statusValue = statusValue; + this.properties = new HashMap<>(); + this.additionalProperties = new HashMap<>(); + } + + + + @Override + public ResourceSpecificationCreate toRSpecCreate_InitRepo() { + + ResourceSpecificationCreate rsc = toRSpecCreate(); + rsc.setName( OSL_KUBCRV1_RSPEC_NAME ); + rsc.setCategory( OSL_KUBCRV1_RSPEC_CATEGORY ); + rsc.setVersion(OSL_KUBCRV1_RSPEC_VERSION); + rsc.setDescription( OSL_KUBCRV1_RSPEC_DESCRIPTION ); + rsc.setType( OSL_KUBCRV1_RSPEC_TYPE ); + + return rsc; + } + + + @Override + public ResourceSpecificationCreate toRSpecCreate() { + + ResourceSpecificationCreate rsc = new ResourceSpecificationCreate(); + rsc.setName( this.name ); + rsc.setCategory( OSL_KUBCRV1_RSPEC_CATEGORY ); + rsc.setVersion(this.version); + rsc.setDescription( this.description ); + rsc.setType( OSL_KUBCRV1_RSPEC_TYPE ); + + rsc.setLifecycleStatus( ELifecycle.ACTIVE.getValue() ); + rsc.addResourceSpecificationCharacteristicItemShort( "clusterMasterURL", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "currentContextCluster", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "fullResourceName", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "Kind", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "apiGroup", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "UID", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "namespace", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "metadata", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "yaml", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "json", "", EValueType.TEXT.getValue(), "", false); + + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_SPEC", "", EValueType.TEXT.getValue(), "Used for providing the json Custom Resource description to apply", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_SPEC_APPLIED", "", EValueType.TEXT.getValue(), "Used for providing the json Custom Resource description as applied", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECK_FIELD", "", EValueType.TEXT.getValue(), "Used for providing the field that need to be checked for the resource status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_STANDBY", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the standby status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_ALARM", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the alarm status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_AVAILABLE", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the available status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_RESERVED", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the reserved status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_UNKNOWN", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the unknown status", false); + rsc.addResourceSpecificationCharacteristicItemShort( "_CR_CHECKVAL_SUSPENDED", "", EValueType.TEXT.getValue(), "Used for providing the equivalent value from resource to signal the suspended status", false); + +// rsc.addResourceSpecificationCharacteristicItemShort( "properties", "", EValueType.SET.getValue()); +// rsc.addResourceSpecificationCharacteristicItemShort( "additionalProperties", "", EValueType.SET.getValue()); + + + return rsc; + } + + @Override + public ResourceSpecificationUpdate toRSpecUpdate() { + return this.toRSpecCreate(); + } + + @Override + public KubernetesCRV1 fromRSpec(ResourceSpecification rSpec) { + osl_KUBCRV1_RSPEC_UUID = rSpec.getUuid(); + return this; + } + + @Override + public ResourceCreate toResourceCreate() { + + if (osl_KUBCRV1_RSPEC_UUID == null) { + return null; + } + + ResourceSpecificationRef rSpecRef = new ResourceSpecificationRef(); + rSpecRef.setId( osl_KUBCRV1_RSPEC_UUID ); + rSpecRef.setName( OSL_KUBCRV1_RSPEC_NAME ); + rSpecRef.setVersion( OSL_KUBCRV1_RSPEC_VERSION ); + + ResourceCreate rs = new ResourceCreate(); + rs.name( this.name ) + .category( this.category ) + .description( this.description ) + + .resourceStatus( ResourceStatusType.RESERVED ) + + .operationalState( ResourceOperationalStateType.ENABLE ) + .resourceSpecification( rSpecRef ) + .resourceVersion( this.version); + + rs.addResourceCharacteristicItemShort("clusterMasterURL", this.clusterMasterURL, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("currentContextCluster", this.currentContextCluster, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("fullResourceName", this.fullResourceName, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("Kind", this.kind, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("apiGroup", this.apiGroup, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("apiVersion", this.version , EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("UID", this.UID, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("namespace", this.namespace, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("metadata", this.metadata, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("yaml", this.yaml, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("json", this.json, EValueType.TEXT.getValue()); + + + rs.addResourceCharacteristicItemShort("_CR_SPEC_APPLIED", this.cr_spec_applied, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECK_FIELD", this.statusCheckFieldName, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_STANDBY", this.statusCheckValueStandby, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_ALARM", this.statusCheckValueAlarm, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_AVAILABLE", this.statusCheckValueAvailable, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_RESERVED", this.statusCheckValueReserved, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_UNKNOWN", this.statusCheckValueUnknown, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("_CR_CHECKVAL_SUSPENDED", this.statusCheckValueSuspended, EValueType.TEXT.getValue()); + + rs.resourceStatus( this.statusValue ); + + if (this.properties != null) + this.properties.forEach((kPropName, vProVal) -> { + rs.addResourceCharacteristicItemShort(kPropName , vProVal, EValueType.TEXT.getValue()); + + }); + + if (this.additionalProperties != null ) { + this.additionalProperties.forEach((kPropName, vProVal) -> { + rs.addResourceCharacteristicItemShort(kPropName, vProVal, EValueType.TEXT.getValue()); + + }); + } + + + return rs; + } + + @Override + public ResourceUpdate toResourceUpdate() { + + return this.toResourceCreate(); + } + +} diff --git a/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesContextDefinition.java b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesContextDefinition.java new file mode 100644 index 0000000000000000000000000000000000000000..c4f6a01987e8efe01f00b13e345b202ddda564f8 --- /dev/null +++ b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesContextDefinition.java @@ -0,0 +1,155 @@ +package org.etsi.osl.domain.model.kubernetes; + +import org.etsi.osl.domain.model.DomainModelDefinition; +import org.etsi.osl.domain.model.ITMFRCM634_ModelTransformer; +import org.etsi.osl.domain.model.ITMFRI639_ModelTransformer; +import org.etsi.osl.tmf.common.model.ELifecycle; +import org.etsi.osl.tmf.common.model.EValueType; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecification; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationCreate; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationUpdate; +import org.etsi.osl.tmf.ri639.model.ResourceCreate; +import org.etsi.osl.tmf.ri639.model.ResourceOperationalStateType; +import org.etsi.osl.tmf.ri639.model.ResourceStatusType; +import org.etsi.osl.tmf.ri639.model.ResourceUpdate; +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +/** + * @author ctranoris + */ +@Getter +@Setter +public class KubernetesContextDefinition + extends DomainModelDefinition + implements ITMFRCM634_ModelTransformer, ITMFRI639_ModelTransformer { + + + public static final String OSL_KUBD_RSPEC_NAME = "kubernetes-context-definition.openslice.io"; + public static final String OSL_KUBD_RSPEC_VERSION = "0.0.1"; + public static final String OSL_KUBD_RSPEC_CATEGORY = "KubernetesContextDefinition"; + public static final String OSL_KUBD_RESOURCE_CATEGORY = "KubernetesContextDefinition"; + public static final String OSL_KUBD_RSPEC_TYPE = "LogicalResourceSpecification"; + public static final String OSL_KUBD_RSPEC_DESCRIPTION = "This Specification is used to describe a KubernetesClient"; + + private String osl_KUBD_SPEC_UUID = null; //this is assigned by the system through the DB for a specific instance + + //properties of an instance + private String masterURL; + private String currentContextName; + private String currentContextCluster; + private String currentContextUser; + private String clusterVersion; + + + @Builder + public KubernetesContextDefinition(String osl_KUBD_SPEC_UUID, String uuid, String name, String version, String description, String category, + String masterURL, String currentContextName, String currentContextCluster, String currentContextUser, + String clusterVersion) { + super(uuid, name, version, description, category); + this.osl_KUBD_SPEC_UUID = osl_KUBD_SPEC_UUID; + this.masterURL = masterURL; + this.currentContextName = currentContextName; + this.currentContextCluster = currentContextCluster; + this.currentContextUser = currentContextUser; + this.clusterVersion = clusterVersion; + } + + + @Override + public ResourceSpecificationCreate toRSpecCreate_InitRepo() { + ResourceSpecificationCreate rsc = this.toRSpecCreate(); + rsc.setName( OSL_KUBD_RSPEC_NAME ); + rsc.setVersion( OSL_KUBD_RSPEC_VERSION ); + rsc.setCategory( OSL_KUBD_RSPEC_CATEGORY ); + rsc.setDescription( OSL_KUBD_RSPEC_DESCRIPTION ); + rsc.setType( OSL_KUBD_RSPEC_TYPE ); + rsc.setLifecycleStatus( ELifecycle.ACTIVE.getValue() ); + + return rsc; + + } + + @Override + public ResourceSpecificationCreate toRSpecCreate() { + ResourceSpecificationCreate rsc = new ResourceSpecificationCreate(); + rsc.setName( this.name ); + rsc.setVersion( this.version ); + rsc.setCategory( OSL_KUBD_RSPEC_CATEGORY ); + rsc.setDescription( this.description ); + rsc.setType( OSL_KUBD_RSPEC_TYPE ); + rsc.setLifecycleStatus( ELifecycle.ACTIVE.getValue() ); + rsc.addResourceSpecificationCharacteristicItemShort( "masterURL", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "resourceVersion", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "currentContextName", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "currentContextCluster", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "currentContextUser", "", EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort( "clusterVersion", "", EValueType.TEXT.getValue(), "", false); + return rsc; + + } + + @Override + public ResourceSpecificationUpdate toRSpecUpdate() { + return this.toRSpecCreate(); + } + + /* we care only for the ID of the specification from the stored model. The definition will be static + * (non-Javadoc) + * @see org.etsi.osl.domain.model.ITMFRCM634_ModelTransformer#fromRSpec(org.etsi.osl.tmf.rcm634.model.ResourceSpecification) + */ + @Override + public KubernetesContextDefinition fromRSpec(ResourceSpecification rSpec) { + osl_KUBD_SPEC_UUID = rSpec.getUuid(); + return this; + } + + + /* + * returns Null if OSL_KUBD_RSPEC_UUID is not initialized + * (non-Javadoc) + * @see org.etsi.osl.domain.model.ITMFRI639_ModelTransformer#toResourceCreate() + */ + @Override + public ResourceCreate toResourceCreate() throws Exception { + if (this.osl_KUBD_SPEC_UUID == null) { + throw new Exception( "osl_UUID is null. Resource cannot be created without referring a Resource specification" ); + + } + + ResourceSpecificationRef rSpecRef = new ResourceSpecificationRef(); + rSpecRef.setId( this.osl_KUBD_SPEC_UUID ); + rSpecRef.setName( OSL_KUBD_RSPEC_NAME ); + rSpecRef.setVersion( OSL_KUBD_RSPEC_VERSION ); + + ResourceCreate rs = new ResourceCreate(); + rs.setName( this.name ); + rs.setResourceStatus( ResourceStatusType.AVAILABLE ); + rs.setOperationalState( ResourceOperationalStateType.ENABLE); + rs.setCategory( OSL_KUBD_RESOURCE_CATEGORY ); + rs.setResourceSpecification(rSpecRef); + rs.resourceVersion( this.clusterVersion ); + + rs.addResourceCharacteristicItemShort("masterUrl", this.masterURL, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("currentContextName", this.currentContextName , EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("currentContextCluster", this.currentContextCluster , EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("currentContextUser", this.currentContextUser , EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("clusterVersion", this.clusterVersion , EValueType.TEXT.getValue()); + + + + + return rs; + } + + @Override + public ResourceUpdate toResourceUpdate() throws Exception { + return this.toResourceCreate(); + } + + + + +} diff --git a/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesSecret.java b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesSecret.java new file mode 100644 index 0000000000000000000000000000000000000000..820c777f39fcc275e8d3eea9d6b822313cd057cc --- /dev/null +++ b/src/main/java/org/etsi/osl/domain/model/kubernetes/KubernetesSecret.java @@ -0,0 +1,213 @@ +package org.etsi.osl.domain.model.kubernetes; + +import java.util.HashMap; +import java.util.Map; +import org.etsi.osl.domain.model.DomainModelDefinition; +import org.etsi.osl.domain.model.ITMFRCM634_ModelTransformer; +import org.etsi.osl.domain.model.ITMFRI639_ModelTransformer; +import org.etsi.osl.tmf.common.model.ELifecycle; +import org.etsi.osl.tmf.common.model.EValueType; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecification; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationCreate; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationRef; +import org.etsi.osl.tmf.rcm634.model.ResourceSpecificationUpdate; +import org.etsi.osl.tmf.ri639.model.ResourceCreate; +import org.etsi.osl.tmf.ri639.model.ResourceOperationalStateType; +import org.etsi.osl.tmf.ri639.model.ResourceStatusType; +import org.etsi.osl.tmf.ri639.model.ResourceUpdate; +import lombok.Builder; +import lombok.Getter; +import lombok.Setter; + +/** + * @author ctranoris + */ +@Getter +@Setter +public class KubernetesSecret extends DomainModelDefinition + implements ITMFRCM634_ModelTransformer, ITMFRI639_ModelTransformer { + + public static final String OSL_KUBSECRET_RSPEC_NAME = "kubernetes-secret.openslice.io"; + public static final String OSL_KUBSECRET_RSPEC_VERSION = "0.0.3"; + public static final String OSL_KUBSECRET_RSPEC_CATEGORY = "Secret/Kubernetes/v1"; + public static final String OSL_KUBSECRET_RESOURCE_CATEGORY = "Secret/Kubernetes/v1"; + public static final String OSL_KUBSECRET_RSPEC_TYPE = "LogicalResourceSpecification"; + public static final String OSL_KUBSECRET_RSPEC_DESCRIPTION = "This Specification is used to describe a generic Kubernetes Secret"; + + private String osl_KUBCRD_RSPEC_UUID = null; //this is assigned by the system through the DB for a specific instance + + private String clusterMasterURL; + private String currentContextCluster; + private String fullResourceName; + private String kind; + private String apiGroup; + private String UID; + private String metadata; + private String yaml; + private String json; + private String namespace; + + + private Map<String, String> data; + private String dataObj; + private Map<String, String> properties; + + + @Builder + public KubernetesSecret(String osl_KUBCRD_RSPEC_UUID, String uuid, String name, String version, String description, String category, + String clusterMasterURL, String currentContextCluster, String fullResourceName, String namespace, + String kind, String apiGroup, String uID, + String metadata, + String yaml, + String json) { + super(uuid, name, version, description, category); + this.osl_KUBCRD_RSPEC_UUID = osl_KUBCRD_RSPEC_UUID; + this.clusterMasterURL = clusterMasterURL; + this.currentContextCluster = currentContextCluster; + this.fullResourceName = fullResourceName; + this.kind = kind; + this.apiGroup = apiGroup; + this.namespace = namespace; + this.UID = uID; + this.metadata = metadata; + this.yaml = yaml; + this.json = json; + this.properties = new HashMap<>(); + this.data = new HashMap<>(); + this.category = OSL_KUBSECRET_RSPEC_CATEGORY; + } + + + + @Override + public ResourceSpecificationCreate toRSpecCreate_InitRepo() { + + ResourceSpecificationCreate rsc = this.toRSpecCreate(); + rsc.setName( OSL_KUBSECRET_RSPEC_NAME ); + rsc.setCategory( OSL_KUBSECRET_RSPEC_CATEGORY ); + rsc.setVersion(OSL_KUBSECRET_RSPEC_VERSION); + rsc.setDescription( OSL_KUBSECRET_RSPEC_DESCRIPTION ); + rsc.setType( OSL_KUBSECRET_RSPEC_TYPE ); + + + + return rsc; + } + + @Override + public ResourceSpecificationCreate toRSpecCreate() { + + ResourceSpecificationCreate rsc = new ResourceSpecificationCreate(); + rsc.setName( this.name ); + rsc.setCategory( OSL_KUBSECRET_RSPEC_CATEGORY ); + rsc.setVersion( this.version ); + rsc.setDescription( this.version ); + rsc.setType( OSL_KUBSECRET_RSPEC_TYPE ); + + rsc.setLifecycleStatus( ELifecycle.ACTIVE.getValue() ); + rsc.addResourceSpecificationCharacteristicItemShort("clusterMasterURL", this.clusterMasterURL, EValueType.TEXT.getValue(), "URL of cluster", false); + rsc.addResourceSpecificationCharacteristicItemShort("currentContextCluster", this.currentContextCluster, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("fullResourceName", this.fullResourceName, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("Kind", this.kind, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("apiGroup", this.apiGroup, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("UID", this.UID, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("metadata", this.metadata, EValueType.OBJECT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("yaml", this.yaml, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("json", this.json, EValueType.TEXT.getValue(), "", false); + rsc.addResourceSpecificationCharacteristicItemShort("data", this.dataObj, EValueType.OBJECT.getValue(), "", false); + + if (this.properties != null) + this.properties.forEach((kPropName, vProVal) -> { + EValueType etype; + etype = EValueType.TEXT; + rsc.addResourceSpecificationCharacteristicItemShort(kPropName , vProVal, etype.getValue(), "", false); + + }); + if (this.data != null) + this.data.forEach((kPropName, vProVal) -> { + EValueType etype; + etype = EValueType.TEXT; + rsc.addResourceSpecificationCharacteristicItemShort(kPropName , vProVal, etype.getValue(), "", false); + + }); + + + + return rsc; + } + + @Override + public ResourceSpecificationUpdate toRSpecUpdate() { + return this.toRSpecCreate(); + } + + @Override + public KubernetesSecret fromRSpec(ResourceSpecification rSpec) { + this.osl_KUBCRD_RSPEC_UUID = rSpec.getUuid(); + return this; + } + + @Override + public ResourceCreate toResourceCreate() { + + if (osl_KUBCRD_RSPEC_UUID == null) { + return null; + } + + ResourceSpecificationRef rSpecRef = new ResourceSpecificationRef(); + rSpecRef.setId( osl_KUBCRD_RSPEC_UUID ); + rSpecRef.setName( OSL_KUBSECRET_RSPEC_NAME ); + rSpecRef.setVersion( OSL_KUBSECRET_RSPEC_VERSION ); + + ResourceCreate rs = new ResourceCreate(); + rs.name( this.name ) + .category( OSL_KUBSECRET_RESOURCE_CATEGORY ) + .description( this.description ) + .resourceStatus( ResourceStatusType.AVAILABLE ) + .operationalState( ResourceOperationalStateType.ENABLE ) + .resourceSpecification( rSpecRef ) + .resourceVersion( this.version); + + rs.addResourceCharacteristicItemShort("clusterMasterURL", this.clusterMasterURL, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("currentContextCluster", this.currentContextCluster, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("fullResourceName", this.fullResourceName, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("Kind", this.kind, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("apiGroup", this.apiGroup, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("UID", this.UID, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("metadata", this.metadata, EValueType.OBJECT.getValue()); + rs.addResourceCharacteristicItemShort("yaml", this.yaml, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("json", this.json, EValueType.TEXT.getValue()); + rs.addResourceCharacteristicItemShort("data", this.dataObj, EValueType.OBJECT.getValue()); + + + + + if (this.properties != null) + this.properties.forEach((kPropName, vProVal) -> { + EValueType etype; + etype = EValueType.TEXT; + + rs.addResourceCharacteristicItemShort(kPropName , vProVal, etype.getValue()); + + }); + if (this.data != null) + this.data.forEach((kPropName, vProVal) -> { + EValueType etype; + etype = EValueType.TEXT; + rs.addResourceCharacteristicItemShort(kPropName , vProVal, etype.getValue()); + + }); + + + + + return rs; + } + + @Override + public ResourceUpdate toResourceUpdate() { + + return this.toResourceCreate(); + } + +} diff --git a/target/.gitignore b/target/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..840e7d3120ee3206168d49bf62df2c269c38e17e --- /dev/null +++ b/target/.gitignore @@ -0,0 +1 @@ +/classes/