Get underlying image name for Google Cloud Launcher deployment - google-compute-engine

I'd like to deploy MongoDB in Google Cloud Compute Engine using terraform. Since this is an experimental setup, I'd like to use some pre-configured image to save time. Browsing through Google Cloud Launcher I've found this MongoDB deployments.
After some more Googling I've found this Google Deployment Manager example, where I found project name for Cloud Launcher images: click-to-deploy.
Using it I've managed to list all MongoDB click-to-deploy images:
gcloud compute images list --project click-to-deploy-images --regexp mongodb.+ --uri
Which gave me this list:
https://www.googleapis.com/compute/v1/projects/click-to-deploy-images/global/images/mongodb-3-2-debian-8-jessie-20161006-083532
https://www.googleapis.com/compute/v1/projects/click-to-deploy-images/global/images/mongodb-3-2-debian-8-jessie-20161111-154124
https://www.googleapis.com/compute/v1/projects/click-to-deploy-images/global/images/mongodb-3-4-debian-8-jessie-20170117-113500
https://www.googleapis.com/compute/v1/projects/click-to-deploy-images/global/images/mongodb-3-4-debian-8-jessie-20170119-150929
https://www.googleapis.com/compute/v1/projects/click-to-deploy-images/global/images/mongodb-32-1607281513-debian-8-jessie-v20160718
https://www.googleapis.com/compute/v1/projects/click-to-deploy-images/global/images/mongodb-cloud-manager-bootstrap-ubuntu-v20160516a
But there is no way to correlate these images to Cloud Launcher deployments. I've thought about using image/deployment timestamps for this, but unfortunately they don't match.
So, the question is, how to get underlying image for Google Cloud Launcher deployment?

This is not the answer I was hoping for, but it's the best I've got for now.
You have to deploy VM using Google Cloud Launcher and grab image name afterwards from Google Deployment Manager. To do so, you have to expand Template details and click on template type (mongodb.jinja in my case).
It's also gives you a complete Deployment Manager config (with metadata, scripts and other stuff).
Here is the screenshot:

Related

Testing Google Apps Script using Google Cloud APIs

I am working on implementing a Google App Script project which makes use of various cloud APIs like Big Query, Cloud SQL, Google Ads etc. Implementation works pretty well through a project where GCP project ID is configured.
But I would like to have a development only version which I can use for my validation.
If I use a test deployment as mentioned on https://developers.google.com/apps-script/add-ons/how-tos/testing-editor-addons, it works. But this works only via the script project where GCP project is configured. For other, it gives "Google developers console API activation" error.
So question here is - is it mandatory to provide the GCP project ID even for test deployments? Is there any configuration that I can use for getting around this problem?
Please note - I can always create a test deployment from the production version of App Script project (where GCP project id is added). But I would like to maintain 2 versions possibly without having to add GCP project in development version.
Kindly advice.
It depends on how you or your team have designed the solution. Also it's depends on if the solution is requiring users to authorize all the scopes, if it's using a service account, among other factors.
One design might be based on the use of a single Google Cloud Platform standard project to handle all the OAuth authorizations.
Another design might be based on using two or more Google Cloud Platform projects. I.E. you could use a default project for Google Apps Script and a standard project another for the Google APIs like BigQuery. This setup might require the use of a service account.
Related
Create a development environment and use a deployment tool for Google apps script in spreadsheets
Best development setup for developing gmail add-ons locally?

Google Apps Script - how to view HEAD Deployment ID / link?

