cgcsdk 1.0.9__py3-none-any.whl → 1.0.10__py3-none-any.whl
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.
- cgc/.env +1 -1
- cgc/CHANGELOG.md +11 -1
- cgc/cgc.py +3 -1
- cgc/commands/compute/compute_cmd.py +1 -1
- cgc/commands/compute/compute_responses.py +1 -1
- cgc/commands/db/db_cmd.py +1 -1
- cgc/commands/jobs/job_utils.py +1 -1
- cgc/commands/resource/resource_cmd.py +1 -1
- cgc/commands/user/__init__.py +14 -0
- cgc/commands/{keys → user}/keys_cmd.py +9 -6
- cgc/commands/{keys → user}/keys_responses.py +8 -11
- cgc/commands/{keys → user}/keys_utils.py +1 -1
- cgc/commands/user/secret_cmd.py +154 -0
- cgc/commands/user/secret_responses.py +44 -0
- cgc/commands/user/secret_utils.py +60 -0
- cgc/sdk/resource.py +6 -6
- cgc/tests/responses_tests.py +1 -1
- cgc/utils/requests_helper.py +2 -0
- cgcsdk-1.0.10.dist-info/LICENSE +0 -0
- {cgcsdk-1.0.9.dist-info → cgcsdk-1.0.10.dist-info}/METADATA +1 -1
- {cgcsdk-1.0.9.dist-info → cgcsdk-1.0.10.dist-info}/RECORD +27 -23
- cgc/commands/keys/__init__.py +0 -5
- /cgc/commands/compute/{compute_utills.py → compute_utils.py} +0 -0
- /cgc/commands/{keys → user}/keys_models.py +0 -0
- /cgcsdk-1.0.9.dist-info/LICENSE → /cgc/commands/user/secret_models.py +0 -0
- {cgcsdk-1.0.9.dist-info → cgcsdk-1.0.10.dist-info}/WHEEL +0 -0
- {cgcsdk-1.0.9.dist-info → cgcsdk-1.0.10.dist-info}/entry_points.txt +0 -0
- {cgcsdk-1.0.9.dist-info → cgcsdk-1.0.10.dist-info}/top_level.txt +0 -0
cgc/.env
CHANGED
cgc/CHANGELOG.md
CHANGED
@@ -1,10 +1,20 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 1.0.10
|
4
|
+
|
5
|
+
Release on April 24, 2024
|
6
|
+
|
7
|
+
* added new command group: cgc secrets
|
8
|
+
* add - add new secret
|
9
|
+
* list - list all secrets in the namespace
|
10
|
+
* delete - delete secret (requires to be owner of the secret)
|
11
|
+
* update - update secret (requires to be owner of the secret)
|
12
|
+
|
3
13
|
## 1.0.9
|
4
14
|
|
5
15
|
Release on April 23, 2024
|
6
16
|
|
7
|
-
* updated cgc to work with cgc-server 1.
|
17
|
+
* updated cgc to work with cgc-server 1.0.10
|
8
18
|
* updated registration process
|
9
19
|
* updated available apps, so it reflects changes in cgc-server
|
10
20
|
* hotfix: listening jobs, which are not Running
|
cgc/cgc.py
CHANGED
@@ -19,7 +19,8 @@ from cgc.commands.cgc_cmd import (
|
|
19
19
|
resource_events,
|
20
20
|
context_group,
|
21
21
|
)
|
22
|
-
from cgc.commands.
|
22
|
+
from cgc.commands.user.keys_cmd import keys_group
|
23
|
+
from cgc.commands.user.secret_cmd import secret_group
|
23
24
|
|
24
25
|
from cgc.utils.version_control import check_version, _get_version
|
25
26
|
from cgc.utils.click_group import CustomGroup
|
@@ -48,6 +49,7 @@ cli.add_command(sending_telemetry_permission)
|
|
48
49
|
cli.add_command(cgc_logs)
|
49
50
|
cli.add_command(job_group)
|
50
51
|
cli.add_command(keys_group)
|
52
|
+
cli.add_command(secret_group)
|
51
53
|
|
52
54
|
if __name__ == "__main__" or __name__ == "cgc.cgc":
|
53
55
|
cli()
|
@@ -10,7 +10,7 @@ from cgc.commands.compute.compute_responses import (
|
|
10
10
|
compute_list_response,
|
11
11
|
get_compute_port_list,
|
12
12
|
)
|
13
|
-
from cgc.commands.compute.
|
13
|
+
from cgc.commands.compute.compute_utils import (
|
14
14
|
compute_create_payload,
|
15
15
|
port_delete_payload,
|
16
16
|
port_modification_payload,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from cgc.telemetry.basic import change_gauge
|
2
2
|
from cgc.telemetry.basic import setup_gauge
|
3
|
-
from cgc.commands.compute.
|
3
|
+
from cgc.commands.compute.compute_utils import get_app_list, get_app_mounts
|
4
4
|
from cgc.utils.config_utils import get_namespace
|
5
5
|
from cgc.utils.message_utils import key_error_decorator_for_helpers
|
6
6
|
from cgc.commands.compute import NoAppsToList
|
cgc/commands/db/db_cmd.py
CHANGED
@@ -4,7 +4,7 @@ import click
|
|
4
4
|
from cgc.commands.compute.compute_responses import compute_list_response
|
5
5
|
from cgc.commands.db.db_models import DatabasesList
|
6
6
|
from cgc.commands.compute.compute_responses import compute_create_response
|
7
|
-
from cgc.commands.compute.
|
7
|
+
from cgc.commands.compute.compute_utils import compute_create_payload
|
8
8
|
from cgc.commands.exceptions import DatabaseCreationException
|
9
9
|
from cgc.commands.resource.resource_cmd import resource_delete
|
10
10
|
from cgc.utils.prepare_headers import get_api_url_and_prepare_headers
|
cgc/commands/jobs/job_utils.py
CHANGED
@@ -10,7 +10,7 @@ from cgc.commands.compute.compute_responses import (
|
|
10
10
|
compute_delete_response,
|
11
11
|
)
|
12
12
|
|
13
|
-
from cgc.commands.compute.
|
13
|
+
from cgc.commands.compute.compute_utils import compute_delete_payload
|
14
14
|
from cgc.commands.resource.resource_responses import get_ingress_list_from_response
|
15
15
|
|
16
16
|
from cgc.utils.prepare_headers import get_api_url_and_prepare_headers
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from cgc.commands.exceptions import ResponseException
|
2
|
+
|
3
|
+
|
4
|
+
class KeysCommandException(ResponseException):
|
5
|
+
"""Base exception for all key commands."""
|
6
|
+
|
7
|
+
|
8
|
+
class SecretsCommandException(ResponseException):
|
9
|
+
"""Base exception for all secret commands."""
|
10
|
+
|
11
|
+
|
12
|
+
class NoSecretsToList(SecretsCommandException):
|
13
|
+
def __init__(self) -> None:
|
14
|
+
super().__init__("No secrets to list.")
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import json
|
2
2
|
import click
|
3
3
|
from typing import Optional
|
4
|
-
from cgc.commands.
|
4
|
+
from cgc.commands.user.keys_responses import (
|
5
5
|
create_ssh_key_response,
|
6
6
|
delete_ssh_key_response,
|
7
7
|
list_ssh_keys_response,
|
8
8
|
update_ssh_key_response,
|
9
9
|
)
|
10
|
-
from cgc.commands.
|
11
|
-
from cgc.commands.
|
10
|
+
from cgc.commands.user.keys_utils import create_ssh_key_payload, update_ssh_key_payload
|
11
|
+
from cgc.commands.user.keys_models import SSHKeyTypes
|
12
12
|
from cgc.utils.prepare_headers import get_api_url_and_prepare_headers
|
13
13
|
from cgc.utils.response_utils import retrieve_and_validate_response_send_metric
|
14
14
|
from cgc.utils.click_group import CustomGroup, CustomCommand
|
@@ -84,7 +84,8 @@ def create_ssh_key(
|
|
84
84
|
click.echo(
|
85
85
|
create_ssh_key_response(
|
86
86
|
retrieve_and_validate_response_send_metric(__res, metric)
|
87
|
-
)
|
87
|
+
),
|
88
|
+
color="green",
|
88
89
|
)
|
89
90
|
|
90
91
|
|
@@ -135,7 +136,8 @@ def update_ssh_key(
|
|
135
136
|
click.echo(
|
136
137
|
update_ssh_key_response(
|
137
138
|
retrieve_and_validate_response_send_metric(__res, metric)
|
138
|
-
)
|
139
|
+
),
|
140
|
+
color="green",
|
139
141
|
)
|
140
142
|
|
141
143
|
|
@@ -154,7 +156,8 @@ def delete_ssh_key(key_id: str):
|
|
154
156
|
click.echo(
|
155
157
|
delete_ssh_key_response(
|
156
158
|
retrieve_and_validate_response_send_metric(__res, metric)
|
157
|
-
)
|
159
|
+
),
|
160
|
+
color="green",
|
158
161
|
)
|
159
162
|
|
160
163
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import click
|
2
2
|
from cgc.utils.message_utils import key_error_decorator_for_helpers
|
3
|
-
from cgc.commands.
|
3
|
+
from cgc.commands.user.keys_utils import get_user_ssh_keys
|
4
4
|
from cgc.utils.response_utils import (
|
5
5
|
fill_missing_values_in_a_response,
|
6
6
|
tabulate_a_response,
|
@@ -8,7 +8,7 @@ from cgc.utils.response_utils import (
|
|
8
8
|
|
9
9
|
|
10
10
|
@key_error_decorator_for_helpers
|
11
|
-
def create_ssh_key_response(data: dict) ->
|
11
|
+
def create_ssh_key_response(data: dict) -> str:
|
12
12
|
"""Create a response for creating a new SSH key"""
|
13
13
|
try:
|
14
14
|
key_id = data["details"]["key_id"]
|
@@ -18,7 +18,7 @@ def create_ssh_key_response(data: dict) -> dict:
|
|
18
18
|
|
19
19
|
|
20
20
|
@key_error_decorator_for_helpers
|
21
|
-
def delete_ssh_key_response(data: dict) ->
|
21
|
+
def delete_ssh_key_response(data: dict) -> str:
|
22
22
|
"""Create a response for deleting an SSH key"""
|
23
23
|
try:
|
24
24
|
key_id = data["details"]["key_id"]
|
@@ -28,20 +28,17 @@ def delete_ssh_key_response(data: dict) -> dict:
|
|
28
28
|
|
29
29
|
|
30
30
|
@key_error_decorator_for_helpers
|
31
|
-
def list_ssh_keys_response(data: dict) ->
|
31
|
+
def list_ssh_keys_response(data: dict) -> str:
|
32
32
|
"""Create a response for listing all SSH keys"""
|
33
33
|
list_of_json_data = get_user_ssh_keys(data["details"])
|
34
|
+
if not list_of_json_data:
|
35
|
+
return "No keys found."
|
34
36
|
table = fill_missing_values_in_a_response(list_of_json_data)
|
35
37
|
|
36
38
|
return tabulate_a_response(table)
|
37
39
|
|
38
40
|
|
39
41
|
@key_error_decorator_for_helpers
|
40
|
-
def update_ssh_key_response(
|
42
|
+
def update_ssh_key_response(_: dict) -> str:
|
41
43
|
"""Create a response for updating an SSH key"""
|
42
|
-
|
43
|
-
key_id = data["details"]["key_id"]
|
44
|
-
except KeyError:
|
45
|
-
return "Key updated."
|
46
|
-
else:
|
47
|
-
return f"Key updated. New key ID: {key_id}."
|
44
|
+
return "Key updated."
|
@@ -0,0 +1,154 @@
|
|
1
|
+
import json
|
2
|
+
from typing import Optional, Set
|
3
|
+
import click
|
4
|
+
|
5
|
+
from cgc.utils.prepare_headers import get_api_url_and_prepare_headers
|
6
|
+
from cgc.utils.response_utils import retrieve_and_validate_response_send_metric
|
7
|
+
from cgc.utils.click_group import CustomGroup, CustomCommand
|
8
|
+
from cgc.utils.requests_helper import call_api, EndpointTypes
|
9
|
+
from cgc.commands.user.secret_utils import create_secret_payload, update_secret_payload
|
10
|
+
from cgc.commands.user.secret_responses import (
|
11
|
+
create_secret_response,
|
12
|
+
update_secret_response,
|
13
|
+
delete_secret_response,
|
14
|
+
list_secrets_response,
|
15
|
+
)
|
16
|
+
|
17
|
+
|
18
|
+
@click.group(name="secret", cls=CustomGroup)
|
19
|
+
def secret_group():
|
20
|
+
"""
|
21
|
+
Management of secrets.
|
22
|
+
"""
|
23
|
+
|
24
|
+
|
25
|
+
@secret_group.command("create", cls=CustomCommand)
|
26
|
+
@click.argument("secret_name", type=click.STRING)
|
27
|
+
@click.option(
|
28
|
+
"-r",
|
29
|
+
"--registry-list",
|
30
|
+
"registry_list",
|
31
|
+
multiple=True,
|
32
|
+
help="URL of the registry",
|
33
|
+
required=True,
|
34
|
+
)
|
35
|
+
@click.option(
|
36
|
+
"-u",
|
37
|
+
"--username",
|
38
|
+
"username",
|
39
|
+
type=click.STRING,
|
40
|
+
help="Username for the registry",
|
41
|
+
required=True,
|
42
|
+
)
|
43
|
+
@click.option(
|
44
|
+
"-p",
|
45
|
+
"--password",
|
46
|
+
"password",
|
47
|
+
type=click.STRING,
|
48
|
+
help="Password for the username",
|
49
|
+
required=True,
|
50
|
+
)
|
51
|
+
def create_secret(
|
52
|
+
secret_name: str, registry_list: Set[str], username: str, password: str
|
53
|
+
):
|
54
|
+
"""Create a new secret in the namespace"""
|
55
|
+
api_url, headers = get_api_url_and_prepare_headers()
|
56
|
+
url = f"{api_url}/v1/api/secret/create"
|
57
|
+
metric = "user.secret.create"
|
58
|
+
__payload = create_secret_payload(secret_name, registry_list, username, password)
|
59
|
+
__res = call_api(
|
60
|
+
request=EndpointTypes.post,
|
61
|
+
url=url,
|
62
|
+
headers=headers,
|
63
|
+
data=json.dumps(__payload).encode("utf-8"),
|
64
|
+
)
|
65
|
+
click.echo(
|
66
|
+
create_secret_response(
|
67
|
+
retrieve_and_validate_response_send_metric(__res, metric)
|
68
|
+
),
|
69
|
+
color="green",
|
70
|
+
)
|
71
|
+
|
72
|
+
|
73
|
+
@secret_group.command("update", cls=CustomCommand)
|
74
|
+
@click.argument("secret_name", type=click.STRING)
|
75
|
+
@click.option(
|
76
|
+
"-r",
|
77
|
+
"--registry-list",
|
78
|
+
"registry_list",
|
79
|
+
multiple=True,
|
80
|
+
help="URL of the registry",
|
81
|
+
)
|
82
|
+
@click.option(
|
83
|
+
"-u",
|
84
|
+
"--username",
|
85
|
+
"username",
|
86
|
+
type=click.STRING,
|
87
|
+
help="Username for the registry",
|
88
|
+
)
|
89
|
+
@click.option(
|
90
|
+
"-p",
|
91
|
+
"--password",
|
92
|
+
"password",
|
93
|
+
type=click.STRING,
|
94
|
+
help="Password for the username",
|
95
|
+
)
|
96
|
+
def update_secret(
|
97
|
+
secret_name: str,
|
98
|
+
registry_list: Optional[Set[str]] = None,
|
99
|
+
username: Optional[str] = None,
|
100
|
+
password: Optional[str] = None,
|
101
|
+
):
|
102
|
+
"""Update an existing secret in the namespace"""
|
103
|
+
api_url, headers = get_api_url_and_prepare_headers()
|
104
|
+
url = f"{api_url}/v1/api/secret/manage/{secret_name}"
|
105
|
+
metric = "user.secret.update"
|
106
|
+
__payload = update_secret_payload(registry_list, username, password)
|
107
|
+
__res = call_api(
|
108
|
+
request=EndpointTypes.put,
|
109
|
+
url=url,
|
110
|
+
headers=headers,
|
111
|
+
data=json.dumps(__payload).encode("utf-8"),
|
112
|
+
)
|
113
|
+
click.echo(
|
114
|
+
update_secret_response(
|
115
|
+
retrieve_and_validate_response_send_metric(__res, metric)
|
116
|
+
),
|
117
|
+
color="green",
|
118
|
+
)
|
119
|
+
|
120
|
+
|
121
|
+
@secret_group.command("delete", cls=CustomCommand)
|
122
|
+
@click.argument("secret_name", type=click.STRING)
|
123
|
+
def delete_secret(secret_name: str):
|
124
|
+
"""Delete an secret"""
|
125
|
+
api_url, headers = get_api_url_and_prepare_headers()
|
126
|
+
url = f"{api_url}/v1/api/secret/manage/{secret_name}"
|
127
|
+
metric = "user.secret.delete"
|
128
|
+
__res = call_api(
|
129
|
+
request=EndpointTypes.delete,
|
130
|
+
url=url,
|
131
|
+
headers=headers,
|
132
|
+
)
|
133
|
+
click.echo(
|
134
|
+
delete_secret_response(
|
135
|
+
retrieve_and_validate_response_send_metric(__res, metric)
|
136
|
+
),
|
137
|
+
color="green",
|
138
|
+
)
|
139
|
+
|
140
|
+
|
141
|
+
@secret_group.command("list", cls=CustomCommand)
|
142
|
+
def list_secrets():
|
143
|
+
"""List all secrets in the namespace"""
|
144
|
+
api_url, headers = get_api_url_and_prepare_headers()
|
145
|
+
url = f"{api_url}/v1/api/secret/list"
|
146
|
+
metric = "user.secret.list"
|
147
|
+
__res = call_api(
|
148
|
+
request=EndpointTypes.get,
|
149
|
+
url=url,
|
150
|
+
headers=headers,
|
151
|
+
)
|
152
|
+
click.echo(
|
153
|
+
list_secrets_response(retrieve_and_validate_response_send_metric(__res, metric))
|
154
|
+
)
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import click
|
2
|
+
|
3
|
+
from cgc.commands.user import NoSecretsToList
|
4
|
+
from cgc.commands.user.secret_utils import get_secret_list
|
5
|
+
from cgc.telemetry.basic import setup_gauge
|
6
|
+
from cgc.utils.config_utils import get_namespace
|
7
|
+
from cgc.utils.message_utils import key_error_decorator_for_helpers
|
8
|
+
from cgc.utils.response_utils import (
|
9
|
+
fill_missing_values_in_a_response,
|
10
|
+
tabulate_a_response,
|
11
|
+
)
|
12
|
+
|
13
|
+
|
14
|
+
@key_error_decorator_for_helpers
|
15
|
+
def create_secret_response(data: dict) -> str:
|
16
|
+
"""Create a response for creating a new secret in the namespace"""
|
17
|
+
return f'Secret {data.get("details", {}).get("secret_name")} successfully created.'
|
18
|
+
|
19
|
+
|
20
|
+
@key_error_decorator_for_helpers
|
21
|
+
def update_secret_response(data: dict) -> str:
|
22
|
+
"""Create a response for updating a secret in the namespace"""
|
23
|
+
return f'Secret {data.get("details", {}).get("secret_name")} successfully updated.'
|
24
|
+
|
25
|
+
|
26
|
+
@key_error_decorator_for_helpers
|
27
|
+
def delete_secret_response(data: dict) -> str:
|
28
|
+
"""Create a response for deleting a secret in the namespace"""
|
29
|
+
return f'Secret {data.get("details", {}).get("secret_name")} successfully deleted.'
|
30
|
+
|
31
|
+
|
32
|
+
@key_error_decorator_for_helpers
|
33
|
+
def list_secrets_response(data: dict) -> str:
|
34
|
+
"""Create a response for listing all secrets in the namespace"""
|
35
|
+
secret_list = data.get("details", {}).get("secret_names", [])
|
36
|
+
setup_gauge(f"{get_namespace()}.secret.count", len(secret_list))
|
37
|
+
|
38
|
+
if not secret_list:
|
39
|
+
raise NoSecretsToList()
|
40
|
+
|
41
|
+
list_of_json_data = get_secret_list(secret_list)
|
42
|
+
table = fill_missing_values_in_a_response(list_of_json_data)
|
43
|
+
|
44
|
+
return tabulate_a_response(table)
|
@@ -0,0 +1,60 @@
|
|
1
|
+
from typing import Set
|
2
|
+
|
3
|
+
|
4
|
+
def create_secret_payload(
|
5
|
+
secret_name: str, registry_list: Set[str], username: str, password: str
|
6
|
+
) -> dict:
|
7
|
+
"""Create a payload for creating a new secret"""
|
8
|
+
payload = {
|
9
|
+
"name": secret_name,
|
10
|
+
"registry_list": registry_list,
|
11
|
+
"username": username,
|
12
|
+
"password": password,
|
13
|
+
}
|
14
|
+
return payload
|
15
|
+
|
16
|
+
|
17
|
+
def update_secret_payload(
|
18
|
+
registry_list: Set[str], username: str, password: str
|
19
|
+
) -> dict:
|
20
|
+
"""Create a payload for updating a secret"""
|
21
|
+
payload = {}
|
22
|
+
if registry_list:
|
23
|
+
payload["registry_list"] = registry_list
|
24
|
+
if username:
|
25
|
+
payload["username"] = username
|
26
|
+
if password:
|
27
|
+
payload["password"] = password
|
28
|
+
return payload
|
29
|
+
|
30
|
+
|
31
|
+
def _get_secret_json_data(secret_list: list):
|
32
|
+
"""Formats and returns list of secrets to print.
|
33
|
+
|
34
|
+
:param job_list: list of secrets
|
35
|
+
:type job_list: list
|
36
|
+
:return: formatted list of secrets
|
37
|
+
:rtype: list
|
38
|
+
"""
|
39
|
+
output_data = []
|
40
|
+
|
41
|
+
for secret in secret_list:
|
42
|
+
try:
|
43
|
+
|
44
|
+
secret_data = {
|
45
|
+
"name": secret.get("secret"),
|
46
|
+
"secret_type": secret.get("secret_type"),
|
47
|
+
"registry_list": secret.get("registry_list", []),
|
48
|
+
"secret_admin": secret.get("secret_admin"),
|
49
|
+
"date_created": f'{secret.get("date_created")} UTC',
|
50
|
+
"whitelist": secret.get("whitelist", ["*"]),
|
51
|
+
}
|
52
|
+
output_data.append(secret_data)
|
53
|
+
except KeyError:
|
54
|
+
pass
|
55
|
+
|
56
|
+
return output_data
|
57
|
+
|
58
|
+
|
59
|
+
def get_secret_list(secret_list: list):
|
60
|
+
return _get_secret_json_data(secret_list)
|
cgc/sdk/resource.py
CHANGED
@@ -2,7 +2,7 @@ import json as _json
|
|
2
2
|
import cgc.sdk.exceptions as _exceptions
|
3
3
|
from cgc.utils.custom_exceptions import CUSTOM_EXCEPTIONS
|
4
4
|
import cgc.utils.prepare_headers as _prepare_headers
|
5
|
-
import cgc.commands.compute.
|
5
|
+
import cgc.commands.compute.compute_utils as _compute_utils
|
6
6
|
import cgc.utils.requests_helper as _requests_helper
|
7
7
|
import cgc.utils.response_utils as _response_utils
|
8
8
|
from enum import Enum as _Enum
|
@@ -243,7 +243,7 @@ def compute_create_custom(
|
|
243
243
|
gpu_type = gpu_type.upper()
|
244
244
|
if gpu_type not in GPUsList.get_list():
|
245
245
|
raise _exceptions.SDKException(-3, f"Invalid GPU type: {gpu_type}")
|
246
|
-
__payload =
|
246
|
+
__payload = _compute_utils.compute_create_payload(
|
247
247
|
name=name,
|
248
248
|
entity="custom",
|
249
249
|
cpu=cpu,
|
@@ -291,7 +291,7 @@ def resource_update_port(
|
|
291
291
|
api_url, headers = _prepare_headers.get_api_url_and_prepare_headers()
|
292
292
|
url = f"{api_url}/v1/api/resource/ports?port_modification_mode=UPDATE"
|
293
293
|
metric = "resource.ports.update"
|
294
|
-
__payload =
|
294
|
+
__payload = _compute_utils.port_modification_payload(
|
295
295
|
port_name=port_name,
|
296
296
|
port_number=new_port,
|
297
297
|
ingress=ingress,
|
@@ -325,7 +325,7 @@ def resource_add_port(name: str, port_name: str, new_port: int, ingress: bool =
|
|
325
325
|
api_url, headers = _prepare_headers.get_api_url_and_prepare_headers()
|
326
326
|
url = f"{api_url}/v1/api/resource/ports?port_modification_mode=ADD"
|
327
327
|
metric = "resource.ports.add"
|
328
|
-
__payload =
|
328
|
+
__payload = _compute_utils.port_modification_payload(
|
329
329
|
port_name=port_name,
|
330
330
|
port_number=new_port,
|
331
331
|
ingress=ingress,
|
@@ -360,7 +360,7 @@ def resource_delete_port(
|
|
360
360
|
api_url, headers = _prepare_headers.get_api_url_and_prepare_headers()
|
361
361
|
url = f"{api_url}/v1/api/resource/ports?port_modification_mode=DELETE"
|
362
362
|
metric = "resource.ports.delete"
|
363
|
-
__payload =
|
363
|
+
__payload = _compute_utils.port_delete_payload(
|
364
364
|
port_name=port_name,
|
365
365
|
app_name=name,
|
366
366
|
)
|
@@ -411,7 +411,7 @@ def resource_delete(name: str):
|
|
411
411
|
api_url, headers = _prepare_headers.get_api_url_and_prepare_headers()
|
412
412
|
url = f"{api_url}/v1/api/resource/delete"
|
413
413
|
metric = "resource.delete"
|
414
|
-
__payload =
|
414
|
+
__payload = _compute_utils.compute_delete_payload(name=name)
|
415
415
|
__res = _requests_helper.call_api(
|
416
416
|
request=_requests_helper.EndpointTypes.delete,
|
417
417
|
url=url,
|
cgc/tests/responses_tests.py
CHANGED
@@ -27,7 +27,7 @@ from cgc.utils.response_utils import (
|
|
27
27
|
tabulate_a_response,
|
28
28
|
fill_missing_values_in_a_response,
|
29
29
|
)
|
30
|
-
from cgc.commands.compute.
|
30
|
+
from cgc.commands.compute.compute_utils import get_app_list
|
31
31
|
|
32
32
|
|
33
33
|
class TestVolumeResponses(unittest.TestCase):
|
cgc/utils/requests_helper.py
CHANGED
@@ -18,10 +18,12 @@ from cgc.utils.consts.message_consts import (
|
|
18
18
|
|
19
19
|
urllib3.disable_warnings(urllib3.exceptions.SecurityWarning)
|
20
20
|
|
21
|
+
|
21
22
|
class EndpointTypes(Enum):
|
22
23
|
get = requests.get
|
23
24
|
post = requests.post
|
24
25
|
delete = requests.delete
|
26
|
+
put = requests.put
|
25
27
|
|
26
28
|
|
27
29
|
def _process_endpoint_kwargs(**kwargs):
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
|
-
cgc/.env,sha256=
|
2
|
-
cgc/CHANGELOG.md,sha256=
|
1
|
+
cgc/.env,sha256=I-5qrmy3GL9dhkX_k4UN59twXdPL_Tu_Emwf-ZU6-hg,210
|
2
|
+
cgc/CHANGELOG.md,sha256=3eTeQjVZkrfGb5Ld-YUIfM9dios7vOZp3cc2xVILfFQ,8532
|
3
3
|
cgc/__init__.py,sha256=d03Xv8Pw4ktNyUHfmicP6XfxYPXnVYLaCZPyUlg_RNQ,326
|
4
|
-
cgc/cgc.py,sha256=
|
4
|
+
cgc/cgc.py,sha256=SaZIGvZpA25OBx2KnQlZVjWNY2ejCyPU5KEkwqh7sh0,1655
|
5
5
|
cgc/config.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
cgc/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
cgc/commands/cgc_cmd.py,sha256=QwqjZl9FmAMOvuUQMJm-wOV88OxbdwK5UIS0zkg-mAo,4956
|
@@ -18,27 +18,31 @@ cgc/commands/billing/billing_cmd.py,sha256=T1E5WW5Z-RlzddaotimTuvLvIbGihNpStIBET
|
|
18
18
|
cgc/commands/billing/billing_responses.py,sha256=HAD5N-Odx3Jz1OmhO4v66rHoXpTYIOGlXDsrs0da9dk,1949
|
19
19
|
cgc/commands/billing/billing_utils.py,sha256=zXLbBBcWeOgur-r0OKiIjaKeaxMNxASXWzCTeTsyC6o,4711
|
20
20
|
cgc/commands/compute/__init__.py,sha256=lCdLfZ0ECSHtXEUSwq5YRHH85yXHchSsz8ZJvmClPtI,239
|
21
|
-
cgc/commands/compute/compute_cmd.py,sha256=
|
21
|
+
cgc/commands/compute/compute_cmd.py,sha256=eXKeoOV3DsOypuxzKMa3MpITOKKbF2cZjy30iofHHG8,15489
|
22
22
|
cgc/commands/compute/compute_models.py,sha256=yse6mCEhhE2RdWIO7EHx4r5Y-350gWWy4UWFsdltNNg,778
|
23
|
-
cgc/commands/compute/compute_responses.py,sha256=
|
24
|
-
cgc/commands/compute/
|
23
|
+
cgc/commands/compute/compute_responses.py,sha256=DnRIZC_F1ZE887fMOXXYGYuYmB9n5x63sf8Ga_TL4Ww,5806
|
24
|
+
cgc/commands/compute/compute_utils.py,sha256=XXnd_EuF9vCmW14r0ThlN98ScKSx3KAeqFbWy2g2mlk,8812
|
25
25
|
cgc/commands/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
|
-
cgc/commands/db/db_cmd.py,sha256=
|
26
|
+
cgc/commands/db/db_cmd.py,sha256=4iamsHTy68YjrKztyRGz2PqQgo54Q_rURgm2zpp_hL8,3512
|
27
27
|
cgc/commands/db/db_models.py,sha256=oJUAF23nb_r8fSyhLHMJrRbRzLY_vpJQu6Vy4WRa0cg,1036
|
28
28
|
cgc/commands/debug/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
29
|
cgc/commands/debug/debug_cmd.py,sha256=kuAuh5YOqzGFjoiYZwfM9FJ1z5OeSpC0JAIUEzS83lM,412
|
30
30
|
cgc/commands/jobs/__init__.py,sha256=E-438wgIzlnGmXs5jgmWAhJ1KNV6UXF2gz8SXu3UxA0,231
|
31
|
-
cgc/commands/jobs/job_utils.py,sha256=
|
31
|
+
cgc/commands/jobs/job_utils.py,sha256=_WffuTWYZamaXmrkRQIRmQzFsrvNbWzSwXlVLqLbmis,6194
|
32
32
|
cgc/commands/jobs/jobs_cmd.py,sha256=Q-orK6B9Zk1zAf8sOM6QqF9Eeu092P-UEg4GRA-zX-s,6555
|
33
33
|
cgc/commands/jobs/jobs_responses.py,sha256=QXFXA4zwQOo5Gvq5rEc7J_cxxsYqkdU19X9MCcZetUM,1771
|
34
|
-
cgc/commands/keys/__init__.py,sha256=rznd63OZhZvKHbdnXAsIBV_OWTnzHtFGfqzgNM4zCXk,112
|
35
|
-
cgc/commands/keys/keys_cmd.py,sha256=RQtDlvy31WNp7MgqrAfB1ydUya12wnr2eq1BOt2ZLz4,4437
|
36
|
-
cgc/commands/keys/keys_models.py,sha256=IYojnAu3aTGJ7qHIYvZy-0YFzXRmueZNplS4RqdfJfw,378
|
37
|
-
cgc/commands/keys/keys_responses.py,sha256=ENHRpUWEGX1r9mpMIwcVnYy6ikO0F1e-68834JHL9LE,1474
|
38
|
-
cgc/commands/keys/keys_utils.py,sha256=GiQcBoQdI6Zy_fvU9AVvBbUfaQx7g26s8NRbonmG474,2285
|
39
34
|
cgc/commands/resource/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
40
|
-
cgc/commands/resource/resource_cmd.py,sha256=
|
35
|
+
cgc/commands/resource/resource_cmd.py,sha256=y2R6ZF0jFhTppD9JUpwLIcEdFRXg82Xw_5yrNIfG4mI,4089
|
41
36
|
cgc/commands/resource/resource_responses.py,sha256=sES7mAi_Cv5B6Z3I_6eUOqVwOr2HgMO45cz8MiNZetQ,197
|
37
|
+
cgc/commands/user/__init__.py,sha256=Rhaa2SDXQsJVJnTX0oFyZ90tAuiAUBeRy3Bd415S4os,382
|
38
|
+
cgc/commands/user/keys_cmd.py,sha256=dfHnhHmEwRH1xl_wRNQcpCT-THJTBYPHMTJSI2AsDXE,4509
|
39
|
+
cgc/commands/user/keys_models.py,sha256=IYojnAu3aTGJ7qHIYvZy-0YFzXRmueZNplS4RqdfJfw,378
|
40
|
+
cgc/commands/user/keys_responses.py,sha256=TBHFWAVN1kEgP6sudbMwfpiZOcfTr0a0SD-f-Wn-ed8,1389
|
41
|
+
cgc/commands/user/keys_utils.py,sha256=w1TcMTlKJNxXjnj-XsiUU8N__-l1TsWqfPPjGpRqtI0,2285
|
42
|
+
cgc/commands/user/secret_cmd.py,sha256=_b9ewJlEE4gMCrgdyycpO5MOdJvibeHObAiPE-mWIgA,4165
|
43
|
+
cgc/commands/user/secret_models.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
44
|
+
cgc/commands/user/secret_responses.py,sha256=sg7HP5a0LnUvlo9w8oOcYASwI2cPeRnecjTVMa5yk7Y,1600
|
45
|
+
cgc/commands/user/secret_utils.py,sha256=70dn937rzecQ0eE-8zb9fLnBDWtjWjdQY1LJvHv3NzM,1623
|
42
46
|
cgc/commands/volume/__init__.py,sha256=Ou3kyb72aaXkrVCfQCVdniA65R2xHsRFgebooG1gflA,384
|
43
47
|
cgc/commands/volume/data_model.py,sha256=meprXdaXLo3mMTZta1ks1-BJ7G0rO16qi_ycH-sXJpY,1295
|
44
48
|
cgc/commands/volume/volume_cmd.py,sha256=5bd0vq5--Y7IfniO33tGBYH0Z67Le2s_AMTiwJcPBA4,7673
|
@@ -48,11 +52,11 @@ cgc/sdk/__init__.py,sha256=m8uAD2e_ADbHC4_kaOpLrUk_bHy7wC56rPjhcttclCs,177
|
|
48
52
|
cgc/sdk/exceptions.py,sha256=99XIzDO6LYKjex715troH-MkGUN7hi2Bit4KHfSHDis,214
|
49
53
|
cgc/sdk/job.py,sha256=q9Vsarc3rKzurM4AOmbQDsQUVdyRqx0UzJVe_uO8xCU,5318
|
50
54
|
cgc/sdk/postgresql.py,sha256=ziXaMMwjSF3k1OAID3F9npqWVxreQaoZ8wn7X8x1FZw,1637
|
51
|
-
cgc/sdk/resource.py,sha256=
|
55
|
+
cgc/sdk/resource.py,sha256=w8SVRqrx0Mj1FS91Bt0oaMAfC4CDEcomgqzFCNgGaPc,13537
|
52
56
|
cgc/telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
53
57
|
cgc/telemetry/basic.py,sha256=XagCcyH4QSEPmfiQ1WCjqXslnJO6IaJCY0AMPySd5rc,3175
|
54
58
|
cgc/tests/__init__.py,sha256=8aI3MVpkzaj0_UX02kZCtY5vmGO0rnq0mw2H04-OHf8,102743
|
55
|
-
cgc/tests/responses_tests.py,sha256=
|
59
|
+
cgc/tests/responses_tests.py,sha256=TtTwMZFo-nqJ-gHRmObYZsVKFdaEpT0JovMynmcxxfQ,9180
|
56
60
|
cgc/tests/desired_responses/test_billing_invoice.txt,sha256=KR5m2gamn_bgfBdBmWDH2sPRJIPOw1u8kdH-gYE8jow,1579
|
57
61
|
cgc/tests/desired_responses/test_billing_status.txt,sha256=2KSUixFOrhXI5ON6qtsIUmzFye5LBZB1xneY8ST0MqE,2381
|
58
62
|
cgc/tests/desired_responses/test_billing_stop_events_compute.txt,sha256=nHdixgLhAXDMeoDvjk9Mwv6b0JIAsW8j7Z6SS5scjSs,234
|
@@ -67,7 +71,7 @@ cgc/utils/config_utils.py,sha256=NlPs334y6BSNGoYbFjrB5cKc9trTWIXOn8UN6O4ztNU,288
|
|
67
71
|
cgc/utils/custom_exceptions.py,sha256=qvHdzaunZswZgN96iOHZIfLjehlJ79mcjqoMoW-tqEM,2628
|
68
72
|
cgc/utils/message_utils.py,sha256=FAiUC-0zJiMhfPQAQC0ki1ZUs1vI_QqHwLmfoCDbLeU,1790
|
69
73
|
cgc/utils/prepare_headers.py,sha256=67YMPogNoGbKnHQmGFc3iJCbsDZbRVjAIe3kBY-Dq98,2838
|
70
|
-
cgc/utils/requests_helper.py,sha256=
|
74
|
+
cgc/utils/requests_helper.py,sha256=qhSTfOb0o-luHLAeIuiHTOl0R_ykkdQldQZz3D6Sr6s,2062
|
71
75
|
cgc/utils/response_utils.py,sha256=9vJqAt2UFJ1n-oesFPe6CB_ooGoStjl-twY_31Jt4_I,7374
|
72
76
|
cgc/utils/update.py,sha256=AsQwhcBqsjgNPKn6AN6ojt0Ew5otvJXyshys6bjr7DQ,413
|
73
77
|
cgc/utils/version_control.py,sha256=VsqNzNYWDvU3VsoPuYIaZV7Img-K2_DmEOHd7rZlRxk,3267
|
@@ -78,9 +82,9 @@ cgc/utils/cryptography/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
78
82
|
cgc/utils/cryptography/aes_crypto.py,sha256=S0rKg38oy7rM5lTrP6DDpjLA-XRxuZggAXyxMFHtyzY,3333
|
79
83
|
cgc/utils/cryptography/encryption_module.py,sha256=rbblBBorHYPGl-iKblyZX3_NuPEvUTpnH1l_RgNGCbA,1958
|
80
84
|
cgc/utils/cryptography/rsa_crypto.py,sha256=h3jU5qPpj9uVjP1rTqZJTdYB5yjhD9HZpr_nD439h9Q,4180
|
81
|
-
cgcsdk-1.0.
|
82
|
-
cgcsdk-1.0.
|
83
|
-
cgcsdk-1.0.
|
84
|
-
cgcsdk-1.0.
|
85
|
-
cgcsdk-1.0.
|
86
|
-
cgcsdk-1.0.
|
85
|
+
cgcsdk-1.0.10.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
86
|
+
cgcsdk-1.0.10.dist-info/METADATA,sha256=R_I_GsefZji2cCg2zbrk90fXOyWg5MDE0rWJmwiFjQU,3058
|
87
|
+
cgcsdk-1.0.10.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
88
|
+
cgcsdk-1.0.10.dist-info/entry_points.txt,sha256=bdfIHeJ6Y-BBr5yupCVoK7SUrJj1yNdew8OtIOg_3No,36
|
89
|
+
cgcsdk-1.0.10.dist-info/top_level.txt,sha256=nqW9tqcIcCXFigQT69AuOk7XHKc4pCuv4HGJQGXb6iA,12
|
90
|
+
cgcsdk-1.0.10.dist-info/RECORD,,
|
cgc/commands/keys/__init__.py
DELETED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|