@@ -743,6 +743,56 @@ class GroupBoardManager(CRUDMixin, RESTManager):
743743 _create_attrs = (("name" ,), tuple ())
744744
745745
746+ class GroupCluster (SaveMixin , ObjectDeleteMixin , RESTObject ):
747+ pass
748+
749+
750+ class GroupClusterManager (CRUDMixin , RESTManager ):
751+ _path = "/groups/%(group_id)s/clusters"
752+ _obj_cls = GroupCluster
753+ _from_parent_attrs = {"group_id" : "id" }
754+ _create_attrs = (
755+ ("name" , "platform_kubernetes_attributes" ,),
756+ (
757+ "domain" ,
758+ "enabled" ,
759+ "managed" ,
760+ "environment_scope" ,
761+ ),
762+ )
763+ _update_attrs = (
764+ tuple (),
765+ (
766+ "name" ,
767+ "domain" ,
768+ "management_project_id" ,
769+ "platform_kubernetes_attributes" ,
770+ "environment_scope" ,
771+ ),
772+ )
773+
774+ @exc .on_http_error (exc .GitlabStopError )
775+ def create (self , data , ** kwargs ):
776+ """Create a new object.
777+
778+ Args:
779+ data (dict): Parameters to send to the server to create the
780+ resource
781+ **kwargs: Extra options to send to the server (e.g. sudo or
782+ 'ref_name', 'stage', 'name', 'all')
783+
784+ Raises:
785+ GitlabAuthenticationError: If authentication is not correct
786+ GitlabCreateError: If the server cannot perform the request
787+
788+ Returns:
789+ RESTObject: A new instance of the manage object class build with
790+ the data sent by the server
791+ """
792+ path = "%s/user" % (self .path )
793+ return CreateMixin .create (self , data , path = path , ** kwargs )
794+
795+
746796class GroupCustomAttribute (ObjectDeleteMixin , RESTObject ):
747797 _id_attr = "key"
748798
@@ -1150,6 +1200,7 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject):
11501200 ("projects" , "GroupProjectManager" ),
11511201 ("subgroups" , "GroupSubgroupManager" ),
11521202 ("variables" , "GroupVariableManager" ),
1203+ ("clusters" , "GroupClusterManager" ),
11531204 )
11541205
11551206 @cli .register_custom_action ("Group" , ("to_project_id" ,))
@@ -1599,6 +1650,56 @@ class ProjectBranchManager(NoUpdateMixin, RESTManager):
15991650 _create_attrs = (("branch" , "ref" ), tuple ())
16001651
16011652
1653+ class ProjectCluster (SaveMixin , ObjectDeleteMixin , RESTObject ):
1654+ pass
1655+
1656+
1657+ class ProjectClusterManager (CRUDMixin , RESTManager ):
1658+ _path = "/projects/%(project_id)s/clusters"
1659+ _obj_cls = ProjectCluster
1660+ _from_parent_attrs = {"project_id" : "id" }
1661+ _create_attrs = (
1662+ ("name" , "platform_kubernetes_attributes" ,),
1663+ (
1664+ "domain" ,
1665+ "enabled" ,
1666+ "managed" ,
1667+ "environment_scope" ,
1668+ ),
1669+ )
1670+ _update_attrs = (
1671+ tuple (),
1672+ (
1673+ "name" ,
1674+ "domain" ,
1675+ "management_project_id" ,
1676+ "platform_kubernetes_attributes" ,
1677+ "environment_scope" ,
1678+ ),
1679+ )
1680+
1681+ @exc .on_http_error (exc .GitlabStopError )
1682+ def create (self , data , ** kwargs ):
1683+ """Create a new object.
1684+
1685+ Args:
1686+ data (dict): Parameters to send to the server to create the
1687+ resource
1688+ **kwargs: Extra options to send to the server (e.g. sudo or
1689+ 'ref_name', 'stage', 'name', 'all')
1690+
1691+ Raises:
1692+ GitlabAuthenticationError: If authentication is not correct
1693+ GitlabCreateError: If the server cannot perform the request
1694+
1695+ Returns:
1696+ RESTObject: A new instance of the manage object class build with
1697+ the data sent by the server
1698+ """
1699+ path = "%s/user" % (self .path )
1700+ return CreateMixin .create (self , data , path = path , ** kwargs )
1701+
1702+
16021703class ProjectCustomAttribute (ObjectDeleteMixin , RESTObject ):
16031704 _id_attr = "key"
16041705
@@ -3943,6 +4044,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject):
39434044 ("triggers" , "ProjectTriggerManager" ),
39444045 ("variables" , "ProjectVariableManager" ),
39454046 ("wikis" , "ProjectWikiManager" ),
4047+ ("clusters" , "ProjectClusterManager" ),
39464048 )
39474049
39484050 @cli .register_custom_action ("Project" , ("submodule" , "branch" , "commit_sha" ))
0 commit comments