Amazon AWS SDK using Swift and Perfect? - swift

Is it possible to leverage the Amazon Web Services SDK for iOS in a server-side Swift app developed using the Perfect framework? I'd like to be able to deploy my Perfect app to AWS and make calls to DynamoDB, S3, etc. from the app. However, I haven't found any examples showing if that is even possible. Can the AWS SDK be used server-side, even though it says "for iOS"? Does it support the Swift Package Manager, which Perfect seems to use for integrating with 3rd party libraries? If not, does Perfect support CocoaPods for dependency management?
If what I'm attempting feasible, or would I have to write my own integration code using Amazon's RESTful services directly?

"Original" AWS library does not support Swift Package Manager in that moment, and also uses some Obj-c code (as far as I know), so you can't use it on linux. But there is feature suggestion, so maybe it would be there in future
Now you can use AWS services with that library: https://github.com/noppoMan/aws-sdk-swift though its a bit hacky :)
I use that one in my current projects and it's look like all the basic needs are implemented :)

As far as I know, you would probably using Perfect-CURL to perform such tasks; Perfect-MySQL supports RDS, however, you can easily add all SPM compatible 3rd party components as many as need, just edit Package.swift to include; a better idea is to user Perfect Assistant to safely import different components and quickly build / test & deploy to AWS EC2:
http://www.perfect.org/en/assistant/
About Perfect-CURL, there are many examples about Server Side Operations, such as
https://github.com/PerfectExamples/Perfect-Cloudinary-ImageUploader-Demo
which contains how to generate a digital signature in posting files,
also
https://github.com/PerfectServers/SlackBot
with curling API

Related

Self-hosted framework for translation like google translate api?

I am currently developing an enterprise software. The client stated the need to translate certain texts that we gather from different sources into their home language, or at least into English. Due to GDPR concerns we cannot use external APIs like Google Translate API or DeepL. We need to have either a self-hosted solution or even better, just a python framework that contains translation logic for different languages internally.
Do you know of any such framework?
LibreTranslate seems to be a good option that we will be trying out.

What is the difference betweeen: aws-sdk/clients/appsync and aws-appsync?

Can anyone please tell me what is the difference between:
aws-sdk/clients/appsync, and aws-appsync
According to the doc, aws-sdk/clients/appsync is used because just including aws-sdk is too large when we just need appsync, we use aws-sdk/clients/appsync.
However, aws-appsync seems also doing the same thing. When I create a client using aws-sdk/clients/appsync, there is no hydrated() function while aws-appsync has.
So
Why can't we simplify everything by just using aws-sdk/clients/<any_aws_package> and break everything that did not use it?
What is the point of separating something that is similar?
Thank you very much in advance for all your help.
difference between: aws-sdk/clients/appsync, and aws-appsync
GraphQL originated at Facebook and the React/React Native apps used react-apollo to talk to the GraphQL based APIs.
AWS AppSync is the AWS offering for GraphQL. aws-sdk/clients/appsync is the JS SDK to invoke various AppSync management/control APIs (like create GraphQL API, create data source etc). Not sure if they also provided apis to consume the GraphQL based api.
aws-appsync is the way to consume AppSync backed GraphQL APIs. It plays well with react-apollo which is now moved to apollo-client.
There is another high level JS library from AWS Amplify, which is used to consume AppSync backed GraphQL APIs.
aws-sdk/clients/appsync is used because just including aws-sdk is too
large
The initial release of the aws-sdk (Github repo here) contained the clients for all the AWS services and more. You need to install aws-sdk and you can talk to pretty much all the AWS services by initialising the clients for them. Obvisously it was not so good in terms of packaging JS bundles, the library was also not very modular.
Now the latest version V3 (rewritten using TypeScript) which is GA now, moves the clients to individual npm packages i.e. you need to only install the client you need e.g. npm i #aws-sdk/client-appsync instead of npm i aws-sdk. Learn more about it here. If you are getting started use the V3 packages.
Why can't we simplify everything by just using
aws-sdk/clients/<any_aws_package> and break everything that did not
use it?
It is the case with the V3 JS SDK.
What is the point of separating something that is similar?
They are not similar. One is used to consume the GraphQL based APIs (provided by AppSync) and the other is to manage AppSync itself. The V3 packages follow this very strictly while the earlier versions may have some utility code/ high level abstractions along with the core AWS apis.

