#Reference : https://docs.openstack.org/openstacksdk/latest/user/guides/compute.html
from openstack import connection
conn = connection.Connection(
region_name='jakarta-1',
auth=dict(
auth_url='https://keystone.jkt-1.neo.id:443/v3',
username='xxxxxxxxxxxxxxxxx',
password='xxxxxxxxxxxxxxxxx',
project_id='xxxxxxxxxxxxxxxxx',
user_domain_id='xxxxxxxxxxxxxxxxx'),
compute_api_version='2',
identity_interface='internal'
)
#servers = conn.list_servers()
def list_servers(conn):
for server in conn.compute.servers():
print(server)
#images = conn.list_images()
def list_images(conn):
for image in conn.compute.images():
print(image)
#flavors = conn.compute.flavors()
def list_flavors(conn):
for flavor in conn.compute.flavors():
print(flavor)
#keypair = conn.compute.keypairs()
def list_keypairs(conn):
for keypair in conn.compute.keypairs():
print(keypair)
#network = conn.compute.networks()
def list_networks(conn):
for network in conn.network.networks():
print(network)
print(list_servers(conn))
#print(list_images(conn))
#print(list_flavors(conn))
#print(list_keypairs(conn))
#print(list_networks(conn))