Skip to content

Commit e5d024c

Browse files
Upgrade to api version 5 (#79)
* Upgraded the SDK to API version 5 (https://api.ionos.com/cloudapi/v5/swagger.json). Implemented the Kubernetes API methods. Added the appfiles module to dependencies in setup.py so it doesn't require custom install. Refactored a bit the structure of the SDK, it now has each functionality in a separate file. New function for waiting for something to be completed (wait_for) which is using lambdas in order to check basically anything. Various other tweaks and fixes. * Refactored the SDK under IONOS CLOUD. Login variables are now: - IONOS_USERNAME - IONOS_PASSWORD * Namings updates * Renamed to IonosEnterprise
1 parent 2c804b1 commit e5d024c

84 files changed

Lines changed: 4650 additions & 3668 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Apache License
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2015 ProfitBricks GmbH
189+
Copyright 2015 IONOS
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 279 additions & 61 deletions
Large diffs are not rendered by default.

examples/datacenter_example.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python3
22

3-
# Copyright 2015-2017 ProfitBricks GmbH
3+
# Copyright 2015-2017 IONOS
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -19,10 +19,10 @@
1919
import os
2020
"""List Datacenters
2121
"""
22-
from profitbricks.client import ProfitBricksService
22+
from ionosenterprise.client import IonosEnterpriseService
2323

24-
client = ProfitBricksService(
25-
username=os.getenv('PROFITBRICKS_USERNAME'), password=os.getenv('PROFITBRICKS_PASSWORD'))
24+
client = IonosEnterpriseService(
25+
username=os.getenv('IONOS_USERNAME'), password=os.getenv('IONOS_PASSWORD'))
2626

2727
datacenters = client.list_datacenters()
2828

@@ -34,20 +34,20 @@
3434

3535
"""Get Datacenter
3636
"""
37-
from profitbricks.client import ProfitBricksService # noqa
37+
from ionosenterprise.client import IonosEnterpriseService # noqa
3838

3939
datacenter_id = '700e1cab-99b2-4c30-ba8c-1d273ddba022'
4040

41-
client = ProfitBricksService(
41+
client = IonosEnterpriseService(
4242
username='username', password='password')
4343

4444
datacenter = client.get_datacenter(
4545
datacenter_id=datacenter_id)
4646

4747
"""Create Simple Datacenter
4848
"""
49-
from profitbricks.client import ProfitBricksService # noqa
50-
from profitbricks.client import Datacenter, Volume, Server # noqa
49+
from ionosenterprise.client import IonosEnterpriseService # noqa
50+
from ionosenterprise.client import Datacenter, Volume, Server # noqa
5151

5252
i = Datacenter(
5353
name='dc1',
@@ -60,8 +60,8 @@
6060
"""Create Complex Datacenter
6161
"""
6262

63-
from profitbricks.client import ProfitBricksService # noqa
64-
from profitbricks.client import Datacenter, LAN, NIC, LoadBalancer, FirewallRule # noqa
63+
from ionosenterprise.client import IonosEnterpriseService # noqa
64+
from ionosenterprise.client import Datacenter, LAN, NIC, LoadBalancer, FirewallRule # noqa
6565

6666
image_id = 'df8382a1-0f40-11e6-ab6b-52540005ab80'
6767

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/python3
22

3-
# Copyright (C) 2015-2017, ProfitBricks GmbH
4-
# Authors: Benjamin Drung <benjamin.drung@profitbricks.com>
3+
# Copyright (C) 2015-2017, IONOS
54
#
65
# Licensed under the Apache License, Version 2.0 (the "License");
76
# you may not use this file except in compliance with the License.
@@ -17,49 +16,49 @@
1716

1817
# pylint: disable=invalid-name
1918

20-
"""Interactive Python shell for the ProfitBricks REST API"""
19+
"""Interactive Python shell for the IonosEnterprise REST API"""
2120

2221
import argparse
2322
import code
2423
import logging
2524

26-
import profitbricks
27-
import profitbricks.client
25+
import ionosenterprise
26+
import ionosenterprise.client
2827

2928

3029
def main():
31-
"""Main function of the interactive Python shell for the ProfitBricks REST API"""
30+
"""Main function of the interactive Python shell for the IonosEnterprise REST API"""
3231
parser = argparse.ArgumentParser()
33-
parser.add_argument('-b', '--base-uri', default=profitbricks.API_HOST,
32+
parser.add_argument('-b', '--base-uri', default=ionosenterprise.API_HOST,
3433
help="Base URI for the REST API (default: %(default)s)")
3534
parser.add_argument('-c', dest="cmd", help="program passed in as string")
3635
parser.add_argument('-u', '--username',
37-
help="ProfitBricks user name (i.e. email address, "
36+
help="IonosEnterprise user name (i.e. email address, "
3837
"default: read from config)")
3938
args = parser.parse_args()
4039

4140
logging.getLogger("requests").setLevel(logging.WARNING)
4241
logger = logging.getLogger("pb-api-shell")
43-
client = profitbricks.client.ProfitBricksService(
42+
client = ionosenterprise.client.IonosEnterpriseService(
4443
username=args.username, host_base=args.base_uri, client_user_agent='pb-api-shell/1.0')
4544

4645
if args.cmd is None:
47-
banner = ("The ProfitBricks client can be accessed through the 'client' object.\n"
46+
banner = ("The IonosEnterprise client can be accessed through the 'client' object.\n"
4847
"Other available objects: Datacenter, FirewallRule, Group, IPBlock, LAN,\n"
4948
" LoadBalancer, NIC, Server, Snapshot, User, Volume")
5049
variables = {
5150
'client': client,
52-
'Datacenter': profitbricks.client.Datacenter,
53-
'FirewallRule': profitbricks.client.FirewallRule,
54-
'Group': profitbricks.client.Group,
55-
'IPBlock': profitbricks.client.IPBlock,
56-
'LAN': profitbricks.client.LAN,
57-
'LoadBalancer': profitbricks.client.LoadBalancer,
58-
'NIC': profitbricks.client.NIC,
59-
'Server': profitbricks.client.Server,
60-
'Snapshot': profitbricks.client.Snapshot,
61-
'User': profitbricks.client.User,
62-
'Volume': profitbricks.client.Volume,
51+
'Datacenter': ionosenterprise.client.Datacenter,
52+
'FirewallRule': ionosenterprise.client.FirewallRule,
53+
'Group': ionosenterprise.client.Group,
54+
'IPBlock': ionosenterprise.client.IPBlock,
55+
'LAN': ionosenterprise.client.LAN,
56+
'LoadBalancer': ionosenterprise.client.LoadBalancer,
57+
'NIC': ionosenterprise.client.NIC,
58+
'Server': ionosenterprise.client.Server,
59+
'Snapshot': ionosenterprise.client.Snapshot,
60+
'User': ionosenterprise.client.User,
61+
'Volume': ionosenterprise.client.Volume,
6362
}
6463

6564
shell = None
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/python
22
# encoding: utf-8
33

4-
# Copyright 2016-2017 ProfitBricks GmbH
4+
# Copyright 2016-2017 IONOS
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -26,11 +26,10 @@
2626
2727
@author: Jürgen Buchhammer
2828
29-
@copyright: 2016 ProfitBricks GmbH. All rights reserved.
29+
@copyright: 2016 IONOS GmbH. All rights reserved.
3030
3131
@license: Apache License 2.0
3232
33-
@contact: juergen.buchhammer@profitbricks.com
3433
@deffield updated: Updated
3534
'''
3635

@@ -45,7 +44,7 @@
4544
from argparse import RawDescriptionHelpFormatter
4645
from base64 import b64encode, b64decode
4746

48-
from profitbricks.client import ProfitBricksService, Server, Volume, NIC
47+
from ionosenterprise.client import IonosEnterpriseService, Server, Volume, NIC
4948

5049

5150
__all__ = []
@@ -152,7 +151,7 @@ def main(argv=None):
152151
program_license = '''%s
153152
154153
Created by J. Buchhammer on %s.
155-
Copyright 2016 ProfitBricks GmbH. All rights reserved.
154+
Copyright 2016 IONOS. All rights reserved.
156155
157156
Licensed under the Apache License 2.0
158157
http://www.apache.org/licenses/LICENSE-2.0
@@ -223,7 +222,7 @@ def main(argv=None):
223222
(user, password) = getLogin(args.loginfile, args.user, args.password)
224223
if user is None or password is None:
225224
raise ValueError("user or password resolved to None")
226-
pbclient = ProfitBricksService(user, password)
225+
pbclient = IonosEnterpriseService(user, password)
227226

228227
first_nic = NIC(name="local", ips=[], dhcp=True, lan=lan_id)
229228
volume = Volume(name=servername+"-Disk", size=args.storage,
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/python
22
# encoding: utf-8
33

4-
# Copyright 2016-2017 ProfitBricks GmbH
4+
# Copyright 2016-2017 IONOS
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -26,11 +26,10 @@
2626
2727
@author: Jürgen Buchhammer
2828
29-
@copyright: 2016 ProfitBricks GmbH. All rights reserved.
29+
@copyright: 2016 IONOS. All rights reserved.
3030
3131
@license: Apache License 2.0
3232
33-
@contact: juergen.buchhammer@profitbricks.com
3433
@deffield updated: Updated
3534
'''
3635

@@ -44,7 +43,7 @@
4443
from base64 import b64encode, b64decode
4544
from subprocess import call
4645

47-
from profitbricks.client import ProfitBricksService
46+
from ionosenterprise.client import IonosEnterpriseService
4847

4948

5049
__all__ = []
@@ -223,7 +222,7 @@ def main(argv=None):
223222
program_license = '''%s
224223
225224
Created by J. Buchhammer on %s.
226-
Copyright 2016 ProfitBricks GmbH. All rights reserved.
225+
Copyright 2016 IONOS. All rights reserved.
227226
228227
Licensed under the Apache License 2.0
229228
http://www.apache.org/licenses/LICENSE-2.0
@@ -279,7 +278,7 @@ def main(argv=None):
279278
(user, password) = getLogin(args.loginfile, args.user, args.password)
280279
if user is None or password is None:
281280
raise ValueError("user or password resolved to None")
282-
pbclient = ProfitBricksService(user, password)
281+
pbclient = IonosEnterpriseService(user, password)
283282

284283
server = getServerStates(pbclient, dc_id,
285284
args.serverid, args.servername)
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/python
22
# encoding: utf-8
33

4-
# Copyright 2016-2017 ProfitBricks GmbH
4+
# Copyright 2016-2017 IONOS
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -23,11 +23,10 @@
2323
2424
@author: Jürgen Buchhammer
2525
26-
@copyright: 2016 ProfitBricks GmbH. All rights reserved.
26+
@copyright: 2016 IONOS. All rights reserved.
2727
2828
@license: Apache License 2.0
2929
30-
@contact: juergen.buchhammer@profitbricks.com
3130
@deffield updated: Updated
3231
'''
3332

@@ -41,9 +40,9 @@
4140
import json
4241
from base64 import b64decode, b64encode
4342

44-
from profitbricks.client import ProfitBricksService
45-
from profitbricks.client import Datacenter, Volume, Server
46-
from profitbricks.client import LAN, NIC, FirewallRule
43+
from ionosenterprise.client import IonosEnterpriseService
44+
from ionosenterprise.client import Datacenter, Volume, Server
45+
from ionosenterprise.client import LAN, NIC, FirewallRule
4746

4847

4948
__version__ = 0.2
@@ -457,7 +456,7 @@ def main(argv=None):
457456
program_license = '''%s
458457
459458
Created by J. Buchhammer on %s.
460-
Copyright 2016 ProfitBricks GmbH. All rights reserved.
459+
Copyright 2016 IONOS. All rights reserved.
461460
462461
Licensed under the Apache License 2.0
463462
http://www.apache.org/licenses/LICENSE-2.0
@@ -499,7 +498,7 @@ def main(argv=None):
499498
(user, password) = getLogin(args.loginfile, args.user, args.password)
500499
if user is None or password is None:
501500
raise ValueError("user or password resolved to None")
502-
pbclient = ProfitBricksService(user, password)
501+
pbclient = IonosEnterpriseService(user, password)
503502

504503
usefile = args.infile
505504
print("read dc from {}".format(usefile))
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/python
22
# encoding: utf-8
33

4-
# Copyright 2016-2017 ProfitBricks GmbH
4+
# Copyright 2016-2017 IONOS
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -18,10 +18,10 @@
1818
# pylint: disable=broad-except,global-statement
1919

2020
'''
21-
pb_datacenter_inventory -- dump inventory of your Profitbricks data centers to CSV files
21+
pb_datacenter_inventory -- dump inventory of your Ionos Enterprise data centers to CSV files
2222
2323
pb_datacenter_inventory is a sample script to get an inventory overview
24-
of your data centers via Profitbricks REST-API.
24+
of your data centers via Ionos Enterprise REST-API.
2525
2626
It collects some basic information on
2727
- reserved ip blocks:
@@ -46,11 +46,10 @@
4646
4747
@author: Jürgen Buchhammer
4848
49-
@copyright: 2016 ProfitBricks GmbH. All rights reserved.
49+
@copyright: 2016 IONOS. All rights reserved.
5050
5151
@license: license
5252
53-
@contact: juergen.buchhammer@profitbricks.com
5453
@deffield updated: Updated
5554
'''
5655

@@ -66,7 +65,7 @@
6665

6766
import csv
6867

69-
from profitbricks.client import ProfitBricksService
68+
from ionosenterprise.client import IonosEnterpriseService
7069

7170
__all__ = []
7271
__version__ = 0.2
@@ -358,7 +357,7 @@ def main(argv=None): # IGNORE:C0111
358357
program_license = '''%s
359358
360359
Created by J.Buchhammer on %s.
361-
Copyright 2016 ProfitBricks GmbH. All rights reserved.
360+
Copyright 2016 IONOS. All rights reserved.
362361
363362
Licensed under the Apache License 2.0
364363
http://www.apache.org/licenses/LICENSE-2.0
@@ -414,7 +413,7 @@ def main(argv=None): # IGNORE:C0111
414413
print("Verbose mode on")
415414
print("using python ", sys.version_info)
416415

417-
pbclient = ProfitBricksService(user, password)
416+
pbclient = IonosEnterpriseService(user, password)
418417

419418
if datacenterid is not None:
420419
datacenters = {}

0 commit comments

Comments
 (0)