Which is the difference between these google KMS client packages? (CloudKMS vs KeyManagementServiceClient)

I have a java codebase that seems to be using "com.google.api.services.cloudkms.v1.CloudKMS" to call KMS. The online docs says to use "com.google.cloud.kms.v1.KeyManagementServiceClient"
When i looked up both packages seem to be updated, however the reference docs recommend using the latter.
https://developers.google.com/resources/api-libraries/documentation/cloudkms/v1/java/latest/com/google/api/services/cloudkms/v1/CloudKMS.html
https://cloud.google.com/kms/docs/reference/libraries
Could someone tell me what is the difference between these 2 clients packages and if i should move to the one the reference links to?
In general, you should prefer the library referenced on the Reference Libraries page, currently com.google.cloud.kms. The examples and tutorials on the website will use this client library.
Probably more history than you need to know, but we have two client libraries because they run over different protocols. The new libraries (the one's listed on the reference page) use gRPC to communicate. This means less bandwidth and less time spent serializing/de-serializing JSON. On the flip side, gRPC requires HTTP/2, and some organizations can't/won't support HTTP/2 yet. As a result, we still publish and maintain legacy libraries that are REST over HTTP/1. It is strongly recommended you use the gRPC ones unless you can't use HTTP/2.
You can read more about the background and technical details in Kickstart your cryptography with new Cloud KMS client libraries and samples.

Start with web API/REST API

I am in the process of creating an app (cross-platform with Ionic framework) and during my research about app with this framework I found the one created for HabitRPG and it is using an API to retrieve data, it totally suits my app as well, but I don't know where to start to create an API nor what to use.
I allready did some quick test with Spring, NodeJS and Symfony (with FOS) but I'm looking for something really easy to use and to setup but still to have a lot of flexibility (like manage security, users, and data visibility).
Is there a specific technology easy enough to start with ?
If you want to create a Web API and host it, you can perhaps have the look at APISpark (http://restlet.com/products/apispark/). It's an online plateform that allows to design your APIs following REST principles and then host them. The data are also managed by the platform.
Hope it helps.
Thierry

Code for syncing the iPhone with REST-servers

is there any open source code for syncing an iPhone
with a server (preferably REST)?
Found nothing on github and google code.
Regards...
I have been working with a project called ObjectiveResource (Github project here: http://github.com/yfactorial/objectiveresource/tree/master), which is focused mainly on the communication layer between your iphone models and a REST based web service. It is targeted at rails applications but should work with any REST api. Part of that project is a more sync oriented solution that is still in early development, but which has been discussed quite a bit lately in the objective resource google group at http://groups.google.com/group/objectiveresource?hl=en.
I highly recommend objective resource, I've been using it along with sqlitepersistenobjects to handle sync on my iphone project.
I suggest using the excellent ASIHTTPRequest source from All-Seeing Interactive: http://allseeing-i.com/ASIHTTPRequest. I'm doing this, and so are several released iPhone apps, so you can be sure the code is pretty solid.
This is a wrapper around the CFNetwork API that makes some of the more tedious aspects of communicating with web servers easier. It is written in Objective-C and works in both Mac OS X and iPhone applications.
It is suitable for performing basic HTTP requests and interacting with REST-based services (GET / POST / PUT / DELETE). The ASIFormDataRequest subclass makes it easy to submit POST data and files using multipart/form-data.
I've used Adrian Kosmaczewski's iPhone Rest Wrapper with success. See also this SO question.
I would recommend checking out RestKit: http://restkit.org/ It provides an excellent API for accessing RESTful web services and representing the remote resources as local objects, including persisting them to Core Data.