[ARVADOS] updated: 2.1.0-1637-ga188cb604

Git user git at public.arvados.org
Mon Nov 22 20:55:30 UTC 2021


Summary of changes:
 lib/controller/federation/conn.go          | 15 +++++++++++++++
 lib/controller/handler.go                  |  2 ++
 lib/controller/router/response.go          |  9 +++++++++
 lib/controller/router/router.go            | 21 +++++++++++++++++++++
 lib/controller/rpc/conn.go                 | 12 ++++++++++++
 sdk/go/arvados/api.go                      |  4 ++++
 sdk/go/arvados/api_client_authorization.go | 23 +++++++++++++++++++----
 sdk/go/arvadostest/api.go                  |  8 ++++++++
 8 files changed, 90 insertions(+), 4 deletions(-)

       via  a188cb604bafb7bd659ccafcc263f445b62a3eed (commit)
      from  18d5692f7720312fecbb05d55508b6639f32f5cb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit a188cb604bafb7bd659ccafcc263f445b62a3eed
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date:   Mon Nov 22 17:53:29 2021 -0300

    17785: Controller forwards apiClientAuthorization requests to remotes.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/lib/controller/federation/conn.go b/lib/controller/federation/conn.go
index d1bf473d7..5959bc35d 100644
--- a/lib/controller/federation/conn.go
+++ b/lib/controller/federation/conn.go
@@ -725,6 +725,21 @@ func (conn *Conn) APIClientAuthorizationCurrent(ctx context.Context, options arv
 	return conn.chooseBackend(options.UUID).APIClientAuthorizationCurrent(ctx, options)
 }
 
