Skip to content

Commit 1556da4

Browse files
authored
feat: adds ssl certificate list endpoint (#27)
* feat: adds ssl certificate list endpoint * chore: remove unused imports
1 parent 5f42e81 commit 1556da4

4 files changed

Lines changed: 85 additions & 0 deletions

File tree

hostingde/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from hostingde.dns.dns import DnsClient
44
from hostingde.domain.domain import DomainClient
55
from hostingde.hostingde import HostingDeCore
6+
from hostingde.ssl.ssl import SslClient
67

78

89
class HostingDeClient(HostingDeCore):
@@ -18,3 +19,4 @@ def __init__(self):
1819
self.domain: DomainClient = DomainClient(self)
1920
self.account: AccountClient = AccountClient(self)
2021
self.billing: BillingClient = BillingClient(self)
22+
self.ssl: SslClient = SslClient(self)

hostingde/model/ssl.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from dataclasses import dataclass
2+
from typing import Optional
3+
4+
from hostingde.model import Model
5+
6+
7+
@dataclass
8+
class Certificate(Model):
9+
account_id: str
10+
add_date: str
11+
auto_renew: bool
12+
brand: str
13+
cancelable_until: Optional[str]
14+
common_name: str
15+
end_date: Optional[str]
16+
external_order_id: str
17+
id: str
18+
intermediate_cert: str
19+
is_managed: bool
20+
last_change_date: str
21+
order_status: str
22+
product: str
23+
product_code: str
24+
renew_date: Optional[str]
25+
root_cert: str
26+
serial_number: str
27+
server_cert: str
28+
start_date: Optional[str]
29+
status: str
30+
validation_level: str
31+
validity_span_month: int
32+
33+
def __init__(self, **kwargs):
34+
super().__init__(**kwargs)

hostingde/ssl/__init__.py

Whitespace-only changes.

hostingde/ssl/ssl.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
from typing import Optional
2+
3+
from hostingde.paginator import HostingDePaginator
4+
from hostingde.hostingde import HostingDeCore
5+
from hostingde.model.filter import FilterElement
6+
from hostingde.model.sort import SortConfiguration
7+
from hostingde.model.ssl import Certificate
8+
9+
10+
class SslClient(HostingDeCore):
11+
def __init__(self, parent: HostingDeCore):
12+
"""
13+
Construct a new Account client
14+
15+
:param parent: The parent to retrieve the session from
16+
"""
17+
super().__init__(parent)
18+
19+
def build_uri(self, method: str) -> str:
20+
"""
21+
Utility method to easily construct URLs for this service.
22+
23+
:param method: The method within this service
24+
:return: The URL string
25+
"""
26+
return self._build_uri('ssl', method)
27+
28+
def certificates_find(
29+
self,
30+
limit: Optional[int] = None,
31+
filter: Optional[FilterElement] = None,
32+
sort: Optional[SortConfiguration] = None,
33+
page: Optional[int] = None,
34+
*args: list,
35+
**kwargs: dict
36+
) -> HostingDePaginator[Certificate]:
37+
"""
38+
List SSL certificates
39+
40+
:param limit: The limit of objects to retrieve per call. If not set, defaults to 25.
41+
:param filter: A filter that is applied to the query
42+
:param sort: Configuration how results are sorted.
43+
:param page: The page to retrieve. If limit is unset, 25 items will be retrieved.
44+
:return: An iterator that yields Zone objects.
45+
"""
46+
47+
uri = self._build_uri('ssl', 'certificatesFind')
48+
49+
return self._iter(uri, Certificate, filter, limit, sort, page)

0 commit comments

Comments
 (0)