Ejemplo n.º 1
0
 /**
  * Lists all of the blobs in the given container.
  * 
  * @param string                  $container The container name.
  * @param Models\ListBlobsOptions $options   The optional parameters.
  * 
  * @return Models\ListBlobsResult
  * 
  * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd135734.aspx
  */
 public function listBlobs($container, $options = null)
 {
     Validate::isString($container, 'container');
     $method = Resources::HTTP_GET;
     $headers = array();
     $postParams = array();
     $queryParams = array();
     $path = $container;
     $statusCode = Resources::STATUS_OK;
     if (is_null($options)) {
         $options = new ListBlobsOptions();
     }
     $this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $options->getTimeout());
     $this->addOptionalQueryParam($queryParams, Resources::QP_REST_TYPE, 'container');
     $this->addOptionalQueryParam($queryParams, Resources::QP_COMP, 'list');
     $this->addOptionalQueryParam($queryParams, Resources::QP_PREFIX, str_replace('\\', '/', $options->getPrefix()));
     $this->addOptionalQueryParam($queryParams, Resources::QP_MARKER, $options->getMarker());
     $this->addOptionalQueryParam($queryParams, Resources::QP_DELIMITER, $options->getDelimiter());
     $this->addOptionalQueryParam($queryParams, Resources::QP_MAX_RESULTS, $options->getMaxResults());
     $includeMetadata = $options->getIncludeMetadata();
     $includeSnapshots = $options->getIncludeSnapshots();
     $includeUncommittedBlobs = $options->getIncludeUncommittedBlobs();
     $includeValue = $this->groupQueryValues(array($includeMetadata ? 'metadata' : null, $includeSnapshots ? 'snapshots' : null, $includeUncommittedBlobs ? 'uncommittedblobs' : null));
     $this->addOptionalQueryParam($queryParams, Resources::QP_INCLUDE, $includeValue);
     $response = $this->send($method, $headers, $queryParams, $postParams, $path, $statusCode);
     $parsed = $this->dataSerializer->unserialize($response->getBody());
     return ListBlobsResult::create($parsed);
 }
 /**
  * @covers WindowsAzure\Blob\Models\ListBlobsResult::getDelimiter
  */
 public function testGetDelimiter()
 {
     // Setup
     $options = new ListBlobsResult();
     $expected = 'mydelimiter';
     $options->setDelimiter($expected);
     // Test
     $actual = $options->getDelimiter();
     // Assert
     $this->assertEquals($expected, $actual);
 }