Re: Sample code to access cloud.google.com / google compute engine ?

Pontus Östlund <[email protected]> Wed, 15 May 2019 20:24:39 +0200
Newsgroups gmane.comp.lang.pike.devel,gmane.comp.lang.pike.user
Message-ID <[email protected]>
> On 15 May 2019, at 15:30, Stephen R. van den Berg <[email protected]> wrote:
> 
> Does anyone happen to have some boilerplate code which they can share
> that uses Pike to get the authorisation tokens required to create
> and delete google compute engine instances?
> 
> [...]
> 
> In my case I only need to call some Google API (server to server), no userdata
> involved.

I think this might work:

  Web.Api.Google api = Web.Api.Google(0, 0, 0);

  api->auth->get_token_from_jwt(your_service_account_key, 0, 
    lambda (bool ok, string data) {
      // yadda yadda
    });

And if I remember correctly, leaving out the lambda will issue a sync call.

Regards
-----------------------------
Pontus Östlund
Developer • Roxen AB
+46 70-662 81 69

www.roxen.com <http://www.roxen.com/> | twitter.com/roxen <https://twitter.com/roxen>