Category : google-cloud-storage

I’m trying to delete a folder in a GCP bucket using the gs storage PHP library. The folder structure is like so -Folder1 –Folder1.1 —File —File –Folder1.2 —File -Folder2 –Folder2.1 —File —File –Folder2.3 —File Hopefully, that makes sense. If not, I basically just need to delete a folder and all files and folders within it. ..

Read more

I’m having problems getting Google Cloud batch operations authenticated, using the PHP library. I specifically am trying to do batch deletion of Cloud Storage objects. I am setting things up like so: use GoogleCloudStorageStorageClient; $config = [ ‘projectId’ => <MY Project ID> ‘keyFile’ => json_decode(file_get_contents( <my json key file> ), true) ]; $google_client = new ..

Read more

I’m trying to set up batch deleting of GoogleCloudStorage objects. After $config = [ ‘projectId’ => <MY Project ID> ‘keyFile’ => json_decode(file_get_contents( <my json key file> ), true) ]; $google_client = new Google_Client($config); $google_client->setUseBatch(true); $delete_batch_storage_client = new Google_Service_Storage($google_client); $delete_batch = new Google_Http_Batch($google_client, false, NULL, "batch/storage"); $storage_client = new StorageClient($config); $bucket = $storage_client->bucket(<my bucket name>); $params ..

Read more

I am trying to create a pub/sub notification using PHP. I have a project and a service account. My code looks like: use GoogleCloudCoreIamPolicyBuilder; use GoogleCloudPubSubPubSubClient; use GoogleCloudStorageStorageClient; self::$storage_client = new StorageClient( [ ‘projectId’ => "MY PROJECT ID", ‘keyFile’ => json_decode(file_get_contents("PATH TO MY KEYFILE", true) ] ); $pubSub = new PubSubClient( [ ‘projectId’ => "MY ..

Read more

I’m displaying custom data dashboard with the new Google Analytics Data API (GA4). The request output is correct but really slow.. require ‘./vendor/autoload.php’; use GoogleCloudStorageStorageClient; use GoogleAnalyticsDataV1betaBetaAnalyticsDataClient; use GoogleAnalyticsDataV1betaDateRange; use GoogleAnalyticsDataV1betaDimension; use GoogleAnalyticsDataV1betaMetric; putenv(‘GOOGLE_APPLICATION_CREDENTIALS=1_cms_main_conf/google_service_account.json’); $property_id = $conf[‘idAnalytics’]; $client = new BetaAnalyticsDataClient(); $dailyStat = $client->runReport([ ‘property’ => ‘properties/’ . $property_id, ‘dateRanges’ => [ new DateRange([ ‘start_date’ ..

Read more