How can I enable/disable APIs/Services in Google Cloud Project via Restful APIs or python?
For example, I want to enable following API/Service in a project.
https://console.developers.google.com/apis/api/iam.googleapis.com/overview?project=
You can programmatically enable or disable a GCP service using the Service Usage API. There are also methods for batch operations and querying service state. See the link below to the documentation.
https://cloud.google.com/service-usage/docs/reference/rest/v1/services
Related
I've already developed an EMM solution that migrated on Microsoft Azure. Now, I want to integrate Android zero-touch enrollment API and Android Management API into my solution. According to the document, I can use Google Cloud Platform to run the API, but is it compulsory? If I use it, all my new create data will save on Google Cloud, so can I move those data to my current Azure?
To call the API you will need a GCP account as mentioned in the documentation you shared.
However this is only required to call the API. If ou want your application to be hosted on a different cloud that can work, just need the GCP account to generate the API key in order to use the Zero-touch API.
In AWS, making a new API is as easy as going to the API Gateway service and clicking "Create API". How do I do the same in GCP? The Endpoints service does not appear to offer any way of creating an API.
At GCP there are several offers to deploy APIs, and as you have pointed Cloud Endpoints do not offer to ways to create aPI, but it provides frameworks to to base on and to integrate with the actual application hosting offers (App Engine, Compute Engine GKE, Cloud Run, Cloud Functions).
I would follow this tutorial in order to create the base for your API and later deploy and test your API. Notice that in those tutorial App Engine is used to deploy your API.
I'm trying to create new Agents in different projects using Service Accounts (I don't know any alternative to Service Accounts) but as I suspect because Service Accounts are specific to a project, I cannot enable the corresponding Dialogflow API using any kind of REST API or something alike. Any help is kindly appreciated.
Beside using the Cloud console, you can enable Cloud APIs using Cloud SDK and Service Usage API
Using Gcloud command:
gcloud services enable dialogflow.googleapis.com
Using RESTful API services.enable method:
POST https://serviceusage.googleapis.com/v1/projects/12345678901/services/dialogflow.googleapis.com:enable
The used service account requires serviceusage.services.enable that you can include in a custom role and assign it to the used service account.
The following is the link for the console method:
https://console.cloud.google.com/flows/enableapi?project=[YOUR_PROJECT]&apiid=dialogflow.googleapis.com
I would like to know, how to invoke gcloud CLI or API command from Dialogflow fulfillment webhook code.
Here's an example objective: I would like to trigger the creation of Google cloud compute engine, from the Google actions invocation. So I'll be writing a dialogflow fulfillment to achieve the compute engine creation.
I've researched the Google Dialogflow documentation and it does not have much detail about invoking the "gcloud" command in Fulfillment webhook code.
So it would be good to know,
Is there any dialogflow libraries can be used to invoke gcloud CLI or API?
How to handle the those requests within dialogflow fulfillment code?
Are these details are available in a documentation? if yes, please share the URL.
This question would be helpful to developers, who are seeking for similar information on developing Google actions using Dialogflow.
I'm not sure what you mean by gcloud CLI or API, you may need to be more specific as to what you'd like to achieve.
But in case I understand correctly, you'd like to trigger some gcloud API functions. If that's the case; Dialogflow fulfillment (usually) runs o Firebase Cloud Functions. If you're using Firebase for your deployment, you can use gcloud node.js client library to use Google Cloud Platform services.
If you're using your own fulfillment server, you may use the appropriate gcloud client library for that as well.
Q1. Is there any dialogflow libraries can be used to invoke gcloud CLI or API?
Answer:
Google has node.js SDK libraries, that can be imported into Dialogflow webhook code.
So, the creation of Google cloud compute resources are possible through the nodejs library “google-cloud/compute”
Q2. How to handle the those requests within dialogflow fulfillment code?
Answer:
Perform the below changes in the Dialogflow webhook code
In package.json add the compute library in dependencies section,
"dependencies": {
"actions-on-google": "^2.2.0",
….
….
"#google-cloud/compute": "^0.12.0"
}
In index.js file utilize the compute library
// Imports the Google Cloud client library
const Compute = require('#google-cloud/compute');
// Creates a client
const compute = new Compute();
Therefore the “compute” object created above can be used to implement all the functionalities related to Google Cloud Compute resource.
Q3. Are these details are available in a documentation? if yes, please share the URL.
Answer:
Refer Google Cloud Compute Library Documentation Here
Refer Google Cloud Compute Library Documentation for creating compute resource
We have a requirement where we would like to call the API of one java application from another application deployed in the same cloud foundry.
Could you please tell if there is any way to access the api.
Check out the Spring Cloud Netflix project:
http://cloud.spring.io/spring-cloud-netflix/
The service registration and discovery features of Eureka are exactly what you are looking for, and are built for use in a cloud environment.
This article contains code samples:
https://spring.io/blog/2015/01/20/microservice-registration-and-discovery-with-spring-cloud-and-netflix-s-eureka
You can leverage Pivotal Spring Cloud Services in your Spring boot App. You might be using Pivotal SCS libraries.
In order to expose API to an another app, you've to enable service discovery and get registered in Eureka Server.
https://docs.pivotal.io/spring-cloud-services/1-3/common/service-registry/writing-client-applications.html#add-application-dependencies