Skip to content

Commit

Permalink
Merge pull request #8368 from mandy-chessell/oak2024
Browse files Browse the repository at this point in the history
Add GovernanceActionProcessInstance when governance action process runs
  • Loading branch information
mandy-chessell committed Sep 1, 2024
2 parents fd82322 + fd00972 commit 02f5722
Show file tree
Hide file tree
Showing 29 changed files with 996 additions and 203 deletions.
2 changes: 1 addition & 1 deletion CoreContentPackGUIDMap.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoBusinessSystemsArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoClinicalTrialsTemplatesArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoComboArchive.omarchive

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoGovernanceProgramArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoOrganizationArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoSustainabilityArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoTypesArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CoreContentPack.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/OpenMetadataTypes.omarchive

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,49 @@ POST {{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-pl



###
# @name findGovernanceActionProcesses (Clinical Trials)
# Retrieve the list of governance action type metadata elements that contain the search string.
POST {{baseURL}}/servers/{{viewServer}}/api/open-metadata/automated-curation/governance-action-processes/by-search-string?startFrom=0&pageSize=0&startsWith=false&endsWith=false&ignoreCase=true
Authorization: Bearer {{token}}
Content-Type: application/json

{
"filter" : "UnityCatalog"
}

###
# @name initiate catalog-unity-catalog-server
# @name initiateGovernanceActionProcess UnityCatalogServer:CreateAndSurveyGovernanceActionProcess
# Using the named governance action process as a template, initiate a chain of engine actions.

POST {{baseURL}}/servers/{{viewServer}}/api/open-metadata/automated-curation/governance-action-processes/initiate
Authorization: Bearer {{token}}
Content-Type: application/json

{
"processQualifiedName": "UnityCatalogServer:CreateAndCatalogGovernanceActionProcess",
"requestParameters" : {
"hostURL" : "http://localhost",
"portNumber" : "8080",
"serverName" : "Unity Catalog 1",
"versionIdentifier" : "V1.0",
"description" : "First instance of the Unity Catalog (UC) Server.",
"serverUserId" : "uc1"
}
}



###
# @name initiate create-unity-catalog-server
# Using the named governance action type as a template, initiate a single engine action.
POST {{baseURL}}/servers/{{viewServer}}/api/open-metadata/automated-curation/governance-action-types/initiate
Authorization: Bearer {{token}}
Content-Type: application/json

{
"class" : "InitiateGovernanceActionTypeRequestBody",
"governanceActionTypeQualifiedName": "UnityCatalogGovernanceServices:catalog-unity-catalog-server",
"governanceActionTypeQualifiedName": "UnityCatalogGovernanceServices:create-unity-catalog-server",
"requestParameters" : {
"hostURL" : "http://localhost",
"portNumber" : "8080",
Expand All @@ -113,6 +145,24 @@ Content-Type: application/json
}



###
# @name initiate catalog-unity-catalog-server
# Using the named governance action type as a template, initiate a single engine action.
POST {{baseURL}}/servers/{{viewServer}}/api/open-metadata/automated-curation/governance-action-types/initiate
Authorization: Bearer {{token}}
Content-Type: application/json

{
"class" : "InitiateGovernanceActionTypeRequestBody",
"governanceActionTypeQualifiedName": "UnityCatalogGovernanceServices:catalog-unity-catalog-server",
"actionTargets" : [{
"class" : "NewActionTarget",
"actionTargetName": "newAsset",
"actionTargetGUID": "db2f9013-90dd-4085-ab08-e9c419f41aa1"
}]
}

###
# @name createElementFromTemplate (Unity Catalog Server 1)
# Create a new element from a template.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,27 @@ public enum GovernanceActionConnectorsAuditCode implements AuditLogMessageSet
"The governance action service has completed the setup of the integration connector. It will exit with a completion status of ACTIONED.",
"Check that the integration connector is able to contact the server and the cataloguing is operating as expected."),


/**
* GOVERNANCE-ACTION-CONNECTORS-0033 - The {0} governance action service has not been passed a {1} action target
*/
MISSING_ACTION_TARGET("GOVERNANCE-ACTION-CONNECTORS-0033",
AuditLogRecordSeverityLevel.ERROR,
"The {0} governance action service has not been passed a {1} action target",
"The governance action service returns an INVALID completion status.",
"This is an error in the way that the governance action service has been called since a vital piece of information is missing." +
"Identify the way it was called which could be a direct invocation through the initiateGovernanceAction() method," +
"or as part of a governance action process. Then correct this approach so that this action target is set up."),

/**
* GOVERNANCE-ACTION-CONNECTORS-0034 - The {0} governance action service has created a new {1} asset called {2} ({3})
*/
NEW_ASSET_CREATED("GOVERNANCE-ACTION-CONNECTORS-0034",
AuditLogRecordSeverityLevel.INFO,
"The {0} governance action service has created a new {1} asset called {2} ({3})",
"The governance action service returns an ACTIONED completion status.",
"Ensure follow-on uses of the asset are successful."),

;

private final String logMessageId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ public synchronized void start() throws ConnectorCheckedException
List<NewActionTarget> outputActionTargets = new ArrayList<>();
CompletionStatus completionStatus;
AuditLogMessageDefinition messageDefinition;

ActionTargetElement integrationConnector = null;
String templateGUID;
String newAssetGUID = null;

if (governanceContext.getActionTargetElements() != null)
{
Expand All @@ -69,41 +70,29 @@ public synchronized void start() throws ConnectorCheckedException
{
integrationConnector = actionTargetElement;
}
else if (ActionTarget.NEW_ASSET.getName().equals(actionTargetElement.getActionTargetName()))
{
newAssetGUID = actionTargetElement.getActionTargetGUID();
}
}
}
}

