How to create user in cisco ucs manager from api? - devops

I use cisco usc manager emulator and need add new local user (using ansible). I read about uscmsdk for python and XML api. But i can't find where is user section on both of them. Is it any method there to do this? https://www.cisco.com/c/en/us/td/docs/unified_computing/ucs/sw/api/b_ucs_api_book/b_ucs_api_book_chapter_010.html#topic_B19A7BEBFBAB4DDFB90B9456709C6402

So simply we have 3 ways to do this:
Use XML api with configConfMo method
Use uscmsdk with ucsmsdk/mometa/aaa/AaaUser module
Use ansible ucs_managed_objects (prefer way in my situation).

Related

How to upload rdf-file to GraphDB over API

I have an RDF-file stored on my server. The file or at least the file-content should be uploaded to a remote GrapbDB over API.
On the documentation there are two ways to do this. The first one is uploading it to server files and then loading it to GraphDB. Here the problem is, that I am not the owner of the server, GraphDB is running. So I can`t upload it to server files. Or is there maybe another API for that?
The other way is providing a public API on my server and then trigger GraphDB to download the file from my server. But my API must be protected with credantials or JWT. But I donĀ“t know how to set the credantials in the API-Call.
Isn`t there a way to upload a simple graph to a repository?
There is a browser-based user interface in GraphDB that allows you to import from local files. If this is allowed on the server you are connecting to, and you only need to do this once then I think this would be the quickest route to go.
If you want to upload a local file to GraphDB using dotNetRDF, then I would advise you to use the SPARQL 1.1 graph store protocol API via the VDS.RDF.Storage.SparqlHttpProtocolConnector as described here. The base URL you need to use will depend on the configuration of the server and possibly also on the version of GraphDB that it is running, but for the latest version (9.4) the pattern is: <RDF4J_URL>/repositories/<repo_id>/rdf-graphs/service
The connector supports HTTP Basic Authentication (which is one of the options offered by GraphDB) so if you have a user name and password you could try the SetCredentials method on the connector to specify those credentals and if necessary force the use of HTTP Basic Authentication by setting the global options property VDS.RDF.Options.ForceHttpBasicAuth to true.

Detecting network request

When using gems for external services, sometimes I don't know whether a method does a trip to the service or just returns some local computation.
An example - I'm using an image hosting service (Cloudinary) that has a Ruby wrapper for their API. The following command returns a complete URL to a hosted image when providing an image_id:
Cloudinary::Utils.cloudinary_url(image_id)
#=> "http://res.cloudinary.com/my_service/image/upload/v1/some_image_id"
I'd probably construct that URL manually to skip a HTTP request (if that what's what happens).
So to my question - is there any faster way than digging in the source code or unplugging internet access to detect if network request is made before returning a value?
Cloudinary is using RestClient gem. It allows set global logging.
https://github.com/rest-client/rest-client#logging
To enable logging globally you can:
set RestClient.log with a Ruby Logger, or set an environment variable
to avoid modifying the code (in this case you can use a file name,
"stdout" or "stderr"):
$ RESTCLIENT_LOG=stdout path/to/my/program

How can I send Java object between client and server on Android and iOS?

I have a client and a server both written in Java and sharing Java classes that should be sent between each other. I'm not sure which libraries I can use for this on mobile because I don't know what Dalvik supports, what RoboVM supports etc. Not sure what Gluon Mobile can do for me in this case.
Specifically I have a file that looks like this:
class Data {
IntegerProperty int1 = new SimpleIntegerProperty(4);
ObjectProperty<Person> person = new SimpleObjectProperty();
ObservableList<Contact> contacts = FXCollections.observableArrayList();
// other properties
// also add the getters for the properties and the getters and setters for the values
}
Person and Contact are similar to the above - they contain mostly data properties and some methods for adding and removing from internal (private) lists etc. Basically they are like beans or POJOs only with properties wrappers. This is the data that needs to be sent between the server and the client but only the wrapped values are important - not the bindings. This leads me to the point about serialization: javaFX properties are not serializeable so it was suggested here to make such class as the above externalizeable and write and read the wrapped values.
Ultimately I don't care if i need to do this custom stuff (though it's a lot of work) or if there's a way around it. I need a method on the server like Data receiveDatafor(...) that the client can call, the server fetches the Data data and returns it. The client and server each have their own unrelated bindings to the Data object.
Currently we use RMI internally for desktop. I read that RMI isn't supported and it might not be that great of an option anyway but it does allow to just send java objects really easily. JavaEE has websockets which can transfer the binary form of the objects but it's JavaEE so I guess not supported. I'm not against JSONing and sending as Text but it seems more work than to just serialize - could be wrong. The communication method should support encryption for example when sending passwords. What are my options?
In terms of client-server communication you can have a look at Gluon Connect and Gluon CloudLink.
Gluon Connect
An open source library:
Gluon Connect is a client-side library that simplifies binding your data from any source and format to your JavaFX UI controls. It works by retrieving data from a data source and converting that data from a specific format into JavaFX observable lists and observable objects that can be used directly in JavaFX UI controls.
It is also part of the Charm dependencies, so you have it already included when you create a new Gluon project.
See the documentation on how to use to create a FileProvider or a RestProvider, and also the GluonConnectRestProvider sample.
As the doc already mentions: with a RestClient you can "convert" a REST endpoint into an ObservableList:
// create a RestClient to the specific URL
RestClient restClient = RestClient.create()
.requestMethod(RestClient.Method.GET)
.host("https://api.stackexchange.com")
.path("/2.2/errors");
// retrieve a list from the DataProvider
GluonObservableList<Error> errors = DataProvider
.retrieveList(restClient.buildListDataReader(Error.class));
// create a JavaFX ListView and populate it with the retrieved list
ListView<Error> lvErrors = new ListView<>(errors);
The Notes sample uses Gluon Connect for local storage of Notes and Settings.
Note that these samples make uses of JavaFX POJOs (i.e. Error, Note and Settings use properties).
Gluon CloudLink
Gluon CloudLink enables enterprise and mobile developers to easily connect their different services and applications together, enabling bi-directional communications between mobile apps, enterprise infrastructure, and cloud systems.
The data is stored in the cloud, and you (as administrator) can access to it through a Dashboard.
See documentation about it here.
Have a look at the PWS-GluonCloudLink-Whiteboard sample: a full demo of a back-end application (webapp-mobile) running on the cloud (Pivotal Web Services) and a mobile client (mobile app).
In the client side, once you get a valid GluonClient, you can retrieve an observable list of items:
public GluonObservableList<Item> retrieveItems() {
GluonObservableList<Item> items = DataProvider.retrieveList(gluonClient.createListDataReader("items", Item.class));
return items;
}
As you can see, in the client you don't deal with REST endpoints, json serializing... Everything is just JavaFX observables. The connection with the backend is set in CloudLink with the Dashboard application, defining a REST Connector.

