fgcp.server
index
server.py

Fujitsu Global Cloud Platform (FGCP) API Server(s)
 
Example: [see tests/test_*.py for more examples]
 
# Connect without client certificate to region 'test'
from fgcp.resource import FGCPVDataCenter
vdc = FGCPVDataCenter('client.pem', 'test')
 
# Do typical resource actions - updates are not supported here
vsystem = vdc.get_vsystem('Demo System')
vsystem.show_status()
for vserver in vsystem.vservers:
    #result = vserver.backup(wait=True)
...
 
Note: you need to unzip the file 'fixtures.zip' in tests/fixtures first

 
Modules
       
httplib
os
re
time

 
Classes
       
fgcp.FGCPError(exceptions.Exception)
FGCPServerError
FGCPTestServer
FGCPTestServerWithFixtures
FGCPTestServerWithRegistry
httplib.HTTPConnection
FGCPUnsecureRelayServer
httplib.HTTPSConnection(httplib.HTTPConnection)
FGCPRealServer
FGCPRelayServer

 
class FGCPRealServer(httplib.HTTPSConnection)
    Connect to the real API server for the Fujitsu Global Cloud Platform in this region
 
 
Method resolution order:
FGCPRealServer
httplib.HTTPSConnection
httplib.HTTPConnection

Methods inherited from httplib.HTTPSConnection:
__init__(self, host, port=None, key_file=None, cert_file=None, strict=None, timeout=<object object>, source_address=None)
connect(self)
Connect to a host on a given (SSL) port.

Data and other attributes inherited from httplib.HTTPSConnection:
default_port = 443

Methods inherited from httplib.HTTPConnection:
close(self)
Close the connection to the HTTP server.
endheaders(self, message_body=None)
Indicate that the last header line has been sent to the server.
 
This method sends the request to the server.  The optional
message_body argument can be used to pass a message body
associated with the request.  The message body will be sent in
the same packet as the message headers if it is string, otherwise it is
sent as a separate packet.
getresponse(self, buffering=False)
Get the response from the server.
putheader(self, header, *values)
Send a request header line to the server.
 
For example: h.putheader('Accept', 'text/html')
putrequest(self, method, url, skip_host=0, skip_accept_encoding=0)
Send a request to the server.
 
`method' specifies an HTTP request method, e.g. 'GET'.
`url' specifies the object being requested, e.g. '/index.html'.
`skip_host' if True does not add automatically a 'Host:' header
`skip_accept_encoding' if True does not add automatically an
   'Accept-Encoding:' header
request(self, method, url, body=None, headers={})
Send a complete request to the server.
send(self, data)
Send `data' to the server.
set_debuglevel(self, level)
set_tunnel(self, host, port=None, headers=None)
Sets up the host and the port for the HTTP CONNECT Tunnelling.
 
The headers argument should be a mapping of extra HTTP headers
to send with the CONNECT request.

Data and other attributes inherited from httplib.HTTPConnection:
auto_open = 1
debuglevel = 0
response_class = <class httplib.HTTPResponse>
strict = 0

 
class FGCPRelayServer(httplib.HTTPSConnection)
    Connect via some relay API server for remote connections, e.g. for Google App Engine
 
 
Method resolution order:
FGCPRelayServer
httplib.HTTPSConnection
httplib.HTTPConnection

Methods defined here:
__init__(self, host, port=None, path=None, strict=None)
connect(self)
getresponse(self)
request(self, method, url, body=None, headers={})

Data and other attributes inherited from httplib.HTTPSConnection:
default_port = 443

Methods inherited from httplib.HTTPConnection:
close(self)
Close the connection to the HTTP server.
endheaders(self, message_body=None)
Indicate that the last header line has been sent to the server.
 
This method sends the request to the server.  The optional
message_body argument can be used to pass a message body
associated with the request.  The message body will be sent in
the same packet as the message headers if it is string, otherwise it is
sent as a separate packet.
putheader(self, header, *values)
Send a request header line to the server.
 
For example: h.putheader('Accept', 'text/html')
putrequest(self, method, url, skip_host=0, skip_accept_encoding=0)
Send a request to the server.
 
`method' specifies an HTTP request method, e.g. 'GET'.
`url' specifies the object being requested, e.g. '/index.html'.
`skip_host' if True does not add automatically a 'Host:' header
`skip_accept_encoding' if True does not add automatically an
   'Accept-Encoding:' header
send(self, data)
Send `data' to the server.
set_debuglevel(self, level)
set_tunnel(self, host, port=None, headers=None)
Sets up the host and the port for the HTTP CONNECT Tunnelling.
 
