Setting Content Disposition using Rackspace Cloud Java APIs - rackspace-cloud

I am using Java Bindings for Rackspace Cloud API
I am trying to figure out how to set content disposition for the file that I upload to rackspace
I do not see a straightforward way of doing this through FilesClient object exposed through this API

Java API does not provide this functionality out of the box
I ended up changing the FilesClient.saveObjectAs function
-- added a String parameter as "contentDispositionValue"
-- the code that constructs the request, adds this parameter to a set of request parameters

Related

Using Azure functions output in an HTML file

I use my Azure function to return a certain output after passing an HTML trigger. The webpage prints out basic output, like Hello {name}.
I would like to pass this output into an HTML file and display it via a separate HTML file. Essentially, I want to extract what my helloworld.azureapp.com?name={name} returns and push it into a JS variable in an HTML file.
How would I do this?
Note that the Azure function is written in Python.
If I understand correctly, what you're looking for is to make your web application send a GET request to your azure function endpoint and store the response you get back in a javascript variable.
You should treat the responses from an Azure function HTTP trigger just like any standard response from any API.
Instead of writing all js code in native HTML files, it is recommended you pick a simple web application framework.
For python, you can try Django or Flask (introductory tutorials here).
The code that calls your Azure function endpoint helloworld.azureapp.com?name={name}
could be in your web application (using the requests module in python). Tutorial on how to make web requests in python here.
Once you get back the response for that request, you can do further processing with the values you get back.
Depending on your web application framework, you could do many things.
Some of them are:
Save it in a hidden field and get value in JavaScript.
Render the received values to element in page on server side and show it.

Use FluentAPI's to execute against a HTTPClient instead of a destination name

We want to use the VDM generated API's to execute against a Http client instead of a destination.
Currently the fluent api's work along the lines ::
service......execute(new ErpConfigContext(destinationName));
Is it Possible to have it work against a HTTP client.
Use Case :: We are trying to consume Odata Services in non CF environments.. where Destinations are not available.
Update: Starting with version 3.0.0 of the SAP Cloud SDK you are now able to create your own Destinations, so you are no longer reliant on Destinations provided by the SDK.
This might then look something like this:
HttpDestination httpDest = DefaultHttpDestination.builder("https://sap.com").build();
service.getAllEntities().execute(httpDest);
There is no direct possibility to do this via the VDM API as of version 2.19.1.
To circumvent this, however, you could override the DestinationFacade (cf. AbstractDestinationFacade) in the DestinationAccessor.
This would allow you to plug your "non-destination" concept into the VDM.

Pass parameters from C# function app to another Javascript function app in Azure

I need to set up an application in Azure and make communicate 2 functions (one written in C# and one written in JavaScript).
The C# fragment consists in analyzing a XML feed, get the data and save in objects then finally send them to the other JavaScript function by parameter.
I did read that we could establish communication between both functions using HTTP calls but is it possible to do it with parameters ?
If not, would have any suggestions in order to achieve something like this properly? I'm getting started with Azure and i don't have enough visibility to know what is recommened in such a situation
Thank you for your advices
Yes, this is absolutely possible. How you do this is up to you. If you look at the default HTTP trigger templates, you can see that they take parameters (for example, as query string parameters). You can find more examples in the HTTP and webhook recipes documentation.
You can use other trigger types for cross-function communication as well. Take a look at this documentation for related best practices: https://learn.microsoft.com/en-us/azure/azure-functions/functions-best-practices#cross-function-communication

Dynamic Website using AWS

I want to host a dynamic website using AWS serverless. I plan to use Lambda, API Gateway, DynamoDB and S3. My frontend pages will reside in S3. The blocker is that there would be some dynamic items such as Usernames and other metadata which will be user-specific. I know so far that the best we can do is pull the html page from S3. How do I then go ahead and include these variables in those pages?
I would be writing lambda in NodeJS.
Your HTML (static page) should have all the input fields (in your case user name and meta data). You can use any clide side javascript library to take values from those input fields. Even you can use classic JavaScript (like document.getElementById ) to take values from input fields but that will be the pretty old way of doing even if it works.Once you take the needed values then you can compose Json out of that to call lambda function via API gateway. Though S3 supports only static web site hosting you can write JavaScript code inside your HTML, which will not consider as dynamic (like C#, Java etc. ).
Big story short you can acheive anything through JavaScript in the static page you hosted in S3 and compose proper Json in the way your Api gateway / Lambda expecting.
What you mentioned as blocker for dynamic items such as usernames and other metadata. You can use AngularJS or other Framework to handle dynamic variable in application.
You can also use AWS Cognito for authentication.
For a serverless website like you describe you need to make the distinction between the static, and the dynamic content.
The static content, like HTML pages, Javascript files, CSS can be hosted in an S3 bucket.
For dynamic items you can use Javascript or any JS framework, and use it to interact with a couple of lambda's that return dynamic data.
These lambdas can be attached to an API gateway.
If you want to store- and retrieve data to a database you can use DynamoDB, or an RDS instance, that way you don't need to manage any servers
If it is just about authentication you can use AWS Cognito.
AWS S3 is fine for the front with angular for exemple.
For api I use nodejs in docker container in Aws ECS.

Can Azure Functions be used with URI path IDs?

I am wondering if it is possible to configure an Azure Function App to accept a URI-path ID as is typically used in RESTful services, e.g. /api/foo/1, where the function is foo. I haven't been able to find documentation on this and the binding information that I have found suggests that this isn't possible (I don't see a way to map it). It doesn't "just work" with the typical HTTP trigger (which supports /api/foo?id=1). In that configuration one receives a 404 response, I'm guessing because it doesn't know to call the foo function with the ID suffix in the URI.
In case it matters, I'm using C# to write my function.
You are correct that URI parameters are not supported at this time. If you'd like, you can create a feature suggestion for this here in our repo. Thanks :)

Resources