pharo-users@lists.pharo.org

Any question about pharo is welcome

View all threads

Using pharo in a cloud native environment

SK
Stefan Krecher
Fri, Aug 5, 2022 3:38 PM

Hi,
every now and then I get back to smalltalk/ pharo to find out if there's a
practical way to use pharo to manage cloud resources, e.g. by calling
Azure- or AWS APIs.
I know there have been efforts to implement a Smalltalk binding to use the
AWS API at least for some of their services but it looks like there's
support for only a few, eg S3.
I'd love to use pharo to build a seaside app with a nice UI to make calls
to Azure and/ or AWS to start/ stop ec2 instances etc.
Of course I could create Azure functions that do the API calls and then
just call those functions from pharo - but I ask myself if there's a nicer
way do do this ...
Any recommendations?
Regards
Stefan

Hi, every now and then I get back to smalltalk/ pharo to find out if there's a practical way to use pharo to manage cloud resources, e.g. by calling Azure- or AWS APIs. I know there have been efforts to implement a Smalltalk binding to use the AWS API at least for some of their services but it looks like there's support for only a few, eg S3. I'd love to use pharo to build a seaside app with a nice UI to make calls to Azure and/ or AWS to start/ stop ec2 instances etc. Of course I could create Azure functions that do the API calls and then just call those functions from pharo - but I ask myself if there's a nicer way do do this ... Any recommendations? Regards Stefan
BN
Bob Nemec
Tue, Aug 9, 2022 3:29 PM

We use Azure with our GS Seaside app for single sign-on. Once we have the Azure Graph token we then use that token for Graph API calls. Works nicely. I find MS Graph documentation to be excellent, as are all the supporting YouTube videos.
Here's a short Seaside summary of the steps we use...
1 - initialRequest: -> redirect to https://login.microsoftonline.com/ with your Azure application id and redirection URL, which for use is our app URL + ?authenticate 2 - initialRequest: with 'authenticate' -> send request to https://login.microsoftonline.com/ with the authentication token provided by the MS redirect 3 - extract the Graph access token from the response 4 - use the Graph access token for Graph web service calls. In our case we use https://graph.microsoft.com/v1.0/me + Bearer <accessToken> to get the authenticated user's Graph ID, which we then use to find the application user object.5 - refresh the token before it expires, which is usually under and hour, by checking the expires_in value
We've been running this way for a few months now. Next step is to expand our use of MS Graph with Outlook, Teams and SharePoint. 
Hope that helps,Bob Nemec

On Friday, August 5, 2022 at 11:39:48 a.m. EDT, Stefan Krecher <stefan.krecher@gmail.com> wrote:  

Hi,every now and then I get back to smalltalk/ pharo to find out if there's a practical way to use pharo to manage cloud resources, e.g. by calling Azure- or AWS APIs.I know there have been efforts to implement a Smalltalk binding to use the AWS API at least for some of their services but it looks like there's support for only a few, eg S3.I'd love to use pharo to build a seaside app with a nice UI to make calls to Azure and/ or AWS to start/ stop ec2 instances etc.Of course I could create Azure functions that do the API calls and then just call those functions from pharo - but I ask myself if there's a nicer way do do this ...Any recommendations?RegardsStefan

We use Azure with our GS Seaside app for single sign-on. Once we have the Azure Graph token we then use that token for Graph API calls. Works nicely. I find MS Graph documentation to be excellent, as are all the supporting YouTube videos. Here's a short Seaside summary of the steps we use... 1 - initialRequest: -> redirect to https://login.microsoftonline.com/ with your Azure application id and redirection URL, which for use is our app URL + ?authenticate 2 - initialRequest: with 'authenticate' -> send request to https://login.microsoftonline.com/ with the authentication token provided by the MS redirect 3 - extract the Graph access token from the response 4 - use the Graph access token for Graph web service calls. In our case we use https://graph.microsoft.com/v1.0/me + Bearer <accessToken> to get the authenticated user's Graph ID, which we then use to find the application user object.5 - refresh the token before it expires, which is usually under and hour, by checking the expires_in value We've been running this way for a few months now. Next step is to expand our use of MS Graph with Outlook, Teams and SharePoint.  Hope that helps,Bob Nemec On Friday, August 5, 2022 at 11:39:48 a.m. EDT, Stefan Krecher <stefan.krecher@gmail.com> wrote: Hi,every now and then I get back to smalltalk/ pharo to find out if there's a practical way to use pharo to manage cloud resources, e.g. by calling Azure- or AWS APIs.I know there have been efforts to implement a Smalltalk binding to use the AWS API at least for some of their services but it looks like there's support for only a few, eg S3.I'd love to use pharo to build a seaside app with a nice UI to make calls to Azure and/ or AWS to start/ stop ec2 instances etc.Of course I could create Azure functions that do the API calls and then just call those functions from pharo - but I ask myself if there's a nicer way do do this ...Any recommendations?RegardsStefan