⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.177
Server IP:
50.6.168.112
Server:
Linux server-617809.webnetzimbabwe.com 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64
Server Software:
Apache
PHP Version:
8.4.10
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
ctaacademy
/
www
/
vendor
/
aws
/
aws-sdk-php
/
src
/
View File Name :
AwsClient.php
parseClass(); if (!isset($args['service'])) { $args['service'] = manifest($service)['endpoint']; } if (!isset($args['exception_class'])) { $args['exception_class'] = $exceptionClass; } $this->handlerList = new HandlerList(); $resolver = new ClientResolver(static::getArguments()); $config = $resolver->resolve($args, $this->handlerList); $this->api = $config['api']; $this->signatureProvider = $config['signature_provider']; $this->authSchemeResolver = $config['auth_scheme_resolver']; $this->endpoint = new Uri($config['endpoint']); $this->credentialProvider = $config['credentials']; $this->tokenProvider = $config['token']; $this->region = $config['region'] ?? null; $this->signingRegionSet = $config['sigv4a_signing_region_set'] ?? null; $this->config = $config['config']; $this->setClientBuiltIns($args, $config); $this->clientContextParams = $this->setClientContextParams($args); $this->defaultRequestOptions = $config['http']; $this->endpointProvider = $config['endpoint_provider']; $this->serializer = $config['serializer']; $this->addSignatureMiddleware($args); $this->addInvocationId(); $this->addEndpointParameterMiddleware($args); $this->addEndpointDiscoveryMiddleware($config, $args); $this->addRequestCompressionMiddleware($config); $this->loadAliases(); $this->addStreamRequestPayload(); $this->addRecursionDetection(); if ($this->isUseEndpointV2()) { $this->addEndpointV2Middleware(); } $this->addAuthSelectionMiddleware(); if (!is_null($this->api->getMetadata('awsQueryCompatible'))) { $this->addQueryCompatibleInputMiddleware($this->api); $this->addQueryModeHeader(); } if (isset($args['with_resolved'])) { $args['with_resolved']($config); } $this->addUserAgentMiddleware($config); } public function getHandlerList() { return $this->handlerList; } public function getConfig($option = null) { return $option === null ? $this->config : $this->config[$option] ?? null; } public function getCredentials() { $fn = $this->credentialProvider; return $fn(); } public function getEndpoint() { return $this->endpoint; } public function getRegion() { return $this->region; } public function getApi() { return $this->api; } public function getCommand($name, array $args = []) { // Fail fast if the command cannot be found in the description. if (!isset($this->getApi()['operations'][$name])) { $name = ucfirst($name); if (!isset($this->getApi()['operations'][$name])) { throw new \InvalidArgumentException("Operation not found: $name"); } } if (!isset($args['@http'])) { $args['@http'] = $this->defaultRequestOptions; } else { $args['@http'] += $this->defaultRequestOptions; } return new Command($name, $args, clone $this->getHandlerList()); } public function getEndpointProvider() { return $this->endpointProvider; } /** * Provides the set of service context parameter * key-value pairs used for endpoint resolution. * * @return array */ public function getClientContextParams() { return $this->clientContextParams; } /** * Provides the set of built-in keys and values * used for endpoint resolution * * @return array */ public function getClientBuiltIns() { return $this->clientBuiltIns; } public function __sleep() { throw new \RuntimeException('Instances of ' . static::class . ' cannot be serialized'); } /** * Get the signature_provider function of the client. * * @return callable */ final public function getSignatureProvider() { return $this->signatureProvider; } /** * Parse the class name and setup the custom exception class of the client * and return the "service" name of the client and "exception_class". * * @return array */ private function parseClass() { $klass = get_class($this); if ($klass === __CLASS__) { return ['', AwsException::class]; } $service = substr($klass, strrpos($klass, '\\') + 1, -6); return [ strtolower($service), "Aws\\{$service}\\Exception\\{$service}Exception" ]; } private function addEndpointParameterMiddleware($args) { if (empty($args['disable_host_prefix_injection'])) { $list = $this->getHandlerList(); $list->appendBuild( EndpointParameterMiddleware::wrap( $this->api ), 'endpoint_parameter' ); } } private function addEndpointDiscoveryMiddleware($config, $args) { $list = $this->getHandlerList(); if (!isset($args['endpoint'])) { $list->appendBuild( EndpointDiscoveryMiddleware::wrap( $this, $args, $config['endpoint_discovery'] ), 'EndpointDiscoveryMiddleware' ); } } private function addSignatureMiddleware(array $args) { $api = $this->getApi(); $provider = $this->signatureProvider; $signatureVersion = $this->config['signature_version']; $name = $this->config['signing_name']; $region = $this->config['signing_region']; $signingRegionSet = $this->signingRegionSet; if (isset($args['signature_version']) || isset($this->config['configured_signature_version']) ) { $configuredSignatureVersion = true; } else { $configuredSignatureVersion = false; } $resolver = static function ( CommandInterface $command ) use ( $api, $provider, $name, $region, $signatureVersion, $configuredSignatureVersion, $signingRegionSet ) { if (!$configuredSignatureVersion) { if (!empty($command['@context']['signing_region'])) { $region = $command['@context']['signing_region']; } if (!empty($command['@context']['signing_service'])) { $name = $command['@context']['signing_service']; } if (!empty($command['@context']['signature_version'])) { $signatureVersion = $command['@context']['signature_version']; } $authType = $api->getOperation($command->getName())['authtype']; switch ($authType){ case 'none': $signatureVersion = 'anonymous'; break; case 'v4-unsigned-body': $signatureVersion = 'v4-unsigned-body'; break; case 'bearer': $signatureVersion = 'bearer'; break; } } if ($signatureVersion === 'v4a') { $commandSigningRegionSet = !empty($command['@context']['signing_region_set']) ? implode(', ', $command['@context']['signing_region_set']) : null; $region = $signingRegionSet ?? $commandSigningRegionSet ?? $region; } // Capture signature metric $command->getMetricsBuilder()->identifyMetricByValueAndAppend( 'signature', $signatureVersion ); return SignatureProvider::resolve($provider, $signatureVersion, $name, $region); }; $this->handlerList->appendSign( Middleware::signer($this->credentialProvider, $resolver, $this->tokenProvider, $this->getConfig() ), 'signer' ); } private function addRequestCompressionMiddleware($config) { if (empty($config['disable_request_compression'])) { $list = $this->getHandlerList(); $list->appendBuild( RequestCompressionMiddleware::wrap($config), 'request-compression' ); } } private function addQueryCompatibleInputMiddleware(Service $api) { $list = $this->getHandlerList(); $list->appendValidate( QueryCompatibleInputMiddleware::wrap($api), 'query-compatible-input' ); } private function addQueryModeHeader(): void { $list = $this->getHandlerList(); $list->appendBuild( Middleware::mapRequest(function (RequestInterface $r) { return $r->withHeader( 'x-amzn-query-mode', true ); }), 'x-amzn-query-mode-header' ); } private function addInvocationId() { // Add invocation id to each request $this->handlerList->prependSign(Middleware::invocationId(), 'invocation-id'); } private function loadAliases($file = null) { if (!isset($this->aliases)) { if (is_null($file)) { $file = __DIR__ . '/data/aliases.json'; } $aliases = \Aws\load_compiled_json($file); $serviceId = $this->api->getServiceId(); $version = $this->getApi()->getApiVersion(); if (!empty($aliases['operations'][$serviceId][$version])) { $this->aliases = array_flip($aliases['operations'][$serviceId][$version]); } } } private function addStreamRequestPayload() { $streamRequestPayloadMiddleware = StreamRequestPayloadMiddleware::wrap( $this->api ); $this->handlerList->prependSign( $streamRequestPayloadMiddleware, 'StreamRequestPayloadMiddleware' ); } private function addRecursionDetection() { // Add recursion detection header to requests // originating in supported Lambda runtimes $this->handlerList->appendBuild( Middleware::recursionDetection(), 'recursion-detection' ); } private function addAuthSelectionMiddleware() { $list = $this->getHandlerList(); $list->prependBuild( AuthSelectionMiddleware::wrap( $this->authSchemeResolver, $this->getApi() ), 'auth-selection' ); } private function addEndpointV2Middleware() { $list = $this->getHandlerList(); $endpointArgs = $this->getEndpointProviderArgs(); $list->prependBuild( EndpointV2Middleware::wrap( $this->endpointProvider, $this->getApi(), $endpointArgs, $this->credentialProvider ), 'endpoint-resolution' ); } /** * Appends the user agent middleware. * This middleware MUST be appended after the * signature middleware `addSignatureMiddleware`, * so that metrics around signatures are properly * captured. * * @param $args * @return void */ private function addUserAgentMiddleware($args) { $this->getHandlerList()->appendSign( UserAgentMiddleware::wrap($args), 'user-agent' ); } /** * Retrieves client context param definition from service model, * creates mapping of client context param names with client-provided * values. * * @return array */ private function setClientContextParams($args) { $api = $this->getApi(); $resolvedParams = []; if (!empty($paramDefinitions = $api->getClientContextParams())) { foreach($paramDefinitions as $paramName => $paramValue) { if (isset($args[$paramName])) { $resolvedParams[$paramName] = $args[$paramName]; } } } return $resolvedParams; } /** * Retrieves and sets default values used for endpoint resolution. */ private function setClientBuiltIns($args, $resolvedConfig) { $builtIns = []; $config = $resolvedConfig['config']; $service = $args['service']; $builtIns['SDK::Endpoint'] = null; if (!empty($args['endpoint'])) { $builtIns['SDK::Endpoint'] = $args['endpoint']; } elseif (isset($config['configured_endpoint_url'])) { $builtIns['SDK::Endpoint'] = (string) $this->getEndpoint(); } $builtIns['AWS::Region'] = $this->getRegion(); $builtIns['AWS::UseFIPS'] = $config['use_fips_endpoint']->isUseFipsEndpoint(); $builtIns['AWS::UseDualStack'] = $config['use_dual_stack_endpoint']->isUseDualstackEndpoint(); if ($service === 's3' || $service === 's3control'){ $builtIns['AWS::S3::UseArnRegion'] = $config['use_arn_region']->isUseArnRegion(); } if ($service === 's3') { $builtIns['AWS::S3::UseArnRegion'] = $config['use_arn_region']->isUseArnRegion(); $builtIns['AWS::S3::Accelerate'] = $config['use_accelerate_endpoint']; $builtIns['AWS::S3::ForcePathStyle'] = $config['use_path_style_endpoint']; $builtIns['AWS::S3::DisableMultiRegionAccessPoints'] = $config['disable_multiregion_access_points']; } $builtIns['AWS::Auth::AccountIdEndpointMode'] = $resolvedConfig['account_id_endpoint_mode']; $this->clientBuiltIns += $builtIns; } /** * Retrieves arguments to be used in endpoint resolution. * * @return array */ public function getEndpointProviderArgs() { return $this->normalizeEndpointProviderArgs(); } /** * Combines built-in and client context parameter values in * order of specificity. Client context parameter values supersede * built-in values. * * @return array */ private function normalizeEndpointProviderArgs() { $normalizedBuiltIns = []; foreach($this->clientBuiltIns as $name => $value) { $normalizedName = explode('::', $name); $normalizedName = $normalizedName[count($normalizedName) - 1]; $normalizedBuiltIns[$normalizedName] = $value; } return array_merge($normalizedBuiltIns, $this->getClientContextParams()); } protected function isUseEndpointV2() { return $this->endpointProvider instanceof EndpointProviderV2; } public static function emitDeprecationWarning() { trigger_error( "This method is deprecated. It will be removed in an upcoming release." , E_USER_DEPRECATED ); $phpVersion = PHP_VERSION_ID; if ($phpVersion < 70205) { $phpVersionString = phpversion(); @trigger_error( "This installation of the SDK is using PHP version" . " {$phpVersionString}, which will be deprecated on August" . " 15th, 2023. Please upgrade your PHP version to a minimum of" . " 7.2.5 before then to continue receiving updates to the AWS" . " SDK for PHP. To disable this warning, set" . " suppress_php_deprecation_warning to true on the client constructor" . " or set the environment variable AWS_SUPPRESS_PHP_DEPRECATION_WARNING" . " to true.", E_USER_DEPRECATED ); } } /** * Returns a service model and doc model with any necessary changes * applied. * * @param array $api Array of service data being documented. * @param array $docs Array of doc model data. * * @return array Tuple containing a [Service, DocModel] * * @internal This should only used to document the service API. * @codeCoverageIgnore */ public static function applyDocFilters(array $api, array $docs) { $aliases = \Aws\load_compiled_json(__DIR__ . '/data/aliases.json'); $serviceId = $api['metadata']['serviceId'] ?? ''; $version = $api['metadata']['apiVersion']; // Replace names for any operations with SDK aliases if (!empty($aliases['operations'][$serviceId][$version])) { foreach ($aliases['operations'][$serviceId][$version] as $op => $alias) { $api['operations'][$alias] = $api['operations'][$op]; $docs['operations'][$alias] = $docs['operations'][$op]; unset($api['operations'][$op], $docs['operations'][$op]); } } ksort($api['operations']); return [ new Service($api, ApiProvider::defaultProvider()), new DocModel($docs) ]; } /** * @deprecated * @return static */ public static function factory(array $config = []) { return new static($config); } }