Monday, February 8, 2016

[google-cloud-sql-discuss] Problem with authorization(Insufficient Permission), export db from cloud sql to bucket(location on another instance)

I have problem with authorization to google service
I have instance where running php script which trying auth by json config
I turn on next services

BigQuery API
Cloud Debugger API
Debuglet Controller API
Google Cloud Dataflow API
Google Cloud Dataproc API
Google Cloud Deployment Manager API
Google Cloud Deployment Manager V2 API
Google Cloud Logging API
Google Cloud SQL
Google Cloud SQL API
Google Cloud Storage
Google Cloud Storage JSON API
Google Compute Engine
Google Compute Engine Autoscaler API
Google Compute Engine Instance Group Manager API
Google Compute Engine Instance Group Updater API
Google Compute Engine Instance Groups API
Google Container Engine API

I created service key and was generated json file on cloud instance
This json file I used in function 'setAuthConfig'

part of script:

$instance = 'instance name where cloud sql';
        $project = 'octopus-bank-api';

        $client = new \Google_Client();
        //$client->useApplicationDefaultCredentials();

$client->setAuthConfig(path_to_file/file.json');

        $client->addScope(\Google_Service_Storage::DEVSTORAGE_FULL_CONTROL);
        $sqlAdmin = new \Google_Service_SQLAdmin($client);

        $postBody = new \Google_Service_SQLAdmin_InstancesExportRequest();

        $sqlAdmin->instances->export($project, $instance, $postBody);



Exception 'Google_Service_Exception' with message '{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "insufficientPermissions",
    "message": "Insufficient Permission"
   }
  ],
  "code": 403,
  "message": "Insufficient Permission"
 }
}
'

in /var/www/octopus/vendor/google/apiclient/src/Google/Http/REST.php:123

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/644ffcfd-fc61-430e-bdce-8d4242bf888a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment