/**
  * Sets rangeEnd
  * 
  * @param integer $rangeEnd range end value in bytes
  * 
  * @return none
  */
 public function setRangeEnd($rangeEnd)
 {
     Validate::isInteger($rangeEnd, 'rangeEnd');
     $this->_rangeEnd = $rangeEnd;
 }
 /**
  * Sets blob sequenceNumber.
  *
  * @param int $sequenceNumber value.
  *
  * @return none.
  */
 public function setSequenceNumber($sequenceNumber)
 {
     Validate::isInteger($sequenceNumber, 'sequenceNumber');
     $this->_sequenceNumber = $sequenceNumber;
 }
예제 #3
0
 /**
  * @covers MicrosoftAzure\Storage\Common\Internal\Validate::isInteger
  */
 public function testIsIntegerWithNonInteger()
 {
     $this->setExpectedException(get_class(new InvalidArgumentTypeException('')));
     Validate::isInteger(new \DateTime(), 'integer');
 }
예제 #4
0
 /**
  * Sets max results.
  *
  * @param integer $maxResults value.
  * 
  * @return none.
  */
 public function setMaxResults($maxResults)
 {
     Validate::isInteger($maxResults, 'maxResults');
     $this->_maxResults = $maxResults;
 }
 /**
  * Sets blob contentLength.
  *
  * @param integer $contentLength value.
  *
  * @return none.
  */
 public function setContentLength($contentLength)
 {
     Validate::isInteger($contentLength, 'contentLength');
     $this->_contentLength = $contentLength;
 }
예제 #6
0
 /**
  * Updates the visibility timeout of a message and/or the message contents.
  * 
  * @param string              $queueName                  The queue name.
  * @param string              $messageId                  The id of the message.
  * @param string              $popReceipt                 The valid pop receipt 
  * value returned from an earlier call to the Get Messages or Update Message
  * operation.
  * @param string              $messageText                The message contents.
  * @param int                 $visibilityTimeoutInSeconds Specifies the new 
  * visibility timeout value, in seconds, relative to server time. 
  * The new value must be larger than or equal to 0, and cannot be larger 
  * than 7 days. The visibility timeout of a message cannot be set to a value 
  * later than the expiry time. A message can be updated until it has been 
  * deleted or has expired.
  * @param QueueServiceOptions $options                    The optional 
  * parameters.
  * 
  * @return MicrosoftAzure\Storage\Common\Models\UpdateMessageResult
  */
 public function updateMessage($queueName, $messageId, $popReceipt, $messageText, $visibilityTimeoutInSeconds, $options = null)
 {
     Validate::isString($queueName, 'queueName');
     Validate::notNullOrEmpty($queueName, 'queueName');
     Validate::isString($messageId, 'messageId');
     Validate::notNullOrEmpty($messageId, 'messageId');
     Validate::isString($popReceipt, 'popReceipt');
     Validate::notNullOrEmpty($popReceipt, 'popReceipt');
     Validate::isString($messageText, 'messageText');
     Validate::isInteger($visibilityTimeoutInSeconds, 'visibilityTimeoutInSeconds');
     Validate::notNull($visibilityTimeoutInSeconds, 'visibilityTimeoutInSeconds');
     $method = Resources::HTTP_PUT;
     $headers = array();
     $postParams = array();
     $queryParams = array();
     $path = $queueName . '/messages' . '/' . $messageId;
     $body = Resources::EMPTY_STRING;
     $statusCode = Resources::STATUS_NO_CONTENT;
     if (is_null($options)) {
         $options = new QueueServiceOptions();
     }
     $this->addOptionalQueryParam($queryParams, Resources::QP_VISIBILITY_TIMEOUT, $visibilityTimeoutInSeconds);
     $this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $options->getTimeout());
     $this->addOptionalQueryParam($queryParams, Resources::QP_POPRECEIPT, $popReceipt);
     if (!empty($messageText)) {
         $this->addOptionalHeader($headers, Resources::CONTENT_TYPE, Resources::URL_ENCODED_CONTENT_TYPE);
         $message = new QueueMessage();
         $message->setMessageText($messageText);
         $body = $message->toXml($this->dataSerializer);
     }
     $response = $this->send($method, $headers, $queryParams, $postParams, $path, $statusCode, $body);
     $responseHeaders = HttpFormatter::formatHeaders($response->getHeaders());
     $popReceipt = Utilities::tryGetValue($responseHeaders, Resources::X_MS_POPRECEIPT);
     $timeNextVisible = Utilities::tryGetValue($responseHeaders, Resources::X_MS_TIME_NEXT_VISIBLE);
     $date = Utilities::rfc1123ToDateTime($timeNextVisible);
     $result = new UpdateMessageResult();
     $result->setPopReceipt($popReceipt);
     $result->setTimeNextVisible($date);
     return $result;
 }
예제 #7
0
 /**
  * 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 The container name.
  * @param string                   $blob      The blob name.
  * @param integer                  $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   The optional parameters.
  * 
  * @return CopyBlobResult
  * 
  * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179451.aspx
  */
 public function createPageBlob($container, $blob, $length, $options = null)
 {
     Validate::isString($container, 'container');
     Validate::isString($blob, 'blob');
     Validate::notNullOrEmpty($blob, 'blob');
     Validate::isInteger($length, 'length');
     Validate::notNull($length, 'length');
     $method = Resources::HTTP_PUT;
     $headers = array();
     $postParams = array();
     $queryParams = array();
     $path = $this->_createPath($container, $blob);
     $statusCode = Resources::STATUS_CREATED;
     if (is_null($options)) {
         $options = new CreateBlobOptions();
     }
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_TYPE, BlobType::PAGE_BLOB);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_CONTENT_LENGTH, $length);
     $this->addOptionalHeader($headers, Resources::X_MS_BLOB_SEQUENCE_NUMBER, $options->getSequenceNumber());
     $headers = $this->_addCreateBlobOptionalHeaders($options, $headers);
     $this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $options->getTimeout());
     $response = $this->send($method, $headers, $queryParams, $postParams, $path, $statusCode);
     return CopyBlobResult::create(HttpFormatter::formatHeaders($response->getHeaders()));
 }
예제 #8
0
 /**
  * Adds status code to the expected status codes.
  * 
  * @param integer $statusCode The expected status code.
  * 
  * @return none
  */
 public function addStatusCode($statusCode)
 {
     Validate::isInteger($statusCode, 'statusCode');
     $this->_statusCodes[] = $statusCode;
 }