PHP Lib kullanarak programlı olarak Google Console Cloud platformunda proje nasıl oluşturulur?
PHP istemci kitaplığını kullanarak Google konsol bulutunda bir proje oluşturmaya çalışıyorum. Bu örnek kodu şuradan kopyaladım:https://cloud.google.com/resource-manager/reference/rest/v1/projects/create#php
Alınan adımlar / Sorun var:
Bu "
$requestBody = new \Google_Service_CloudResourceManager_Project();" satırı .Fırlatma hatası : 'Sınıf Google_Service_CloudResourceManager_Project bulunamadı'.
Sonra " Bu API'yi dene " menüsünü kontrol ettim , JSON'u Google API Explorer ile API'ye geçirebiliriz. Google API Explorer ile test ettim ve sonuçlar iyi çalışıyor. ( Ekran görüntüsüne bakın )
Bu satırı "
$requestBody = new \Google_Service_CloudResourceManager_Project();" yorumluyor ve yöntemi oluşturmak için gerekli json'u geçmeye çalışıyor (" Bu API'yi dene " menüsünde işaretlediğim gibi).Fırlatma hatası :
create()Bu satırdaki "$response = $service->projects->create($requestBody);" null üzerinde bir üye işlevi çağırın .
Google OAuth komut dosyam düzgün çalışıyor, yalnızca bu projeyle ilgili sorun komut dosyası oluştur
PHP Komut Dosyası:
$client = new \Google_Client();
$client->setApplicationName('Google-CloudResourceManagerSample/0.1');
//$client->useApplicationDefaultCredentials();
$client->addScope('https://www.googleapis.com/auth/cloud-platform');
$service = new \Google_Service_CloudResourceManager($client);
// TODO: Assign values to desired properties of `requestBody`:
//$requestBody = new \Google_Service_CloudResourceManager_Project();
$requestBody = '{
"name": "bob kris project 2",
"projectId": "bk-project-290016"
}';
$response = $service->projects->create($requestBody);
// TODO: Change code below to process the `response` object:
echo '<pre>', var_export($response, true), '</pre>', "\n";
die;
Yanıtlar
Görünüşe göre bu Google'ın dahili bir sorunu. Senaryonuzu yeniden yarattım ve aynı sonucu aldım. Bir Cloud App Engine mühendislik ekibiyle iletişime geçtim ve isteğinizi yeniden yönlendirdim. Ayrıca, halihazırda genel bir çağrı açtık ve Google ile tüm iletişim orada devam edecek.