I am building a frontend-like for OpenNMS and chose to install OpenNMS in a docker container. I need to use the Rest API to further my project and when I try to send a request to
http://localhost:8980/opennms/rest, using the python requests library the return code is 404.
Does OpenNMS for docker not have Rest API or do I need to install it on my core system instead of docker.
P.S. This is my first time trying to do use the Rest API of an application.
imgur link : https://imgur.com/5UDPjRF
The URL you are calling is just the base URL for our rest resources. For Nodes as an example, you can test this with curl -u admin http://localhost:8980/opennms/rest/nodes. The REST API endpoints are described in the documentation here
Related
I'm trying to make a request in Go client.AnnotateVideo(ctx, &annotateVideoRequest) to the Google Cloud Video Intelligence API using the package cloud.google.com/go/videointelligence/apiv1.
I noticed that if I'm on a Google VM, i don't need any credentials or environment variable because the API says:
For API packages whose import path is starting with "cloud.google.com/go",
such as cloud.google.com/go/storage in this case, if there are no credentials
provided, the client library will look for credentials in the environment.
But I guess I can't authenticate because I'm running a Docker Container inside the Google VM, and I don't know if I really need a credentials file in that docker container, because I don't know if the library automatically creates a credentials file, or it just check if there is a $GOOGLE_APPLICATION_CREDENTIALS and then use that (But that makes no sense. I'm on a GOOGLE VM, and I'm supposed to have that permission).
The error is:
PermissionDenied: The caller does not have permissions
Some links that might be helpful:
https://pkg.go.dev/cloud.google.com/go/storage
https://cloud.google.com/docs/authentication#environment-service-accounts
https://cloud.google.com/docs/authentication/production#auth-cloud-implicit-go
https://cloud.google.com/video-intelligence/docs/common/auth#adc
Thanks in advance!
I want to try out continuous deployment with Jenkins on Google Kubernetes Engine. Of course, by using the Jenkins API Rest.
I have gone through https://cloud.google.com/solutions/jenkins-on-container-engine-tutorial
I got Jenkins running. The problem is with regard to the Jenkins API Rest when I try to consume it by using Postman or curl. I'm prompted to Sign in to continue to Google Cloud Shell.
By using curl
curl -X GET https://8080-dot-3828316-dot-devshell.appspot.com/job/dev.ci/api/json\?pretty\=true --user USER:TOKEN
Found.
In Postman
In incognito window
My problem was related to the fact that I didn't expose the service properly. I was using the preview URL that Google provides you. So I had to follow the architecture shown here: https://cloud.google.com/solutions/jenkins-on-kubernetes-engine?fbclid=IwAR19Dl_kUSGzK1cfqyYA1s9cNt26CBnSgXf6zV104NGtIiXNtpTTKrfo3TI. I had to expose my jenkins ui as a NodePort and learn about ingress.
I have a cloud run app deployed that is for internal use only.
Therefore only users of our cluster should have access to it.
I added the permission for allAuthenticated members giving them the role Cloud Run Invoker.
The problem is that those users (including me) now have to add authorization bearer header everytime I want to access that app.
This is what Cloud Run suggests to do (somehow useless when u wanna simply visit a frontend app)
curl -H \
"Authorization: Bearer $(gcloud auth print-identity-token)" \
https://importer-controlroom-frontend-xl23p3zuiq-ew.a.run.app
I wonder why it is not possible to be realized as authorized member like the GCP figures out. I can access the cluster but have to add the authorization header to access the cloud run app as authorized member? I find this very inconvenient.
Is there any way to make it way more fun to access the deployed cloud run app?
PS: I do not want to place the app in our cluser - so only fully managed is an option here
You currently can't do that without the Authorization header on Cloud Run.
allAuthenticated subject means any Google user (or service account), so you need to add the identity-token to prove you're one.
If you want to make your application public, read this doc.
But this is a timely request! I am currently running an experiment that lets you make requests to http://hello and automatically get routed to the full domain + automatically get the Authorization header injected! (This is for communication between Cloud Run applications.)
GCP now offers a proxy tool for making this easier, although it's in beta as of writing this.
It's part of the gcloud suite, you can run:
gcloud beta run services proxy $servicename --project $project --region $region
It will launch a webserver on localhost:8080, that forwards all requests to the targeted service, injecting the user's GCP token into all requests.
Of course this can only be used locally.
I have ASP.NET Core Web Api application. Also I have (not my) remote REST service which is accessible by https using GOST algorithms. I'm doing GET request from my service to this secure remote service. To access remote server I have public and private parts of the key which are in cer and pem files. Moreover, my app is working in docker app.
I can do request with curl from docker container:
curl https://someserver.com -v --cert /app/cert/certificate.cer --key /app/cert/privatekey.pem --insecure
But how can I do it using HttpClient? Or other class from my code?
After googling and experiments i'm at the point of view that this is not possible now using .net core 2.1 in such environment without third party libraries (i even didn't find any of them) or linux packets. I can't load pem file and i'm always getting SSL handshake error from code.
P.S. I'm using rnix/openssl-gost:stretch docker image for GOST support on linux.
I have been following the tutorials which are provided in Hyperledger Composer docs, but I am not getting the results that they are supposed to I should be getting. Specifically, when I try to enable the multiple user mode for the REST server and I try to call one of the business network REST API operations using the REST API explorer I always get a HTTP 401 Authorization Required. According to the Tutorial, I if get this error is due to I have not authenticated correctly to the REST API, but it does not mention why this error occurs or how I may fix it.
It is very important for application development to be able to authenticate each user who wants to make requests to the API.
What version of Hyperledger Composer are you using?
The tutorial/document you refer to is correct for v0.15.0 and works a little differently for prior versions.
Are you seeing an Access token at the top of the Browser Window - this indicates that you have successfully authenticated and can continue with the steps for the Wallet.
If you are not seeing an Access token displayed, then make sure you hit your REST server with a URL similar to http://localhost:3000/auth/github again and login.
If you are still experiencing problems I would suggest going back to just using authentication without multiuser mode and verify that the authentication works properly from there.
After some research, I found a solution and worked for me.
If you already enable Github authentication then ignore. Otherwise first enable authentication following this tutorial Enaling Authentication.
Before start rest server you will export your admin card from the network by using this command:
composer card export -n admin#sample-network -f admincard.card
Now start rest server with authentication using this command:
composer-rest-server -c admin#sample-network -p 3000 -a true -m true
After some time rest server will start.
Now First, go this link for authentication: http://localhost:3000/auth/github
After successful authentication, you will get an access token and also you will see a Wallet options below.
Now you need to import a card that you already export from your network.
That's it, you can able to add anything to your network.
In my case, I have two missed steps:
enabling authentication for the REST server
https://hyperledger.github.io/composer/v0.19/integrating/enabling-rest-authentication.html
composer-rest-server -c admin#you_project -a true, I just execute composer-rest-server but did not specify the identity "admin#you_project" before.