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()) ->setIteratorsConfig(array( 'limit_param' => 'limit', 'token_param' => 'marker', 'token_key' => 'Marker', 'operations' => array( 'ListJobs' => array( 'result_key' => 'JobList' ), 'ListMultipartUploads' => array( 'result_key' => 'UploadsList' ), 'ListParts' => array( 'result_key' => 'Parts' ), 'ListVaults' => array( 'result_key' => 'VaultList' ) ) )) ->build(); // Add the Glacier version header required for all operations $client->getDefaultHeaders()->set('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; } }