-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add deprecation field to ServerType (#192)
- Loading branch information
Showing
7 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Deprecation Info | ||
================== | ||
|
||
.. autoclass:: hcloud.deprecation.domain.DeprecationInfo | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from dateutil.parser import isoparse | ||
|
||
from hcloud.core.domain import BaseDomain | ||
|
||
|
||
class DeprecationInfo(BaseDomain): | ||
"""Describes if, when & how the resources was deprecated. If this field is set to ``None`` the resource is not | ||
deprecated. If it has a value, it is considered deprecated. | ||
:param announced: datetime | ||
Date of when the deprecation was announced. | ||
:param unavailable_after: datetime | ||
After the time in this field, the resource will not be available from the general listing endpoint of the | ||
resource type, and it can not be used in new resources. For example, if this is an image, you can not create | ||
new servers with this image after the mentioned date. | ||
""" | ||
|
||
__slots__ = ( | ||
"announced", | ||
"unavailable_after", | ||
) | ||
|
||
def __init__( | ||
self, | ||
announced=None, | ||
unavailable_after=None, | ||
): | ||
self.announced = isoparse(announced) if announced else None | ||
self.unavailable_after = ( | ||
isoparse(unavailable_after) if unavailable_after else None | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters