AWS ElasticSearchService - Java SDK example? - java

I am using the ElasticsearchService from Amazon. I am a little overwhelmed by their documentation. I find it vast but ever so difficult to navigate. Anyway, I am looking for an example of using the ESService using their AWS Java SDK. Do you have a link - or some code to insert a document?
I am actually using it from Scala, and what I've got so far is:
val awsEsClient: AWSElasticsearchClient = new AWSElasticsearchClient()
awsEsClient.setRegion(Region.getRegion(Regions.EU_CENTRAL_1))
awsEsClient.setEndpoint("es.eu-central-1.amazon.aws.com")
val createD = new CreateElasticsearchDomainRequest()
Where should I specify my own instance ARN? The uri that looks like
arn:aws:es:eu-central-1:xxxxxxxxxxx:domain/yyyyyyyy
Also, when using their SDK, I guess I don't need to specify anywhere the endpoint they provide? The one that goes by
search-yyyyyy-xxxxxxxxxx.eu-central-1.es.amazonaws.com
Or maybe this is what I should specify instead of the
awsEsClient.setEndpoint("es.eu-central-1.amazon.aws.com")
Thank you for your help and sorry if all these questions sound obvious.

So, I got the whole thing wrong from the beginning. The SDK is useful only in order to manage the service, like spin up new nodes and similar -- not to access it. For that, the only solution that Amazon offers is an HTTP endpoint, using the common REST api offered by Elastic Search.
The problem that came next was to authenticate the requests. I have compiled a scala library to do that for every request, which is available here: https://github.com/ticofab/aws-request-signer.

Related

Evernote: Get a list of all edits

I am trying to develop a simple statistics tool to analyse various behaviours of collaborators within an Evernote Notebook using the Evernote Java API.
I need the informations which user edited which note and when.
Even though the documentation is quite good, I am still unable to find the required functionality inside the api.
(TLDR:)
Is there a way to access a list of edits of a evernote note using the API?
I am not bound to using the Java SDK so if there is a way, which is limited to using another language, it would be no problem to switch.
Andreas - Did you look into these methods in the API?
NoteStore.GetNote and NoteStore.getNoteApplicationData
It sounds like this would be a decent place to start at the very least. I cannot say for certain if this will return everything you are looking for though.
I hope this helps!
I'm not exactly sure what you are looking for but NoteStore#listNoteVersions might be the one you want. You can get a list of NoteVersionId and then use another API called NoteStore#getNoteVersion to get metadata to see which note is updated when.
Note that the API is probably only for premium accounts.

Uploading files to Amazon S3 using SigV4 API

I am looking to upload images to amazon S3 using the rest api that they provided. I got to know how to calculate the signing key for SigV4 from this document. This documentation tells you how the request should be signed. But I find it highly confusing as to what should be signed and where should the cannonical request be placed? Should it be placed in a separate header in the request?
Is there a working example/sample to use SigV4 rest api using java?
If you have a very specific reason for not using the provided SDK, the quickest path to getting this working it to look at how the requests are performed in a library where this is already working. You can look at the Java SDK itself to figure this out, but that's a bit dense.
Here is my favorite, although I think it's on sig v3:
http://geek.co.il/2014/05/26/script-day-upload-files-to-amazon-s3-using-bash
You can find out similar examples for v4:
http://geek.co.il/2014/11/19/script-day-amazon-aws-signature-version-4#footnote_0_33255
You can see how everything is compute and what is to be passed in the headers in very few lines of code.
EDIT
Look at http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-examples-using-sdks.html#sig-v4-examples-using-sdk-java for exactly what you are looking for. It has the bare minimum to get this going in java.
aws-v4-signer-java is a lightweight, zero-dependency library that makes it easy to generate AWS V4 signatures.
String contentSha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
HttpRequest request = new HttpRequest("GET", new URI("https://examplebucket.s3.amazonaws.com?max-keys=2&prefix=J"));
String signature = Signer.builder()
.awsCredentials(new AwsCredentials(ACCESS_KEY, SECRET_KEY))
.header("Host", "examplebucket.s3.amazonaws.com")
.header("x-amz-date", "20130524T000000Z")
.header("x-amz-content-sha256", contentSha256)
.buildS3(request, contentSha256)
.getSignature();
If you want to implement it yourself take a look at https://github.com/lucasweb78/aws-v4-signer-java/blob/master/src/main/java/uk/co/lucasweb/aws/v4/signer/Signer.java for an example of how to do it.
Disclaimer: I'm the libraries author.

