Search in sources :

Example 1 with ServiceAccount

use of com.openshift.cloud.api.connector.models.ServiceAccount in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ConnectorsApiClientImpl method createConnector.

@Override
public Connector createConnector(ConnectorEntity connectorEntity) {
    ConnectorRequest createConnectorRequest = new ConnectorRequest();
    String newConnectorName = connectorEntity.getName();
    createConnectorRequest.setName(newConnectorName);
    DeploymentLocation deploymentLocation = new DeploymentLocation();
    deploymentLocation.setKind("addon");
    deploymentLocation.setClusterId(mcClusterId);
    createConnectorRequest.setDeploymentLocation(deploymentLocation);
    String connectorType = connectorEntity.getConnectorType();
    JsonNode payload = connectorEntity.getDefinition();
    createConnectorRequest.setConnectorTypeId(connectorType);
    createConnectorRequest.setConnector(payload);
    ServiceAccount serviceAccount = new ServiceAccount();
    serviceAccount.setClientId(serviceAccountId);
    serviceAccount.setClientSecret(serviceAccountSecret);
    createConnectorRequest.setServiceAccount(serviceAccount);
    KafkaConnectionSettings kafka = new KafkaConnectionSettings();
    kafka.setUrl(kafkaBootstrapServer);
    // https://issues.redhat.com/browse/MGDOBR-198
    // this is currently ignored in the Connectors API
    kafka.setId(KAFKA_ID_IGNORED);
    createConnectorRequest.setKafka(kafka);
    return createConnector(createConnectorRequest);
}
Also used : ServiceAccount(com.openshift.cloud.api.connector.models.ServiceAccount) ConnectorRequest(com.openshift.cloud.api.connector.models.ConnectorRequest) JsonNode(com.fasterxml.jackson.databind.JsonNode) DeploymentLocation(com.openshift.cloud.api.connector.models.DeploymentLocation) KafkaConnectionSettings(com.openshift.cloud.api.connector.models.KafkaConnectionSettings)

Example 2 with ServiceAccount

use of com.openshift.cloud.api.connector.models.ServiceAccount in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ConnectorsApiClientImpl method createConnector.

@Override
public Connector createConnector(ConnectorEntity connectorEntity) {
    ConnectorRequest createConnectorRequest = new ConnectorRequest();
    String newConnectorName = connectorEntity.getName();
    createConnectorRequest.setName(newConnectorName);
    createConnectorRequest.setNamespaceId(mcNamespaceId);
    String connectorTypeId = connectorEntity.getConnectorTypeId();
    JsonNode payload = connectorEntity.getDefinition();
    createConnectorRequest.setConnectorTypeId(connectorTypeId);
    createConnectorRequest.setConnector(payload);
    ServiceAccount serviceAccount = new ServiceAccount();
    serviceAccount.setClientId(serviceAccountId);
    serviceAccount.setClientSecret(serviceAccountSecret);
    createConnectorRequest.setServiceAccount(serviceAccount);
    KafkaConnectionSettings kafka = new KafkaConnectionSettings();
    kafka.setUrl(kafkaBootstrapServer);
    // https://issues.redhat.com/browse/MGDOBR-198
    // this is currently ignored in the Connectors API
    kafka.setId(KAFKA_ID_IGNORED);
    createConnectorRequest.setKafka(kafka);
    return createConnector(createConnectorRequest);
}
Also used : ServiceAccount(com.openshift.cloud.api.connector.models.ServiceAccount) ConnectorRequest(com.openshift.cloud.api.connector.models.ConnectorRequest) JsonNode(com.fasterxml.jackson.databind.JsonNode) KafkaConnectionSettings(com.openshift.cloud.api.connector.models.KafkaConnectionSettings)

Aggregations

JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ConnectorRequest (com.openshift.cloud.api.connector.models.ConnectorRequest)2 KafkaConnectionSettings (com.openshift.cloud.api.connector.models.KafkaConnectionSettings)2 ServiceAccount (com.openshift.cloud.api.connector.models.ServiceAccount)2 DeploymentLocation (com.openshift.cloud.api.connector.models.DeploymentLocation)1