Compare commits
3 Commits
1.18.0-alp
...
main
Author | SHA1 | Date |
---|---|---|
|
0f737991a8 | |
|
0568ba97c6 | |
|
a7c2105af2 |
|
@ -11,10 +11,12 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that helps with the extra resources map and also to create ResourceSelector in order to get extra resources
|
* Class that helps with the extra resources map and also to create ResourceSelector in order to get extra resources
|
||||||
* to the function
|
* to the function
|
||||||
|
@ -56,6 +58,39 @@ public class CrossplaneExtraResourcesService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getConnectionDetails(Map<String, Resources> extraResources, String resourceName) {
|
||||||
|
List<Map<String, String>> resources = getConnectionDetails(extraResources, resourceName, 1);
|
||||||
|
|
||||||
|
if (resources.isEmpty()) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
return resources.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Map<String, String>> getConnectionDetails(Map<String, Resources> extraResources, String resourceName, int expectedResources) {
|
||||||
|
List<Map<String, String>> result = new ArrayList<>();
|
||||||
|
Resources resources = extraResources.get(resourceName);
|
||||||
|
|
||||||
|
if (resources != null && resources.getItemsCount() == expectedResources) {
|
||||||
|
for (int i = 0; i < expectedResources; i++) {
|
||||||
|
try {
|
||||||
|
logger.debug("We have connectiondetails " + resourceName);
|
||||||
|
Map<String, String> currentDetails = new HashMap<>();
|
||||||
|
resources.getItems(i).getConnectionDetailsMap().forEach((key, value) ->
|
||||||
|
currentDetails.put(key, value.toStringUtf8())
|
||||||
|
);
|
||||||
|
result.add(currentDetails);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new CrossplaneUnmarshallException("Error when unmarshalling the connectionDetails", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Map<String, ResourceSelector> createExtraResourcesSelector(String resourceName, HasMetadata type) {
|
public Map<String, ResourceSelector> createExtraResourcesSelector(String resourceName, HasMetadata type) {
|
||||||
ResourceSelector resourceSelector = ResourceSelector.newBuilder()
|
ResourceSelector resourceSelector = ResourceSelector.newBuilder()
|
||||||
.setApiVersion(type.getApiVersion())
|
.setApiVersion(type.getApiVersion())
|
||||||
|
|
|
@ -9,6 +9,8 @@ import io.fabric8.kubernetes.client.utils.Serialization;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,4 +44,22 @@ public class CrossplaneObservableService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getObservableConnectionDetails(String resourceName, State observedState) {
|
||||||
|
Resource observedResource = observedState.getResourcesOrDefault(resourceName, null);
|
||||||
|
Map<String, String> result = new HashMap<>();
|
||||||
|
if (observedResource != null) {
|
||||||
|
try {
|
||||||
|
logger.debug("We have an observed connectionDetails for " + resourceName);
|
||||||
|
observedResource.getConnectionDetailsMap().forEach((key, value) ->
|
||||||
|
result.put(key, value.toStringUtf8())
|
||||||
|
);
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
throw new CrossplaneUnmarshallException("Error when unmarshalling the connectionDetails for " + resourceName, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
<central-publishing-maven-plugin.version>0.4.0</central-publishing-maven-plugin.version>
|
<central-publishing-maven-plugin.version>0.4.0</central-publishing-maven-plugin.version>
|
||||||
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
|
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
|
||||||
<maven-javadoc-plugin.version>3.7.0</maven-javadoc-plugin.version>
|
<maven-javadoc-plugin.version>3.7.0</maven-javadoc-plugin.version>
|
||||||
|
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
|
||||||
<maven-gpg-plugin.version>3.2.4</maven-gpg-plugin.version>
|
<maven-gpg-plugin.version>3.2.4</maven-gpg-plugin.version>
|
||||||
<build-helper-maven-plugin.version>3.6.0</build-helper-maven-plugin.version>
|
<build-helper-maven-plugin.version>3.6.0</build-helper-maven-plugin.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -106,6 +107,11 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>${maven-jar-plugin.version}</version>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>io.crossplane.providers</groupId>
|
<groupId>io.crossplane.providers</groupId>
|
||||||
<artifactId>crossplane-providers-parent</artifactId>
|
<artifactId>crossplane-providers-parent</artifactId>
|
||||||
<version>1.17.0-charlie</version>
|
<version>1.18.0-charlie</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>crossplane-provider-kubernetes-model</artifactId>
|
<artifactId>crossplane-provider-kubernetes-model</artifactId>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>io.crossplane.providers</groupId>
|
<groupId>io.crossplane.providers</groupId>
|
||||||
<artifactId>crossplane-providers-parent</artifactId>
|
<artifactId>crossplane-providers-parent</artifactId>
|
||||||
<version>1.17.0-charlie</version>
|
<version>1.18.0-charlie</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>crossplane-provider-terraform-model</artifactId>
|
<artifactId>crossplane-provider-terraform-model</artifactId>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>io.crossplane.providers</groupId>
|
<groupId>io.crossplane.providers</groupId>
|
||||||
<artifactId>crossplane-providers-parent</artifactId>
|
<artifactId>crossplane-providers-parent</artifactId>
|
||||||
<version>1.17.0-charlie</version>
|
<version>1.18.0-charlie</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>crossplane-provider-upjet-aws-model</artifactId>
|
<artifactId>crossplane-provider-upjet-aws-model</artifactId>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>io.crossplane.providers</groupId>
|
<groupId>io.crossplane.providers</groupId>
|
||||||
<artifactId>crossplane-providers-parent</artifactId>
|
<artifactId>crossplane-providers-parent</artifactId>
|
||||||
<version>1.17.0-charlie</version>
|
<version>1.18.0-charlie</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>crossplane-provider-upjet-azure-model</artifactId>
|
<artifactId>crossplane-provider-upjet-azure-model</artifactId>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>io.crossplane.providers</groupId>
|
<groupId>io.crossplane.providers</groupId>
|
||||||
<artifactId>crossplane-providers-parent</artifactId>
|
<artifactId>crossplane-providers-parent</artifactId>
|
||||||
<version>1.17.0-charlie</version>
|
<version>1.18.0-charlie</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>crossplane-provider-upjet-azuread-model</artifactId>
|
<artifactId>crossplane-provider-upjet-azuread-model</artifactId>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>io.crossplane.providers</groupId>
|
<groupId>io.crossplane.providers</groupId>
|
||||||
<artifactId>crossplane-providers-parent</artifactId>
|
<artifactId>crossplane-providers-parent</artifactId>
|
||||||
<version>1.17.0-charlie</version>
|
<version>1.18.0-charlie</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>crossplane-provider-upjet-gcp-model</artifactId>
|
<artifactId>crossplane-provider-upjet-gcp-model</artifactId>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>io.crossplane.providers</groupId>
|
<groupId>io.crossplane.providers</groupId>
|
||||||
<artifactId>crossplane-providers-parent</artifactId>
|
<artifactId>crossplane-providers-parent</artifactId>
|
||||||
<version>1.17.0-charlie</version>
|
<version>1.18.0-charlie</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>crossplane-provider-upjet-github-model</artifactId>
|
<artifactId>crossplane-provider-upjet-github-model</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue