How to create time-driven triggers in a google API service account - google-api

One of our Java applications uses a google API service account to process all the Google Drive Documents shared to it. As at the moment there is no REST API for manipulating the content of the documents, I plan to use a Google Apps Script with a time driven trigger for that purpose.
Could not find how to set up such a trigger for a google API service account. Needing some help. Thanks.
Sanjay

According to the Documentation, Time-Driven Triggers execute under the trigger owner identity. So it is not important which account type uses your Java Applications.

There is no special trigger for google API service accounts Setting up a trigger is the same for any account. Have a look at the documentation on triggers for more information

Related

How would I use Google's Calendar API to dynamically create events in a SaaS app?

This is a CRM-style app that can have many different organizations using it.
I don't think I can use OAuth, since these events are supposed to be dynamically created. For example, a user could make a trigger to create an event on the creation of a type of record. A user shouldn't need to be actively logged in for events to be made.
I read about service accounts, but it seems like I'd have to walk each of my users through creating a service account on their Workspace. That seems like it would quickly get out of hand.
I also don't see how I would store these service account secrets. I could switch from ENV secrets to something like AWS's SecretsManager, but is that really the only option?

Can Google Calendar API be used to create scalable scheduling service?

I need to create a scheduler for my own SaaS, and I'm trying to understand whether Google Calendar API is a fit for that. Basically I could have hundreds of thousands of calendars. Each calendar may be a user of my service, but not a Google user. It seems that perhaps I could use resource calendars under my Google Cloud service account. My biggest concern is whether my usage will fall within the Calendar API's service quotas, either automatically or by requesting a quota increase?
Yes service accounts will fall within quota usage limits. There is also a limit about creating more then 25 calendars in a day causing the user to end up in read mode for the rest of the day.
pricing
Google Calendar API Usage Limits
The Google Calendar API has a courtesy limit of 1,000,000 queries per day.
To view or change usage limits for your project, or to request an increase to your quota, do the following:
If you don't already have a billing account for your project, then create one.
Visit the Enabled APIs page of the API library in the API Console, and select an API from the list.
To view and change quota-related settings, select Quotas. To view usage statistics, select Usage.
On the one hand, you could work around the quota issues by sharding your users across multiple Service Accounts. You would probably also want to shard them across multiple App IDs.
On the other hand, don't do it. In my experience, using Google APIs outside their intended use case doesn't end well.

Is it possible to create google API KEY programmatically?

I'm trying to automate the process of creating and managing my projects on Google Cloud Platform. I want to create new project and generate API keys for it and use them.
I am unable to find any API to create API KEYS. Is there any solution ?
Thanks
You may not be able to create API keys programmatically, but you can create service accounts. Service accounts can do all the things on API keys can, and are much more secure than API keys. And you can create them via API calls!
Here's the API reference for creating service accounts, and for creating service account keys (which have a public/private keypair).
Here's the API reference for creating projects.
You should be able to do whatever you were trying to accomplish with these tools. But for most simple use-cases using the UI is recommended.
From My little experience you can't . You have to use Google API Console
❯ gcloud alpha services api-keys create --display-name=NAME
See: https://cloud.google.com/sdk/gcloud/reference/alpha/services/api-keys/create

Does Google Container Engine SDK/API exist?

I am planning to launch container cluster from an SDK/API. Presently, I am fine with any language, but I prefer NodeJS SDK. As far as I have seen, I could not find any Container engine SDK. Here is the NodeJS SDK for GCP which does not contain container engine. In fact it contains SDK only for very few GCP services.
I came across OAuth API for container engine but it involves human intervention to launch it. I am looking for service account based authentication for the SDK.
Are there container engine SDKs available ?
Update after discussion with Robert Lacok:
This is the code I tried to use for container APIs with API-key, it does not work. It expects Oauth 2 token, or some other credentials other than Service account. I tried API-key it didnt work. I dont know how to use Service account authentication with the API.
Here is my source code:
Here is the error:
I see a method for Application Default credentials. But I dont think so it will be useful for my use-case. I am trying to create container cluster from AWS Lambda. So, I cant use application default credentials. Is there any other options ?
The API for Google Container Engine is very limited at the moment as all the features are in Alpha status and because they can change not many people are incorporating them into the SDKs they are developing.
These are the current available APIs: https://cloud.google.com/sdk/gcloud/reference/container/
And here is the Alpha APIs: https://cloud.google.com/sdk/gcloud/reference/alpha/container/
What you probably want to do is making calls to the REST API and using the client library for OAuth2 authentication.
You can browse the API documentation and see that every method has a short how-to for a number of languages, NODE.JS being one of them. Have a look here for an example on how to create a container cluster.
You also mentioned service account authentication. The preferred way to do this is to use the application default credentials, you can have a little read about them here.
In short, you want to set an environment variable GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json which is a key to service account you generated in console.
Then the client library will take care of the rest (getting the OAuth tokens and what not).

Creating a Google Develper's Account

I'm having no luck in trying to create a Google Developer's Account. I appreciate instructions have been posted in Stackoverflow in the past but the process or web pages have since changed. I've been to the Developer's Console and created a Project but I can't access the Project itself. My objective is to create the Developer's Account to get the API key to code the service into a client-server application that includes geocoding - reverse, and address lookup to return latitude and longitudes. Thereafter, I wish to be able to advise my clients how they can create client accounts to access the service. Any step-by-step advice would be appreciated.

Resources