GCP Notification channel - google-cloud-platform

I have set up a notification channel for Console Cloud mobile Application:
Now I would like to be able to add the notification to alerting via Terraform, so I would like to get the notification channel id:
gcloud alpha monitoring channels list
This command returns all the channels, but this one not.
Also when trying to plan with Terraform, I can discover the id (projects/goout-cloud/notificationChannels/#####), however when I try to add it to any alert Terraform section, I will always get:
Error: Cannot import non-existent remote object

I consulted this question internally,
Any sort of interaction - including get, create and update to Mobile App Channels through the API is not possible and gives 404. This notification channel cannot be used by non-Google internal API clients. As such, automation is not currently possible.
The Cloud Stackdriver Monitoring team is aware of this limitation, but it solving this issue is not on the priority list, hence there is no ETA for implementation any time soon.
There is a Issue Tracker regarding this topic, if you want to receive updates, please star the issue.

Related

Can we get "agent status report" and "agent performance report" through historical metrics using APIs in Amazon Connect?

I hope everyone is doing great.
I am working on Amazon Connect reporting APIs. The basic need to post this question is that I want to get agent performance and agent status report through historical metrics using APIs. I am trying to find an API that will give me agent status from midnight that is only possible through historical metrics.
I don't want to use Streams APIs. If anyone has any solution kindly respond to me, it would be very helpful for me. Thanks.
The current reporting API only provides one function for retrieving historical data, GetMetricData, and that function is only able to return queue or channel statistics. Agent specific data is only available via agent event stream and console-based reports at this time. So, unfortunately, there is no way to do what your describing with an API in Amazon Connect right now.

Is pubsub suitable to be used by client desktop applications?

If I were to create a client desktop application, I'm trying to find a reliable way to notify client applications of new data that needs to be queried from the server. Would pubsub be a good use for this? Most of the documentation I see for it seems to be focused on server to server communication, and is a bit ambiguous if this would work well for server to client notifications.
If it should work, would I be able to properly authenticate subscribers to limit the topics they could subscribe to? This application would be potentially downloadable by anyone, and I would need to ensure that information intended for one client couldn't end up in the hands of another client.
Cloud Pub/Sub is not going to be a good choice for this use case. First of all, note that each topic and project is limited to 10,000 subscriptions. Therefore, if you intend to have more than that, you will run out of subscriptions. Secondly, note that a subscription only receives messages published after the subscription is created. If you only need messages to be delivered that were published after the user came to the website, this may be okay. However, with these two issues combined, you'll need to consider lifetime of your subscriptions. Do they get deleted when a user logs out? If not, when a user comes back, do you expect them to get all of the messages published since the last time they visited?
Additionally, as discussed in the comments, there is the issue of authentication. Your client-side app would have to have the credentials to subscribe. This would require you to essentially leak those credentials into your client-side code, which could be a vulnerability in your application.
The service designed to deliver notifications of this nature is Firebase Cloud Messaging.
If you want to open the application to anyone on the internet, you can't rely on the IAM service that only works with Google identity -> You can't ask your user to have a Google Account, the user experience will be bad.
Thus, you can't use IAM service to secure the PubSub access, and thus to use PubSub because anyone could access it.
In your use case, the first step is to ask the user to register (create an account, validate email, maybe use payment method,...). Then, you have an identity, but managed by you, not by IAM. You know which messages are for this user and which aren't.
If you want to be notified "in real time", I propose you to use long polling method or streaming to push data to the user. Cloud Run is now capable to do this and I recommend you to have a look on that.

Concurrency Issues between Google Cloud Functions and Sheets v4 API

I have 2 problems related to managing concurrency between Google Cloud Functions.
The setup is I have a slackbot enabling use of a "checkoff" slash command. This slash command sends another Slack user yes/no buttons whether to authorize the checkoff. When the user clicks an option, it sends that response to a Google Cloud Function which 1) Sends a response back to Slack to close the buttons and 2) Records the checkoff if authorized in a Google Sheet using the Sheets v4 API (spreadsheets.values.append)
Issue #1: Users who spam the yes/no buttons trigger multiple Slack requests to the Cloud Function before the Function can acknowledge and close the buttons. This leads to multiple Cloud Functions spawning and multiple checkoffs being recorded in the sheet. If I could maintain state, I could save unique information from the request and check to make sure that request had not been already serviced. Is there a pattern to do this with Cloud Functions?
Issue #2: Sometimes multiple checkoffs are authorized at similar times by independent users. These requests spawn independent Cloud Function instances which attempt to append to the Sheet. There is a rare case where another Function writes in between the first Function's read then write causing an overwrite. I would use a read-write lock to deal with this but there's no way to share concurrency resources between Cloud Functions I'm aware of.
(Less important) Issue #3: I'd really love to batch the spreadsheet writes but it seems against the grain of serverless computing in the 1st place. Is there a way to do this?
Any help is appreciated.
I had a similar issues with Cloud Functions and Firestore. In my case I was receiving notifications about new and updated data in the form of 'order/123', I was then creating a copy of the order in Firestore, the problem was that sometimes multiple notifications arrived at the same time resulting in duplicated orders because of race conditions.
My solution to the problem was to use Google Cloud Tasks, https://console.cloud.google.com/cloudtasks, I have a cloud function that receives the notification, that adds a message to the queue to be processed with concurrency of 1, then other cloud function takes care of the processing.
Receive notification -> Post message to queue (concurrency 1) -> Process message
In this case I have 1 queue per customer, I am sure there a better ways but for now this is good enough. You can later on route customers to the same queues but always having the same customer on the same queue.

Amazon Quicksight - is it possible to invoke APIs in Quicksight?

I am new to AWS. I have to design an architecture for a client specifically with AWS, as they already use some AWS components. Their request is to have a frontend in Quicksight. The alerts should be visible in a table, each row representing one alert. The alerts should have a status column (new/in progress/solved etc.) and there should be a button at the end of every row, and when the user clicks on the button, the user should receive a pop-up, where they can put in some comments, then after clicking on an OK button, the status should be updated and the comments should be stored.
Their expectation is to store the alerts history in an AWS database. They currently use ProstgreSQL on premise. The question is, is Quicksight able to fulfill these requirements? Is it possible to add buttons with which the user can make updates in an underlying database, and refresh Quicksight, when the update was done? If not, what would be a better tool for the visualization?
(I was planning to create some APIs for making updates in a database, my original plan was to use DynamoDB, but I might need to reconsider this due to their preference regarding ProsgreSQL).
I don't think this is directly possible in QuickSight. There is no way to provision external controls (like buttons) and trigger actions right away. However, a possible workaround can be using a blended way to use QuickSight APIs and trigger events from a web app using AWS Lambda. This is not a proven practice yet, but I anticipate this is possible.
Cheers!

Delta or Partial API for getting changes in users info for Directory API google

I am working on a POC for getting Users under GSuit domain using Directory API, which always return all the users under the given domain. I want to monitor the changes for all the users, is there any API for the same MSGraph has delta API which returns only users which is updated.
I explored about the Watch API which creates a notification channel and sends the notification, but my requirement was to sync information incrementally with the help of some scheduled process.
You can use Push Notifications in Directory API to achieve your goal:
The Directory API provides push notifications that let you watch for
changes to resources. You can use this feature to improve the
performance of your application. It allows you to eliminate the extra
network and compute costs involved with polling resources to determine
if they have changed. Whenever a watched resource changes, the
Directory API notifies your application.