@@ -451,6 +451,187 @@ async def RunOnAllMachines(self, applications=None, commands=None, machines=None
451451
452452
453453
454+ class AdminFacade (Type ):
455+ name = 'Admin'
456+ version = 3
457+ schema = {'definitions' : {'Address' : {'additionalProperties' : False ,
458+ 'properties' : {'scope' : {'type' : 'string' },
459+ 'space-id' : {'type' : 'string' },
460+ 'space-name' : {'type' : 'string' },
461+ 'type' : {'type' : 'string' },
462+ 'value' : {'type' : 'string' }},
463+ 'required' : ['value' , 'type' , 'scope' ],
464+ 'type' : 'object' },
465+ 'AuthUserInfo' : {'additionalProperties' : False ,
466+ 'properties' : {'controller-access' : {'type' : 'string' },
467+ 'credentials' : {'type' : 'string' },
468+ 'display-name' : {'type' : 'string' },
469+ 'identity' : {'type' : 'string' },
470+ 'last-connection' : {'format' : 'date-time' ,
471+ 'type' : 'string' },
472+ 'model-access' : {'type' : 'string' }},
473+ 'required' : ['display-name' ,
474+ 'identity' ,
475+ 'controller-access' ,
476+ 'model-access' ],
477+ 'type' : 'object' },
478+ 'FacadeVersions' : {'additionalProperties' : False ,
479+ 'properties' : {'name' : {'type' : 'string' },
480+ 'versions' : {'items' : {'type' : 'integer' },
481+ 'type' : 'array' }},
482+ 'required' : ['name' , 'versions' ],
483+ 'type' : 'object' },
484+ 'HostPort' : {'additionalProperties' : False ,
485+ 'properties' : {'Address' : {'$ref' : '#/definitions/Address' },
486+ 'port' : {'type' : 'integer' },
487+ 'scope' : {'type' : 'string' },
488+ 'space-id' : {'type' : 'string' },
489+ 'space-name' : {'type' : 'string' },
490+ 'type' : {'type' : 'string' },
491+ 'value' : {'type' : 'string' }},
492+ 'required' : ['value' ,
493+ 'type' ,
494+ 'scope' ,
495+ 'Address' ,
496+ 'port' ],
497+ 'type' : 'object' },
498+ 'LoginRequest' : {'additionalProperties' : False ,
499+ 'properties' : {'auth-tag' : {'type' : 'string' },
500+ 'bakery-version' : {'type' : 'integer' },
501+ 'cli-args' : {'type' : 'string' },
502+ 'credentials' : {'type' : 'string' },
503+ 'macaroons' : {'items' : {'items' : {'$ref' : '#/definitions/Macaroon' },
504+ 'type' : 'array' },
505+ 'type' : 'array' },
506+ 'nonce' : {'type' : 'string' },
507+ 'user-data' : {'type' : 'string' }},
508+ 'required' : ['auth-tag' ,
509+ 'credentials' ,
510+ 'nonce' ,
511+ 'macaroons' ,
512+ 'user-data' ],
513+ 'type' : 'object' },
514+ 'LoginResult' : {'additionalProperties' : False ,
515+ 'properties' : {'bakery-discharge-required' : {'$ref' : '#/definitions/Macaroon' },
516+ 'controller-tag' : {'type' : 'string' },
517+ 'discharge-required' : {'$ref' : '#/definitions/Macaroon' },
518+ 'discharge-required-error' : {'type' : 'string' },
519+ 'facades' : {'items' : {'$ref' : '#/definitions/FacadeVersions' },
520+ 'type' : 'array' },
521+ 'model-tag' : {'type' : 'string' },
522+ 'public-dns-name' : {'type' : 'string' },
523+ 'server-version' : {'type' : 'string' },
524+ 'servers' : {'items' : {'items' : {'$ref' : '#/definitions/HostPort' },
525+ 'type' : 'array' },
526+ 'type' : 'array' },
527+ 'user-info' : {'$ref' : '#/definitions/AuthUserInfo' }},
528+ 'type' : 'object' },
529+ 'Macaroon' : {'additionalProperties' : False , 'type' : 'object' },
530+ 'RedirectInfoResult' : {'additionalProperties' : False ,
531+ 'properties' : {'ca-cert' : {'type' : 'string' },
532+ 'servers' : {'items' : {'items' : {'$ref' : '#/definitions/HostPort' },
533+ 'type' : 'array' },
534+ 'type' : 'array' }},
535+ 'required' : ['servers' , 'ca-cert' ],
536+ 'type' : 'object' }},
537+ 'properties' : {'Login' : {'description' : 'Login logs in with the provided '
538+ 'credentials. All subsequent '
539+ 'requests on the\n '
540+ 'connection will act as the '
541+ 'authenticated user.' ,
542+ 'properties' : {'Params' : {'$ref' : '#/definitions/LoginRequest' },
543+ 'Result' : {'$ref' : '#/definitions/LoginResult' }},
544+ 'type' : 'object' },
545+ 'RedirectInfo' : {'description' : 'RedirectInfo returns '
546+ 'redirected host information '
547+ 'for the model.\n '
548+ 'In Juju it always returns an '
549+ 'error because the Juju '
550+ 'controller\n '
551+ 'does not multiplex '
552+ 'controllers.' ,
553+ 'properties' : {'Result' : {'$ref' : '#/definitions/RedirectInfoResult' }},
554+ 'type' : 'object' }},
555+ 'type' : 'object' }
556+
557+
558+ @ReturnMapping (LoginResult )
559+ async def Login (self , auth_tag = None , bakery_version = None , cli_args = None , credentials = None , macaroons = None , nonce = None , user_data = None ):
560+ '''
561+ Login logs in with the provided credentials. All subsequent requests on the
562+ connection will act as the authenticated user.
563+
564+ auth_tag : str
565+ bakery_version : int
566+ cli_args : str
567+ credentials : str
568+ macaroons : typing.Sequence[~Macaroon]
569+ nonce : str
570+ user_data : str
571+ Returns -> LoginResult
572+ '''
573+ if auth_tag is not None and not isinstance (auth_tag , (bytes , str )):
574+ raise Exception ("Expected auth_tag to be a str, received: {}" .format (type (auth_tag )))
575+
576+ if bakery_version is not None and not isinstance (bakery_version , int ):
577+ raise Exception ("Expected bakery_version to be a int, received: {}" .format (type (bakery_version )))
578+
579+ if cli_args is not None and not isinstance (cli_args , (bytes , str )):
580+ raise Exception ("Expected cli_args to be a str, received: {}" .format (type (cli_args )))
581+
582+ if credentials is not None and not isinstance (credentials , (bytes , str )):
583+ raise Exception ("Expected credentials to be a str, received: {}" .format (type (credentials )))
584+
585+ if macaroons is not None and not isinstance (macaroons , (bytes , str , list )):
586+ raise Exception ("Expected macaroons to be a Sequence, received: {}" .format (type (macaroons )))
587+
588+ if nonce is not None and not isinstance (nonce , (bytes , str )):
589+ raise Exception ("Expected nonce to be a str, received: {}" .format (type (nonce )))
590+
591+ if user_data is not None and not isinstance (user_data , (bytes , str )):
592+ raise Exception ("Expected user_data to be a str, received: {}" .format (type (user_data )))
593+
594+ # map input types to rpc msg
595+ _params = dict ()
596+ msg = dict (type = 'Admin' ,
597+ request = 'Login' ,
598+ version = 3 ,
599+ params = _params )
600+ _params ['auth-tag' ] = auth_tag
601+ _params ['bakery-version' ] = bakery_version
602+ _params ['cli-args' ] = cli_args
603+ _params ['credentials' ] = credentials
604+ _params ['macaroons' ] = macaroons
605+ _params ['nonce' ] = nonce
606+ _params ['user-data' ] = user_data
607+ reply = await self .rpc (msg )
608+ return reply
609+
610+
611+
612+ @ReturnMapping (RedirectInfoResult )
613+ async def RedirectInfo (self ):
614+ '''
615+ RedirectInfo returns redirected host information for the model.
616+ In Juju it always returns an error because the Juju controller
617+ does not multiplex controllers.
618+
619+
620+ Returns -> RedirectInfoResult
621+ '''
622+
623+ # map input types to rpc msg
624+ _params = dict ()
625+ msg = dict (type = 'Admin' ,
626+ request = 'RedirectInfo' ,
627+ version = 3 ,
628+ params = _params )
629+
630+ reply = await self .rpc (msg )
631+ return reply
632+
633+
634+
454635class ApplicationFacade (Type ):
455636 name = 'Application'
456637 version = 3
@@ -3061,13 +3242,21 @@ async def WatchUnits(self, entities=None):
30613242class ImageMetadataFacade (Type ):
30623243 name = 'ImageMetadata'
30633244 version = 3
3064- schema = {'properties' : {'UpdateFromPublishedImages' : {'type' : 'object' }},
3245+ schema = {'properties' : {'UpdateFromPublishedImages' : {'description' : 'UpdateFromPublishedImages '
3246+ 'is now a no-op.\n '
3247+ 'It is retained '
3248+ 'for '
3249+ 'compatibility.' ,
3250+ 'type' : 'object' }},
30653251 'type' : 'object' }
30663252
30673253
30683254 @ReturnMapping (None )
30693255 async def UpdateFromPublishedImages (self ):
30703256 '''
3257+ UpdateFromPublishedImages is now a no-op.
3258+ It is retained for compatibility.
3259+
30713260
30723261 Returns -> None
30733262 '''
0 commit comments