Skip to content

Commit

Permalink
Add interface method (#2742)
Browse files Browse the repository at this point in the history
* Cleanup ownership parsing

* Add function activator metadata generator

* remove comment

* Add interface method
  • Loading branch information
Yasirmod17 authored Apr 2, 2024
1 parent bca2018 commit 3d4c9a4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.finos.legend.engine.protocol.bigqueryFunction.deployment.BigQueryFunctionDeploymentConfiguration;
import org.finos.legend.engine.protocol.bigqueryFunction.deployment.BigQueryFunctionDeploymentResult;
import org.finos.legend.engine.protocol.functionActivator.deployment.FunctionActivatorArtifact;
import org.finos.legend.engine.protocol.functionActivator.deployment.FunctionActivatorDeploymentConfiguration;
import org.finos.legend.engine.shared.core.identity.Identity;
import org.finos.legend.pure.generated.Root_meta_external_function_activator_bigQueryFunction_BigQueryFunctionDeploymentConfiguration;
import org.finos.legend.pure.generated.Root_meta_pure_alloy_connections_alloy_specification_BigQueryDatasourceSpecification;
Expand All @@ -41,6 +42,11 @@ public class BigQueryFunctionDeploymentManager implements DeploymentManager<BigQ
{
private static final Logger LOGGER = LoggerFactory.getLogger(BigQueryFunctionDeploymentManager.class);

public List<BigQueryFunctionDeploymentConfiguration> selectConfig(List<FunctionActivatorDeploymentConfiguration> availableConfigs)
{
return Lists.mutable.withAll(availableConfigs).selectInstancesOf(BigQueryFunctionDeploymentConfiguration.class);
}

@Override
public boolean canDeploy(FunctionActivatorArtifact activatorArtifact)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
public interface DeploymentManager<U extends FunctionActivatorArtifact, V extends DeploymentResult, W extends FunctionActivatorDeploymentConfiguration>
{

public List<W> selectConfig(List<FunctionActivatorDeploymentConfiguration> availableConfigs);

public V deploy(Identity identity, U artifact);

public V deploy(Identity identity, U artifact, List<W> availableRuntimeConfigurations);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.eclipse.collections.api.list.MutableList;
import org.finos.legend.engine.functionActivator.deployment.DeploymentManager;
import org.finos.legend.engine.protocol.functionActivator.deployment.FunctionActivatorArtifact;
import org.finos.legend.engine.protocol.functionActivator.deployment.FunctionActivatorDeploymentConfiguration;
import org.finos.legend.engine.protocol.hostedService.deployment.*;
import org.finos.legend.engine.shared.core.ObjectMapperFactory;
import org.finos.legend.engine.shared.core.identity.Identity;
Expand All @@ -50,6 +51,11 @@ public boolean canDeploy(FunctionActivatorArtifact element)
return element instanceof HostedServiceArtifact;
}

public List<HostedServiceDeploymentConfiguration> selectConfig(List<FunctionActivatorDeploymentConfiguration> availableConfigs)
{
return Lists.mutable.withAll(availableConfigs).selectInstancesOf(HostedServiceDeploymentConfiguration.class);
}

public HostedServiceDeploymentResult deploy(Identity identity, HostedServiceArtifact artifact)
{
return doDeploy(identity, (HostedServiceDeploymentConfiguration) artifact.deploymentConfiguration, artifact);
Expand Down Expand Up @@ -96,8 +102,10 @@ public HostedServiceDeploymentResult doDeploy(Identity identity, HostedServiceDe
}
else
{
HostedServiceDeploymentResult responseResult = mapper.readValue(EntityUtils.toString(response.getEntity()), HostedServiceDeploymentResult.class);
result.deployed = responseResult.deployed;
result.successful = true;
result.deploymentLocation = buildDeployStub(deployConf, artifact);
result.deploymentLocation = responseResult.deploymentLocation;
}
return "done";
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.finos.legend.engine.functionActivator.deployment.DeploymentManager;
import org.finos.legend.engine.protocol.functionActivator.deployment.FunctionActivatorArtifact;
import org.finos.legend.engine.language.snowflakeApp.api.SnowflakeAppDeploymentTool;
import org.finos.legend.engine.protocol.functionActivator.deployment.FunctionActivatorDeploymentConfiguration;
import org.finos.legend.engine.protocol.snowflakeApp.deployment.SnowflakeAppArtifact;
import org.finos.legend.engine.protocol.snowflakeApp.deployment.SnowflakeAppDeploymentConfiguration;
import org.finos.legend.engine.protocol.snowflakeApp.deployment.SnowflakeAppContent;
Expand Down Expand Up @@ -72,6 +73,11 @@ public SnowflakeAppDeploymentManager(PlanExecutor planExecutor)
connectionManager = ((RelationalStoreState)planExecutor.getExtraExecutors().select(c -> c instanceof RelationalStoreExecutor).getFirst().getStoreState()).getRelationalExecutor().getConnectionManager();
}

public List<SnowflakeAppDeploymentConfiguration> selectConfig(List<FunctionActivatorDeploymentConfiguration> availableConfigs)
{
return org.eclipse.collections.api.factory.Lists.mutable.withAll(availableConfigs).selectInstancesOf(SnowflakeAppDeploymentConfiguration.class);
}

@Override
public boolean canDeploy(FunctionActivatorArtifact artifact)
{
Expand Down

0 comments on commit 3d4c9a4

Please sign in to comment.