How get the softlayer storage credendials?

2024/10/13 17:19:59

I'm trying to get the Username,password and host IQN of a authorized Softlayer Network Storage. I used this python script, but the shell returns []

    import SoftLayerAPI_USERNAME = 'xxx'API_KEY = 'yyyy'storageId = zzzzclient = SoftLayer.Client(username=API_USERNAME,api_key=API_KEY)client['SoftLayer_Network_Storage'].getCredentials(id=storageId)

What's wrong in my code? Regards

Answer

try this:

"""
Get all the authorized hosts for a iSCSI.Important manual pages:
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Hardware
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Virtual_Guest
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Network_Storage
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage
http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/getObjectLicense: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <[email protected]>
"""
import SoftLayerUSERNAME = 'set me'
API_KEY = 'set me'iscsiId = 6548079# Declares the API client
client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)
networkStorageService = client['SoftLayer_Network_Storage']objectMask = "mask[id,username,allowedVirtualGuests[fullyQualifiedDomainName,allowedHost[name,credential[username,password]]],allowedHardware[fullyQualifiedDomainName,allowedHost[name,credential[username,password]]]]"try:response = networkStorageService.getObject(id=iscsiId, mask=objectMask)print(response)
except SoftLayer.SoftLayerAPIError as e:# If there was an error returned from the SoftLayer API then bomb out with the# error message.print("Unable to retrieve the network storage. faultCode=%s, faultString=%s" % (e.faultCode, e.faultString))
https://en.xdnf.cn/q/118056.html

Related Q&A

dopy.manager.DoError: Unable to authenticate you

Im trying to configure a Virtual Machine(with Vagrant and Ansible), that needs a file.py to the full correct configuration of this machine (according to the book that Im studying),Im was using the Digi…

subprocess.Popen: OSError: [Errno 2] No such file or directory only on Linux

This is not a duplicate of subprocess.Popen: OSError: [Errno 13] Permission denied only on Linux as that problem occurred due to wrong permissions. That has been fixed and this is an entirely different…

Windows Theano Keras - lazylinker_ext\mod.cpp: No such file or directory

I am installing Theano and Keras follwing the How do I install Keras and Theano in Anaconda Python on Windows?, which worked fine for me with an older release before. Now I have upgraded to the latest…

Python Threading: Making the thread function return from an external signal

Could anyone please point out whats wrong with this code. I am trying to return the thread through a variable flag, which I want to control in my main thread. test27.pyimport threading import timelock …

Python join data lines together

Hello i have dataset a few thousand lines which is split in even and odd number lines and i cant find a way to join them together again in the same line. Reading the file and overwriting it is fine or …

How to undraw plot with Zelle graphics?

This is a code problem for Python 3.5.2 using John Zelles graphics.py:I have spent a good amount of time looking for the answer here, but just can not figure it out. The function undraw() exists just l…

/bin/sh: line 62: to: command not found

I have a python code in which I am calling a shell command. The part of the code where I did the shell command is:try:def parse(text_list):text = \n.join(text_list)cwd = os.getcwd()os.chdir("/var/…

Using PyMySQL with MariaDB

I have read this article about switching from MySQL to MariaDB on Ubuntu. The article claims that it would be not problem to switch between the two. Currently, I am using PyMySQL to connect to my MySQL…

Overloading str in Python

I have code that looks like the following:class C(str):def __init__(self, a, b):print(init was called!)super().__init__(b)self.a = ac = C(12, c)When I try to run it, it gives me the following error:Tra…

Why cant I install Pillow on my mac? It gives some errors

here is the error from installing Pillow. Im using OS X Mavericks. I tried installing Pillow through pip install.._imaging.c:391:28: warning: implicit conversion loses integer precision: long to int [-…