I need cloud Foundry api to view log - cloud-foundry

Is there any api which I can use to read real time application log from pivotal log console? I was reading cloud Foundryclient api but I didn’t find any.

CF CLI when accessing the logs uses this api
I think from api you mean accessing doppler, because this component handles the loggin part
I fired the log command and used verbose option, here i see the http request and response for the same.
Hope it helps

Related

Google Cloud Run - Services to discover other Internal services running within the same project

The requirement is to call other microservices running within the same GCP project using the service name instead of the full service url to get the ID token as mentioned here https://cloud.google.com/run/docs/authenticating/service-to-service.
I see a similar stackoverflow question - Google Cloud Run API - accessing endpoint internally. Here it looked like there was no direct solution from GCP and has been suggested to use runsd - https://github.com/ahmetb/runsd.
Is there something available from GCP now where a cloud run service can call another private cloud run service within the same project using "https://servicename" internally
(or)
Is it still not available and we need to use the complete service url https://--.run.app to get the ID Token and then make the call using the ID Token and the full service url?
I have tried using the full service url and ID Token to make the call. But getting the full url with the projectHash is not something we are looking for. A more uniform approach using the service name for internal call will be more easier from microservice calling perspective.
Since Google Cloud is not offering this yet. You may file a feature request to this link. However, please keep in mind that this will still be under consideration and there is no definite ETA.
You must use the whole service URL, which contains the service name, project hash, and region, together with the ID token, to perform a service-to-service call to another Cloud Run service inside the same project.
The above answer from Christian Paul Andaya is the accepted answer.

Send HTTP POST request to Segment.io from GCP

I am trying to send HTTPS Post Request from GCP to Segment.io
I want to create a service that will read data from BigQuery table and then send calls directly to Segment.io API (link) from where I'll redirect the data to other destinations, but on the GCP site I'm struggling to find the most optimal way to do it. Cloud Run seems like a good option but I'm wondering if there might be an easier way?
The recommended products to be used for this task can be either Cloud Run or Cloud Functions.
You can either use the Client Libraries or API in order to extract the data from the BigQuery table and use any HTTP request library of your favorite programming language to issue the POST request to the Segment.io API.

Google Pubsub subscriber that does a http PUSH to a cloud function (in same project or another project)

Is it possible to setup a pubsub topic/subscriber in one project that does a http PUSH to a cloud function in the same OR in another google project? I know there are PubSub triggers but these do not work when the pubsub topic is in another google project. Curious if this even doable with a subscriber PUSH.
Error I get thiis pubsub error INVALID_ARGUMENT if I try to create it. I wasn't sure if this was because I needed to register the endpoint (https://cloud.google.com/pubsub/docs/push#other-endpoints). However that didn't feel right because when I create a function, the URL is given to me automatically and I can hit it via Postman.
I did find this link (GCP - Verify ownership of a cloud function https endpoint for a PubSub push) and think it is url-verification related.. just want a confirmation :)
Thoughts? Did I miss some documentation somewhere?
EDIT: I think it's related to URL verification as well as using the ../_ah/push-handlers/.. path. When I register a PubSub trigger, the delivery type to the function is still a PUSH but it's to a encoded url with more of a path: https://{hash}-dot-{hash}.appspot.com/_ah/push-handlers/pubsub/projects/{project-id}/topics/prototype-contact-created?pubsub_trigger=true
This was a solution I was given here: https://github.com/googleapis/nodejs-pubsub/issues/118
You need to verify this URL by going on your Google Cloud Console, API
& Services, Credentials, then the Domain Verification tab. Add the url
of your Cloud Functions. You will need to do that for each and every
one.
Then, make sure that in the Search Console, you select the META TAG
verification method, and response with that on GET requests.
if (req.method === 'GET') {
// mine is in a settings file but you can hardcode yours for testing purposes
return res.send(`<html><head><meta name="google-site-verification" content="${settings.google.siteVerificationCode}" /></head><body></body></html>`)
}

Can't login to Predix from the Cloud Foundry CLI

I'm trying to login Cloud Foundry endpoint.
But when I connect by Cloud Foundry CLI, I get a error message below:
C:\Users\abc>cf login -a https://xxx.predix-
uaa.run.aws-usw02-pr.ice.predix.io
API endpoint: https://xxx.predix-uaa.run.aws-us
w02-pr.ice.predix.io
Not logged in. Use 'cf login' to log in.
FAILED
Error performing request: Get /login: unsupported protocol scheme ""
Please help!
The issue is likely that you are not specifying your CF API endpoint url. Please contact your platform operator to confirm what it should be.
We'll improve the error message, but what seems to be happening is that the cf CLI tries to retrieve a json configuration from [api-endpoint]/v2/info, but not getting the response it expects.
It then builds a URL to the login endpoint from the "authorization_endpoint" that should be advertised in that json configuration. As that field is not in your response, it tries to access "/login" instead of e.g. "https://xxx.predix-uaa.run.aws-usw02-pr.ice.predix.io/login", causing the error.
CF endpoint urls generally start with "api.". In fact, I've never seen one starting differently.

WSO2 APi Manager Response Code 0

I'm trying to use WSO2 API Manager 1.10.0 on an existent micro-services project with REST APIs following WSO2 tutorial.
I have installed it on my computer as well as a copy of my application and configured AM to manage requests (GET, POST and DELETE) to my resource but I always obtain a "Response code 0" with Response Header
{
"error": "no response from server"
}
Trying to contact my application using Advanced REST Client I obtain 200 with the correct result.
My APIs use a token inside the header to authenticate the user passed so I have implemented a dummy API without authentication but I still have the same issue.
I have tried also the Cloud version with our test server but still obtaining the same result.
I found this guide http://wso2.com/blogs/cloud/video-setting-up-custom-url-for-api-store-and-gateway/ but I don't know if this can be a solution for the problem in localhost.
Setting up the custom url in WSO2 API Cloud wont help. Thats there for a different purpose. There are two things you can do.
If you are interested in going ahead with the cloud version, you can get help from them. You can send a support request and the cloud team will help.
You can troubleshoot your local instance. When doing so, first, try to invoke your api via curl and see whether it gets a response. Sometime, your api can work fine, but due to some reasons, the result might not reach the api console.
If the curl works fine or not, you can check the logs to see whether there are any errors printed. Some more questions:
Is your backend service exposed via http or https?
If it is https, then if its certificate is not a CA signed one, API Manager will fail during the handshake. If so, you will have to add the cert to api managers client-truststore.jks
In the cloud scenario, your backend should be accessible from internet and the certificate story is valid for cloud too.
Are you trying to access the api using swagger console (or any web application). There are couple of reasons you could encounter this issue. one could be certificate not installed in the browser.
If this happens you should see some error log in the api manager console (something related to CA not found). for that first you can copy the backend url (swagger console shows the url it used to send the request) and paste it on a new browser window and install the certificate to the browser.
also you can get an idea about the issue by using a tool like firebug and check the request. (it will show the error for not connecting the AM)
Finally I have found the issue: the API Manager does not accept plain text response, responding using a JSON solves the problem.
Using other mediatype such as XML or TEXT/HTML it reports 406, with text plain it returns Error 0.