anaconda / ae5-tools

A command-line tool for scripting AE5 actions
https://www.anaconda.com/enterprise/
BSD 3-Clause "New" or "Revised" License
9 stars 8 forks source link

Reduce api calls for impersonation #199

Closed mcg1969 closed 4 weeks ago

mcg1969 commented 1 month ago

Before:

$ API_DEBUG=1 ae5 project list --impersonate
Connecting to user account anaconda-enterprise@anaconda.example.com.
Connecting to admin account admin@anaconda.example.com.
POST https://anaconda.example.com/auth/realms/master/protocol/openid-connect/token 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/ae-admin/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/ae-creator/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/ae-deployer/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/ae-uploader/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/ae-userview/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/default-roles-anaconda-platform/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/default-roles-anacondaplatform/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/offline_access/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/uma_authorization/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/groups?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/groups/41a03f1d-306d-4f19-a819-97a60e10f049/members?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/groups/a753d069-2cbf-4663-884e-37c8a44ac7d9/members?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/groups/d0f377c9-6c9c-4140-bfdc-e6557f50dac7/members?... 200
POST https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/users/f605d5ca-409f-45a2-8421-5a2640719dda/impersonation 200
GET https://anaconda.example.com/auth/realms/AnacondaPlatform/protocol/openid-connect/auth?... 302
GET https://anaconda.example.com/login?... 302
GET https://anaconda.example.com/?... 200
GET https://anaconda.example.com/api/v2/projects 200

After:

$ API_DEBUG=1 ae5 project list --impersonate
Connecting to user account anaconda-enterprise@anaconda.example.com.
Connecting to admin account admin@anaconda.example.com.
Password for admin@anaconda.example.com: 
POST https://anaconda.example.com/auth/realms/master/protocol/openid-connect/token 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/users?... 200
POST https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/users/f605d5ca-409f-45a2-8421-5a2640719dda/impersonation 200
GET https://anaconda.example.com/auth/realms/AnacondaPlatform/protocol/openid-connect/auth?... 302
GET https://anaconda.example.com/login?... 302
GET https://anaconda.example.com/?... 200
GET https://anaconda.example.com/api/v2/projects 200
                                                     project
                     resource                        _create  --- s3_ ---    ...
name  owner  editor  _profile  id  created  updated  _status  bucket  path  s...
----  -----  ------  --------  --  -------  -------  -------  ------  ----  ----
mcg1969 commented 1 month ago

@joshburt this is passing anaconda-platform-system tests on my machine