setConfig($config) ->setConfigDefaults(array( Options::VERSION => self::LATEST_API_VERSION, Options::SERVICE_DESCRIPTION => __DIR__ . '/Resources/glacier-%s.php', // Set default value for "accountId" for all requests 'command.params' => array( 'accountId' => '-', Options::MODEL_PROCESSING => true ) )) ->setExceptionParser(new JsonRestExceptionParser()) ->build(); // Add the Glacier version header required for all operations $client->getConfig()->setPath( 'request.options/headers/x-amz-glacier-version', $client->getDescription()->getApiVersion() ); // Allow for specifying bodies with file paths and file handles $uploadOperations = array('UploadArchive', 'UploadMultipartPart'); $client->addSubscriber(new UploadBodyListener($uploadOperations, 'body', 'sourceFile')); // Listen for upload operations and make sure the required hash headers are added $client->addSubscriber(new GlacierUploadListener()); return $client; } }