Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 12... Línea 12...
12
// GNU General Public License for more details.
12
// GNU General Public License for more details.
13
//
13
//
14
// You should have received a copy of the GNU General Public License
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea 16... Línea -...
16
 
-
 
17
/**
-
 
18
 * AWS Client factory. Retrieves a client with moodle specific HTTP configuration.
-
 
19
 *
-
 
20
 * @package    core
-
 
21
 * @author     Peter Burnett <peterburnett@catalyst-au.net>
-
 
22
 * @copyright  2022 Catalyst IT
-
 
23
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-
 
24
 */
-
 
25
 
16
 
26
namespace core\aws;
17
namespace core\aws;
Línea 27... Línea 18...
27
use Aws\AwsClient;
18
use Aws\AwsClient;
28
 
19
 
29
/**
20
/**
30
 * AWS Client factory. Retrieves a client with moodle specific HTTP configuration.
21
 * AWS Client factory. Retrieves a client with moodle specific HTTP configuration.
31
 *
22
 *
32
 * @copyright  2022 Catalyst IT
23
 * @copyright  2022 Catalyst IT
-
 
24
 * @author     Peter Burnett <peterburnett@catalyst-au.net>
-
 
25
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
33
 * @author     Peter Burnett <peterburnett@catalyst-au.net>
26
 * @deprecated Since Moodle 4.5
34
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27
 * @todo       MDL-82459 Final deprecation in Moodle 5.0.
35
 */
28
 */
36
class client_factory {
29
class client_factory {
37
    /**
30
    /**
38
     * Get an AWS client with moodle specific HTTP configuration.
31
     * Get an AWS client with moodle specific HTTP configuration.
39
     *
32
     *
40
     * @param string $class Fully qualified AWS classname e.g. \Aws\S3\S3Client
33
     * @param string $class Fully qualified AWS classname e.g. \Aws\S3\S3Client
-
 
34
     * @param array $opts array of constructor options for AWS Client.
41
     * @param array $opts array of constructor options for AWS Client.
35
     * @return AwsClient
-
 
36
     * @deprecated Since Moodle 4.5
-
 
37
     */
-
 
38
    #[\core\attribute\deprecated(
-
 
39
        'client_factory::get_client()',
-
 
40
        since: '4.5',
42
     * @return AwsClient
41
        mdl: 'MDL-80962',
-
 
42
    )]
43
     */
43
    public static function get_client(string $class, array $opts): AwsClient {
44
    public static function get_client(string $class, array $opts): AwsClient {
44
        \core\deprecation::emit_deprecation(__FUNCTION__);
45
        // Modify the opts to add HTTP timeouts.
45
        // Modify the opts to add HTTP timeouts.
46
        if (empty($opts['http'])) {
46
        if (empty($opts['http'])) {
47
            $opts['http'] = ['connect_timeout' => HOURSECS];
47
            $opts['http'] = ['connect_timeout' => HOURSECS];