What is "Initial WSDL" technically?

Let's suppose there is a link to a web-service, e.g. http://1.2.3.4:56789/ws_bla_bla_bla/some_service?WSDL
This address shows xml document, as I guess this is called Initial WSDL.
What is it? Just a list of possibe requests/responces pairs and their xml-structure?
WSDL describes the web service and used to generate client side class which you can used to communicate with service (proxy classes)
couple of generators
http://easywsdl.com/
http://www.wsdl2code.com/
SoapUI is another tool which you can used to test service based on WSDL.

Rails connect to Asterisk and make phone calls

Hi i have googled all day long but i can't find an answer.
I have to write a web app which talks to asterisk.
It should be able to do ClicktoCall operations.
Can you guys recommend something ?
I came across a few projects but I'm still not sure.
I just want to connect to Asterisk and do calls from the web app.
thanks
If you're a Ruby programmer the best way for you to hook into Asterisk is adhearsion. It wraps up Asterisk's AGI and Manager (MAPI) APIs for you.
Also hAve a look at SIP, asterisk, adhearson and VoIP and in particular Adam Kalsey's answer. He works for Tropo which sponsor the adhearsion project.
First you need to know, that the protocol Asterisk uses is SIP, you can learn more at the Wikipedia.
Since you want to use an rails application, you may want to use ruby as well, so there's a ruby implementation named OverSip, you can check their API and see if it fits your requirements.
If you are aiming at web calls, you'll need an WebRTC, Flash or Java applet. For WebRTC you can check sipML5 for an opensource solution.
You can also opt for an interface, that will start a call from one number to another, using your phone. When the first call is picked up the server starts ringing in the destination.
Also you could make use of cloud communications providers like twilio, tropo, etc.
Try this Google search:
rails asterisk manager interface
I saw some interesting things right off. I am not trying to be one if those Use Google type people, just didn't want to paste all the links in that I found from this Google search.
Check it out, hope it helps.
There are several ways to do this but the three easiest ones are
1. Generate a call file on the Asterisk server
These files should be written to the dir
/var/spool/asterisk/outgoing
Asterisk will then pickup the file, process and delete it.
It's pretty aggressive when doing this so it's recommended to write the file into a temporary directory and then move it to the spool dir for processing.
An tutorial of the file format is here:
https://www.voip-info.org/asterisk-auto-dial-out/
(I personally feel this is a bit "hacky", and prefer doing it with an API call)
2. Generate the call by the AMI API interface.
Use the Originate function of the AMI API to generate the call. It's pretty easy to set this up just configure the manager.conf file whitch sets up a HTTP server on port 5038 from witch you can call the API.
https://www.voip-info.org/asterisk-config-managerconf/
3. Set up the call using the ARI API
First you need to setup ari.conf, this is enough for now:
[general]
enabled = yes
pretty=yes
allowed_origins=http://ari.asterisk.org
[my_username]
type = user
read_only = no
password = my_password
password_format = plain
This is a little bit more complicated to set up, but it really isn't that hard if you just get past the technical geek-speak. Just set up two channels, setup a mixing bridge and add both channels to the bridge.
To set up a click2call you dont even need to do that...
This is the call we use (ruby):
where
#{sip_id} is your registered SIP username
#{number} is the extension that is sent to the dialplan
#{USERNAME}
#{PASSWORD} is from ari.conf
HTTParty.post("http://sipserver.com/ari/channels?endpoint=SIP/#{sip_id}&extension=#{number}&context=outgoing&priority=1&timeout=30&api_key=#{USERNAME}:#{PASSWORD}")
(Note that you need to send the variabels for the variable parameter as a separate JSON for the originate command if you need to send them)
A really useful tool to understand how this works is the swagger at
http://ari.asterisk.org. We already allowed this origin in ari.conf so it should be ready to go. Remember to open your ports in firewalls etc.
Setup your Server IP and port and the API_KEY is in this format: my_username:my_password

Resources