The headers argument should be a mapping of extra HTTP headers
to send with the CONNECT request.

Data and other attributes inherited from httplib.HTTPConnection:
auto_open = 1
debuglevel = 0
response_class = <class httplib.HTTPResponse>
strict = 0

 
class FGCPServerError(fgcp.FGCPError)
    
Method resolution order:
FGCPServerError
fgcp.FGCPError
exceptions.Exception
exceptions.BaseException
__builtin__.object

Methods inherited from fgcp.FGCPError:
__init__(self, status, message)
__str__(self)

Data descriptors inherited from fgcp.FGCPError:
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class FGCPTestServer
     Methods defined here:
__init__(self, *args, **kwargs)
close(self)
getresponse(self)
read(self)
request(self, method, uri, body, headers)
set_testid(self, testid)

Data and other attributes defined here:
reason = 'OK'
status = 200

 
class FGCPTestServerWithFixtures(FGCPTestServer)
    Connect to this test API server for local tests - updates are not supported
 
>>> from fgcp.resource import FGCPVDataCenter
>>> vdc = FGCPVDataCenter('client.pem', 'test')
>>> vsystem = vdc.get_vsystem('Demo System')
>>> vsystem.show_status()   #doctest: +NORMALIZE_WHITESPACE
Status Overview for VSystem Demo System
VSystem Demo System     NORMAL
PublicIP        80.70.163.172   ATTACHED
Firewall        Firewall        RUNNING
LoadBalancer    SLB1    192.168.0.211   RUNNING
VServer WebApp1 192.168.0.13    RUNNING
VServer DB1     192.168.1.12    RUNNING
        VDisk   DISK1   NORMAL
VServer WebApp2 192.168.0.15    RUNNING
.
 
  Methods defined here:
__init__(self, *args, **kwargs)
close(self)
getresponse(self)
read(self)
request(self, method, uri, body, headers)
save_request(self, testid, body)
save_response(self, testid, data)

Methods inherited from FGCPTestServer:
set_testid(self, testid)

Data and other attributes inherited from FGCPTestServer:
reason = 'OK'
status = 200

 
class FGCPTestServerWithRegistry(FGCPTestServer)
     Methods defined here:
__init__(self, filePath='fgcp_demo_system.txt')

Methods inherited from FGCPTestServer:
close(self)
getresponse(self)
read(self)
request(self, method, uri, body, headers)
set_testid(self, testid)

Data and other attributes inherited from FGCPTestServer:
reason = 'OK'
status = 200

 
class FGCPUnsecureRelayServer(httplib.HTTPConnection)
    Connect via some relay API server for remote connections, e.g. for localhost
 
  Methods defined here:
__init__(self, host, port=None, path=None, strict=None)
connect(self)
getresponse(self)
request(self, method, url, body=None, headers={})

Methods inherited from httplib.HTTPConnection:
close(self)
Close the connection to the HTTP server.
endheaders(self, message_body=None)
Indicate that the last header line has been sent to the server.
 
This method sends the request to the server.  The optional
message_body argument can be used to pass a message body
associated with the request.  The message body will be sent in
the same packet as the message headers if it is string, otherwise it is
sent as a separate packet.
putheader(self, header, *values)
Send a request header line to the server.
 
For example: h.putheader('Accept', 'text/html')
putrequest(self, method, url, skip_host=0, skip_accept_encoding=0)
Send a request to the server.
 
`method' specifies an HTTP request method, e.g. 'GET'.
`url' specifies the object being requested, e.g. '/index.html'.
`skip_host' if True does not add automatically a 'Host:' header
`skip_accept_encoding' if True does not add automatically an
   'Accept-Encoding:' header
send(self, data)
Send `data' to the server.
set_debuglevel(self, level)
set_tunnel(self, host, port=None, headers=None)
Sets up the host and the port for the HTTP CONNECT Tunnelling.
 
The headers argument should be a mapping of extra HTTP headers
to send with the CONNECT request.

Data and other attributes inherited from httplib.HTTPConnection:
auto_open = 1
debuglevel = 0
default_port = 80
response_class = <class httplib.HTTPResponse>
strict = 0

 
Functions
       
FGCPGetServerConnection(key_file='client.pem', region='de')

 
Data
        FGCP_REGIONS = {'au': 'api.globalcloud.fujitsu.com.au', 'de': 'api.globalcloud.de.fujitsu.com', 'jp': 'api.oviss.jp.fujitsu.com', 'relay': 'relay', 'sg': 'api.globalcloud.sg.fujitsu.com', 'test': 'test', 'uk': 'api.globalcloud.uk.fujitsu.com', 'us': 'api.globalcloud.us.fujitsu.com'}