コード例 #1
0
 /**
  * コンテナーを作成する
  * 
  * IMPORTANT:
  * コンテナーの名前は、常に小文字にする必要があります。
  * コンテナー名に大文字が含まれている場合や、コンテナーの名前付け規則の他の違反がある場合、400 エラー (無効な要求) が発生することがあります。
  * コンテナーの名前付け規則については、https://msdn.microsoft.com/library/azure/dd135715.aspxをご覧ください。
  * 
  * @param type $containerName
  * @param type $publicAccess
  * @param type $metadata
  * @throws Exception
  */
 public function createBlobContainer($containerName, $publicAccess = PublicAccessType::NONE, $metadata = null)
 {
     $createContainerOptions = new CreateContainerOptions();
     $createContainerOptions->setPublicAccess($publicAccess);
     if ($metadata) {
         $createContainerOptions->setMetadata($metadata);
     }
     try {
         $this->blobRestProxy->createContainer($containerName, $createContainerOptions);
     } catch (Exception $e) {
         throw new Exception($e->getMessage(), $e->getCode());
     }
 }
コード例 #2
0
 /**
  * @covers WindowsAzure\Blob\Models\CreateContainerOptions::getMetadata
  */
 public function testGetMetadata()
 {
     // Setup
     $container = new CreateContainerOptions();
     $expected = array('key1' => 'value1', 'key2' => 'value2');
     $container->setMetadata($expected);
     // Test
     $actual = $container->getMetadata();
     // Assert
     $this->assertEquals($expected, $actual);
 }
コード例 #3
0
 /**
  * @covers WindowsAzure\Blob\BlobRestProxy::getContainerMetadata
  * @covers WindowsAzure\Blob\BlobRestProxy::_getContainerPropertiesImpl
  */
 public function testGetContainerMetadata()
 {
     // Setup
     $name = 'getcontainermetadata' . $this->createSuffix();
     $options = new CreateContainerOptions();
     $expected = array('name1' => 'MyName1', 'mymetaname' => '12345', 'values' => 'Microsoft_');
     $options->setMetadata($expected);
     $this->createContainer($name, $options);
     $result = $this->restProxy->getContainerProperties($name);
     $expectedETag = $result->getETag();
     $expectedLastModified = $result->getLastModified();
     // Test
     $result = $this->restProxy->getContainerMetadata($name);
     // Assert
     $this->assertEquals($expectedETag, $result->getETag());
     $this->assertEquals($expectedLastModified, $result->getLastModified());
     $this->assertEquals($expected, $result->getMetadata());
 }
コード例 #4
0
 public static function getInterestingCreateContainerOptions()
 {
     $ret = array();
     $options = new CreateContainerOptions();
     array_push($ret, $options);
     $options = new CreateContainerOptions();
     $options->setTimeout(10);
     array_push($ret, $options);
     $options = new CreateContainerOptions();
     $options->setTimeout(-10);
     array_push($ret, $options);
     $options = new CreateContainerOptions();
     $options->setPublicAccess('container');
     array_push($ret, $options);
     $options = new CreateContainerOptions();
     $options->setPublicAccess('blob');
     array_push($ret, $options);
     $options = new CreateContainerOptions();
     $metadata = array('foo' => 'bar', 'boo' => 'baz');
     $options->setMetadata($metadata);
     array_push($ret, $options);
     return $ret;
 }
コード例 #5
0
 /**
  * Update a container with some properties
  *
  * @param string $container
  * @param array  $properties
  *
  * @throws NotFoundException
  * @return void
  */
 public function updateContainerProperties($container, $properties = [])
 {
     $this->checkConnection();
     $options = new CreateContainerOptions();
     $options->setMetadata($properties);
     //		$options->setPublicAccess('blob');
     $this->blobConn->setContainerMetadata($container, $options);
 }