Podio API, attaching files to items

I have a problem with attaching a file to a specific item using Java API. I know it should be possible as this functionality described here in the Podio documentation https://developers.podio.com/doc/files/attach-file-22518 and examples for PHP and Ruby are given. However I cannot find such method in the podio java library. I could find in FileAPI just methods that provide uploading files, but not attaching them to specific objects as described in documentation.
I use Podio APi version 0.7.1
Any ideas how it should be done in Java?
Podio uses a REST-Style API. You send standard http-request, and you get back json-formatted data. So you can do it all without a special library for your programming language.
If there is no predefined java class for you, you can just do the call yourself. In the end it is just a HTTP-call.
From the ruby implemention, I see that you attach the file as multipart/form-data,
so it is the same a browser would do it. There should be http-handling java classes to help you.
You also need to add the information from the API-Page, like the POST-Parameters and of course the url. The most difficult part is probably the authentication headers, but you need to solve this problem only once.

How to create client application to access uddi using java?

I've successfully set up an Apache Juddi v3 on my computer ans know I want to create a client that can publish and discover webservices using java. I have searched in google but i could not find a clear explanation of how to do that as am new in webservice and uddi.
any help please!!!
You want to start with the jUDDI examples. There's a bunch of them.
http://svn.apache.org/repos/asf/juddi/trunk/juddi-examples/
http://svn.apache.org/repos/asf/juddi/trunk/juddi-examples/more-uddi-samples/src/main/java/org/apache/juddi/samples/
Note: you didn't specify what version you're using, so some of that code may not compile against what you're using. Most solutions should be obvious. If not, try getting checking out the full source (the readme has directions)

Service similar to Airbrake.io for java applications?

We made our own api for airbrake.io in java. This works fine but airbrake is displaying parameters and stacktraces in some kind of Rails style. This is somewhat annoying. Anyone know of similar services made for java?
Example of how data is displayed:
Parameters
{"controller"=>"", "action"=>""}
Stacktrace
/testapp/app/models/user.rb:53:in `public'
/testapp/app/controllers/users_controller.rb:14:in `index'
UPDATE 2015-02-13: This service no longer exists. The GitHub account linked below is gone, as is the company website.
Have you tried using Coalmine https://github.com/coalmine/coalmine_java Its meant to be used with the Coalmine service: https://getcoalmine.com/
I work at Coalmine and we have been using this internally for some time now. We just open sourced the java connector this week and I would be happy to help you get started with it. You can send me an email at brad#builtfromsource.com
Have you tried using http://code.google.com/p/hoptoad/ . It's a little out of date, but it should just need to update an endpoint to http://api.airbrake.io .
A quick google lead me to http://logdigger.com/ which is designed specific for JAVA specific sites.
I work at Airbrake, and I would be happy to work with you to make our site more JAVA friendly. Please get in touch ben#airbrake.io, and I'll see how we can better display java specific information.
Just adding to the others suggested here, but Raygun (http://raygun.io) has first class support for Java.
Read more here: http://raygun.io/java
I work for Mindscape who built Raygun so can answer any questions you may have about it: jd#mindscape.co.nz. We already have a large number of organizations using Raygun with their Java apps, although Raygun does support other platforms (.NET, Node, Rails, PHP, etc)

Categories