forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-80736 libraries: Move AWS helper code from factor_sms to core\aws
- Loading branch information
1 parent
f30110b
commit 2f351c5
Showing
7 changed files
with
23 additions
and
26 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 |
---|---|---|
|
@@ -17,13 +17,13 @@ | |
/** | ||
* Admin setting for AWS regions. | ||
* | ||
* @package factor_sms | ||
* @package core | ||
* @author Dmitrii Metelkin <[email protected]> | ||
* @copyright 2020 Catalyst IT | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace factor_sms; | ||
namespace core\aws; | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
|
@@ -32,7 +32,7 @@ | |
/** | ||
* Admin setting for a list of AWS regions. | ||
* | ||
* @package factor_sms | ||
* @package core | ||
* @copyright 2020 Catalyst IT | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
@@ -50,7 +50,9 @@ public function output_html($data, $query='') { | |
|
||
$default = $this->get_defaultsetting(); | ||
$options = []; | ||
$all = require_once($CFG->dirroot . '/lib/aws-sdk/src/data/endpoints.json.php'); | ||
// We do require() not require_once() here, as the file returns a value and we may need to get | ||
// this value more than once. | ||
$all = require($CFG->dirroot . '/lib/aws-sdk/src/data/endpoints.json.php'); | ||
$ends = $all['partitions'][0]['regions']; | ||
if ($ends) { | ||
foreach ($ends as $key => $value) { | ||
|
@@ -69,7 +71,7 @@ public function output_html($data, $query='') { | |
'size' => $this->size, | ||
'options' => $options, | ||
]; | ||
$element = $OUTPUT->render_from_template('factor_sms/setting_aws_region', $context); | ||
$element = $OUTPUT->render_from_template('core/aws/setting_aws_region', $context); | ||
return format_admin_setting($this, $this->visiblename, $element, $this->description, true, '', $default, $query); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -17,13 +17,13 @@ | |
/** | ||
* AWS helper class. Contains useful functions when interacting with the SDK. | ||
* | ||
* @package factor_sms | ||
* @package core | ||
* @author Peter Burnett <[email protected]> | ||
* @copyright 2020 Catalyst IT | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace factor_sms\local; | ||
namespace core\aws; | ||
|
||
use Aws\CommandInterface; | ||
use Aws\AwsClient; | ||
|
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 |
---|---|---|
|
@@ -17,13 +17,13 @@ | |
/** | ||
* AWS Client factory. Retrieves a client with moodle specific HTTP configuration. | ||
* | ||
* @package factor_sms | ||
* @package core | ||
* @author Peter Burnett <[email protected]> | ||
* @copyright 2022 Catalyst IT | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace factor_sms\local; | ||
namespace core\aws; | ||
use Aws\AwsClient; | ||
|
||
/** | ||
|
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 |
---|---|---|
|
@@ -17,22 +17,22 @@ | |
/** | ||
* factor_sms unit tests. | ||
* | ||
* @package factor_sms | ||
* @package core | ||
* @author Mikhail Golenkov <[email protected]> | ||
* @copyright 2020 Catalyst IT | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace factor_sms; | ||
namespace core\aws; | ||
|
||
/** | ||
* Testcase for the list of AWS regions admin setting. | ||
* | ||
* @package factor_sms | ||
* @package core | ||
* @author Mikhail Golenkov <[email protected]> | ||
* @copyright 2020 Catalyst IT | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @covers \admin_settings_aws_region_test | ||
* @covers \core\aws\admin_settings_aws_region | ||
*/ | ||
class admin_settings_aws_region_test extends \advanced_testcase { | ||
|
||
|
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 |
---|---|---|
|
@@ -15,18 +15,16 @@ | |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* factor_sms unit tests. | ||
* aws_helper unit tests. | ||
* | ||
* @package factor_sms | ||
* @package core | ||
* @author Peter Burnett <[email protected]> | ||
* @copyright 2020 Catalyst IT | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @covers \factor_sms\local\aws_helper | ||
* @covers \core\aws\aws_helper | ||
*/ | ||
|
||
namespace factor_sms; | ||
|
||
use factor_sms\local\aws_helper; | ||
namespace core\aws; | ||
|
||
/** | ||
* Testcase for the AWS helper. | ||
|
@@ -35,7 +33,7 @@ | |
* @author Peter Burnett <[email protected]> | ||
* @copyright 2020 Catalyst IT | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @covers \factor_sms\classes\local\aws_helper | ||
* @covers \core\aws\aws_helper | ||
*/ | ||
class aws_helper_test extends \advanced_testcase { | ||
|
||
|