Search in sources :

Example 1 with IncompleteConnectorSpecException

use of org.bf2.cos.fleetshard.operator.connector.IncompleteConnectorSpecException in project cos-fleetshard by bf2fc6cc711aee1a0c2a.

the class AbstractOperandController method reify.

@Override
public List<HasMetadata> reify(ManagedConnector connector, Secret secret) {
    LOGGER.debug("Reifying connector: {} and secret.metadata: {}", connector, secret.getMetadata());
    final ServiceAccount serviceAccountSettings = extract(secret, SECRET_ENTRY_SERVICE_ACCOUNT, ServiceAccount.class);
    LOGGER.debug("Extracted serviceAccount {}", serviceAccountSettings == null ? "is null" : "with clientId: " + serviceAccountSettings.getClientId());
    ServiceAccountSpec sas = serviceAccountSettings == null ? new ServiceAccountSpecBuilder().build() : new ServiceAccountSpecBuilder().withClientId(serviceAccountSettings.getClientId()).withClientSecret(serviceAccountSettings.getClientSecret()).build();
    ConnectorConfiguration<S> connectorConfig;
    try {
        connectorConfig = new ConnectorConfiguration<>(extract(secret, SECRET_ENTRY_CONNECTOR, ObjectNode.class), connectorSpecType);
    } catch (IncompleteConnectorSpecException e) {
        throw new RuntimeException("Incomplete connectorSpec for connector \"" + connector.getSpec().getConnectorId() + "@" + connector.getSpec().getDeploymentId() + "#" + connector.getSpec().getDeployment().getDeploymentResourceVersion() + "\": " + e.getLocalizedMessage(), e);
    }
    return doReify(connector, extract(secret, SECRET_ENTRY_META, metadataType), connectorConfig, sas);
}
Also used : IncompleteConnectorSpecException(org.bf2.cos.fleetshard.operator.connector.IncompleteConnectorSpecException) ServiceAccount(org.bf2.cos.fleet.manager.model.ServiceAccount) ServiceAccountSpec(org.bf2.cos.fleetshard.api.ServiceAccountSpec) ServiceAccountSpecBuilder(org.bf2.cos.fleetshard.api.ServiceAccountSpecBuilder)

Aggregations

ServiceAccount (org.bf2.cos.fleet.manager.model.ServiceAccount)1 ServiceAccountSpec (org.bf2.cos.fleetshard.api.ServiceAccountSpec)1 ServiceAccountSpecBuilder (org.bf2.cos.fleetshard.api.ServiceAccountSpecBuilder)1 IncompleteConnectorSpecException (org.bf2.cos.fleetshard.operator.connector.IncompleteConnectorSpecException)1