@@ -533,3 +533,133 @@ async def create_oauth2_credential_provider_with_dcr(
533533
534534 # Create the credential provider with updated config
535535 return self .create_oauth2_credential_provider (request_params )
536+
537+ def create_user_pool (self , name : str ) -> str :
538+ from volcenginesdkid import CreateUserPoolRequest , CreateUserPoolResponse
539+
540+ request = CreateUserPoolRequest (
541+ name = name ,
542+ )
543+ response : CreateUserPoolResponse = self ._api_client .create_user_pool (request )
544+
545+ return response .uid
546+
547+ def get_user_pool (self , name : str ) -> str | None :
548+ from volcenginesdkid import (
549+ ListUserPoolsRequest ,
550+ ListUserPoolsResponse ,
551+ FilterForListUserPoolsInput ,
552+ DataForListUsersOutput ,
553+ )
554+
555+ request = ListUserPoolsRequest (
556+ page_number = 1 ,
557+ page_size = 1 ,
558+ filter = FilterForListUserPoolsInput (
559+ name = name ,
560+ ),
561+ )
562+ response : ListUserPoolsResponse = self ._api_client .list_user_pools (request )
563+ if response .total_count == 0 :
564+ return None
565+
566+ user_pool : DataForListUsersOutput = response .data [0 ]
567+ return user_pool .uid
568+
569+ def create_user_pool_client (
570+ self , user_pool_uid : str , name : str , client_type : str
571+ ) -> tuple [str , str ]:
572+ from volcenginesdkid import (
573+ CreateUserPoolClientRequest ,
574+ CreateUserPoolClientResponse ,
575+ )
576+
577+ request = CreateUserPoolClientRequest (
578+ user_pool_uid = user_pool_uid ,
579+ name = name ,
580+ client_type = client_type ,
581+ )
582+ response : CreateUserPoolClientResponse = (
583+ self ._api_client .create_user_pool_client (request )
584+ )
585+ return response .uid , response .client_secret
586+
587+ def register_callback_for_user_pool_client (
588+ self ,
589+ user_pool_uid : str ,
590+ client_uid : str ,
591+ callback_url : str ,
592+ web_origin : str ,
593+ ):
594+ from volcenginesdkid import (
595+ GetUserPoolClientRequest ,
596+ GetUserPoolClientResponse ,
597+ UpdateUserPoolClientRequest ,
598+ )
599+
600+ request = GetUserPoolClientRequest (
601+ user_pool_uid = user_pool_uid ,
602+ client_uid = client_uid ,
603+ )
604+ response : GetUserPoolClientResponse = self ._api_client .get_user_pool_client (
605+ request
606+ )
607+
608+ allowed_callback_urls = response .allowed_callback_urls
609+ if not allowed_callback_urls :
610+ allowed_callback_urls = []
611+ allowed_callback_urls .append (callback_url )
612+ allowed_web_origins = response .allowed_web_origins
613+ if not allowed_web_origins :
614+ allowed_web_origins = []
615+ allowed_web_origins .append (web_origin )
616+
617+ request2 = UpdateUserPoolClientRequest (
618+ user_pool_uid = user_pool_uid ,
619+ client_uid = client_uid ,
620+ name = response .name ,
621+ description = response .description ,
622+ allowed_callback_urls = allowed_callback_urls ,
623+ allowed_logout_urls = response .allowed_logout_urls ,
624+ allowed_web_origins = allowed_web_origins ,
625+ allowed_cors = response .allowed_cors ,
626+ id_token = response .id_token ,
627+ refresh_token = response .refresh_token ,
628+ )
629+ self ._api_client .update_user_pool_client (request2 )
630+
631+ def get_user_pool_client (
632+ self , user_pool_uid : str , name : str
633+ ) -> tuple [str , str ] | None :
634+ from volcenginesdkid import (
635+ ListUserPoolClientsRequest ,
636+ ListUserPoolClientsResponse ,
637+ FilterForListUserPoolClientsInput ,
638+ DataForListUserPoolClientsOutput ,
639+ GetUserPoolClientRequest ,
640+ GetUserPoolClientResponse ,
641+ )
642+
643+ request = ListUserPoolClientsRequest (
644+ user_pool_uid = user_pool_uid ,
645+ page_number = 1 ,
646+ page_size = 1 ,
647+ filter = FilterForListUserPoolClientsInput (
648+ name = name ,
649+ ),
650+ )
651+ response : ListUserPoolClientsResponse = self ._api_client .list_user_pool_clients (
652+ request
653+ )
654+ if response .total_count == 0 :
655+ return None
656+
657+ client : DataForListUserPoolClientsOutput = response .data [0 ]
658+ request2 = GetUserPoolClientRequest (
659+ user_pool_uid = user_pool_uid ,
660+ client_uid = client .uid ,
661+ )
662+ response2 : GetUserPoolClientResponse = self ._api_client .get_user_pool_client (
663+ request2
664+ )
665+ return response2 .uid , response2 .client_secret
0 commit comments