예제 #1
0
 /**
  * Constructs HTTP call context for deleteEntity API.
  * 
  * @param string                     $table        The name of the table.
  * @param string                     $partitionKey The entity partition key.
  * @param string                     $rowKey       The entity row key.
  * @param Models\DeleteEntityOptions $options      The optional parameters.
  * 
  * @return HttpCallContext
  */
 private function _constructDeleteEntityContext($table, $partitionKey, $rowKey, $options)
 {
     Validate::isString($table, 'table');
     Validate::notNullOrEmpty($table, 'table');
     Validate::isTrue(!is_null($partitionKey), Resources::NULL_TABLE_KEY_MSG);
     Validate::isTrue(!is_null($rowKey), Resources::NULL_TABLE_KEY_MSG);
     $method = Resources::HTTP_DELETE;
     $headers = array();
     $queryParams = array();
     $statusCode = Resources::STATUS_NO_CONTENT;
     $path = $this->_getEntityPath($table, $partitionKey, $rowKey);
     if (is_null($options)) {
         $options = new DeleteEntityOptions();
     }
     $etagObj = $options->getETag();
     $ETag = !is_null($etagObj);
     $this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $options->getTimeout());
     $this->addOptionalHeader($headers, Resources::IF_MATCH, $ETag ? $etagObj : Resources::ASTERISK);
     $context = new HttpCallContext();
     $context->setHeaders($headers);
     $context->setMethod($method);
     $context->setPath($path);
     $context->setQueryParameters($queryParams);
     $context->addStatusCode($statusCode);
     $context->setUri($this->getUri());
     $context->setBody('');
     return $context;
 }