@@ -2012,6 +2012,69 @@ def create(self, data, **kwargs):
2012
2012
return CreateMixin .create (self , data , path = path , ** kwargs )
2013
2013
2014
2014
2015
+ class ProjectPipelineScheduleVariable (SaveMixin , ObjectDeleteMixin , RESTObject ):
2016
+ _id_attr = 'key'
2017
+
2018
+
2019
+ class ProjectPipelineScheduleVariableManager (CRUDMixin , RESTManager ):
2020
+ _path = '/projects/%(project_id)s/pipeline_schedules/%(pipeline_schedule_id)s/variables'
2021
+ _obj_cls = ProjectPipelineScheduleVariable
2022
+ _from_parent_attrs = {'project_id' : 'project_id' ,
2023
+ 'pipeline_schedule_id' : 'id' }
2024
+ _create_attrs = (('pipeline_schedule_id' , 'key' , 'value' ), tuple ())
2025
+ _create_attrs = (('key' , 'value' ), tuple ())
2026
+
2027
+ def list (self ):
2028
+ array = []
2029
+ if 'variables' in self ._parent ._attrs :
2030
+ for variable in self ._parent ._attrs ['variables' ]:
2031
+ schedule_variable = self ._obj_cls (self , variable )
2032
+ array .append (schedule_variable )
2033
+ else :
2034
+ obj = self ._parent .manager .get (self ._parent .id )
2035
+ for variable in obj ._attrs ['variables' ]:
2036
+ schedule_variable = self ._obj_cls (self , variable )
2037
+ array .append (schedule_variable )
2038
+
2039
+ return array
2040
+
2041
+
2042
+ class ProjectPipelineSchedule (RESTObject ):
2043
+ _managers = (
2044
+ ('variables' , 'ProjectPipelineScheduleVariableManager' ),
2045
+ )
2046
+
2047
+
2048
+ class ProjectPipelineSchedulesManager (RetrieveMixin , CreateMixin , RESTManager ):
2049
+ _path = '/projects/%(project_id)s/pipeline_schedules'
2050
+ _obj_cls = ProjectPipelineSchedule
2051
+ _from_parent_attrs = {'project_id' : 'id' }
2052
+ _create_attrs = (('description' , 'ref' , 'cron' ),
2053
+ ('cron_timezone' , 'active' ))
2054
+
2055
+ def create (self , data , ** kwargs ):
2056
+ """Creates a new object.
2057
+
2058
+ Args:
2059
+ data (dict): Parameters to send to the server to create the
2060
+ resource
2061
+ **kwargs: Extra options to send to the server (e.g. sudo)
2062
+
2063
+ Raises:
2064
+ GitlabAuthenticationError: If authentication is not correct
2065
+ GitlabCreateError: If the server cannot perform the request
2066
+
2067
+ Returns:
2068
+ RESTObject: A new instance of the managed object class build with
2069
+ the data sent by the server
2070
+ """
2071
+ return CreateMixin .create (self , data , path = self .path , ** kwargs )
2072
+
2073
+
2074
+ class ProjectSnippetNote (SaveMixin , ObjectDeleteMixin , RESTObject ):
2075
+ pass
2076
+
2077
+
2015
2078
class ProjectPipelineJob (ProjectJob ):
2016
2079
pass
2017
2080
@@ -2323,6 +2386,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject):
2323
2386
('pagesdomains' , 'ProjectPagesDomainManager' ),
2324
2387
('pipelines' , 'ProjectPipelineManager' ),
2325
2388
('protectedbranches' , 'ProjectProtectedBranchManager' ),
2389
+ ('pipeline_schedules' , 'ProjectPipelineSchedulesManager' ),
2326
2390
('runners' , 'ProjectRunnerManager' ),
2327
2391
('services' , 'ProjectServiceManager' ),
2328
2392
('snippets' , 'ProjectSnippetManager' ),
0 commit comments