Add IAM identity alias to API

This commit is contained in:
Ingo Oppermann
2023-08-03 17:28:02 +03:00
parent 2c2d460a19
commit 0b718b8b18
7 changed files with 288 additions and 0 deletions

View File

@@ -1997,6 +1997,9 @@ const docTemplateClusterAPI = `{
"identity.User": { "identity.User": {
"type": "object", "type": "object",
"properties": { "properties": {
"alias": {
"type": "string"
},
"auth": { "auth": {
"$ref": "#/definitions/identity.UserAuth" "$ref": "#/definitions/identity.UserAuth"
}, },

View File

@@ -1989,6 +1989,9 @@
"identity.User": { "identity.User": {
"type": "object", "type": "object",
"properties": { "properties": {
"alias": {
"type": "string"
},
"auth": { "auth": {
"$ref": "#/definitions/identity.UserAuth" "$ref": "#/definitions/identity.UserAuth"
}, },

View File

@@ -583,6 +583,8 @@ definitions:
type: object type: object
identity.User: identity.User:
properties: properties:
alias:
type: string
auth: auth:
$ref: '#/definitions/identity.UserAuth' $ref: '#/definitions/identity.UserAuth'
name: name:

View File

@@ -375,6 +375,92 @@ const docTemplate = `{
} }
} }
}, },
"/api/v3/cluster/fs/{storage}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "List all files on a filesystem. The listing can be ordered by name, size, or date of last modification in ascending or descending order.",
"produces": [
"application/json"
],
"tags": [
"v16.?.?"
],
"summary": "List all files on a filesystem",
"operationId": "cluster-3-list-files",
"parameters": [
{
"type": "string",
"description": "Name of the filesystem",
"name": "storage",
"in": "path",
"required": true
},
{
"type": "string",
"description": "glob pattern for file names",
"name": "glob",
"in": "query"
},
{
"type": "integer",
"description": "minimal size of files",
"name": "size_min",
"in": "query"
},
{
"type": "integer",
"description": "maximal size of files",
"name": "size_max",
"in": "query"
},
{
"type": "integer",
"description": "minimal last modification time",
"name": "lastmod_start",
"in": "query"
},
{
"type": "integer",
"description": "maximal last modification time",
"name": "lastmod_end",
"in": "query"
},
{
"type": "string",
"description": "none, name, size, lastmod",
"name": "sort",
"in": "query"
},
{
"type": "string",
"description": "asc, desc",
"name": "order",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/api.FileInfo"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
}
},
"/api/v3/cluster/healthy": { "/api/v3/cluster/healthy": {
"get": { "get": {
"security": [ "security": [
@@ -4594,6 +4680,9 @@ const docTemplate = `{
"description": "percent 0-100*npcu", "description": "percent 0-100*npcu",
"type": "number" "type": "number"
}, },
"error": {
"type": "string"
},
"is_throttling": { "is_throttling": {
"type": "boolean" "type": "boolean"
}, },
@@ -5327,6 +5416,12 @@ const docTemplate = `{
}, },
"event": { "event": {
"type": "string" "type": "string"
},
"level": {
"type": "string"
},
"message": {
"type": "string"
} }
} }
}, },
@@ -5344,6 +5439,9 @@ const docTemplate = `{
"api.FileInfo": { "api.FileInfo": {
"type": "object", "type": "object",
"properties": { "properties": {
"core_id": {
"type": "string"
},
"last_modified": { "last_modified": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
@@ -5475,6 +5573,9 @@ const docTemplate = `{
"api.IAMUser": { "api.IAMUser": {
"type": "object", "type": "object",
"properties": { "properties": {
"alias": {
"type": "string"
},
"auth": { "auth": {
"$ref": "#/definitions/api.IAMUserAuth" "$ref": "#/definitions/api.IAMUserAuth"
}, },
@@ -6886,6 +6987,9 @@ const docTemplate = `{
}, },
"token": { "token": {
"type": "string" "type": "string"
},
"ttl_sec": {
"type": "integer"
} }
} }
}, },

View File

@@ -367,6 +367,92 @@
} }
} }
}, },
"/api/v3/cluster/fs/{storage}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "List all files on a filesystem. The listing can be ordered by name, size, or date of last modification in ascending or descending order.",
"produces": [
"application/json"
],
"tags": [
"v16.?.?"
],
"summary": "List all files on a filesystem",
"operationId": "cluster-3-list-files",
"parameters": [
{
"type": "string",
"description": "Name of the filesystem",
"name": "storage",
"in": "path",
"required": true
},
{
"type": "string",
"description": "glob pattern for file names",
"name": "glob",
"in": "query"
},
{
"type": "integer",
"description": "minimal size of files",
"name": "size_min",
"in": "query"
},
{
"type": "integer",
"description": "maximal size of files",
"name": "size_max",
"in": "query"
},
{
"type": "integer",
"description": "minimal last modification time",
"name": "lastmod_start",
"in": "query"
},
{
"type": "integer",
"description": "maximal last modification time",
"name": "lastmod_end",
"in": "query"
},
{
"type": "string",
"description": "none, name, size, lastmod",
"name": "sort",
"in": "query"
},
{
"type": "string",
"description": "asc, desc",
"name": "order",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/api.FileInfo"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
}
},
"/api/v3/cluster/healthy": { "/api/v3/cluster/healthy": {
"get": { "get": {
"security": [ "security": [
@@ -4586,6 +4672,9 @@
"description": "percent 0-100*npcu", "description": "percent 0-100*npcu",
"type": "number" "type": "number"
}, },
"error": {
"type": "string"
},
"is_throttling": { "is_throttling": {
"type": "boolean" "type": "boolean"
}, },
@@ -5319,6 +5408,12 @@
}, },
"event": { "event": {
"type": "string" "type": "string"
},
"level": {
"type": "string"
},
"message": {
"type": "string"
} }
} }
}, },
@@ -5336,6 +5431,9 @@
"api.FileInfo": { "api.FileInfo": {
"type": "object", "type": "object",
"properties": { "properties": {
"core_id": {
"type": "string"
},
"last_modified": { "last_modified": {
"type": "integer", "type": "integer",
"format": "int64" "format": "int64"
@@ -5467,6 +5565,9 @@
"api.IAMUser": { "api.IAMUser": {
"type": "object", "type": "object",
"properties": { "properties": {
"alias": {
"type": "string"
},
"auth": { "auth": {
"$ref": "#/definitions/api.IAMUserAuth" "$ref": "#/definitions/api.IAMUserAuth"
}, },
@@ -6878,6 +6979,9 @@
}, },
"token": { "token": {
"type": "string" "type": "string"
},
"ttl_sec": {
"type": "integer"
} }
} }
}, },

View File

@@ -174,6 +174,8 @@ definitions:
cpu_used: cpu_used:
description: percent 0-100*npcu description: percent 0-100*npcu
type: number type: number
error:
type: string
is_throttling: is_throttling:
type: boolean type: boolean
memory_limit_bytes: memory_limit_bytes:
@@ -668,6 +670,10 @@ definitions:
type: object type: object
event: event:
type: string type: string
level:
type: string
message:
type: string
type: object type: object
api.EventFilters: api.EventFilters:
properties: properties:
@@ -678,6 +684,8 @@ definitions:
type: object type: object
api.FileInfo: api.FileInfo:
properties: properties:
core_id:
type: string
last_modified: last_modified:
format: int64 format: int64
type: integer type: integer
@@ -765,6 +773,8 @@ definitions:
type: object type: object
api.IAMUser: api.IAMUser:
properties: properties:
alias:
type: string
auth: auth:
$ref: '#/definitions/api.IAMUserAuth' $ref: '#/definitions/api.IAMUserAuth'
name: name:
@@ -1791,6 +1801,8 @@ definitions:
type: array type: array
token: token:
type: string type: string
ttl_sec:
type: integer
type: object type: object
api.SessionsActive: api.SessionsActive:
additionalProperties: additionalProperties:
@@ -2664,6 +2676,63 @@ paths:
summary: List of identities in the cluster summary: List of identities in the cluster
tags: tags:
- v16.?.? - v16.?.?
/api/v3/cluster/fs/{storage}:
get:
description: List all files on a filesystem. The listing can be ordered by name,
size, or date of last modification in ascending or descending order.
operationId: cluster-3-list-files
parameters:
- description: Name of the filesystem
in: path
name: storage
required: true
type: string
- description: glob pattern for file names
in: query
name: glob
type: string
- description: minimal size of files
in: query
name: size_min
type: integer
- description: maximal size of files
in: query
name: size_max
type: integer
- description: minimal last modification time
in: query
name: lastmod_start
type: integer
- description: maximal last modification time
in: query
name: lastmod_end
type: integer
- description: none, name, size, lastmod
in: query
name: sort
type: string
- description: asc, desc
in: query
name: order
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/api.FileInfo'
type: array
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/api.Error'
security:
- ApiKeyAuth: []
summary: List all files on a filesystem
tags:
- v16.?.?
/api/v3/cluster/healthy: /api/v3/cluster/healthy:
get: get:
description: Whether the cluster is healthy description: Whether the cluster is healthy

View File

@@ -7,6 +7,7 @@ import (
type IAMUser struct { type IAMUser struct {
Name string `json:"name"` Name string `json:"name"`
Alias string `json:"alias"`
Superuser bool `json:"superuser"` Superuser bool `json:"superuser"`
Auth IAMUserAuth `json:"auth"` Auth IAMUserAuth `json:"auth"`
Policies []IAMPolicy `json:"policies"` Policies []IAMPolicy `json:"policies"`
@@ -14,6 +15,7 @@ type IAMUser struct {
func (u *IAMUser) Marshal(user identity.User, policies []access.Policy) { func (u *IAMUser) Marshal(user identity.User, policies []access.Policy) {
u.Name = user.Name u.Name = user.Name
u.Alias = user.Alias
u.Superuser = user.Superuser u.Superuser = user.Superuser
u.Auth = IAMUserAuth{ u.Auth = IAMUserAuth{
API: IAMUserAuthAPI{ API: IAMUserAuthAPI{
@@ -46,6 +48,7 @@ func (u *IAMUser) Marshal(user identity.User, policies []access.Policy) {
func (u *IAMUser) Unmarshal() (identity.User, []access.Policy) { func (u *IAMUser) Unmarshal() (identity.User, []access.Policy) {
iamuser := identity.User{ iamuser := identity.User{
Name: u.Name, Name: u.Name,
Alias: u.Alias,
Superuser: u.Superuser, Superuser: u.Superuser,
Auth: identity.UserAuth{ Auth: identity.UserAuth{
API: identity.UserAuthAPI{ API: identity.UserAuthAPI{