IBlob.php 19.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491
<?php

/**
 * LICENSE: Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * PHP version 5
 *
 * @category  Microsoft
 * @package   WindowsAzure\Blob\Internal
 * @author    Azure PHP SDK <azurephpsdk@microsoft.com>
 * @copyright 2012 Microsoft Corporation
 * @license   http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
 * @link      https://github.com/windowsazure/azure-sdk-for-php
 */
 
namespace WindowsAzure\Blob\Internal;
use WindowsAzure\Common\Internal\FilterableService;

/**
 * This interface has all REST APIs provided by Windows Azure for Blob service.
 *
 * @category  Microsoft
 * @package   WindowsAzure\Blob\Internal
 * @author    Azure PHP SDK <azurephpsdk@microsoft.com>
 * @copyright 2012 Microsoft Corporation
 * @license   http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
 * @version   Release: 0.4.1_2015-03
 * @link      https://github.com/windowsazure/azure-sdk-for-php
 * @see       http://msdn.microsoft.com/en-us/library/windowsazure/dd135733.aspx
 */
interface IBlob extends FilterableService
{
    /**
    * Gets the properties of the Blob service.
    * 
    * @param Models\BlobServiceOptions $options optional blob service options.
    * 
    * @return WindowsAzure\Common\Models\GetServicePropertiesResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/hh452239.aspx
    */
    public function getServiceProperties($options = null);

    /**
    * Sets the properties of the Blob service.
    * 
    * @param ServiceProperties         $serviceProperties new service properties
    * @param Models\BlobServiceOptions $options           optional parameters
    * 
    * @return none.
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/hh452235.aspx
    */
    public function setServiceProperties($serviceProperties, $options = null);

    /**
    * Lists all of the containers in the given storage account.
    * 
    * @param Models\ListContainersOptions $options optional parameters
    * 
    * @return WindowsAzure\Blob\Models\ListContainersResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179352.aspx
    */
    public function listContainers($options = null);

    /**
    * Creates a new container in the given storage account.
    * 
    * @param string                        $container name
    * @param Models\CreateContainerOptions $options   optional parameters
    * 
    * @return none.
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179468.aspx
    */
    public function createContainer($container, $options = null);

    /**
    * Creates a new container in the given storage account.
    * 
    * @param string                        $container name
    * @param Models\DeleteContainerOptions $options   optional parameters
    * 
    * @return none.
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179408.aspx
    */
    public function deleteContainer($container, $options = null);

    /**
    * Returns all properties and metadata on the container.
    * 
    * @param string                    $container name
    * @param Models\BlobServiceOptions $options   optional parameters
    * 
    * @return Models\GetContainerPropertiesResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179370.aspx
    */
    public function getContainerProperties($container, $options = null);

    /**
    * Returns only user-defined metadata for the specified container.
    * 
    * @param string                    $container name
    * @param Models\BlobServiceOptions $options   optional parameters
    * 
    * @return Models\GetContainerPropertiesResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691976.aspx 
    */
    public function getContainerMetadata($container, $options = null);

    /**
    * Gets the access control list (ACL) and any container-level access policies 
    * for the container.
    * 
    * @param string                    $container name
    * @param Models\BlobServiceOptions $options   optional parameters
    * 
    * @return Models\GetContainerAclResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179469.aspx
    */
    public function getContainerAcl($container, $options = null);

    /**
    * Sets the ACL and any container-level access policies for the container.
    * 
    * @param string                    $container name
    * @param Models\ContainerAcl       $acl       access control list for container
    * @param Models\BlobServiceOptions $options   optional parameters
    * 
    * @return none.
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179391.aspx
    */
    public function setContainerAcl($container, $acl, $options = null);

    /**
    * Sets metadata headers on the container.
    * 
    * @param string                             $container name
    * @param array                              $metadata  metadata key/value pair.
    * @param Models\SetContainerMetadataOptions $options   optional parameters
    * 
    * @return none.
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179362.aspx
    */
    public function setContainerMetadata($container, $metadata, $options = null);

    /**
    * Lists all of the blobs in the given container.
    * 
    * @param string                  $container name
    * @param Models\ListBlobsOptions $options   optional parameters
    * 
    * @return Models\ListBlobsResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd135734.aspx
    */
    public function listBlobs($container, $options = null);

    /**
    * Creates a new page blob. Note that calling createPageBlob to create a page
    * blob only initializes the blob.
    * To add content to a page blob, call createBlobPages method.
    * 
    * @param string                   $container name of the container
    * @param string                   $blob      name of the blob
    * @param int                      $length    specifies the maximum size for the
    * page blob, up to 1 TB. The page blob size must be aligned to a 512-byte 
    * boundary.
    * @param Models\CreateBlobOptions $options   optional parameters
    * 
    * @return CopyBlobResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
    */
    public function createPageBlob($container, $blob, $length, $options = null);