+func (conn *Conn) APIClientAuthorizationCreate(ctx context.Context, options arvados.CreateOptions) (arvados.APIClientAuthorization, error) {
+	if conn.cluster.Login.LoginCluster != "" {
+		return conn.chooseBackend(conn.cluster.Login.LoginCluster).APIClientAuthorizationCreate(ctx, options)
+	}
+	ownerUUID, ok := options.Attrs["owner_uuid"].(string)
+	if ok && ownerUUID != "" {
+		return conn.chooseBackend(ownerUUID).APIClientAuthorizationCreate(ctx, options)
+	}
+	return conn.local.APIClientAuthorizationCreate(ctx, options)
+}
+
+func (conn *Conn) APIClientAuthorizationGet(ctx context.Context, options arvados.GetOptions) (arvados.APIClientAuthorization, error) {
+	return conn.chooseBackend(options.UUID).APIClientAuthorizationGet(ctx, options)
+}
+
 type backend interface {
 	arvados.API
 	BaseURL() url.URL
diff --git a/lib/controller/handler.go b/lib/controller/handler.go
index b51d90911..3f29c8f99 100644
--- a/lib/controller/handler.go
+++ b/lib/controller/handler.go
@@ -133,6 +133,8 @@ func (h *Handler) setup() {
 	mux.Handle("/arvados/v1/links/", rtr)
 	mux.Handle("/login", rtr)
 	mux.Handle("/logout", rtr)
+	mux.Handle("/arvados/v1/api_client_authorizations", rtr)
+	mux.Handle("/arvados/v1/api_client_authorizations/", rtr)
 
 	hs := http.NotFoundHandler()
 	hs = prepend(hs, h.proxyRailsAPI)
diff --git a/lib/controller/router/response.go b/lib/controller/router/response.go
index 01126bcb4..c0c599be8 100644
--- a/lib/controller/router/response.go
+++ b/lib/controller/router/response.go
@@ -138,6 +138,7 @@ func (rtr *router) sendError(w http.ResponseWriter, err error) {
 }
 
 var infixMap = map[string]interface{}{
+	"gj3su": arvados.APIClientAuthorization{},
 	"4zz18": arvados.Collection{},
 	"xvhdp": arvados.ContainerRequest{},
 	"dz642": arvados.Container{},
@@ -150,6 +151,11 @@ var infixMap = map[string]interface{}{
 	"7fd4e": arvados.Workflow{},
 }
 
+var specialKindTransforms = map[string]string{
+	"arvados.APIClientAuthorization":     "arvados#apiClientAuthorization",
+	"arvados.APIClientAuthorizationList": "arvados#apiClientAuthorizationList",
+}
+
 var mungeKind = regexp.MustCompile(`\..`)
 
 func kind(resp interface{}) string {
@@ -157,6 +163,9 @@ func kind(resp interface{}) string {
 	if !strings.HasPrefix(t, "arvados.") {
 		return ""
 	}
+	if k, ok := specialKindTransforms[t]; ok {
+		return k
+	}
 	return mungeKind.ReplaceAllStringFunc(t, func(s string) string {
 		// "arvados.CollectionList" => "arvados#collectionList"
 		return "#" + strings.ToLower(s[1:])
diff --git a/lib/controller/router/router.go b/lib/controller/router/router.go
index 02e06279f..be32d9298 100644
--- a/lib/controller/router/router.go
+++ b/lib/controller/router/router.go
@@ -384,6 +384,27 @@ func (rtr *router) addRoutes() {
 				return rtr.backend.SpecimenDelete(ctx, *opts.(*arvados.DeleteOptions))
 			},
 		},
+		{
+			arvados.EndpointAPIClientAuthorizationCreate,
+			func() interface{} { return &arvados.CreateOptions{} },
+			func(ctx context.Context, opts interface{}) (interface{}, error) {
+				return rtr.backend.APIClientAuthorizationCreate(ctx, *opts.(*arvados.CreateOptions))
+			},
+		},
+		{
+			arvados.EndpointAPIClientAuthorizationCurrent,
+			func() interface{} { return &arvados.GetOptions{} },
+			func(ctx context.Context, opts interface{}) (interface{}, error) {
+				return rtr.backend.APIClientAuthorizationCurrent(ctx, *opts.(*arvados.GetOptions))
+			},
+		},
+		{
+			arvados.EndpointAPIClientAuthorizationGet,
+			func() interface{} { return &arvados.GetOptions{} },
+			func(ctx context.Context, opts interface{}) (interface{}, error) {
+				return rtr.backend.APIClientAuthorizationGet(ctx, *opts.(*arvados.GetOptions))
+			},
+		},
 		{
 			arvados.EndpointUserCreate,
 			func() interface{} { return &arvados.CreateOptions{} },
diff --git a/lib/controller/rpc/conn.go b/lib/controller/rpc/conn.go
index 25f47bc3b..8d77047ec 100644
--- a/lib/controller/rpc/conn.go
+++ b/lib/controller/rpc/conn.go
@@ -645,6 +645,18 @@ func (conn *Conn) APIClientAuthorizationCurrent(ctx context.Context, options arv
 	err := conn.requestAndDecode(ctx, &resp, ep, nil, options)
 	return resp, err
 }
+func (conn *Conn) APIClientAuthorizationCreate(ctx context.Context, options arvados.CreateOptions) (arvados.APIClientAuthorization, error) {
+	ep := arvados.EndpointAPIClientAuthorizationCreate
+	var resp arvados.APIClientAuthorization
+	err := conn.requestAndDecode(ctx, &resp, ep, nil, options)
+	return resp, err
+}
+func (conn *Conn) APIClientAuthorizationGet(ctx context.Context, options arvados.GetOptions) (arvados.APIClientAuthorization, error) {
+	ep := arvados.EndpointAPIClientAuthorizationGet
+	var resp arvados.APIClientAuthorization
+	err := conn.requestAndDecode(ctx, &resp, ep, nil, options)
+	return resp, err
+}
 
 type UserSessionAuthInfo struct {
 	UserUUID        string    `json:"user_uuid"`
diff --git a/sdk/go/arvados/api.go b/sdk/go/arvados/api.go
index 0fdc13d19..78e0a363c 100644
--- a/sdk/go/arvados/api.go
+++ b/sdk/go/arvados/api.go
@@ -84,6 +84,8 @@ var (
 	EndpointUserBatchUpdate               = APIEndpoint{"PATCH", "arvados/v1/users/batch_update", ""}
 	EndpointUserAuthenticate              = APIEndpoint{"POST", "arvados/v1/users/authenticate", ""}
 	EndpointAPIClientAuthorizationCurrent = APIEndpoint{"GET", "arvados/v1/api_client_authorizations/current", ""}
+	EndpointAPIClientAuthorizationCreate  = APIEndpoint{"POST", "arvados/v1/api_client_authorizations", "api_client_authorization"}
+	EndpointAPIClientAuthorizationGet     = APIEndpoint{"GET", "arvados/v1/api_client_authorizations/{uuid}", ""}
 )
 
 type ContainerSSHOptions struct {
@@ -283,4 +285,6 @@ type API interface {
 	UserBatchUpdate(context.Context, UserBatchUpdateOptions) (UserList, error)
 	UserAuthenticate(ctx context.Context, options UserAuthenticateOptions) (APIClientAuthorization, error)
 	APIClientAuthorizationCurrent(ctx context.Context, options GetOptions) (APIClientAuthorization, error)
+	APIClientAuthorizationCreate(ctx context.Context, options CreateOptions) (APIClientAuthorization, error)
+	APIClientAuthorizationGet(ctx context.Context, options GetOptions) (APIClientAuthorization, error)
 }
diff --git a/sdk/go/arvados/api_client_authorization.go b/sdk/go/arvados/api_client_authorization.go
index 7c17cdef0..0fb1dd894 100644
--- a/sdk/go/arvados/api_client_authorization.go
+++ b/sdk/go/arvados/api_client_authorization.go
@@ -4,12 +4,27 @@
 
 package arvados
 
+import "time"
+
 // APIClientAuthorization is an arvados#apiClientAuthorization resource.
 type APIClientAuthorization struct {
-	UUID      string   `json:"uuid"`
-	APIToken  string   `json:"api_token"`
-	ExpiresAt string   `json:"expires_at"`
-	Scopes    []string `json:"scopes"`
+	UUID                 string    `json:"uuid"`
+	APIClientID          int       `json:"api_client_id"`
+	APIToken             string    `json:"api_token"`
+	CreatedAt            time.Time `json:"created_at"`
+	CreatedByIPAddress   *string   `json:"created_by_ip_address"`
+	DefaultOwnerUUID     *string   `json:"default_owner_uuid"`
+	Etag                 string    `json:"etag"`
+	ExpiresAt            string    `json:"expires_at"`
+	Href                 string    `json:"href"`
+	LastUsedAt           time.Time `json:"last_used_at"`
+	LastUsedByIPAddress  *string   `json:"last_used_by_ip_address"`
+	ModifiedAt           time.Time `json:"modified_at"`
+	ModifiedByClientUUID *string   `json:"modified_by_client_uuid"`
+	ModifiedByUserUUID   *string   `json:"modified_by_user_uuid"`
+	OwnerUUID            string    `json:"owner_uuid"`
+	Scopes               []string  `json:"scopes"`
+	UserID               int       `json:"user_id"`
 }
 
 // APIClientAuthorizationList is an arvados#apiClientAuthorizationList resource.
diff --git a/sdk/go/arvadostest/api.go b/sdk/go/arvadostest/api.go
index 0af477125..d59150589 100644
--- a/sdk/go/arvadostest/api.go
+++ b/sdk/go/arvadostest/api.go
@@ -265,6 +265,14 @@ func (as *APIStub) APIClientAuthorizationCurrent(ctx context.Context, options ar
 	as.appendCall(ctx, as.APIClientAuthorizationCurrent, options)
 	return arvados.APIClientAuthorization{}, as.Error
 }
+func (as *APIStub) APIClientAuthorizationCreate(ctx context.Context, options arvados.CreateOptions) (arvados.APIClientAuthorization, error) {
+	as.appendCall(ctx, as.APIClientAuthorizationCreate, options)
+	return arvados.APIClientAuthorization{}, as.Error
+}
+func (as *APIStub) APIClientAuthorizationGet(ctx context.Context, options arvados.GetOptions) (arvados.APIClientAuthorization, error) {
+	as.appendCall(ctx, as.APIClientAuthorizationGet, options)
+	return arvados.APIClientAuthorization{}, as.Error
+}
 
 func (as *APIStub) appendCall(ctx context.Context, method interface{}, options interface{}) {
 	as.mtx.Lock()

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list