I recently installed jclouds to use with eclipse to create a project in java to communicate with openstack. Does anyone know if there is a way to create an instance from a snapshot or using default parameters (ovf image ). I would appreciate it. Thank you very much.
Try OpenStack4j. Jcloud is only a high level basic API for OpenStack since it supports many other clouds. Example using OpenStack4j
// Create a Server Model Object
Server server = Builders.server()
.name("Ubuntu 2")
.flavor("flavorId")
.image("imageId")
.addPersonality("/etc/motd", "Welcome to the new VM! Restricted access only")
.build();
// Boot the Server
Server server = os.compute().servers().boot(server);
Related
I have a Java application that needs to update some fields of the manifest.json of an app registration in Azure.
I have already done this from the Linux terminal with the azure-cli tool. I then tried to google for a similar Java SDK to do this but only came up with SDKs that let you authenticate against Azure.
Is there another SDK for my use case or do I have to use some API directly via HTTP?
You can use Management SDK.
Sample code:
// skip this if you know the object id
ActiveDirectoryApplication app = azure.accessManagement().activeDirectoryApplications()
.getByName("<app_name>");
GraphRbacManagementClient client = azure.accessManagement().activeDirectoryApplications().manager().serviceClient();
client.getApplications().patch(
app.id(),
(ApplicationUpdateParameters) new ApplicationUpdateParameters()
.withGroupMembershipClaims(GroupMembershipClaimTypes.ALL));
It is a bit convoluted, because technically speaking AAD does not belong to Management. AAD is included in the SDK mainly for RBAC (role-based-access-control) for other resources.
I am using Google Cloud Translate v3 API Java Client. The Java Client code samples work great. The authentication of the code samples is done using the GOOGLE_APPLICATION_CREDENTIALS environment variable.
I need to develop code that will run in an application server that I have no control over the environment variables. So I need to use another way to get the call authenticated.
Setting Up Authentication for Server to Server Production Applications, under "Passing the path to the service account key in code" has a code sample (choose the JAVA tab) that works for the Storage service, but I can't find a similar way to pass the GoogleCredentials to Translation v3 API Java Client. Does anyone know?
Also, I can't find the Java doc for v3 API. https://googleapis.dev/java/google-cloud-clients/latest/index.html shows version "0.119.0-alpha" and it does not list the package com.google.cloud.translate.v3. Is there a separate java doc page ?
I think I found a solution.
The client API javadoc doesn't list com.google.cloud.translate.v3 but it does list com.google.cloud.translate.v3beta1. In the javadoc for TranslationServiceClient, i.e. https://googleapis.dev/java/google-cloud-clients/latest/com/google/cloud/translate/v3beta1/TranslationServiceClient.html
there's a mention of setting credential, and this method worked!
TranslationServiceSettings translationServiceSettings =
TranslationServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
TranslationServiceClient translationServiceClient =
TranslationServiceClient.create(translationServiceSettings);
I am working on a small project to list all the VirtualNetworks details under a subscription. In our subscription we have both classic and ARM Virtual networks. I am using Azure latest Java SDK(1.1.2) to pull the info. I am using the below API call and it is returning only the VNets from ARM, not from classic. Please see the code snippet.
ApplicationTokenCredentials credentials = new ApplicationTokenCredentials(
clientId, tenantId, clientKey, AzureEnvironment.AZURE);
Azure azure = Azure.authenticate(credentials).withSubscription(subscriptionId);
for (Network virtualNetwork : azure.networks().list()){
Utils.print(virtualNetwork);
}
How can I get both ARM and classic VNets?
The APIs of ASM (Azure Service Management) support the feature for listing the classic Virtual Networks.
There are two ways as below.
Using Azure Java SDK for ASM, you can install it via maven repositories azure-svc-mgmt & azure-svc-mgmt-network, and follow the blog to authenticate for NetworkManagementService to create an instance of NetworkManagementClient to getNetworksOperations() to list() the NetworkListResponse.
Via the ASM REST API List Virtual Network Sites to get the XML response, and refer to the reference Authenticating Service Management Requests, Service to service calls using client credentials (shared secret or certificate) & Create the request to create an authenticated request to call the REST API.
Meanwhile, you also can refer to these similar SO thread for ASM as below.
Azure retrieving the PublicIPAddress of VirtualMachines from Azure Java SDK
MS Azure java client code throws the error
Hope it helps.
I am trying to connect to the SharePoint from my java code. However there seems to be something is missing and I am not able to connect to the sharepoint.
I am using the below code,
NtlmAuthenticator credentials = new NtlmAuthenticator("domain", "uname", "Password");
// Initialize proxy settings
//HttpProxy httpProxy = new HttpProxy("my_system_proxy", 80);
// Connect to Sharepoint
SPSite instance = new SPSite(new URL("https://my_url/cplc/projects/Knowledge%20Share/Forms/PracticeWise.aspx"), credentials, null, true, SPVersion.SP2013);
// Get root web instance
SPWeb rootWeb = instance.getRootWeb();
// Get list of all lists and document libraries from root web
SPListCollection lists = rootWeb.getLists();
I don't know what value I should set for proxy field there.
If I don't set the proxy and send null to it, it says "401: UnAuthorised"
HTTP transport error: java.net.UnknownHostException: proxy.msa"
Update:
I am referring this,
https://code.google.com/p/java-sharepoint-library/
Can anybody please help me to proceed further?
Even if this is not the answer to the question, I want to share with you a project i've just created to help otheres to integrate with sharepoint, as the problem you are into is the same i faced when trying to integrate java apps with sharepoint online. My first approach was to create a jni wrapper of a library made with c#, but this is a headache when you have linux machines in your company, as it will not work as it is based on native dlls method invocation.
I created a simple to use sharepoint java api that hope will help others to communicate with sharepoint
https://github.com/kikovalle/PLGSharepointRestAPI-java/
Also as the full implementation of the Rest API is not covered, you can feel free to contribute to the project.
Hope this will help and be usefull to save you time struggling with sharepoint integrations.
Cisco offers the so called "AXL Toolkit" which allows to access functionality provided by the Cisco Unified Communications Manager (CUCM).
A WSDL-File is shipped with the toolkit. Using Eclipse, I tried to create Java-stubs out of it. But this didn't work. It says the file was inaccessible, while I'm having it right on the filesystem...
I would like to associate a phone with an application user. I have a software which does a similar stuff - but sniffing on the network isn't possible, because HTTPS is enforced for AXL-calls.
Any idea how to accomplish this?
I've finally found a tutorial, right on the Cisco website. One can use Apache Axis to transform the WSDL file to working java classes. You just have to modify the WSDL somewhat before.
Here is the information you need to get started:
Using AXL via WSDL and Java (with Axis)
Then you can just run queries against the database directly (here I'm using the AxlSqlToolkit class from the example code at the link provided):
AxlSqlToolkit ast = new AxlSqlToolkit("192.168.10.72", "admin", "admin4cisco");
String[] res = ast.executeSQL("select pkid from device");
for (String s : res) {
System.out.println(s);
}