This repository has been archived by the owner on Nov 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add msi_add_avu and msi_rmw_avu microservices.
- Loading branch information
1 parent
2cba656
commit d78d4d7
Showing
6 changed files
with
180 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#include "irods_error.hpp" | ||
#include "irods_ms_plugin.hpp" | ||
#include "rsModAVUMetadata.hpp" | ||
|
||
int msiAddAVU( | ||
msParam_t* _item_type, | ||
msParam_t* _item_name, | ||
msParam_t* _attr_name, | ||
msParam_t* _attr_val, | ||
msParam_t* _attr_unit, | ||
ruleExecInfo_t* _rei ) { | ||
|
||
char *it_str = parseMspForStr( _item_type ); | ||
if( !it_str ) { | ||
return SYS_INVALID_INPUT_PARAM; | ||
} | ||
|
||
char *in_str = parseMspForStr( _item_name ); | ||
if( !in_str ) { | ||
return SYS_INVALID_INPUT_PARAM; | ||
} | ||
|
||
char *an_str = parseMspForStr( _attr_name ); | ||
if( !an_str ) { | ||
return SYS_INVALID_INPUT_PARAM; | ||
} | ||
|
||
char *av_str = parseMspForStr( _attr_val ); | ||
if( !av_str ) { | ||
return SYS_INVALID_INPUT_PARAM; | ||
} | ||
|
||
char *au_str = parseMspForStr( _attr_unit ); | ||
if( !au_str ) { | ||
return SYS_INVALID_INPUT_PARAM; | ||
} | ||
|
||
char op[] = "add"; | ||
|
||
modAVUMetadataInp_t avuOp; | ||
memset(&avuOp, 0, sizeof(avuOp)); | ||
avuOp.arg0 = op; | ||
avuOp.arg1 = it_str; | ||
avuOp.arg2 = in_str; | ||
avuOp.arg3 = an_str; | ||
avuOp.arg4 = av_str; | ||
avuOp.arg5 = au_str; | ||
|
||
_rei->status = rsModAVUMetadata(_rei->rsComm, &avuOp); | ||
|
||
return _rei->status; | ||
|
||
} | ||
|
||
extern "C" | ||
irods::ms_table_entry* plugin_factory() { | ||
irods::ms_table_entry* msvc = new irods::ms_table_entry(5); | ||
|
||
msvc->add_operation< | ||
msParam_t*, | ||
msParam_t*, | ||
msParam_t*, | ||
msParam_t*, | ||
msParam_t*, | ||
ruleExecInfo_t*>("msiAddAVU", | ||
std::function<int( | ||
msParam_t*, | ||
msParam_t*, | ||
msParam_t*, | ||
msParam_t*, | ||
msParam_t*, | ||
ruleExecInfo_t*)>(msiAddAVU)); | ||
return msvc; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Call with | ||
# | ||
# irule -F msi_add_avu_test.r | ||
# | ||
|
||
test() { | ||
# type, path, attribute, value, unit | ||
msi_add_avu("-d", "/nlmumc/home/rods/docker-compose.yml", "foo", "bar", "xyz"); | ||
} | ||
|
||
|
||
INPUT null | ||
OUTPUT ruleExecOut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#include "irods_error.hpp" | ||
#include "irods_ms_plugin.hpp" | ||
#include "rsModAVUMetadata.hpp" | ||
|
||
int msiAddAVU( | ||
msParam_t* _item_type, | ||
msParam_t* _item_name, | ||
msParam_t* _attr_name, | ||
msParam_t* _attr_val, | ||
msParam_t* _attr_unit, | ||
ruleExecInfo_t* _rei ) { | ||
|
||
char *it_str = parseMspForStr( _item_type ); | ||
if( !it_str ) { | ||
return SYS_INVALID_INPUT_PARAM; | ||
} | ||
|
||
char *in_str = parseMspForStr( _item_name ); | ||
if( !in_str ) { | ||
return SYS_INVALID_INPUT_PARAM; | ||
} | ||
|
||
char *an_str = parseMspForStr( _attr_name ); | ||
if( !an_str ) { | ||
return SYS_INVALID_INPUT_PARAM; | ||
} | ||
|
||
char *av_str = parseMspForStr( _attr_val ); | ||
if( !av_str ) { | ||
return SYS_INVALID_INPUT_PARAM; | ||
} | ||
|
||
char *au_str = parseMspForStr( _attr_unit ); | ||
if( !au_str ) { | ||
return SYS_INVALID_INPUT_PARAM; | ||
} | ||
|
||
char op[] = "rmw"; | ||
|
||
modAVUMetadataInp_t avuOp; | ||
memset(&avuOp, 0, sizeof(avuOp)); | ||
avuOp.arg0 = op; | ||
avuOp.arg1 = it_str; | ||
avuOp.arg2 = in_str; | ||
avuOp.arg3 = an_str; | ||
avuOp.arg4 = av_str; | ||
avuOp.arg5 = au_str; | ||
|
||
_rei->status = rsModAVUMetadata(_rei->rsComm, &avuOp); | ||
|
||
return _rei->status; | ||
|
||
} | ||
|
||
extern "C" | ||
irods::ms_table_entry* plugin_factory() { | ||
irods::ms_table_entry* msvc = new irods::ms_table_entry(5); | ||
|
||
msvc->add_operation< | ||
msParam_t*, | ||
msParam_t*, | ||
msParam_t*, | ||
msParam_t*, | ||
msParam_t*, | ||
ruleExecInfo_t*>("msiAddAVU", | ||
std::function<int( | ||
msParam_t*, | ||
msParam_t*, | ||
msParam_t*, | ||
msParam_t*, | ||
msParam_t*, | ||
ruleExecInfo_t*)>(msiAddAVU)); | ||
return msvc; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Call with | ||
# | ||
# irule -F msi_add_avu_test.r | ||
# | ||
|
||
test() { | ||
# type, path, attribute, value, unit | ||
msi_rmw_avu("-d", "/nlmumc/home/rods/docker-compose.yml", "%", "%", "xyz"); | ||
} | ||
|
||
|
||
INPUT null | ||
OUTPUT ruleExecOut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
#define RODS_SERVER 1 | ||
|
||
#include "irods_error.hpp" | ||
#include "irods_ms_plugin.hpp" | ||
#include "rsModAVUMetadata.hpp" | ||
|