• Модуль: clouds
  • Путь к файлу: ~/bitrix/modules/clouds/classes/general/storage_service_google.php
  • Класс: CCloudStorageService_GoogleStorage
  • Вызов: CCloudStorageService_GoogleStorage::CreateBucket
function CreateBucket($arBucket)
{
	global $APPLICATION;

	if($arBucket["LOCATION"])
		$content =
			''.
			''.$arBucket["LOCATION"].''.
			'';
	else
		$content = '';

	$response = $this->SendRequest(
		$arBucket["SETTINGS"]["ACCESS_KEY"],
		$arBucket["SETTINGS"]["SECRET_KEY"],
		'PUT',
		$arBucket["BUCKET"],
		'/',
		'',
		$content,
		array(
			"x-goog-project-id" => $arBucket["SETTINGS"]["PROJECT_ID"],
		)
	);

	if($this->status == 409/*Already exists*/)
	{
		$APPLICATION->ResetException();
		return true;
	}
	elseif (is_array($response))
	{
		return true;
	}
	else
	{
		if (defined("BX_CLOUDS_ERROR_DEBUG"))
		{
			AddMessage2Log($this);
		}
		return false;
	}
}