diff --git a/Cargo.lock b/Cargo.lock index 6df989ce..b4967e9b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -80,7 +80,7 @@ dependencies = [ ] [[package]] -name = "action-workflow-delete" +name = "action-user-login" version = "0.1.0" dependencies = [ "actions-common 0.1.0 (git+https://github.com/hugobyte/aurras?rev=1f7e117)", @@ -88,7 +88,7 @@ dependencies = [ "chesterfield", "chrono", "jsonwebtoken", - "openwhisk-client-rust 0.1.7", + "reqwest 0.11.11", "serde", "serde_derive", "serde_json", @@ -97,15 +97,13 @@ dependencies = [ ] [[package]] -name = "action-workflow-management" +name = "action-user-registartion" version = "0.1.0" dependencies = [ "actions-common 0.1.0 (git+https://github.com/hugobyte/aurras?rev=1f7e117)", "bcrypt", "chesterfield", - "chrono", - "jsonwebtoken", - "openwhisk-client-rust 0.1.7", + "reqwest 0.11.11", "serde", "serde_derive", "serde_json", @@ -114,15 +112,28 @@ dependencies = [ ] [[package]] -name = "action-workflow-registartion" +name = "action-workflow-invoker" +version = "0.1.0" +dependencies = [ + "actions-common 0.1.0 (git+https://github.com/hugobyte/aurras?rev=1f7e117)", + "chesterfield", + "reqwest 0.11.11", + "serde", + "serde_derive", + "serde_json", + "tokio 1.19.2", + "uuid 0.8.2", +] + +[[package]] +name = "action-workflow-mngmnt" version = "0.1.0" dependencies = [ "actions-common 0.1.0 (git+https://github.com/hugobyte/aurras?rev=1f7e117)", "bcrypt", "chesterfield", - "chrono", "jsonwebtoken", - "openwhisk-client-rust 0.1.7", + "reqwest 0.11.11", "serde", "serde_derive", "serde_json", @@ -131,7 +142,7 @@ dependencies = [ ] [[package]] -name = "action-workflow-update-rule" +name = "action-workflow-registartion" version = "0.1.0" dependencies = [ "actions-common 0.1.0 (git+https://github.com/hugobyte/aurras?rev=1f7e117)", @@ -2432,8 +2443,7 @@ dependencies = [ [[package]] name = "openwhisk-client-rust" version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d54a2db242ff8a9d83f58e1aa61efa972315ee5ba3b5eb11ebb1fb5bf92ecba" +source = "git+https://github.com/HugoByte/openwhisk-client-rust.git#75ebaaa272d95e6112d097ae1e36e33b7ad52304" dependencies = [ "async-std", "base64 0.13.0", diff --git a/Cargo.toml b/Cargo.toml index 8a7ee154..52bf15bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,11 +7,11 @@ members = [ "actions/push-notification", "actions/event-receiver", "actions/substrate-event-processor", - "actions/user_registration", - "actions/user_login", + "actions/user-registration", + "actions/user-login", "actions/workflow-invoker", - "actions/workflow_management", - "actions/workflow_registration", + "actions/workflow-management", + "actions/workflow-registration", "workflow/openwhisk_macro", "workflow/workflow_macro", "workflow/polkadot_macro", diff --git a/actions/push-notification/deploy.sh b/actions/push-notification/deploy.sh index 37a6014c..a7ffd516 100755 --- a/actions/push-notification/deploy.sh +++ b/actions/push-notification/deploy.sh @@ -26,5 +26,8 @@ build $WSK_CLI -i --apihost "$openwhiskApiHost" action update ${ACTION} "$TEMP_DIR/main.zip" --docker "$DOCKER_IMAGE" \ --auth "$openwhiskApiKey" --param api_key "$FIREBASE_API_KEY" +$WSK_CLI -i --apihost "$openwhiskApiHost" action update "push_notification" "$TEMP_DIR/main.zip" --docker "$DOCKER_IMAGE" \ +--auth "$openwhiskApiKey" --param api_key "$FIREBASE_API_KEY" + $WSK_CLI -i --apihost "$openwhiskApiHost" trigger update "send-${ACTION}" --auth "$openwhiskApiKey" $WSK_CLI -i --apihost "$openwhiskApiHost" rule update "${ACTION}-rule" "send-${ACTION}" ${ACTION} --auth "$openwhiskApiKey" diff --git a/actions/user_login/Cargo.toml b/actions/user-login/Cargo.toml similarity index 100% rename from actions/user_login/Cargo.toml rename to actions/user-login/Cargo.toml diff --git a/actions/user-login/deploy.sh b/actions/user-login/deploy.sh new file mode 100755 index 00000000..917305c7 --- /dev/null +++ b/actions/user-login/deploy.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# To run this command +# ./deploy.sh --openwhiskApiHost --openwhiskApiKey --openwhiskNamespace + +openwhiskApiHost=${openwhiskApiHost:-https://localhost:31001} +openwhiskApiKey=${openwhiskApiKey:-23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP} +openwhiskNamespace=${openwhiskNamespace:-guest} +actionHome=${actionHome:-actions/user_login} + +ACTION="user-login" +ACTION_TYPE="rust" +SCRIPTS_DIR="$PWD/scripts" +SRC_DIR="$PWD/${actionHome}" +TEMP_DIR="$PWD/${actionHome}/temp" + +source "$SCRIPTS_DIR/accept_params.sh" +source "$SCRIPTS_DIR/check_dependencies.sh" +source "$SCRIPTS_DIR/build_action.sh" + +check wsk + +build + +$WSK_CLI -i --apihost "$openwhiskApiHost" action update ${ACTION} "$TEMP_DIR/main.zip" --docker "$DOCKER_IMAGE" \ +--auth "$openwhiskApiKey" --timeout 300000 --web true --param db_url "http://admin:p@ssw0rd@172.17.0.1:5984" --param db_name "user_registration_db" diff --git a/actions/user_login/src/lib.rs b/actions/user-login/src/lib.rs similarity index 100% rename from actions/user_login/src/lib.rs rename to actions/user-login/src/lib.rs diff --git a/actions/user_login/src/types/mod.rs b/actions/user-login/src/types/mod.rs similarity index 100% rename from actions/user_login/src/types/mod.rs rename to actions/user-login/src/types/mod.rs diff --git a/actions/user_login/src/types/user.rs b/actions/user-login/src/types/user.rs similarity index 100% rename from actions/user_login/src/types/user.rs rename to actions/user-login/src/types/user.rs diff --git a/actions/user_registration/Cargo.toml b/actions/user-registration/Cargo.toml similarity index 100% rename from actions/user_registration/Cargo.toml rename to actions/user-registration/Cargo.toml diff --git a/actions/user-registration/deploy.sh b/actions/user-registration/deploy.sh new file mode 100755 index 00000000..7894492c --- /dev/null +++ b/actions/user-registration/deploy.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# To run this command +# ./deploy.sh --openwhiskApiHost --openwhiskApiKey --openwhiskNamespace + +openwhiskApiHost=${openwhiskApiHost:-https://localhost:31001} +openwhiskApiKey=${openwhiskApiKey:-23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP} +openwhiskNamespace=${openwhiskNamespace:-guest} +actionHome=${actionHome:-actions/user_registration} + +ACTION="user-registration" +ACTION_TYPE="rust" +SCRIPTS_DIR="$PWD/scripts" +SRC_DIR="$PWD/${actionHome}" +TEMP_DIR="$PWD/${actionHome}/temp" + +source "$SCRIPTS_DIR/accept_params.sh" +source "$SCRIPTS_DIR/check_dependencies.sh" +source "$SCRIPTS_DIR/build_action.sh" + +check wsk + +build + +$WSK_CLI -i --apihost "$openwhiskApiHost" action update ${ACTION} "$TEMP_DIR/main.zip" --docker "$DOCKER_IMAGE" \ +--auth "$openwhiskApiKey" --timeout 300000 --web true --param db_url "http://admin:p@ssw0rd@172.17.0.1:5984" --param db_name "user_registration_db" diff --git a/actions/user_registration/src/lib.rs b/actions/user-registration/src/lib.rs similarity index 100% rename from actions/user_registration/src/lib.rs rename to actions/user-registration/src/lib.rs diff --git a/actions/user_registration/src/types/mod.rs b/actions/user-registration/src/types/mod.rs similarity index 100% rename from actions/user_registration/src/types/mod.rs rename to actions/user-registration/src/types/mod.rs diff --git a/actions/user_registration/src/types/user.rs b/actions/user-registration/src/types/user.rs similarity index 100% rename from actions/user_registration/src/types/user.rs rename to actions/user-registration/src/types/user.rs diff --git a/actions/workflow-invoker/deploy.sh b/actions/workflow-invoker/deploy.sh index be86e686..23b3019e 100755 --- a/actions/workflow-invoker/deploy.sh +++ b/actions/workflow-invoker/deploy.sh @@ -6,7 +6,7 @@ openwhiskApiHost=${openwhiskApiHost:-https://localhost:31001} openwhiskApiKey=${openwhiskApiKey:-23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP} openwhiskNamespace=${openwhiskNamespace:-guest} -actionHome=${actionHome:-actions/balance-filter} +actionHome=${actionHome:-actions/workflow-invoker} ACTION="workflow-invoker" ACTION_TYPE="rust" diff --git a/actions/workflow_management/Cargo.toml b/actions/workflow-management/Cargo.toml similarity index 100% rename from actions/workflow_management/Cargo.toml rename to actions/workflow-management/Cargo.toml diff --git a/actions/workflow_management/deploy.sh b/actions/workflow-management/deploy.sh similarity index 93% rename from actions/workflow_management/deploy.sh rename to actions/workflow-management/deploy.sh index fcb87170..ec69ea3a 100755 --- a/actions/workflow_management/deploy.sh +++ b/actions/workflow-management/deploy.sh @@ -6,7 +6,7 @@ openwhiskApiHost=${openwhiskApiHost:-https://localhost:31001} openwhiskApiKey=${openwhiskApiKey:-23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP} openwhiskNamespace=${openwhiskNamespace:-guest} -actionHome=${actionHome:-actions/balance-notification-registration} +actionHome=${actionHome:-actions/workflow_management} ACTION="workflow-management" ACTION_TYPE="rust" diff --git a/actions/workflow_management/src/lib.rs b/actions/workflow-management/src/lib.rs similarity index 100% rename from actions/workflow_management/src/lib.rs rename to actions/workflow-management/src/lib.rs diff --git a/actions/workflow_management/src/types/body.rs b/actions/workflow-management/src/types/body.rs similarity index 100% rename from actions/workflow_management/src/types/body.rs rename to actions/workflow-management/src/types/body.rs diff --git a/actions/workflow_management/src/types/mod.rs b/actions/workflow-management/src/types/mod.rs similarity index 100% rename from actions/workflow_management/src/types/mod.rs rename to actions/workflow-management/src/types/mod.rs diff --git a/actions/workflow_management/src/types/response.rs b/actions/workflow-management/src/types/response.rs similarity index 100% rename from actions/workflow_management/src/types/response.rs rename to actions/workflow-management/src/types/response.rs diff --git a/actions/workflow_management/src/types/topic.rs b/actions/workflow-management/src/types/topic.rs similarity index 100% rename from actions/workflow_management/src/types/topic.rs rename to actions/workflow-management/src/types/topic.rs diff --git a/actions/workflow_registration/Cargo.toml b/actions/workflow-registration/Cargo.toml similarity index 100% rename from actions/workflow_registration/Cargo.toml rename to actions/workflow-registration/Cargo.toml diff --git a/actions/workflow_registration/deploy.sh b/actions/workflow-registration/deploy.sh similarity index 90% rename from actions/workflow_registration/deploy.sh rename to actions/workflow-registration/deploy.sh index 566c168d..f6b0f566 100755 --- a/actions/workflow_registration/deploy.sh +++ b/actions/workflow-registration/deploy.sh @@ -6,9 +6,9 @@ openwhiskApiHost=${openwhiskApiHost:-https://localhost:31001} openwhiskApiKey=${openwhiskApiKey:-23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP} openwhiskNamespace=${openwhiskNamespace:-guest} -actionHome=${actionHome:-actions/balance-notification-registration} +actionHome=${actionHome:-actions/workflow_registration} -ACTION="workflow-registration +ACTION="workflow-registration" ACTION_TYPE="rust" SCRIPTS_DIR="$PWD/scripts" SRC_DIR="$PWD/${actionHome}" diff --git a/actions/workflow_registration/src/lib.rs b/actions/workflow-registration/src/lib.rs similarity index 98% rename from actions/workflow_registration/src/lib.rs rename to actions/workflow-registration/src/lib.rs index 93febf72..bf812785 100644 --- a/actions/workflow_registration/src/lib.rs +++ b/actions/workflow-registration/src/lib.rs @@ -135,7 +135,7 @@ impl Action { } } - serde_json::to_value(x) + Ok(serde_json::json!({"action_name" : x.name})) } Err(e) => return Err(e).map_err(serde::de::Error::custom), } diff --git a/actions/workflow_registration/src/types/mod.rs b/actions/workflow-registration/src/types/mod.rs similarity index 100% rename from actions/workflow_registration/src/types/mod.rs rename to actions/workflow-registration/src/types/mod.rs diff --git a/actions/workflow_registration/src/types/user.rs b/actions/workflow-registration/src/types/user.rs similarity index 100% rename from actions/workflow_registration/src/types/user.rs rename to actions/workflow-registration/src/types/user.rs diff --git a/deploy.sh b/deploy.sh index 8d67adb9..e0ba66b1 100755 --- a/deploy.sh +++ b/deploy.sh @@ -6,10 +6,10 @@ openwhiskApiHost=${openwhiskApiHost:-https://localhost:31001} openwhiskApiKey=${openwhiskApiKey:-23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP} openwhiskNamespace=${openwhiskNamespace:-guest} -build=${build:-push-notification,balance-filter,event-receiver,event-registration,balance-notification-registration,event-producer,kafka-provider-feed,kafka-provider-web,substrate-event-processor} +build=${build:-push-notification,balance-filter,event-receiver,event-registration,balance-notification-registration,event-producer,kafka-provider-feed,kafka-provider-web,substrate-event-processor,user-registration,user-login,workflow-invoker,workflow-registration,workflow-management} skip=${skip:-} -actions=("actions/push-notification" "actions/balance-filter" "actions/event-receiver" "actions/event-registration" "actions/balance-notification-registration" "actions/event-producer" "actions/kafka-provider-feed" "actions/kafka-provider-web" "actions/substrate-event-processor") +actions=("actions/push-notification" "actions/balance-filter" "actions/event-receiver" "actions/event-registration" "actions/balance-notification-registration" "actions/event-producer" "actions/kafka-provider-feed" "actions/kafka-provider-web" "actions/substrate-event-processor" "actions/user-registration" "actions/user-login" "actions/workflow-invoker" "actions/workflow-registration" "actions/workflow-management") source ./scripts/accept_params.sh source ./scripts/util.sh