tiktalik-cli 1.9.3.2__tar.gz → 1.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tiktalik_cli-1.10.0/PKG-INFO +77 -0
- {tiktalik-cli-1.9.3.2 → tiktalik_cli-1.10.0}/README.md +1 -1
- tiktalik_cli-1.10.0/pyproject.toml +51 -0
- {tiktalik-cli-1.9.3.2 → tiktalik_cli-1.10.0/src}/tiktalik_cli/__init__.py +5 -0
- {tiktalik-cli-1.9.3.2 → tiktalik_cli-1.10.0/src}/tiktalik_cli/auth.py +2 -2
- {tiktalik-cli-1.9.3.2 → tiktalik_cli-1.10.0/src}/tiktalik_cli/command/__init__.py +33 -6
- {tiktalik-cli-1.9.3.2 → tiktalik_cli-1.10.0/src}/tiktalik_cli/command/auth.py +3 -4
- {tiktalik-cli-1.9.3.2 → tiktalik_cli-1.10.0/src}/tiktalik_cli/command/command.py +59 -20
- {tiktalik-cli-1.9.3.2 → tiktalik_cli-1.10.0/src}/tiktalik_cli/command/image.py +3 -25
- {tiktalik-cli-1.9.3.2 → tiktalik_cli-1.10.0/src}/tiktalik_cli/command/instance.py +7 -6
- {tiktalik-cli-1.9.3.2 → tiktalik_cli-1.10.0/src}/tiktalik_cli/main.py +1 -5
- tiktalik-cli-1.9.3.2/PKG-INFO +0 -77
- tiktalik-cli-1.9.3.2/setup.cfg +0 -7
- tiktalik-cli-1.9.3.2/setup.py +0 -51
- tiktalik-cli-1.9.3.2/tiktalik_cli/command/loadbalancer.py +0 -407
- tiktalik-cli-1.9.3.2/tiktalik_cli.egg-info/PKG-INFO +0 -77
- tiktalik-cli-1.9.3.2/tiktalik_cli.egg-info/SOURCES.txt +0 -20
- tiktalik-cli-1.9.3.2/tiktalik_cli.egg-info/dependency_links.txt +0 -1
- tiktalik-cli-1.9.3.2/tiktalik_cli.egg-info/entry_points.txt +0 -3
- tiktalik-cli-1.9.3.2/tiktalik_cli.egg-info/requires.txt +0 -1
- tiktalik-cli-1.9.3.2/tiktalik_cli.egg-info/top_level.txt +0 -1
- {tiktalik-cli-1.9.3.2 → tiktalik_cli-1.10.0/src}/tiktalik_cli/command/network.py +0 -0
- {tiktalik-cli-1.9.3.2 → tiktalik_cli-1.10.0/src}/tiktalik_cli/command/util.py +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tiktalik-cli
|
|
3
|
+
Version: 1.10.0
|
|
4
|
+
Summary: Tiktalik Computing command line interface
|
|
5
|
+
Keywords: Tiktalik,CLI,Terminal,VPS
|
|
6
|
+
Author: Techstorage sp. z o.o
|
|
7
|
+
Author-email: Techstorage sp. z o.o <kontakt@tiktalik.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Development Status :: 6 - Mature
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: System Administrators
|
|
18
|
+
Classifier: Intended Audience :: Information Technology
|
|
19
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
20
|
+
Classifier: Natural Language :: English
|
|
21
|
+
Classifier: Operating System :: POSIX
|
|
22
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
23
|
+
Classifier: Topic :: Internet
|
|
24
|
+
Classifier: Topic :: Utilities
|
|
25
|
+
Classifier: Topic :: System :: Systems Administration
|
|
26
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
27
|
+
Requires-Dist: tiktalik>=1.8.0
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Project-URL: Homepage, https://www.tiktalik.com
|
|
30
|
+
Project-URL: Repository, https://github.com/tiktalik-cloud/tiktalik-cli.git
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# Tiktalik Command Line Interface
|
|
34
|
+
|
|
35
|
+
This is a command line interface utility implemented in Python, which enables the
|
|
36
|
+
user to perform core operations on the [Tiktalik Cloud Computing](http://www.tiktalik.com) service.
|
|
37
|
+
|
|
38
|
+
## Requirements
|
|
39
|
+
|
|
40
|
+
* [tiktalik-python](https://github.com/tiktalik-cloud/tiktalik-python)
|
|
41
|
+
* Python >=3.10
|
|
42
|
+
|
|
43
|
+
Note that package dependencies are automatically installed by pip.
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
Install using pip:
|
|
48
|
+
|
|
49
|
+
`$ pip install tiktalik-cli`
|
|
50
|
+
|
|
51
|
+
## Authentication
|
|
52
|
+
|
|
53
|
+
To use the CLI you need an API key. You can generate one in your
|
|
54
|
+
[admin panel](https://tiktalik.com/panel/#apikeys). The API authentication
|
|
55
|
+
information consists of an *API key* and an *API secret*. You can save this
|
|
56
|
+
information locally by executing:
|
|
57
|
+
|
|
58
|
+
`$ tiktalik init-auth API-KEY API-SECRET`
|
|
59
|
+
|
|
60
|
+
This saves the key and secret to `~/.tiktalik/auth`
|
|
61
|
+
|
|
62
|
+
Alternatively, if you don't want to save your API key, you can use the `--key`
|
|
63
|
+
and `--secret` switches on the commandline.
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
The basic usage patterns is:
|
|
68
|
+
|
|
69
|
+
`$ tiktalik COMMAND`
|
|
70
|
+
|
|
71
|
+
You can get a list of commands by running `tiktalik` without arguments.
|
|
72
|
+
To get a help on a specific command, run:
|
|
73
|
+
|
|
74
|
+
`$ tiktalik COMMAND --help`
|
|
75
|
+
|
|
76
|
+
We also have [a tutorial](http://articles.tiktalik.com/content/help/using-tiktalik-command-line-utility/) to quickly get
|
|
77
|
+
you started.
|
|
@@ -6,7 +6,7 @@ user to perform core operations on the [Tiktalik Cloud Computing](http://www.tik
|
|
|
6
6
|
## Requirements
|
|
7
7
|
|
|
8
8
|
* [tiktalik-python](https://github.com/tiktalik-cloud/tiktalik-python)
|
|
9
|
-
* Python >=3.
|
|
9
|
+
* Python >=3.10
|
|
10
10
|
|
|
11
11
|
Note that package dependencies are automatically installed by pip.
|
|
12
12
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tiktalik-cli"
|
|
3
|
+
version = "1.10.0"
|
|
4
|
+
description = "Tiktalik Computing command line interface"
|
|
5
|
+
requires-python = ">=3.10"
|
|
6
|
+
authors = [
|
|
7
|
+
{name = "Techstorage sp. z o.o", email = "kontakt@tiktalik.com"}
|
|
8
|
+
]
|
|
9
|
+
license = "MIT"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
keywords=["Tiktalik", "CLI", "Terminal", "VPS"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
14
|
+
"Programming Language :: Python :: 3.10",
|
|
15
|
+
"Programming Language :: Python :: 3.11",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Programming Language :: Python :: 3.13",
|
|
18
|
+
"Development Status :: 6 - Mature",
|
|
19
|
+
"Environment :: Console",
|
|
20
|
+
"Intended Audience :: Developers",
|
|
21
|
+
"Intended Audience :: System Administrators",
|
|
22
|
+
"Intended Audience :: Information Technology",
|
|
23
|
+
"Intended Audience :: End Users/Desktop",
|
|
24
|
+
"Natural Language :: English",
|
|
25
|
+
"Operating System :: POSIX",
|
|
26
|
+
"Operating System :: Microsoft :: Windows",
|
|
27
|
+
"Topic :: Internet",
|
|
28
|
+
"Topic :: Utilities",
|
|
29
|
+
"Topic :: System :: Systems Administration",
|
|
30
|
+
"License :: OSI Approved :: MIT License",
|
|
31
|
+
]
|
|
32
|
+
dependencies = [
|
|
33
|
+
"tiktalik>=1.8.0",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.scripts]
|
|
37
|
+
tiktalik = "tiktalik_cli:main"
|
|
38
|
+
|
|
39
|
+
[project.urls]
|
|
40
|
+
Homepage = "https://www.tiktalik.com"
|
|
41
|
+
Repository = "https://github.com/tiktalik-cloud/tiktalik-cli.git"
|
|
42
|
+
|
|
43
|
+
[build-system]
|
|
44
|
+
requires = ["uv_build>=0.8.22,<0.9.0"]
|
|
45
|
+
build-backend = "uv_build"
|
|
46
|
+
|
|
47
|
+
[dependency-groups]
|
|
48
|
+
dev = [
|
|
49
|
+
"ruff>=0.13.2",
|
|
50
|
+
"ty>=0.0.1a21",
|
|
51
|
+
]
|
|
@@ -16,3 +16,8 @@
|
|
|
16
16
|
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
17
|
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
18
18
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
19
|
+
|
|
20
|
+
from .main import main
|
|
21
|
+
|
|
22
|
+
if __name__ == "__main__":
|
|
23
|
+
main()
|
|
@@ -83,10 +83,10 @@ def read_from_file():
|
|
|
83
83
|
else:
|
|
84
84
|
print(("Unable to access %s: %s" % (CONFIG_FILE_PATH, ex)))
|
|
85
85
|
|
|
86
|
-
if (stat.S_IMODE(st.st_mode) != 0o600) and (os.name ==
|
|
86
|
+
if (stat.S_IMODE(st.st_mode) != 0o600) and (os.name == "posix"):
|
|
87
87
|
raise SecurityError()
|
|
88
88
|
|
|
89
|
-
cfg = configparser.
|
|
89
|
+
cfg = configparser.ConfigParser()
|
|
90
90
|
cfg.read(CONFIG_FILE_PATH)
|
|
91
91
|
|
|
92
92
|
return cfg.get("main", "key"), cfg.get("main", "secret")
|
|
@@ -18,9 +18,36 @@
|
|
|
18
18
|
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
19
19
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
20
|
|
|
21
|
-
from .instance import
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
from .instance import (
|
|
22
|
+
ListInstances as ListInstances,
|
|
23
|
+
CreateInstance as CreateInstance,
|
|
24
|
+
InstanceCommand as InstanceCommand,
|
|
25
|
+
StartInstance as StartInstance,
|
|
26
|
+
StopInstance as StopInstance,
|
|
27
|
+
BackupInstance as BackupInstance,
|
|
28
|
+
DeleteInstance as DeleteInstance,
|
|
29
|
+
InstanceInfo as InstanceInfo,
|
|
30
|
+
AddInterface as AddInterface,
|
|
31
|
+
RemoveInterface as RemoveInterface,
|
|
32
|
+
)
|
|
33
|
+
from .image import (
|
|
34
|
+
ListImages as ListImages,
|
|
35
|
+
RenameImage as RenameImage,
|
|
36
|
+
DeleteImage as DeleteImage,
|
|
37
|
+
)
|
|
38
|
+
from .network import (
|
|
39
|
+
ListNetworks as ListNetworks,
|
|
40
|
+
CreateNetwork as CreateNetwork,
|
|
41
|
+
)
|
|
42
|
+
from .auth import (
|
|
43
|
+
InitAuth as InitAuth,
|
|
44
|
+
)
|
|
45
|
+
from .command import (
|
|
46
|
+
CommandError as CommandError,
|
|
47
|
+
CommandAborted as CommandAborted,
|
|
48
|
+
Command as Command,
|
|
49
|
+
GeneralCommand as GeneralCommand,
|
|
50
|
+
ComputingCommand as ComputingCommand,
|
|
51
|
+
ComputingImageCommand as ComputingImageCommand,
|
|
52
|
+
ComputingNetworkCommand as ComputingNetworkCommand,
|
|
53
|
+
)
|
|
@@ -32,7 +32,7 @@ class InitAuth(GeneralCommand):
|
|
|
32
32
|
def add_parser(cls, parser, subparser):
|
|
33
33
|
p = subparser.add_parser(
|
|
34
34
|
"init-auth",
|
|
35
|
-
description="Store auth information
|
|
35
|
+
description="Store auth information locally %s" % auth.CONFIG_FILE_PATH,
|
|
36
36
|
)
|
|
37
37
|
p.add_argument("key", help="Your API Key")
|
|
38
38
|
p.add_argument("secret", help="Your API Secret")
|
|
@@ -43,8 +43,7 @@ class InitAuth(GeneralCommand):
|
|
|
43
43
|
key, secret = auth.read_from_file()
|
|
44
44
|
if key:
|
|
45
45
|
raise CommandError(
|
|
46
|
-
"Authentication information already "
|
|
47
|
-
"exists in " + auth.CONFIG_FILE_PATH
|
|
46
|
+
"Authentication information already exists in " + auth.CONFIG_FILE_PATH
|
|
48
47
|
)
|
|
49
48
|
|
|
50
49
|
try:
|
|
@@ -54,7 +53,7 @@ class InitAuth(GeneralCommand):
|
|
|
54
53
|
if e.errno != errno.EEXIST:
|
|
55
54
|
raise CommandError(e)
|
|
56
55
|
|
|
57
|
-
cfg = configparser.
|
|
56
|
+
cfg = configparser.ConfigParser()
|
|
58
57
|
cfg.add_section("main")
|
|
59
58
|
cfg.set("main", "key", self.args.key)
|
|
60
59
|
cfg.set("main", "secret", self.args.secret)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"""Module tiktalik_cli.command.command"""
|
|
2
|
+
|
|
3
|
+
import os
|
|
2
4
|
# Copyright (c) 2013 Techstorage sp. z o.o.
|
|
3
5
|
#
|
|
4
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
@@ -19,9 +21,11 @@
|
|
|
19
21
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
22
|
|
|
21
23
|
import sys
|
|
22
|
-
from
|
|
23
|
-
from
|
|
24
|
-
from
|
|
24
|
+
from abc import ABC, abstractmethod
|
|
25
|
+
from typing import Optional
|
|
26
|
+
from dataclasses import dataclass
|
|
27
|
+
|
|
28
|
+
from tiktalik import TiktalikAuthConnection
|
|
25
29
|
|
|
26
30
|
|
|
27
31
|
class CommandError(Exception):
|
|
@@ -32,13 +36,39 @@ class CommandAborted(Exception):
|
|
|
32
36
|
"""Command aborted"""
|
|
33
37
|
|
|
34
38
|
|
|
35
|
-
|
|
39
|
+
@dataclass
|
|
40
|
+
class ProxyDetails:
|
|
41
|
+
http_proxy: Optional[str]
|
|
42
|
+
https_proxy: Optional[str]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def lookup_proxy_settings() -> ProxyDetails:
|
|
46
|
+
details = ProxyDetails(http_proxy=None, https_proxy=None)
|
|
47
|
+
if os.environ.get("HTTP_PROXY") is not None:
|
|
48
|
+
details.http_proxy = os.environ.get("HTTP_PROXY")
|
|
49
|
+
if os.environ.get("http_proxy") is not None:
|
|
50
|
+
details.http_proxy = os.environ.get("http_proxy")
|
|
51
|
+
if os.environ.get("HTTPS_PROXY") is not None:
|
|
52
|
+
details.https_proxy = os.environ.get("HTTPS_PROXY")
|
|
53
|
+
if os.environ.get("https_proxy") is not None:
|
|
54
|
+
details.https_proxy = os.environ.get("https_proxy")
|
|
55
|
+
|
|
56
|
+
return details
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class Command(ABC):
|
|
36
60
|
"""Basic command"""
|
|
37
61
|
|
|
38
62
|
def __init__(self, args, keyid, secret, connection_cls):
|
|
39
63
|
self.args = args
|
|
40
64
|
if connection_cls is not None:
|
|
41
|
-
|
|
65
|
+
proxy_details = lookup_proxy_settings()
|
|
66
|
+
self.conn = connection_cls(
|
|
67
|
+
keyid,
|
|
68
|
+
secret,
|
|
69
|
+
http_proxy=proxy_details.http_proxy,
|
|
70
|
+
https_proxy=proxy_details.https_proxy,
|
|
71
|
+
)
|
|
42
72
|
|
|
43
73
|
@classmethod
|
|
44
74
|
def add_parser(cls, parser, subparser):
|
|
@@ -50,11 +80,12 @@ class Command:
|
|
|
50
80
|
"""Return command group"""
|
|
51
81
|
return "General commands"
|
|
52
82
|
|
|
83
|
+
@abstractmethod
|
|
53
84
|
def execute(self):
|
|
54
|
-
|
|
55
|
-
raise NotImplementedError()
|
|
85
|
+
pass
|
|
56
86
|
|
|
57
|
-
|
|
87
|
+
@staticmethod
|
|
88
|
+
def yesno(message: str, abort=True) -> bool:
|
|
58
89
|
"""Listen for a yes/no answers"""
|
|
59
90
|
print(message)
|
|
60
91
|
|
|
@@ -71,14 +102,25 @@ class Command:
|
|
|
71
102
|
else:
|
|
72
103
|
return False
|
|
73
104
|
|
|
105
|
+
|
|
74
106
|
class GeneralCommand(Command):
|
|
75
107
|
def __init__(self, args, keyid, secret):
|
|
76
108
|
super(GeneralCommand, self).__init__(args, keyid, secret, None)
|
|
77
109
|
|
|
110
|
+
@abstractmethod
|
|
111
|
+
def execute(self):
|
|
112
|
+
pass
|
|
113
|
+
|
|
78
114
|
|
|
79
115
|
class ComputingCommand(Command):
|
|
80
116
|
def __init__(self, args, keyid, secret):
|
|
81
|
-
super(ComputingCommand, self).__init__(
|
|
117
|
+
super(ComputingCommand, self).__init__(
|
|
118
|
+
args, keyid, secret, TiktalikAuthConnection
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
@abstractmethod
|
|
122
|
+
def execute(self):
|
|
123
|
+
pass
|
|
82
124
|
|
|
83
125
|
@classmethod
|
|
84
126
|
def get_cmd_group_name(cls):
|
|
@@ -86,23 +128,20 @@ class ComputingCommand(Command):
|
|
|
86
128
|
|
|
87
129
|
|
|
88
130
|
class ComputingImageCommand(ComputingCommand):
|
|
131
|
+
@abstractmethod
|
|
132
|
+
def execute(self):
|
|
133
|
+
pass
|
|
134
|
+
|
|
89
135
|
@classmethod
|
|
90
136
|
def get_cmd_group_name(cls):
|
|
91
137
|
return "Computing image commands"
|
|
92
138
|
|
|
93
139
|
|
|
94
140
|
class ComputingNetworkCommand(ComputingCommand):
|
|
95
|
-
@
|
|
96
|
-
def
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
class LoadBalancerCommand(Command):
|
|
101
|
-
def __init__(self, args, keyid, secret):
|
|
102
|
-
super(LoadBalancerCommand, self).__init__(
|
|
103
|
-
args, keyid, secret, LoadBalancerConnection
|
|
104
|
-
)
|
|
141
|
+
@abstractmethod
|
|
142
|
+
def execute(self):
|
|
143
|
+
pass
|
|
105
144
|
|
|
106
145
|
@classmethod
|
|
107
146
|
def get_cmd_group_name(cls):
|
|
108
|
-
return "
|
|
147
|
+
return "Computing network commands"
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
18
18
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
19
19
|
|
|
20
|
-
from tiktalik
|
|
20
|
+
from tiktalik import TiktalikAPIError
|
|
21
21
|
|
|
22
|
-
from .command import ComputingImageCommand, CommandError
|
|
22
|
+
from .command import ComputingImageCommand, CommandError, Command
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class ListImages(ComputingImageCommand):
|
|
@@ -66,28 +66,6 @@ class RenameImage(ComputingImageCommand):
|
|
|
66
66
|
|
|
67
67
|
print(("Image %s renamed to %s." % (self.args.uuid, self.args.name)))
|
|
68
68
|
|
|
69
|
-
class RenameImage(ComputingImageCommand):
|
|
70
|
-
@classmethod
|
|
71
|
-
def add_parser(cls, parent, subparser):
|
|
72
|
-
p = subparser.add_parser("rename-image", description="Rename an image.", parents=[parent])
|
|
73
|
-
p.add_argument("uuid", help="Image UUID. This image must belong to you.")
|
|
74
|
-
p.add_argument("name", help="New name for the image.")
|
|
75
|
-
|
|
76
|
-
return "rename-image"
|
|
77
|
-
|
|
78
|
-
def execute(self):
|
|
79
|
-
try:
|
|
80
|
-
self.conn.rename_image(self.args.uuid, self.args.name)
|
|
81
|
-
except TiktalikAPIError as ex:
|
|
82
|
-
if ex.http_status == 400:
|
|
83
|
-
raise CommandError("Invalid image name")
|
|
84
|
-
elif ex.http_status == 401:
|
|
85
|
-
raise CommandError("User unauthenticated")
|
|
86
|
-
elif ex.http_status == 404:
|
|
87
|
-
raise CommandError("Image doesn't exist in your account")
|
|
88
|
-
raise
|
|
89
|
-
|
|
90
|
-
print("Image %s renamed to %s." % (self.args.uuid, self.args.name))
|
|
91
69
|
|
|
92
70
|
class DeleteImage(ComputingImageCommand):
|
|
93
71
|
@classmethod
|
|
@@ -105,7 +83,7 @@ class DeleteImage(ComputingImageCommand):
|
|
|
105
83
|
def execute(self):
|
|
106
84
|
confirmed = self.args.force
|
|
107
85
|
if not confirmed:
|
|
108
|
-
confirmed =
|
|
86
|
+
confirmed = Command.yesno(
|
|
109
87
|
"Are you sure you want to delete image %s?" % self.args.uuid
|
|
110
88
|
)
|
|
111
89
|
|
|
@@ -18,10 +18,9 @@
|
|
|
18
18
|
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
19
19
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
20
|
|
|
21
|
-
from tiktalik
|
|
22
|
-
from tiktalik.error import TiktalikAPIError
|
|
21
|
+
from tiktalik import Instance, TiktalikAPIError
|
|
23
22
|
|
|
24
|
-
from .command import ComputingCommand, CommandError
|
|
23
|
+
from .command import ComputingCommand, CommandError, Command
|
|
25
24
|
from . import util
|
|
26
25
|
|
|
27
26
|
|
|
@@ -150,7 +149,7 @@ class CreateInstance(ComputingCommand):
|
|
|
150
149
|
disk_size_gb = self.args.disk_size_gb
|
|
151
150
|
|
|
152
151
|
if not self.args.batch_mode:
|
|
153
|
-
|
|
152
|
+
Command.yesno(
|
|
154
153
|
"Creating new instance with these parameters:\n"
|
|
155
154
|
"Image UUID: %s\nSize: %s\nHostname: %s\nNetworks: %s\n"
|
|
156
155
|
"Is this OK?"
|
|
@@ -162,7 +161,7 @@ class CreateInstance(ComputingCommand):
|
|
|
162
161
|
)
|
|
163
162
|
)
|
|
164
163
|
|
|
165
|
-
|
|
164
|
+
self.conn.create_instance(
|
|
166
165
|
self.args.hostname,
|
|
167
166
|
size,
|
|
168
167
|
self.args.image_uuid,
|
|
@@ -353,7 +352,9 @@ class BackupInstance(InstanceCommand):
|
|
|
353
352
|
)
|
|
354
353
|
InstanceCommand.add_common_arguments(p)
|
|
355
354
|
p.add_argument(
|
|
356
|
-
"--set_name",
|
|
355
|
+
"--set_name",
|
|
356
|
+
type=str,
|
|
357
|
+
help="Set name of your backup",
|
|
357
358
|
)
|
|
358
359
|
return "backup"
|
|
359
360
|
|
|
@@ -26,7 +26,7 @@ import textwrap
|
|
|
26
26
|
import inspect
|
|
27
27
|
import sys
|
|
28
28
|
|
|
29
|
-
from tiktalik
|
|
29
|
+
from tiktalik import TiktalikAPIError
|
|
30
30
|
from . import command, auth
|
|
31
31
|
|
|
32
32
|
|
|
@@ -100,7 +100,3 @@ You can fix this by executing:
|
|
|
100
100
|
print((textwrap.fill("Error: " + str(e), 76)))
|
|
101
101
|
except auth.AuthError as e:
|
|
102
102
|
print((textwrap.fill("Error: " + str(e), 76)))
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if __name__ == "__main__":
|
|
106
|
-
main()
|
tiktalik-cli-1.9.3.2/PKG-INFO
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: tiktalik-cli
|
|
3
|
-
Version: 1.9.3.2
|
|
4
|
-
Summary: Tiktalik Computing command line interface
|
|
5
|
-
Home-page: http://www.tiktalik.com
|
|
6
|
-
Author: Techstorage sp. z o.o.
|
|
7
|
-
Author-email: kontakt@tiktalik.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Download-URL: https://github.com/tiktalik-cloud/tiktalik-cli/archive/v1.9.3.2.tar.gz
|
|
10
|
-
Description: # Tiktalik Command Line Interface
|
|
11
|
-
|
|
12
|
-
This is a command line interface utility implemented in Python, which enables the
|
|
13
|
-
user to perform core operations on the [Tiktalik Cloud Computing](http://www.tiktalik.com) service.
|
|
14
|
-
|
|
15
|
-
## Requirements
|
|
16
|
-
|
|
17
|
-
* [tiktalik-python](https://github.com/tiktalik-cloud/tiktalik-python)
|
|
18
|
-
* Python >=3.5
|
|
19
|
-
|
|
20
|
-
Note that package dependencies are automatically installed by pip.
|
|
21
|
-
|
|
22
|
-
## Installation
|
|
23
|
-
|
|
24
|
-
Install using pip:
|
|
25
|
-
|
|
26
|
-
`$ pip install tiktalik-cli`
|
|
27
|
-
|
|
28
|
-
## Authentication
|
|
29
|
-
|
|
30
|
-
To use the CLI you need an API key. You can generate one in your
|
|
31
|
-
[admin panel](https://tiktalik.com/panel/#apikeys). The API authentication
|
|
32
|
-
information consists of an *API key* and an *API secret*. You can save this
|
|
33
|
-
information locally by executing:
|
|
34
|
-
|
|
35
|
-
`$ tiktalik init-auth API-KEY API-SECRET`
|
|
36
|
-
|
|
37
|
-
This saves the key and secret to `~/.tiktalik/auth`
|
|
38
|
-
|
|
39
|
-
Alternatively, if you don't want to save your API key, you can use the `--key`
|
|
40
|
-
and `--secret` switches on the commandline.
|
|
41
|
-
|
|
42
|
-
## Usage
|
|
43
|
-
|
|
44
|
-
The basic usage patterns is:
|
|
45
|
-
|
|
46
|
-
`$ tiktalik COMMAND`
|
|
47
|
-
|
|
48
|
-
You can get a list of commands by running `tiktalik` without arguments.
|
|
49
|
-
To get a help on a specific command, run:
|
|
50
|
-
|
|
51
|
-
`$ tiktalik COMMAND --help`
|
|
52
|
-
|
|
53
|
-
We also have [a tutorial](http://articles.tiktalik.com/content/help/using-tiktalik-command-line-utility/) to quickly get
|
|
54
|
-
you started.
|
|
55
|
-
Keywords: Tiktalik,CLI,Terminal,VPS
|
|
56
|
-
Platform: UNKNOWN
|
|
57
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
58
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
59
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
60
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
61
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
62
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
63
|
-
Classifier: Development Status :: 6 - Mature
|
|
64
|
-
Classifier: Environment :: Console
|
|
65
|
-
Classifier: Intended Audience :: Developers
|
|
66
|
-
Classifier: Intended Audience :: System Administrators
|
|
67
|
-
Classifier: Intended Audience :: Information Technology
|
|
68
|
-
Classifier: Intended Audience :: End Users/Desktop
|
|
69
|
-
Classifier: Natural Language :: English
|
|
70
|
-
Classifier: Operating System :: POSIX
|
|
71
|
-
Classifier: Operating System :: Microsoft :: Windows
|
|
72
|
-
Classifier: Topic :: Internet
|
|
73
|
-
Classifier: Topic :: Utilities
|
|
74
|
-
Classifier: Topic :: System :: Systems Administration
|
|
75
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
76
|
-
Requires-Python: >=3.5
|
|
77
|
-
Description-Content-Type: text/markdown
|
tiktalik-cli-1.9.3.2/setup.cfg
DELETED
tiktalik-cli-1.9.3.2/setup.py
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"""Tiktalik Command Line Interface"""
|
|
2
|
-
import sys
|
|
3
|
-
import setuptools
|
|
4
|
-
|
|
5
|
-
try:
|
|
6
|
-
import tiktalik_cli
|
|
7
|
-
except ImportError:
|
|
8
|
-
print("error: tiktalik-cli requires Python 3.5 or greater.")
|
|
9
|
-
sys.exit(1)
|
|
10
|
-
|
|
11
|
-
LONG_DESC = open('README.md').read()
|
|
12
|
-
DOWNLOAD = "https://github.com/tiktalik-cloud/tiktalik-cli/archive/v1.9.3.2.tar.gz"
|
|
13
|
-
|
|
14
|
-
setuptools.setup(
|
|
15
|
-
name="tiktalik-cli",
|
|
16
|
-
version="1.9.3.2",
|
|
17
|
-
python_requires=">=3.5",
|
|
18
|
-
license="MIT",
|
|
19
|
-
description="Tiktalik Computing command line interface",
|
|
20
|
-
long_description_content_type="text/markdown",
|
|
21
|
-
long_description=LONG_DESC,
|
|
22
|
-
author="Techstorage sp. z o.o.",
|
|
23
|
-
author_email="kontakt@tiktalik.com",
|
|
24
|
-
url="http://www.tiktalik.com",
|
|
25
|
-
download_url=DOWNLOAD,
|
|
26
|
-
keywords=["Tiktalik", "CLI", "Terminal", "VPS"],
|
|
27
|
-
classifiers=[
|
|
28
|
-
"Programming Language :: Python :: 3 :: Only",
|
|
29
|
-
"Programming Language :: Python :: 3.5",
|
|
30
|
-
"Programming Language :: Python :: 3.6",
|
|
31
|
-
"Programming Language :: Python :: 3.7",
|
|
32
|
-
"Programming Language :: Python :: 3.8",
|
|
33
|
-
"Programming Language :: Python :: 3.9",
|
|
34
|
-
"Development Status :: 6 - Mature",
|
|
35
|
-
"Environment :: Console",
|
|
36
|
-
"Intended Audience :: Developers",
|
|
37
|
-
"Intended Audience :: System Administrators",
|
|
38
|
-
"Intended Audience :: Information Technology",
|
|
39
|
-
"Intended Audience :: End Users/Desktop",
|
|
40
|
-
"Natural Language :: English",
|
|
41
|
-
"Operating System :: POSIX",
|
|
42
|
-
"Operating System :: Microsoft :: Windows",
|
|
43
|
-
"Topic :: Internet",
|
|
44
|
-
"Topic :: Utilities",
|
|
45
|
-
"Topic :: System :: Systems Administration",
|
|
46
|
-
"License :: OSI Approved :: MIT License",
|
|
47
|
-
],
|
|
48
|
-
packages=["tiktalik_cli", "tiktalik_cli.command"],
|
|
49
|
-
entry_points={"console_scripts": ["tiktalik = tiktalik_cli.main:main"]},
|
|
50
|
-
install_requires=["tiktalik>=1.6.3.1.1"],
|
|
51
|
-
)
|
|
@@ -1,407 +0,0 @@
|
|
|
1
|
-
"""Module tiktalik_cli.command.loadbalancer"""
|
|
2
|
-
# Copyright (c) 2013 Techstorage sp. z o.o.
|
|
3
|
-
#
|
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
-
# this software and associated documentation files (the "Software"), to deal in
|
|
6
|
-
# the Software without restriction, including without limitation the rights to
|
|
7
|
-
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
8
|
-
# the Software, and to permit persons to whom the Software is furnished to do so,
|
|
9
|
-
# subject to the following conditions:
|
|
10
|
-
#
|
|
11
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
12
|
-
# copies or substantial portions of the Software.
|
|
13
|
-
#
|
|
14
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
16
|
-
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
17
|
-
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
18
|
-
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
19
|
-
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
20
|
-
|
|
21
|
-
import sys
|
|
22
|
-
|
|
23
|
-
from tiktalik.loadbalancer import *
|
|
24
|
-
from tiktalik.error import TiktalikAPIError
|
|
25
|
-
|
|
26
|
-
from .command import LoadBalancerCommand, CommandError
|
|
27
|
-
from . import util
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def validate_backend(ip, port, weight):
|
|
31
|
-
import socket
|
|
32
|
-
|
|
33
|
-
if port is not None:
|
|
34
|
-
port = int(port)
|
|
35
|
-
if port <= 0 or port >= 65536:
|
|
36
|
-
raise ValueError("Port number must be between 1-65535")
|
|
37
|
-
|
|
38
|
-
if weight is not None:
|
|
39
|
-
if int(weight) < 0:
|
|
40
|
-
raise ValueError("Weight must be positive or zero to suspend.")
|
|
41
|
-
|
|
42
|
-
if ip is not None:
|
|
43
|
-
socket.inet_aton(ip)
|
|
44
|
-
if ip.count(".") != 3:
|
|
45
|
-
raise ValueError("Invalid IPv4 address")
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
class ListLoadBalancers(LoadBalancerCommand):
|
|
49
|
-
@classmethod
|
|
50
|
-
def add_parser(cls, parser, subparser):
|
|
51
|
-
p = subparser.add_parser(
|
|
52
|
-
"list-load-balancers", description="List Load Balancers", parents=[parser]
|
|
53
|
-
)
|
|
54
|
-
p.add_argument("-v", action="store_true", dest="verbose", help="Verbose output")
|
|
55
|
-
|
|
56
|
-
return "list-load-balancers"
|
|
57
|
-
|
|
58
|
-
def execute(self):
|
|
59
|
-
balancers = LoadBalancer.list_all(self.conn, history=self.args.verbose)
|
|
60
|
-
if not self.args.verbose:
|
|
61
|
-
self._print_short(balancers)
|
|
62
|
-
else:
|
|
63
|
-
list(map(util.print_load_balancer, balancers))
|
|
64
|
-
|
|
65
|
-
def _print_short(self, balancers):
|
|
66
|
-
for b in balancers:
|
|
67
|
-
print(
|
|
68
|
-
(
|
|
69
|
-
"%s %s (%s) %s at %s:%d, backends: %s"
|
|
70
|
-
% (
|
|
71
|
-
b.name,
|
|
72
|
-
b.uuid,
|
|
73
|
-
b.status,
|
|
74
|
-
b.type,
|
|
75
|
-
"..." + b.address[b.address.rfind("-") :],
|
|
76
|
-
b.port,
|
|
77
|
-
", ".join(
|
|
78
|
-
"%s:%i (w=%i)" % (i.ip, i.port, i.weight)
|
|
79
|
-
for i in b.backends
|
|
80
|
-
)
|
|
81
|
-
if b.backends
|
|
82
|
-
else "none",
|
|
83
|
-
)
|
|
84
|
-
)
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
class CreateLoadBalancer(LoadBalancerCommand):
|
|
89
|
-
@classmethod
|
|
90
|
-
def add_parser(cls, parser, subparser):
|
|
91
|
-
p = subparser.add_parser(
|
|
92
|
-
"create-load-balancer",
|
|
93
|
-
description="Create a new Load Balancer",
|
|
94
|
-
parents=[parser],
|
|
95
|
-
)
|
|
96
|
-
p.add_argument("name", help="Name assigned to this Load Balancer.")
|
|
97
|
-
p.add_argument(
|
|
98
|
-
"proto", help='Type of Load Balancer, one of "TCP", "HTTP" or "HTTPS".'
|
|
99
|
-
)
|
|
100
|
-
p.add_argument(
|
|
101
|
-
"-a",
|
|
102
|
-
dest="address",
|
|
103
|
-
metavar="ADDRESS",
|
|
104
|
-
action="store",
|
|
105
|
-
default=None,
|
|
106
|
-
help="Optional entry point to use, if not set then new entry point will be created.",
|
|
107
|
-
)
|
|
108
|
-
p.add_argument(
|
|
109
|
-
"-p",
|
|
110
|
-
dest="port",
|
|
111
|
-
metavar="PORT",
|
|
112
|
-
action="store",
|
|
113
|
-
type=int,
|
|
114
|
-
default=None,
|
|
115
|
-
help="Listen port, only for TCP proto balancing.",
|
|
116
|
-
)
|
|
117
|
-
p.add_argument(
|
|
118
|
-
"-b",
|
|
119
|
-
dest="backends",
|
|
120
|
-
metavar="BACKEND",
|
|
121
|
-
action="append",
|
|
122
|
-
default=[],
|
|
123
|
-
help="Add backends to the Load Balancer configuration. Pass backends using this format: IP:PORT:WEIGHT",
|
|
124
|
-
)
|
|
125
|
-
p.add_argument(
|
|
126
|
-
"-d",
|
|
127
|
-
dest="domains",
|
|
128
|
-
metavar="DOMAIN",
|
|
129
|
-
action="append",
|
|
130
|
-
default=[],
|
|
131
|
-
help="Add domains to the HTTP proto Load Balancer.",
|
|
132
|
-
)
|
|
133
|
-
|
|
134
|
-
return "create-load-balancer"
|
|
135
|
-
|
|
136
|
-
def execute(self):
|
|
137
|
-
name = self.args.name
|
|
138
|
-
backends = []
|
|
139
|
-
|
|
140
|
-
# Roughly validate input
|
|
141
|
-
for b in self.args.backends:
|
|
142
|
-
try:
|
|
143
|
-
ip, port, weight = b.split(":")
|
|
144
|
-
except:
|
|
145
|
-
raise CommandError(
|
|
146
|
-
"Invalid backend specified. Please use the IP:PORT:WEIGHT format"
|
|
147
|
-
)
|
|
148
|
-
try:
|
|
149
|
-
validate_backend(ip, port, weight)
|
|
150
|
-
backends.append((ip, int(port), int(weight)))
|
|
151
|
-
except ValueError as e:
|
|
152
|
-
raise CommandError(
|
|
153
|
-
"Invalid backend specified."
|
|
154
|
-
+ {"": ""}.get(e.message, " " + e.message)
|
|
155
|
-
)
|
|
156
|
-
if not backends:
|
|
157
|
-
raise CommandError("Need at least one backend specified")
|
|
158
|
-
if self.args.proto not in ["TCP", "HTTP", "HTTPS"]:
|
|
159
|
-
raise CommandError("Invalid balancer type")
|
|
160
|
-
|
|
161
|
-
# still developing
|
|
162
|
-
if self.args.proto == "HTTPS":
|
|
163
|
-
raise CommandError("HTTPS Balancer not supported yet")
|
|
164
|
-
|
|
165
|
-
kwargs = {"backends": backends}
|
|
166
|
-
if self.args.address:
|
|
167
|
-
kwargs["address"] = self.args.address
|
|
168
|
-
if self.args.port:
|
|
169
|
-
kwargs["port"] = self.args.port
|
|
170
|
-
if self.args.domains:
|
|
171
|
-
kwargs["domains"] = [
|
|
172
|
-
d.decode(sys.stdin.encoding) for d in self.args.domains
|
|
173
|
-
]
|
|
174
|
-
|
|
175
|
-
balancer = LoadBalancer.create(self.conn, name, self.args.proto, **kwargs)
|
|
176
|
-
util.print_load_balancer(balancer)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
class LoadBalancerCommand(LoadBalancerCommand):
|
|
180
|
-
@classmethod
|
|
181
|
-
def add_common_arguments(cls, parser):
|
|
182
|
-
parser.add_argument("name", help="Load Balancer name.")
|
|
183
|
-
|
|
184
|
-
def _wb_by_name(self, name, history=False):
|
|
185
|
-
L = [
|
|
186
|
-
x
|
|
187
|
-
for x in LoadBalancer.list_all(self.conn, history=history)
|
|
188
|
-
if x.name == name
|
|
189
|
-
]
|
|
190
|
-
if len(L) == 1:
|
|
191
|
-
return L[0]
|
|
192
|
-
elif len(L) == 0:
|
|
193
|
-
raise CommandError("Load Balancer %s not found" % name)
|
|
194
|
-
else:
|
|
195
|
-
raise CommandError("More than one balancer named '%s' found, what do?!")
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
class ViewLoadBalancer(LoadBalancerCommand):
|
|
199
|
-
@classmethod
|
|
200
|
-
def add_parser(cls, parser, subparser):
|
|
201
|
-
p = subparser.add_parser(
|
|
202
|
-
"view-load-balancer",
|
|
203
|
-
description="View Load Balancer information",
|
|
204
|
-
parents=[parser],
|
|
205
|
-
)
|
|
206
|
-
LoadBalancerCommand.add_common_arguments(p)
|
|
207
|
-
return "view-load-balancer"
|
|
208
|
-
|
|
209
|
-
def execute(self):
|
|
210
|
-
balancer = self._wb_by_name(self.args.name, history=True)
|
|
211
|
-
util.print_load_balancer(balancer)
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
class RemoveLoadBalancer(LoadBalancerCommand):
|
|
215
|
-
@classmethod
|
|
216
|
-
def add_parser(cls, parser, subparser):
|
|
217
|
-
p = subparser.add_parser(
|
|
218
|
-
"rm-load-balancer", description="Remove a Load Balancer", parents=[parser]
|
|
219
|
-
)
|
|
220
|
-
LoadBalancerCommand.add_common_arguments(p)
|
|
221
|
-
return "rm-load-balancer"
|
|
222
|
-
|
|
223
|
-
def execute(self):
|
|
224
|
-
balancer = self._wb_by_name(self.args.name)
|
|
225
|
-
balancer.delete()
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
class DisableLoadBalancer(LoadBalancerCommand):
|
|
229
|
-
@classmethod
|
|
230
|
-
def add_parser(cls, parser, subparser):
|
|
231
|
-
p = subparser.add_parser(
|
|
232
|
-
"disable-load-balancer",
|
|
233
|
-
description="Temporarily disable a Load Balancer",
|
|
234
|
-
parents=[parser],
|
|
235
|
-
)
|
|
236
|
-
LoadBalancerCommand.add_common_arguments(p)
|
|
237
|
-
|
|
238
|
-
return "disable-load-balancer"
|
|
239
|
-
|
|
240
|
-
def execute(self):
|
|
241
|
-
self._wb_by_name(self.args.name).disable()
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
class EnableLoadBalancer(LoadBalancerCommand):
|
|
245
|
-
@classmethod
|
|
246
|
-
def add_parser(cls, parser, subparser):
|
|
247
|
-
p = subparser.add_parser(
|
|
248
|
-
"enable-load-balancer",
|
|
249
|
-
description="Enable a Load Balancer",
|
|
250
|
-
parents=[parser],
|
|
251
|
-
)
|
|
252
|
-
LoadBalancerCommand.add_common_arguments(p)
|
|
253
|
-
|
|
254
|
-
return "enable-load-balancer"
|
|
255
|
-
|
|
256
|
-
def execute(self):
|
|
257
|
-
self._wb_by_name(self.args.name).enable()
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
class RenameLoadBalancer(LoadBalancerCommand):
|
|
261
|
-
@classmethod
|
|
262
|
-
def add_parser(cls, parser, subparser):
|
|
263
|
-
p = subparser.add_parser(
|
|
264
|
-
"rename-load-balancer",
|
|
265
|
-
description="Enable a Load Balancer",
|
|
266
|
-
parents=[parser],
|
|
267
|
-
)
|
|
268
|
-
LoadBalancerCommand.add_common_arguments(p)
|
|
269
|
-
p.add_argument("new_name", help="New name")
|
|
270
|
-
|
|
271
|
-
return "rename-load-balancer"
|
|
272
|
-
|
|
273
|
-
def execute(self):
|
|
274
|
-
self._wb_by_name(self.args.name).rename(self.args.new_name)
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
class RemoveLoadBalancerDomain(LoadBalancerCommand):
|
|
278
|
-
@classmethod
|
|
279
|
-
def add_parser(cls, parser, subparser):
|
|
280
|
-
p = subparser.add_parser(
|
|
281
|
-
"rm-load-balancer-domain",
|
|
282
|
-
description="Remove a domain from a HTTP Balancer's domain list",
|
|
283
|
-
parents=[parser],
|
|
284
|
-
)
|
|
285
|
-
LoadBalancerCommand.add_common_arguments(p)
|
|
286
|
-
p.add_argument("domain", help="Domain to remove")
|
|
287
|
-
|
|
288
|
-
return "rm-load-balancer-domain"
|
|
289
|
-
|
|
290
|
-
def execute(self):
|
|
291
|
-
balancer = self._wb_by_name(self.args.name)
|
|
292
|
-
domain = self.args.domain
|
|
293
|
-
balancer.remove_domain(domain)
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
class AddLoadBalancerDomain(LoadBalancerCommand):
|
|
297
|
-
@classmethod
|
|
298
|
-
def add_parser(cls, parser, subparser):
|
|
299
|
-
p = subparser.add_parser(
|
|
300
|
-
"add-load-balancer-domain",
|
|
301
|
-
description="Add a domain to a HTTP Balancer's domain list",
|
|
302
|
-
parents=[parser],
|
|
303
|
-
)
|
|
304
|
-
LoadBalancerCommand.add_common_arguments(p)
|
|
305
|
-
p.add_argument("domain", help="Domain to add")
|
|
306
|
-
|
|
307
|
-
return "add-load-balancer-domain"
|
|
308
|
-
|
|
309
|
-
def execute(self):
|
|
310
|
-
balancer = self._wb_by_name(self.args.name)
|
|
311
|
-
domain = self.args.domain
|
|
312
|
-
if domain in balancer.domains:
|
|
313
|
-
raise CommandError("Domain '%s' already exists" % self.args.domain)
|
|
314
|
-
|
|
315
|
-
balancer.add_domain(self.args.domain)
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
class AddLoadBalancerBackend(LoadBalancerCommand):
|
|
319
|
-
@classmethod
|
|
320
|
-
def add_parser(cls, parser, subparser):
|
|
321
|
-
p = subparser.add_parser(
|
|
322
|
-
"add-load-balancer-backend",
|
|
323
|
-
description="Add a backend to a Load Balancer's backend list",
|
|
324
|
-
parents=[parser],
|
|
325
|
-
)
|
|
326
|
-
LoadBalancerCommand.add_common_arguments(p)
|
|
327
|
-
|
|
328
|
-
p.add_argument("ip", help="Backend IP address")
|
|
329
|
-
p.add_argument("port", type=int, help="Backend port")
|
|
330
|
-
p.add_argument("weight", type=int, default=10, help="Backend's weight value")
|
|
331
|
-
|
|
332
|
-
return "add-load-balancer-backend"
|
|
333
|
-
|
|
334
|
-
def execute(self):
|
|
335
|
-
try:
|
|
336
|
-
validate_backend(self.args.ip, self.args.port, self.args.weight)
|
|
337
|
-
except ValueError as e:
|
|
338
|
-
raise CommandError(
|
|
339
|
-
"Invalid backend specified." + {"": ""}.get(e.message, " " + e.message)
|
|
340
|
-
)
|
|
341
|
-
|
|
342
|
-
balancer = self._wb_by_name(self.args.name)
|
|
343
|
-
balancer.add_backend(self.args.ip, self.args.port, self.args.weight)
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
class RemoveLoadBalancerBackend(LoadBalancerCommand):
|
|
347
|
-
@classmethod
|
|
348
|
-
def add_parser(cls, parser, subparser):
|
|
349
|
-
p = subparser.add_parser(
|
|
350
|
-
"rm-load-balancer-backend",
|
|
351
|
-
description="Remove a backend from a Load Balancer's backend list",
|
|
352
|
-
parents=[parser],
|
|
353
|
-
)
|
|
354
|
-
LoadBalancerCommand.add_common_arguments(p)
|
|
355
|
-
p.add_argument("uuid", help="Backend UUID")
|
|
356
|
-
|
|
357
|
-
return "rm-load-balancer-backend"
|
|
358
|
-
|
|
359
|
-
def execute(self):
|
|
360
|
-
balancer = self._wb_by_name(self.args.name)
|
|
361
|
-
if not [b for b in balancer.backends if b.uuid == self.args.uuid]:
|
|
362
|
-
raise CommandError("No such backend")
|
|
363
|
-
balancer.remove_backend(self.args.uuid)
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
class ModifyLoadBalancerBackend(LoadBalancerCommand):
|
|
367
|
-
@classmethod
|
|
368
|
-
def add_parser(cls, parser, subparser):
|
|
369
|
-
p = subparser.add_parser(
|
|
370
|
-
"modify-load-balancer-backend",
|
|
371
|
-
description="Modify a Load Balancer's backend",
|
|
372
|
-
parents=[parser],
|
|
373
|
-
)
|
|
374
|
-
LoadBalancerCommand.add_common_arguments(p)
|
|
375
|
-
p.add_argument("uuid", help="Backend UUID")
|
|
376
|
-
p.add_argument("-i", dest="ip", help="Change the IP address")
|
|
377
|
-
p.add_argument("-p", dest="port", type=int, help="Change the port")
|
|
378
|
-
p.add_argument("-w", dest="weight", type=int, help="Change the weight value")
|
|
379
|
-
|
|
380
|
-
return "modify-load-balancer-backend"
|
|
381
|
-
|
|
382
|
-
def execute(self):
|
|
383
|
-
if not self.args.ip and not self.args.port and self.args.weight == None:
|
|
384
|
-
raise CommandError(
|
|
385
|
-
"Nothing to do. Please supply parameters that you want to modify."
|
|
386
|
-
)
|
|
387
|
-
|
|
388
|
-
balancer = self._wb_by_name(self.args.name)
|
|
389
|
-
for backend in balancer.backends:
|
|
390
|
-
if backend.uuid == self.args.uuid:
|
|
391
|
-
break
|
|
392
|
-
else:
|
|
393
|
-
raise CommandError("No such backend")
|
|
394
|
-
|
|
395
|
-
try:
|
|
396
|
-
validate_backend(self.args.ip, self.args.port, self.args.weight)
|
|
397
|
-
except ValueError as e:
|
|
398
|
-
raise CommandError(
|
|
399
|
-
"Invalid parameters" + {"": ""}.get(e.message, ". " + e.message)
|
|
400
|
-
)
|
|
401
|
-
|
|
402
|
-
balancer.modify_backend(
|
|
403
|
-
self.args.uuid,
|
|
404
|
-
ip=self.args.ip,
|
|
405
|
-
port=self.args.port,
|
|
406
|
-
weight=self.args.weight,
|
|
407
|
-
)
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: tiktalik-cli
|
|
3
|
-
Version: 1.9.3.2
|
|
4
|
-
Summary: Tiktalik Computing command line interface
|
|
5
|
-
Home-page: http://www.tiktalik.com
|
|
6
|
-
Author: Techstorage sp. z o.o.
|
|
7
|
-
Author-email: kontakt@tiktalik.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Download-URL: https://github.com/tiktalik-cloud/tiktalik-cli/archive/v1.9.3.2.tar.gz
|
|
10
|
-
Description: # Tiktalik Command Line Interface
|
|
11
|
-
|
|
12
|
-
This is a command line interface utility implemented in Python, which enables the
|
|
13
|
-
user to perform core operations on the [Tiktalik Cloud Computing](http://www.tiktalik.com) service.
|
|
14
|
-
|
|
15
|
-
## Requirements
|
|
16
|
-
|
|
17
|
-
* [tiktalik-python](https://github.com/tiktalik-cloud/tiktalik-python)
|
|
18
|
-
* Python >=3.5
|
|
19
|
-
|
|
20
|
-
Note that package dependencies are automatically installed by pip.
|
|
21
|
-
|
|
22
|
-
## Installation
|
|
23
|
-
|
|
24
|
-
Install using pip:
|
|
25
|
-
|
|
26
|
-
`$ pip install tiktalik-cli`
|
|
27
|
-
|
|
28
|
-
## Authentication
|
|
29
|
-
|
|
30
|
-
To use the CLI you need an API key. You can generate one in your
|
|
31
|
-
[admin panel](https://tiktalik.com/panel/#apikeys). The API authentication
|
|
32
|
-
information consists of an *API key* and an *API secret*. You can save this
|
|
33
|
-
information locally by executing:
|
|
34
|
-
|
|
35
|
-
`$ tiktalik init-auth API-KEY API-SECRET`
|
|
36
|
-
|
|
37
|
-
This saves the key and secret to `~/.tiktalik/auth`
|
|
38
|
-
|
|
39
|
-
Alternatively, if you don't want to save your API key, you can use the `--key`
|
|
40
|
-
and `--secret` switches on the commandline.
|
|
41
|
-
|
|
42
|
-
## Usage
|
|
43
|
-
|
|
44
|
-
The basic usage patterns is:
|
|
45
|
-
|
|
46
|
-
`$ tiktalik COMMAND`
|
|
47
|
-
|
|
48
|
-
You can get a list of commands by running `tiktalik` without arguments.
|
|
49
|
-
To get a help on a specific command, run:
|
|
50
|
-
|
|
51
|
-
`$ tiktalik COMMAND --help`
|
|
52
|
-
|
|
53
|
-
We also have [a tutorial](http://articles.tiktalik.com/content/help/using-tiktalik-command-line-utility/) to quickly get
|
|
54
|
-
you started.
|
|
55
|
-
Keywords: Tiktalik,CLI,Terminal,VPS
|
|
56
|
-
Platform: UNKNOWN
|
|
57
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
58
|
-
Classifier: Programming Language :: Python :: 3.5
|
|
59
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
60
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
61
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
62
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
63
|
-
Classifier: Development Status :: 6 - Mature
|
|
64
|
-
Classifier: Environment :: Console
|
|
65
|
-
Classifier: Intended Audience :: Developers
|
|
66
|
-
Classifier: Intended Audience :: System Administrators
|
|
67
|
-
Classifier: Intended Audience :: Information Technology
|
|
68
|
-
Classifier: Intended Audience :: End Users/Desktop
|
|
69
|
-
Classifier: Natural Language :: English
|
|
70
|
-
Classifier: Operating System :: POSIX
|
|
71
|
-
Classifier: Operating System :: Microsoft :: Windows
|
|
72
|
-
Classifier: Topic :: Internet
|
|
73
|
-
Classifier: Topic :: Utilities
|
|
74
|
-
Classifier: Topic :: System :: Systems Administration
|
|
75
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
76
|
-
Requires-Python: >=3.5
|
|
77
|
-
Description-Content-Type: text/markdown
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
README.md
|
|
2
|
-
setup.cfg
|
|
3
|
-
setup.py
|
|
4
|
-
tiktalik_cli/__init__.py
|
|
5
|
-
tiktalik_cli/auth.py
|
|
6
|
-
tiktalik_cli/main.py
|
|
7
|
-
tiktalik_cli.egg-info/PKG-INFO
|
|
8
|
-
tiktalik_cli.egg-info/SOURCES.txt
|
|
9
|
-
tiktalik_cli.egg-info/dependency_links.txt
|
|
10
|
-
tiktalik_cli.egg-info/entry_points.txt
|
|
11
|
-
tiktalik_cli.egg-info/requires.txt
|
|
12
|
-
tiktalik_cli.egg-info/top_level.txt
|
|
13
|
-
tiktalik_cli/command/__init__.py
|
|
14
|
-
tiktalik_cli/command/auth.py
|
|
15
|
-
tiktalik_cli/command/command.py
|
|
16
|
-
tiktalik_cli/command/image.py
|
|
17
|
-
tiktalik_cli/command/instance.py
|
|
18
|
-
tiktalik_cli/command/loadbalancer.py
|
|
19
|
-
tiktalik_cli/command/network.py
|
|
20
|
-
tiktalik_cli/command/util.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
tiktalik>=1.6.3.1.1
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
tiktalik_cli
|
|
File without changes
|
|
File without changes
|