[#3] Added generate proto script create container method

Signed-off-by: Ilyas Niyazov <i.niyazov@yadro.com>
This commit is contained in:
Ilyas Niyazov 2025-03-25 11:13:48 +03:00
parent 19282f13cc
commit 297e107b10
52 changed files with 1380 additions and 74 deletions

View file

@ -0,0 +1,22 @@
import grpc
from frostfs_sdk.cryptography.key_extension import KeyExtension
from frostfs_sdk.client.models.ecdsa_model import ECDSA
from frostfs_sdk.models.dto.version import Version
from frostfs_sdk.models.dto.owner_id import OwnerId
from frostfs_sdk.client.utils.session_cache import SessionCache
class ClientEnvironment:
def __init__(self, ecdsa: ECDSA, channel: grpc.Channel, address: str, version: Version, session_cache: SessionCache):
self.ecdsa = ecdsa
self.channel = channel
self.version = version
self.owner_id = OwnerId(KeyExtension().get_owner_id_by_public_key(ecdsa.public_key))
self.session_cache = session_cache
self.address = address
self._session_key = None
def get_session_key(self):
if not self._session_key:
self._session_key = SessionCache.form_cache_key(self.address, KeyExtension.get_hex_string(self.ecdsa.public_key))
return self._session_key

View file

@ -0,0 +1,19 @@
class ClientSettings:
def __init__(self, wif: str = None, address: str = None):
"""
Initializes client settings with validation.
Args:
wif: Wallet import format string
address: FrostFS node host address
"""
self.wif = wif
self.address = address
# Perform validation after initialization
self.validate()
def validate(self):
"""Performs runtime validation of the settings"""
if not (self.address and self.wif):
raise ValueError("The value must be specified ADDRESS and WIF")

View file

@ -0,0 +1,8 @@
from frostfs_sdk.cryptography.key_extension import KeyExtension
class ECDSA:
def __init__(self, wif: str):
self.wif = wif
self.private_key: bytes = KeyExtension().get_private_key_from_wif(wif)
self.public_key: bytes = KeyExtension().get_public_key(self.private_key)