SoftLayer blockstorage凭证

时间:2016-03-17 09:17:11

标签: ibm-cloud-infrastructure

我希望通过api获取存储的凭据数据。 所以我试着在URL下面

thufir@mordor:~/NetBeansProjects/selenium$ 
thufir@mordor:~/NetBeansProjects/selenium$ gradle clean build --refresh-dependencies
:clean
:compileJava
Download https://jitpack.io/com/github/THUFIR/hello_api/master-SNAPSHOT/hello_api-master-1-gef696be-2.pom
:processResources UP-TO-DATE
:classes
:jar
hibernate-core-3.6.7.Final.jar selenium-java-2.53.0.jar hello_api-master-SNAPSHOT.jar jna-4.1.0.jar antlr-2.7.6.jar jna-platform-4.1.0.jar commons-collections-3.1.jar netty-3.5.7.Final.jar dom4j-1.6.1.jar hibernate-commons-annotations-3.2.0.Final.jar cglib-nodep-2.1_3.jar hibernate-jpa-2.0-api-1.0.1.Final.jar gson-2.3.1.jar jta-1.1.jar slf4j-api-1.6.1.jar selenium-api-2.53.0.jar httpclient-4.5.1.jar selenium-chrome-driver-2.53.0.jar selenium-edge-driver-2.53.0.jar guava-19.0.jar selenium-firefox-driver-2.53.0.jar selenium-ie-driver-2.53.0.jar selenium-safari-driver-2.53.0.jar selenium-support-2.53.0.jar selenium-leg-rc-2.53.0.jar httpcore-4.4.3.jar selenium-remote-driver-2.53.0.jar commons-logging-1.2.jar commons-codec-1.9.jar commons-io-2.4.jar commons-exec-1.3.jar
:startScripts
:distTar
:distZip
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build

BUILD SUCCESSFUL

Total time: 14.021 secs
thufir@mordor:~/NetBeansProjects/selenium$ 
thufir@mordor:~/NetBeansProjects/selenium$ 
thufir@mordor:~/NetBeansProjects/selenium$ cat build.gradle 
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'maven'

mainClassName = 'net.bounceme.mordor.hello.client.HelloClient'
//version = 'dev'
//group = 'com.some.project'
description = 'hello world KISS'


clean{
    delete "hello_client"
}

sourceCompatibility = '1.8'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
if (!hasProperty(mainClassName)) {
    ext.mainClass = mainClassName
}

repositories {
    mavenCentral()
    maven { url "https://jitpack.io" }
}


dependencies {
    compile group: 'org.hibernate', name: 'hibernate-core', version: '3.6.7.Final'
    compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '2.+'
    compile 'com.github.THUFIR:hello_api:master-SNAPSHOT'
}

jar.doFirst
{
    def manifestClasspath = configurations.runtime.collect { it.name }
    manifestClasspath = manifestClasspath.unique().join(" ")
    println (manifestClasspath)
    manifest.attributes.put("Main-Class", mainClassName)
    manifest.attributes.put("Class-Path", manifestClasspath)
}

thufir@mordor:~/NetBeansProjects/selenium$ 
thufir@mordor:~/NetBeansProjects/selenium$ gradle run
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:run
hello world 

BUILD SUCCESSFUL

Total time: 6.15 secs
thufir@mordor:~/NetBeansProjects/selenium$ 
thufir@mordor:~/NetBeansProjects/selenium$ cat src/main/java/net/bounceme/mordor/hello/client/HelloClient.java 
package net.bounceme.mordor.hello.client;

import static java.lang.System.out;
import net.bounceme.mordor.hello.library.HelloLibrary;

public class HelloClient {

    private org.openqa.selenium.WebDriver driver = new org.openqa.selenium.firefox.FirefoxDriver();

    public static void main(String... args) {
        new HelloClient().runLibrary(args);
    }

    private void runLibrary(String... args) {
        HelloLibrary library = new HelloLibrary();
        out.println(library.hello(args));
    }

}
thufir@mordor:~/NetBeansProjects/selenium$ 

但我无法获得凭据。

所以我尝试了另一个api。

SoftLayer_Network_Storage/8884475.json?objectMask=mask[serviceResourceBackendIpAddress,bytesUsed,osTypeId,allowedIpAddresses,parentVolume.volumeStatus,credentials,serviceResource.datacenter]

但不能

我如何了解凭证?

感谢。

1 个答案:

答案 0 :(得分:0)

应用此SoftLayer_Network_Storage::getCredentials后,响应会使用您的network Storage Id显示空值。 但我认为您需要与Authorized hosts相关的凭据。如果我是对的,下面的示例向您显示:“Username”“Password”“Host IQN”用于授权主机(裸机服务器,虚拟服务器,IP地址)。

https://[username]:[apikey]@api.softlayer.com/rest/v3.1/SoftLayer_Network_Storage/8884475/getObject?objectMask=mask[id,username,allowedVirtualGuests[fullyQualifiedDomainName,allowedHost[name,credential[username,password]]],allowedHardware[fullyQualifiedDomainName,allowedHost[name,credential[username,password]]],allowedIpAddresses[ipAddress,allowedHost[name,credential[username,password]]]]

Method: GET