I am not sure if this changed recently with the new IDE, but I thought that the deployment ID / URL of one's web app didn't change when one created additional versions. However, at this moment I am confused.
In my process.env, I have a link to my GAS URL which performs a doGet(e). However, when I go to manage deployments in my GAS file, I cannot find the corresponding deployment ID / link anywhere (not under Active nor Archived), yet, the code is working and reflects the latest changes in my script, so I believe it's the head deployment. Is this correct, or am I using some legacy deployment ID or something that's hidden?
Or perhaps asked differently, if I have the /macros/s/{deployment_id}/exec URL, is there a way within my Google account to find the corresponding script file and version / deployment?
Lastly, if the documentation recommends using versioned deployments, does this mean we have to update the GAS URL each time (e.g., if it's a public facing web app)?
Edit: others have encountered this: https://groups.google.com/g/google-apps-script-community/c/qhiqjGabQpI/m/q5i31yydCAAJ
To view the all deployment IDs, including HEAD (aka version 0):
Switch to Legacy Editor
Go to Publish => Deploy From Manifest
You'll get a list of deployment, with ID next to each one
Copy the ID of Version 0
Paste the ID in the corresponding Google Cloud Console => Configuration
Switch again to New Editor :)
If you are using Clasp with Apps Script for the development simply you can use clasp commands agents the given App Script Project.
clasp deployments to see the list of deployments including HEAD
this document maybe can help you.
Follow step 5 and step 6 in the IMPORTANT POINT.
5. Update the deployment as follows:
a. Open "New deployment" dialog with "Deploy" -> "Manage deployments".
b. For the 1st deployment, click the pencil icon for editing the deployment.
c. Set "version" as "New version".
d. When you want to change the description, please modify it.
e.Click "Deploy" button.
6.Testing
Please use above sample curl command. By this, you can confirm that sample2 is returned without changing the endpoint.
Answer:
There ways of viewing and editing deployments is set out in this article, which I will go through below. If you can not view the desired deployment using these methods, then I would urge you to contact Google Workspace support.
More Information:
As per the documentation on creating and managing deployments:
There are two types of deployments:
Head deployments, which are always synced to the current project code.
Versioned deployments, which are connected to a specific project version.
View versioned deployments
New editor:
To view the deployments of an Apps Script project, at the top, click Deploy > Manage deployments.
Find a deployment ID
New editor:
Open the Apps Script project.
At the top right, click Deploy > Manage deployments.
The deployment ID appears on the current deployment.
References:
Create and manage deployments | Apps Script | Google Developers

How to request internal API in App Script

I have a project in GCP with some internal APIs (in VMs), Databases, and so on.
Now, I'm trying to create a GAS to obtain data from one of those internal APIs (Druid, in my case) to print some data in a Google Spreadsheet.
My point here is that I link the GAS to my GCP project, expecting to be able to connect to my internal IP (10.1.0.x) which is in a VPC, shared with the default one. So, if I start a new VM attached to the default network, I could be able to ping and connect to it. Seems reasonable.
But, when I execute the GAS function, the following pice of code fails: UrlFetchApp.fetch('http://10.1.0.3:8082/druid/v2/?pretty', options);.
Should I configure something else in the GCP project to be able to connect to internal APIs?
Should I change the way and use another GCP service to do so?
Any help would be more than appreciated!
Thanks
That is not supported in Apps Script. You could request a feature request in the bug tracker. See https://developers.google.com/apps-script/support#missing_features
Internal APIs run client-side and need to be incorporated within JavaScript code.
Within Apps Script you can run JavaScript code, if you deploy your project as a Web App.
You can then either embed the JS code within the HTML file attached to the project, or directly insert it within the <script></script> tags within HtmlService.createHtmlOutput().

Can't switch google cloud project on GAS Editor

I am not able to switch google cloud platform project in GAS editor.
What I am doing is…
Open the google sheet GAS editor
Open Resource --> Cloud Platform Project
Enter project number that I want to connect
With the process above, I was able to switch a cloud platform project but now it returns an error
‘Project does not exist, or you need edit access to it.’
I am using the same cloud project and same account(editor) that I used before and properly worked. I tried do the same with a owner account, but it didn’t work, either.
Also, this cloud project is not a default project nor a hidden project. (If it does, I guess it should not be able to access through GAS editor from the beginning)
I have checked documentation below, but it tells me only case when switching to a hidden project.
https://developers.google.com/apps-script/guides/cloud-platform-projects
Does anyone have a solution or suggestion??
Thank you for the help in advance.
Problem Solved.
I figured out that OAuth IDs which are generated when make connection docs to the cloud project are not be deleted even though delete actual document files.
What I have done is...
Login Google Cloud Platform
Go to APIs&Services --> Credentials
On OAuth 2.0 client IDs, delete unnecessary contents from the list
Back to your docs and switch the cloud project.

How to retrieve my Install Statistics from the Google Developer's Console

I am trying to programmatically retrieve my company's app data from the Google Developer's Console, specifically the daily installs. I have found that Google recommends the gsutil tool to access the data programmatically through the Google Cloud Storage SDK. However, I beleive they charge for this service. I want a free way to programmatically retrieve the data, preferably as a JSON stream to avoid dealing with file downloads. I have found the "direct reporting" links, but I have problems authenticating when I try to use them, and I also have to do something with the actual files then.
Is there a way to get a JSON version of the data through OAuth2 or something without downloading an Excel file? Has anyone had to do this?
You should look into use the Core Reporting API.
There are client libraries available in a number of languages.
You should work through the Hello Analytics APIs to get started.
Java Script
PHP
Python
Java
A quick solution for building a dashboard would also be the Embed API.
Using the gsutil tool to access the company's storage bucket that are provided by google is a free service. I wrote a code that will run the gsutil code as a process through the command line and parsed the downloaded .csv files into a database for storage. OAuth2 was not necessary.