Accessing to Google Cloud Platform Rest APIs using Service Account Credentials (Google's recommended way)
For more information about authentication: https://cloud.google.com/speech/docs/common/auth
gcp_rest_guzzle_adapter:
clients:
pubsub:
email: '[email protected]'
private_key: "-----BEGIN PRIVATE KEY-----SDADAavaf...-----END PRIVATE KEY-----"
scope: 'https://www.googleapis.com/auth/pubsub'
project_base_url: 'https://pubsub.googleapis.com/v1/projects/test-project123/'
Note: Double quote for private_key. Single quote occur openssl_sign error
$pubSubClient = $container->get('gcp_rest_guzzle_adapter.client.pubsub_client');
$result = $pubSubClient->get(
sprintf('topics/%s/subscriptions', 'test-topic')
);
var_dump((string)$result->getBody()->getContents());
string(113) "{
"subscriptions": [
"projects/test-project123/subscriptions/test_topicSubscriber"
]
}
"