    /**
    * Creates a new block blob or updates the content of an existing block blob.
    * Updating an existing block blob overwrites any existing metadata on the blob.
    * Partial updates are not supported with createBlockBlob; the content of the
    * existing blob is overwritten with the content of the new blob. To perform a
    * partial update of the content of a block blob, use the createBlockList method.
    * 
    * @param string                   $container name of the container
    * @param string                   $blob      name of the blob
    * @param string                   $content   content of the blob
    * @param Models\CreateBlobOptions $options   optional parameters
    * 
    * @return CopyBlobResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
    */
    public function createBlockBlob($container, $blob, $content, $options = null);

    /**
    * Clears a range of pages from the blob.
    * 
    * @param string                        $container name of the container
    * @param string                        $blob      name of the blob
    * @param Models\PageRange              $range     Can be up to the value of the
    * blob's full size.
    * @param Models\CreateBlobPagesOptions $options   optional parameters
    * 
    * @return Models\CreateBlobPagesResult.
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691975.aspx
    */
    public function clearBlobPages($container, $blob, $range, $options = null);

    /**
    * Creates a range of pages to a page blob.
    * 
    * @param string                        $container name of the container
    * @param string                        $blob      name of the blob
    * @param Models\PageRange              $range     Can be up to 4 MB in size
    * @param string                        $content   the blob contents
    * @param Models\CreateBlobPagesOptions $options   optional parameters
    * 
    * @return Models\CreateBlobPagesResult.
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691975.aspx
    */
    public function createBlobPages($container, $blob, $range, $content,
        $options = null
    );

    /**
    * Creates a new block to be committed as part of a block blob.
    * 
    * @param string                        $container name of the container
    * @param string                        $blob      name of the blob
    * @param string                        $blockId   must be less than or equal to 
    * 64 bytes in size. For a given blob, the length of the value specified for the
    * blockid parameter must be the same size for each block.
    * @param string                        $content   the blob block contents
    * @param Models\CreateBlobBlockOptions $options   optional parameters
    * 
    * @return none.
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd135726.aspx
    */
    public function createBlobBlock($container, $blob, $blockId, $content,
        $options = null
    );

    /**
    * This method writes a blob by specifying the list of block IDs that make up the
    * blob. In order to be written as part of a blob, a block must have been 
    * successfully written to the server in a prior createBlobBlock method.
    * 
    * You can call Put Block List to update a blob by uploading only those blocks 
    * that have changed, then committing the new and existing blocks together. 
    * You can do this by specifying whether to commit a block from the committed 
    * block list or from the uncommitted block list, or to commit the most recently
    * uploaded version of the block, whichever list it may belong to.
    * 
    * @param string                         $container name of the container
    * @param string                         $blob      name of the blob
    * @param Models\BlockList               $blockList the block list entries
    * @param Models\CommitBlobBlocksOptions $options   optional parameters
    * 
    * @return none.
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179467.aspx 
    */
    public function commitBlobBlocks($container, $blob, $blockList, $options = null);

    /**
    * Retrieves the list of blocks that have been uploaded as part of a block blob.
    * 
    * There are two block lists maintained for a blob:
    * 1) Committed Block List: The list of blocks that have been successfully 
    *    committed to a given blob with commitBlobBlocks.
    * 2) Uncommitted Block List: The list of blocks that have been uploaded for a 
    *    blob using Put Block (REST API), but that have not yet been committed. 
    *    These blocks are stored in Windows Azure in association with a blob, but do
    *    not yet form part of the blob.
    * 
    * @param string                       $container name of the container
    * @param string                       $blob      name of the blob
    * @param Models\ListBlobBlocksOptions $options   optional parameters
    * 
    * @return Models\ListBlobBlocksResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179400.aspx
    */
    public function listBlobBlocks($container, $blob, $options = null);

    /**
    * Returns all properties and metadata on the blob.
    * 
    * @param string                          $container name of the container
    * @param string                          $blob      name of the blob
    * @param Models\GetBlobPropertiesOptions $options   optional parameters
    * 
    * @return Models\GetBlobPropertiesResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179394.aspx
    */
    public function getBlobProperties($container, $blob, $options = null);

    /**
    * Returns all properties and metadata on the blob.
    * 
    * @param string                        $container name of the container
    * @param string                        $blob      name of the blob
    * @param Models\GetBlobMetadataOptions $options   optional parameters
    * 
    * @return Models\GetBlobMetadataResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179350.aspx
    */
    public function getBlobMetadata($container, $blob, $options = null);

    /**
    * Returns a list of active page ranges for a page blob. Active page ranges are 
    * those that have been populated with data.
    * 
    * @param string                           $container name of the container
    * @param string                           $blob      name of the blob
    * @param Models\ListPageBlobRangesOptions $options   optional parameters
    * 
    * @return Models\ListPageBlobRangesResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691973.aspx
    */
    public function listPageBlobRanges($container, $blob, $options = null);

    /**
    * Sets system properties defined for a blob.
    * 
    * @param string                          $container name of the container
    * @param string                          $blob      name of the blob
    * @param Models\SetBlobPropertiesOptions $options   optional parameters
    * 
    * @return Models\SetBlobPropertiesResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691966.aspx
    */
    public function setBlobProperties($container, $blob, $options = null);

    /**
    * Sets metadata headers on the blob.
    * 
    * @param string                        $container name of the container
    * @param string                        $blob      name of the blob
    * @param array                         $metadata  key/value pair representation
    * @param Models\SetBlobMetadataOptions $options   optional parameters
    * 
    * @return Models\SetBlobMetadataResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179414.aspx
    */
    public function setBlobMetadata($container, $blob, $metadata, $options = null);

    /**
    * Reads or downloads a blob from the system, including its metadata and 
    * properties.
    * 
    * @param string                $container name of the container
    * @param string                $blob      name of the blob
    * @param Models\GetBlobOptions $options   optional parameters
    * 
    * @return Models\GetBlobResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179440.aspx
    */
    public function getBlob($container, $blob, $options = null);

    /**
     * Deletes a blob or blob snapshot.
     * 
     * Note that if the snapshot entry is specified in the $options then only this
     * blob snapshot is deleted. To delete all blob snapshots, do not set Snapshot 
     * and just set getDeleteSnaphotsOnly to true.
     * 
     * @param string                   $container name of the container
     * @param string                   $blob      name of the blob
     * @param Models\DeleteBlobOptions $options   optional parameters
     * 
     * @return none
     * 
     * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179413.aspx
     */
    public function deleteBlob($container, $blob, $options = null);

    /**
    * Creates a snapshot of a blob.
    * 
    * @param string                           $container name of the container
    * @param string                           $blob      name of the blob
    * @param Models\CreateBlobSnapshotOptions $options   optional parameters
    * 
    * @return Models\CreateBlobSnapshotResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691971.aspx
    */
    public function createBlobSnapshot($container, $blob, $options = null);

    /**
    * Copies a source blob to a destination blob within the same storage account.
    * 
    * @param string                 $destinationContainer name of container
    * @param string                 $destinationBlob      name of blob
    * @param string                 $sourceContainer      name of container
    * @param string                 $sourceBlob           name of blob
    * @param Models\CopyBlobOptions $options              optional parameters
    * 
    * @return CopyBlobResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx
    */
    public function copyBlob($destinationContainer, $destinationBlob,
        $sourceContainer, $sourceBlob, $options = null
    );

    /**
    * Establishes an exclusive one-minute write lock on a blob. To write to a locked
    * blob, a client must provide a lease ID.
    * 
    * @param string                     $container name of the container
    * @param string                     $blob      name of the blob
    * @param Models\AcquireLeaseOptions $options   optional parameters
    * 
    * @return Models\AcquireLeaseResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx
    */
    public function acquireLease($container, $blob, $options = null);

    /**
    * Renews an existing lease
    * 
    * @param string                    $container name of the container
    * @param string                    $blob      name of the blob
    * @param string                    $leaseId   lease id when acquiring
    * @param Models\BlobServiceOptions $options   optional parameters
    * 
    * @return Models\AcquireLeaseResult
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx
    */
    public function renewLease($container, $blob, $leaseId, $options = null);

    /**
    * Frees the lease if it is no longer needed so that another client may 
    * immediately acquire a lease against the blob.
    * 
    * @param string                    $container name of the container
    * @param string                    $blob      name of the blob
    * @param string                    $leaseId   lease id when acquiring
    * @param Models\BlobServiceOptions $options   optional parameters
    * 
    * @return none
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx
    */
    public function releaseLease($container, $blob, $leaseId, $options = null);

    /**
    * Ends the lease but ensure that another client cannot acquire a new lease until
    * the current lease period has expired.
    * 
    * @param string                    $container name of the container
    * @param string                    $blob      name of the blob
    * @param Models\BlobServiceOptions $options   optional parameters
    * 
    * @return none
    * 
    * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee691972.aspx
    */
    public function breakLease($container, $blob, $options = null);
}