@@ -1764,6 +1764,65 @@ def create(self, data, **kwargs):
17641764 return CreateMixin .create (self , data , path = path , ** kwargs )
17651765
17661766
1767+ class ProjectPipelineScheduleVariable (SaveMixin , ObjectDeleteMixin , RESTObject ):
1768+ _id_attr = 'key'
1769+
1770+
1771+ class ProjectPipelineScheduleVariableManager (CRUDMixin , RESTManager ):
1772+ _path = '/projects/%(project_id)s/pipeline_schedules/%(pipeline_schedule_id)s/variables'
1773+ _obj_cls = ProjectPipelineScheduleVariable
1774+ _from_parent_attrs = {'project_id' : 'project_id' ,
1775+ 'pipeline_schedule_id' : 'id' }
1776+ _create_attrs = (('pipeline_schedule_id' , 'key' , 'value' ), tuple ())
1777+ _create_attrs = (('key' , 'value' ), tuple ())
1778+
1779+ def list (self ):
1780+ array = []
1781+ if 'variables' in self ._parent ._attrs :
1782+ for variable in self ._parent ._attrs ['variables' ]:
1783+ schedule_variable = self ._obj_cls (self , variable )
1784+ array .append (schedule_variable )
1785+ else :
1786+ obj = self ._parent .manager .get (self ._parent .id )
1787+ for variable in obj ._attrs ['variables' ]:
1788+ schedule_variable = self ._obj_cls (self , variable )
1789+ array .append (schedule_variable )
1790+
1791+ return array
1792+
1793+
1794+ class ProjectPipelineSchedule (RESTObject ):
1795+ _managers = (
1796+ ('variables' , 'ProjectPipelineScheduleVariableManager' ),
1797+ )
1798+
1799+
1800+ class ProjectPipelineSchedulesManager (RetrieveMixin , CreateMixin , RESTManager ):
1801+ _path = '/projects/%(project_id)s/pipeline_schedules'
1802+ _obj_cls = ProjectPipelineSchedule
1803+ _from_parent_attrs = {'project_id' : 'id' }
1804+ _create_attrs = (('description' , 'ref' , 'cron' ),
1805+ ('cron_timezone' , 'active' ))
1806+
1807+ def create (self , data , ** kwargs ):
1808+ """Creates a new object.
1809+
1810+ Args:
1811+ data (dict): Parameters to send to the server to create the
1812+ resource
1813+ **kwargs: Extra options to send to the server (e.g. sudo)
1814+
1815+ Raises:
1816+ GitlabAuthenticationError: If authentication is not correct
1817+ GitlabCreateError: If the server cannot perform the request
1818+
1819+ Returns:
1820+ RESTObject: A new instance of the managed object class build with
1821+ the data sent by the server
1822+ """
1823+ return CreateMixin .create (self , data , path = self .path , ** kwargs )
1824+
1825+
17671826class ProjectSnippetNote (SaveMixin , ObjectDeleteMixin , RESTObject ):
17681827 pass
17691828
@@ -2035,6 +2094,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject):
20352094 ('notificationsettings' , 'ProjectNotificationSettingsManager' ),
20362095 ('pipelines' , 'ProjectPipelineManager' ),
20372096 ('protectedbranches' , 'ProjectProtectedBranchManager' ),
2097+ ('pipeline_schedules' , 'ProjectPipelineSchedulesManager' ),
20382098 ('runners' , 'ProjectRunnerManager' ),
20392099 ('services' , 'ProjectServiceManager' ),
20402100 ('snippets' , 'ProjectSnippetManager' ),
0 commit comments