templateGUID = getProperty(CatalogServerRequestParameter.TEMPLATE_GUID.getName(), null);


if (integrationConnector == null)
{
messageDefinition = GovernanceActionConnectorsAuditCode.NO_CONNECTOR.getMessageDefinition(governanceServiceName);
outputGuards.add(CatalogServerGuard.MISSING_CONNECTOR.getName());
completionStatus = CatalogServerGuard.MISSING_CONNECTOR.getCompletionStatus();
}
else if (templateGUID == null)
else if (newAssetGUID == null)
{
messageDefinition = GovernanceActionConnectorsAuditCode.NO_TEMPLATE_GUID.getMessageDefinition(governanceServiceName);
outputGuards.add(CatalogServerGuard.MISSING_TEMPLATE.getName());
completionStatus = CatalogServerGuard.MISSING_TEMPLATE.getCompletionStatus();
messageDefinition = GovernanceActionConnectorsAuditCode.MISSING_ACTION_TARGET.getMessageDefinition(governanceServiceName, ActionTarget.NEW_ASSET.getName());
outputGuards.add(CatalogServerGuard.MISSING_ASSET.getName());
completionStatus = CatalogServerGuard.MISSING_ASSET.getCompletionStatus();
}
else
{
String serverGUID = governanceContext.getOpenMetadataStore().createMetadataElementFromTemplate(null,
null,
true,
null,
null,
templateGUID,
null,
governanceContext.getRequestParameters(),
null,
null,
null,
true);

OpenMetadataElement serverElement = governanceContext.getOpenMetadataStore().getMetadataElementByGUID(serverGUID);
OpenMetadataElement serverElement = governanceContext.getOpenMetadataStore().getMetadataElementByGUID(newAssetGUID);

String serverName = propertyHelper.getStringProperty(governanceServiceName,
OpenMetadataProperty.NAME.name,
Expand All @@ -126,7 +115,7 @@ else if (templateGUID == null)

governanceContext.getOpenMetadataStore().createRelatedElementsInStore(OpenMetadataType.CATALOG_TARGET_RELATIONSHIP_TYPE_NAME,
integrationConnector.getTargetElement().getElementGUID(),
serverGUID,
newAssetGUID,
null,
null,
catalogTargetProperties);
Expand All @@ -135,13 +124,6 @@ else if (templateGUID == null)
serverType,
serverName);

NewActionTarget newActionTarget = new NewActionTarget();

newActionTarget.setActionTargetGUID(serverGUID);
newActionTarget.setActionTargetName(ActionTarget.NEW_ASSET.name);

outputActionTargets.add(newActionTarget);

completionStatus = CatalogServerGuard.SET_UP_COMPLETE.getCompletionStatus();
outputGuards.add(CatalogServerGuard.SET_UP_COMPLETE.getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

package org.odpi.openmetadata.adapters.connectors.governanceactions.stewardship;

import org.odpi.openmetadata.frameworks.connectors.controls.SupportedTechnologyType;
import org.odpi.openmetadata.frameworks.connectors.properties.beans.ConnectorType;
import org.odpi.openmetadata.frameworks.governanceaction.GovernanceActionServiceProviderBase;
import org.odpi.openmetadata.frameworks.governanceaction.controls.ActionTarget;
import org.odpi.openmetadata.frameworks.governanceaction.controls.ActionTargetType;
import org.odpi.openmetadata.frameworks.openmetadata.refdata.DeployedImplementationType;

import java.util.Arrays;

Expand All @@ -19,7 +21,7 @@ public class CatalogServerGovernanceActionProvider extends GovernanceActionServi
private static final String connectorTypeGUID = "e55f9c8d-188e-4ffd-b9c8-fe980fefa7cf";
private static final String connectorTypeQualifiedName = "Egeria:GovernanceActionService:Stewardship:CatalogServer";
private static final String connectorTypeDisplayName = "Catalog Server Governance Action Service";
private static final String connectorTypeDescription = "Governance Action Service that creates an asset that represents a server and attaches it to the appropriate integration connector as a catalog target.";
private static final String connectorTypeDescription = "Governance Action Service that attaches a software server entity it to the appropriate integration connector as a catalog target.";

private static final String connectorClassName = CatalogServerGovernanceActionConnector.class.getName();

Expand All @@ -32,7 +34,7 @@ public CatalogServerGovernanceActionProvider()
{
super();

super.supportedRequestParameters = CatalogServerRequestParameter.getRequestParameterTypes();
super.supportedRequestParameters = CreateServerRequestParameter.getRequestParameterTypes();
super.producedGuards = CatalogServerGuard.getGuardTypes();
super.supportedActionTargetTypes = Arrays.asList(new ActionTargetType[]{ActionTarget.INTEGRATION_CONNECTOR.getActionTargetType()});
super.producedActionTargetTypes = Arrays.asList(new ActionTargetType[]{ActionTarget.NEW_ASSET.getActionTargetType()});
Expand All @@ -50,5 +52,7 @@ public CatalogServerGovernanceActionProvider()
connectorType.setSupportedDeployedImplementationType(supportedDeployedImplementationType);

super.connectorTypeBean = connectorType;

super.supportedTechnologyTypes = SupportedTechnologyType.getSupportedTechnologyTypes(new DeployedImplementationType[]{DeployedImplementationType.SOFTWARE_SERVER});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public enum CatalogServerGuard
{
SET_UP_COMPLETE("set-up-complete", CompletionStatus.ACTIONED, "The integration connector has been configured with the server information as a catalog target."),
MISSING_TEMPLATE("missing-template", CompletionStatus.INVALID, "The templateGUID request parameter has not been supplied."),
MISSING_ASSET("missing-asset", CompletionStatus.INVALID, "The 'newAsset' asset has not been supplied."),
MISSING_CONNECTOR("missing-connector", CompletionStatus.INVALID, "The integrationConnector has not been supplied."),
SERVICE_FAILED("service-failed", CompletionStatus.FAILED, "An unexpected error occurred while the governance service was running. Messages are logged to the audit log explaining the source of the error."),
;
Expand Down
Loading

0 comments on commit 02f5722

Please sign in to comment.