diff options
Diffstat (limited to 'gitlab/v4/objects/variables.py')
-rw-r--r-- | gitlab/v4/objects/variables.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gitlab/v4/objects/variables.py b/gitlab/v4/objects/variables.py index 2e5e483..d5f32e3 100644 --- a/gitlab/v4/objects/variables.py +++ b/gitlab/v4/objects/variables.py @@ -4,6 +4,8 @@ https://docs.gitlab.com/ee/api/instance_level_ci_variables.html https://docs.gitlab.com/ee/api/project_level_variables.html https://docs.gitlab.com/ee/api/group_level_variables.html """ +from typing import Any, cast, Union + from gitlab.base import RequiredOptional, RESTManager, RESTObject from gitlab.mixins import CRUDMixin, ObjectDeleteMixin, SaveMixin @@ -31,6 +33,9 @@ class VariableManager(CRUDMixin, RESTManager): required=("key", "value"), optional=("protected", "variable_type", "masked") ) + def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> Variable: + return cast(Variable, super().get(id=id, lazy=lazy, **kwargs)) + class GroupVariable(SaveMixin, ObjectDeleteMixin, RESTObject): _id_attr = "key" @@ -47,6 +52,11 @@ class GroupVariableManager(CRUDMixin, RESTManager): required=("key", "value"), optional=("protected", "variable_type", "masked") ) + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> GroupVariable: + return cast(GroupVariable, super().get(id=id, lazy=lazy, **kwargs)) + class ProjectVariable(SaveMixin, ObjectDeleteMixin, RESTObject): _id_attr = "key" @@ -64,3 +74,8 @@ class ProjectVariableManager(CRUDMixin, RESTManager): required=("key", "value"), optional=("protected", "variable_type", "masked", "environment_scope"), ) + + def get( + self, id: Union[str, int], lazy: bool = False, **kwargs: Any + ) -> ProjectVariable: + return cast(ProjectVariable, super().get(id=id, lazy=lazy, **kwargs)) |