Enabling Google Platform APIs - google-cloud-platform

I am a total GCP noob - I've literally just signed up to use one of the APIs.
I tried to follow these steps from here , but got stuck when trying to enable the APIs.
I came across this, which tells me: You need permission serviceusage.services.enable on the project and permission servicemanagement.services.bind on the API to enable it.
There is a link with information on it, but this means nothing to me. I have managed to find and IAM & Admin page for my project, but can't find a way to do the above.
All help is appreciated.

To enable the API on you GCP project follow the steps :-
I. Go to dashboard
II. From Navigation Menu go to "API and Services" dashboard and then click on “Enable API and Services”
III. Search for the APIs you need to enable(Cloud IOT, Dataflow API, Cloud Pub/Sub)
IV. Then click on enable API
From "IAM and Admin" page you get the service credentials key or json key which enables you to access you gcp project from command line interface.
To get the service credentials key follow the steps :-
I. Go to the link for getting service key : https://console.cloud.google.com/apis/credentials/serviceaccountkey
II. Under the heading of “Service Account” select a new service account and then give a name to your service account and select the role as owner{Project<Owner}.
III. Under the key type select JSON and click on ‘Create’
IV. A file will be automatically downloaded on your device.

Related

Not showing the newly created project to select, when creating new Agent in Google Dialogflow ES

I created a new project in Google Cloud Console. (eg. my-project-abc12345 - only a example name)
Then I tried to create an agent in Google Dialogflow Console, under the created project.
But the project my-project-abc12345 I created is not listed here. Does anybody know a possible reason for this?
Actually, I need to create the project first as I need proper naming for my project_id, and then use it in the agent creation time in Dialogflow.
The same scenario works well with my personal google account. For this one, I am using my company's google account.
Your ideas/comments/answers on this are really appreciated.
You can try below steps to resolve your issue :
First, make sure that you are using the same account in GCP and in
Dialogflow ES console, and that the account is listed as the owner
for that project.
You can try refreshing the browser page with the Dialogflow ES console if the project was created after you opened the Create a New Agent option in Dialogflow ES.
You can create an agent via the
API and then open it in the console, pasting the project ID in the
URL to the agent in the browser address bar.That is, open an
existing agent and replace the project ID in the URL.
The above step
is not required if you can see the new agent in the agents selector
after refreshing the Dialogflow ES console browser page.

Twitter callback not working with Cloud Run

I'm trying to create a website to make F1 predictions with flask
We started developing in Heroku, and the twitter API is already configured, you can check
https://demoflaskdance.herokuapp.com/
But now we are moving to Cloud Run as Heroku does not support pyodbc. We deployed our project, with the same code, and added to apps.twitter.com the urls, but when trying to log in with the link that google provided https://demo-flask-dance-kjomqyaifq-ew.a.run.app
we get an error and says that the URL is not authorized
Any help? Thanks
If your Cloud Run application does not require authenticated access, enable public access.
Go to the Google Cloud Console.
Select the service you want to make public.
Click Show Info Panel in the top right corner to show the Permissions tab.
In the Add members field, allUsers
Select the Cloud Run Invoker role from the Select a role drop-down menu.
Click Add.
Allowing public (unauthenticated) access
If you require authenticated access see this document:
Authentication overview

In line 14 of my code publish.py, what would be the service_account_path and how can i download this path?

In the code below, i am getting one error attached. Also there is a service_account_path i have to enter, where do i find this path and how can i download this file?
# Replace with your service account path
path_service_account = 'service1'
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = path_service_account
# Replace with your input file path
input_file = 'C:\tumbling window\store_sales.csv'
# create publisher
publisher = pubsub_v1.PublisherClient()[enter image description here][1]
Client libraries make use of service account credentials to authenticate into GCP services and APIs, such as Pub/Sub.
To do this, an environment variable named GOOGLE_APPLICATION_CREDENTIALS needs to be set and its value is a string with the path of the JSON key value of that service account.
First, you need to make sure that you've created a service account with enough permissions to do the required Pub/Sub operations:
In the Cloud Console, go to the Service accounts page.
Select your project.
Click Create service account.
Enter a service account name to display in the Cloud Console.
Choose one or more IAM roles to grant to the service account on the project. This is an important step, if you're only planning to use this account to consume the Pub/Sub service, then you could grant it the Pub/Sub admin role. If your code also makes use of another service (Such as BigQuery, for example) you need to grant the required roles as well. An easy option would be to grant it the Project Editor role, which grants access to all GCP services, but is always a recommended security practice to grant only the required minimal necessary permissions.
Once you've granted the required role(s), click Done to finish creating the service account.
Once you've created the service account, then you need to generate a JSON key file:
In the Cloud Console, go to the Service accounts page.
Select your project.
Find the row of the service account that you want to create a key for. In that row, click the More (3-dot) button, and then click Create key.
Select a JSON Key type and click Create.
Clicking Create downloads a service account key file.
That is the file which path needs to be referenced in path_service_account. Let's say that your JSON key file was downloaded in C:\Downloads\YOUR_JSON_KEY_FILENAME.json, then your code would be something like:
path_service_account = 'C:\Downloads\YOUR_JSON_KEY_FILENAME.json'
This should solve the authentication errors that you're getting.

How do I upload my own custom zip of a deployment?

I'm trying to use an existing setup/deployment, however it has a failure and hence I thought I'd try fix it by creating my own "deployment".
I can't figure out how to do this though.
I just get a page of "There are no solutions yet. Contact your admin for status on the catalogue."
I followed the instructions here: https://cloud.google.com/private-catalog/docs/create-catalog
However at step 3 - there is no "manage solutions" button...
I HAVE added the "catalogue admin" + "catalogue manager" roles to my user.
Why am I not getting this button?
There are three prerequisites to use Private Catalogues:
You must have a Google Cloud organization and access to the organization.
You must have the administrator role for your Google Cloud organization.
You must have the Catalog admin role for Private Catalog.
Perhaps you are only missing the first one:
Organizations are only available for GSuite and Cloud Identity customers: https://cloud.google.com/resource-manager/docs/creating-managing-organization
Edit: here is a better quickstart guide for using Private Catalogues:

Using the defaut application credentials to access the Google Play API?

I'm building an appengine app that requires access to the Google Play Developer API. I've seen in the sample code that it's possible to authenticate using a service account in addition to Oauth.
Is there any chance this could work with the default service account without having to generate a json key ? That would make the setup a bit easier.
Edit: be more explicit about not using a json key but really using the default application credentials instead.
For App Engine Standard environment:
You can generate a Service Account key file from default service
account. Follow the link sample code you provided, then click on
the link shown in the "Getting Started" section, you'll get in
the Google Developer Console. If logged in with the correct account
(you should see your project name at the top), then go to Credentials
-> Create credentials -> Service Account key. In the service account dropdown list, choose "App Engine Default Service Account", choose
JSON as key type and you should be good to go to follow the last
instructions on the Github page.
For App Engine Flexible environment:
The default service account isn't listed in the Service Account page, as explained here. You can't generate a service account key with it. You'd need to use a custom service account.