Browse Source
			
			
			Admin - adding 'Import Realm' to pass a RealmRepresentation and create a new Realm
			
			
				pull/12/head
			
			
		 
		
			
				
					
						 Ewan Jones
					
					7 years ago
						Ewan Jones
					
					7 years ago
					
				 
				
			 
		 
		
			
				
				  
				  No known key found for this signature in database
				  
				  	
						GPG Key ID: E34E7F21D7272734
				  	
				  
				
			
		
		
		
	
		
			
				 2 changed files with 
17 additions and 
0 deletions
			 
			
		 
		
			
				- 
					
					
					 
					keycloak/keycloak_admin.py
				
- 
					
					
					 
					keycloak/urls_patterns.py
				
					
					
						
							
								
									
										
											
	
		
			
				
					|  |  | @ -114,6 +114,22 @@ class KeycloakAdmin: | 
			
		
	
		
			
				
					|  |  |  |     def token(self, value): | 
			
		
	
		
			
				
					|  |  |  |         self._token = value | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     def import_realm(self, payload): | 
			
		
	
		
			
				
					|  |  |  |         """ | 
			
		
	
		
			
				
					|  |  |  |         Import a new realm from a RealmRepresentation. Realm name must be unique. | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         RealmRepresentation | 
			
		
	
		
			
				
					|  |  |  |         https://www.keycloak.org/docs-api/4.4/rest-api/index.html#_realmrepresentation | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         :param payload: RealmRepresentation | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         :return: RealmRepresentation | 
			
		
	
		
			
				
					|  |  |  |         """ | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         data_raw = self.connection.raw_post(URL_ADMIN_REALM_IMPORT, | 
			
		
	
		
			
				
					|  |  |  |                                             data=json.dumps(payload)) | 
			
		
	
		
			
				
					|  |  |  |         return raise_error_from_response(data_raw, KeycloakGetError, expected_code=201) | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     def get_users(self, query=None): | 
			
		
	
		
			
				
					|  |  |  |         """ | 
			
		
	
		
			
				
					|  |  |  |         Get users Returns a list of users, filtered according to query parameters | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
										
									
								
							
						 
					 
				 
			
		
			
				
					
					
						
							
								
									
										
											
	
		
			
				
					|  |  | @ -64,6 +64,7 @@ URL_ADMIN_CLIENT_AUTHZ_RESOURCES = "admin/realms/{realm-name}/clients/{id}/authz | 
			
		
	
		
			
				
					|  |  |  | URL_ADMIN_CLIENT_CERTS = "admin/realms/{realm-name}/clients/{id}/certificates/{attr}" | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | URL_ADMIN_REALM_ROLES = "admin/realms/{realm-name}/roles" | 
			
		
	
		
			
				
					|  |  |  | URL_ADMIN_REALM_IMPORT = "admin/realms" | 
			
		
	
		
			
				
					|  |  |  | URL_ADMIN_IDPS = "admin/realms/{realm-name}/identity-provider/instances" | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | URL_ADMIN_FLOWS = "admin/realms/{realm-name}/authentication/flows" | 
			
		
	
	
		
			
				
					|  |  | 
 |