From 78e40e2979cd5bb4b620ca8ec9649731db7a7112 Mon Sep 17 00:00:00 2001 From: "taekyu.kang" Date: Thu, 4 Apr 2024 18:07:15 +0900 Subject: [PATCH] feature. add & update default snr --- api/swagger/docs.go | 997 +++++++++++++----- api/swagger/swagger.json | 997 +++++++++++++----- api/swagger/swagger.yaml | 614 ++++++++--- internal/delivery/http/role.go | 20 +- .../delivery/http/system-notification-rule.go | 2 +- internal/delivery/http/user.go | 10 +- internal/usecase/system-notification-rule.go | 6 +- pkg/domain/system-notification-template.go | 2 +- scripts/init_postgres.sql | 12 +- 9 files changed, 1919 insertions(+), 741 deletions(-) diff --git a/api/swagger/docs.go b/api/swagger/docs.go index 3b318de7..71b72122 100644 --- a/api/swagger/docs.go +++ b/api/swagger/docs.go @@ -202,6 +202,45 @@ const docTemplate = `{ } } }, + "/admin/organizations": { + "post": { + "security": [ + { + "JWT": [] + } + ], + "description": "Create organization in Admin portal", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Organizations" + ], + "summary": "Create organization in Admin portal", + "parameters": [ + { + "description": "create organization request", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.CreateOrganizationRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object" + } + } + } + } + }, "/admin/organizations/{organizationId}/projects": { "get": { "security": [ @@ -241,6 +280,11 @@ const docTemplate = `{ }, "/admin/organizations/{organizationId}/roles": { "get": { + "security": [ + { + "JWT": [] + } + ], "description": "Admin List Tks Roles", "produces": [ "application/json" @@ -270,6 +314,11 @@ const docTemplate = `{ }, "/admin/organizations/{organizationId}/roles/{roleId}": { "get": { + "security": [ + { + "JWT": [] + } + ], "description": "Admin Get Tks Role", "produces": [ "application/json" @@ -304,9 +353,14 @@ const docTemplate = `{ } } }, - "/admin/organizations/{organizationId}/users/{accountId}": { - "get": { - "description": "Get user detail by admin", + "/admin/organizations/{organizationId}/users": { + "post": { + "security": [ + { + "JWT": [] + } + ], + "description": "Create user by admin in Admin Portal", "consumes": [ "application/json" ], @@ -316,7 +370,7 @@ const docTemplate = `{ "tags": [ "Users" ], - "summary": "Get user detail by admin", + "summary": "Create user by admin in Admin Portal", "parameters": [ { "type": "string", @@ -326,29 +380,33 @@ const docTemplate = `{ "required": true }, { - "type": "string", - "description": "accountId", - "name": "accountId", - "in": "path", - "required": true + "description": "create user request", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.Admin_CreateUserRequest" + } } ], "responses": { "200": { - "description": "OK", + "description": "create user response", "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain_admin.GetUserResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.Admin_CreateUserResponse" } } } - }, + } + }, + "/admin/organizations/{organizationId}/users/{accountId}": { "put": { "security": [ { "JWT": [] } ], - "description": "Update user by admin", + "description": "Update user by admin in Admin Portal", "consumes": [ "application/json" ], @@ -358,7 +416,7 @@ const docTemplate = `{ "tags": [ "Users" ], - "summary": "Update user by admin", + "summary": "Update user by admin in Admin Portal", "parameters": [ { "type": "string", @@ -380,7 +438,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain_admin.UpdateUserRequest" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.Admin_UpdateUserRequest" } } ], @@ -388,8 +446,56 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain_admin.UpdateUserResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.Admin_UpdateUserResponse" + } + } + } + }, + "delete": { + "security": [ + { + "JWT": [] + } + ], + "description": "Delete user by admin in Admin Portal", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Users" + ], + "summary": "Delete user by admin in Admin Portal", + "parameters": [ + { + "description": "input", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.DeleteUserRequest" } + }, + { + "type": "string", + "description": "organizationId", + "name": "organizationId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "accountId", + "name": "accountId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK" } } } @@ -2532,43 +2638,6 @@ const docTemplate = `{ } } } - }, - "post": { - "security": [ - { - "JWT": [] - } - ], - "description": "Create organization", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Organizations" - ], - "summary": "Create organization", - "parameters": [ - { - "description": "create organization request", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.CreateOrganizationRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "object" - } - } - } } }, "/organizations/name/{name}/existence": { @@ -7096,25 +7165,36 @@ const docTemplate = `{ } } }, - "/organizations/{organizationId}/stack-templates": { + "/organizations/{organizationId}/roles/{roleId}/users": { "get": { "security": [ { "JWT": [] } ], - "description": "Get Organization StackTemplates", - "consumes": [ - "application/json" - ], + "description": "Get Users By Role ID", "produces": [ "application/json" ], "tags": [ - "StackTemplates" + "Roles" ], - "summary": "Get Organization StackTemplates", + "summary": "Get Users By Role ID", "parameters": [ + { + "type": "string", + "description": "Organization ID", + "name": "organizationId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Role ID", + "name": "roleId", + "in": "path", + "required": true + }, { "type": "string", "description": "pageSize", @@ -7154,18 +7234,18 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetStackTemplatesResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetUsersInRoleIdResponse" } } } }, - "put": { + "post": { "security": [ { "JWT": [] } ], - "description": "Remove organization stackTemplates", + "description": "Append Users To Role", "consumes": [ "application/json" ], @@ -7173,17 +7253,31 @@ const docTemplate = `{ "application/json" ], "tags": [ - "StackTemplates" + "Roles" ], - "summary": "Remove organization stackTemplates", + "summary": "Append Users To Role", "parameters": [ { - "description": "Remove organization stack templates request", + "type": "string", + "description": "Organization ID", + "name": "organizationId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Role ID", + "name": "roleId", + "in": "path", + "required": true + }, + { + "description": "Append Users To Role Request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RemoveOrganizationStackTemplatesRequest" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.AppendUsersToRoleRequest" } } ], @@ -7193,13 +7287,13 @@ const docTemplate = `{ } } }, - "post": { + "delete": { "security": [ { "JWT": [] } ], - "description": "Add organization stackTemplates", + "description": "Remove Users From Role", "consumes": [ "application/json" ], @@ -7207,17 +7301,31 @@ const docTemplate = `{ "application/json" ], "tags": [ - "StackTemplates" + "Roles" ], - "summary": "Add organization stackTemplates", + "summary": "Remove Users From Role", "parameters": [ { - "description": "Add organization stack templates request", + "type": "string", + "description": "Organization ID", + "name": "organizationId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Role ID", + "name": "roleId", + "in": "path", + "required": true + }, + { + "description": "Remove Users From Role Request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.AddOrganizationStackTemplatesRequest" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RemoveUsersFromRoleRequest" } } ], @@ -7228,42 +7336,55 @@ const docTemplate = `{ } } }, - "/organizations/{organizationId}/stack-templates/{stackTemplateId}": { + "/organizations/{organizationId}/roles/{roleName}/existence": { "get": { "security": [ { "JWT": [] } ], - "description": "Get Organization StackTemplate", - "consumes": [ - "application/json" - ], + "description": "Check whether the role name exists", "produces": [ "application/json" ], "tags": [ - "StackTemplates" + "Roles" + ], + "summary": "Check whether the role name exists", + "parameters": [ + { + "type": "string", + "description": "Organization ID", + "name": "organizationId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Role Name", + "name": "roleName", + "in": "path", + "required": true + } ], - "summary": "Get Organization StackTemplate", "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetStackTemplateResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.CheckRoleNameResponse" } } } } }, - "/organizations/{organizationId}/stacks": { + "/organizations/{organizationId}/stack-templates": { "get": { "security": [ { "JWT": [] } ], - "description": "Get Stacks", + "description": "Get Organization StackTemplates", "consumes": [ "application/json" ], @@ -7271,16 +7392,176 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Stacks" + "StackTemplates" ], - "summary": "Get Stacks", + "summary": "Get Organization StackTemplates", "parameters": [ { "type": "string", - "description": "organizationId", - "name": "organizationId", - "in": "path", - "required": true + "description": "pageSize", + "name": "pageSize", + "in": "query" + }, + { + "type": "string", + "description": "pageNumber", + "name": "pageNumber", + "in": "query" + }, + { + "type": "string", + "description": "sortColumn", + "name": "soertColumn", + "in": "query" + }, + { + "type": "string", + "description": "sortOrder", + "name": "sortOrder", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "description": "filters", + "name": "filters", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetStackTemplatesResponse" + } + } + } + }, + "put": { + "security": [ + { + "JWT": [] + } + ], + "description": "Remove organization stackTemplates", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "StackTemplates" + ], + "summary": "Remove organization stackTemplates", + "parameters": [ + { + "description": "Remove organization stack templates request", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RemoveOrganizationStackTemplatesRequest" + } + } + ], + "responses": { + "200": { + "description": "OK" + } + } + }, + "post": { + "security": [ + { + "JWT": [] + } + ], + "description": "Add organization stackTemplates", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "StackTemplates" + ], + "summary": "Add organization stackTemplates", + "parameters": [ + { + "description": "Add organization stack templates request", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.AddOrganizationStackTemplatesRequest" + } + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/organizations/{organizationId}/stack-templates/{stackTemplateId}": { + "get": { + "security": [ + { + "JWT": [] + } + ], + "description": "Get Organization StackTemplate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "StackTemplates" + ], + "summary": "Get Organization StackTemplate", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetStackTemplateResponse" + } + } + } + } + }, + "/organizations/{organizationId}/stacks": { + "get": { + "security": [ + { + "JWT": [] + } + ], + "description": "Get Stacks", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Stacks" + ], + "summary": "Get Stacks", + "parameters": [ + { + "type": "string", + "description": "organizationId", + "name": "organizationId", + "in": "path", + "required": true }, { "type": "string", @@ -8460,6 +8741,50 @@ const docTemplate = `{ } } }, + "put": { + "security": [ + { + "JWT": [] + } + ], + "description": "Update multiple users", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Users" + ], + "summary": "Update multiple users", + "parameters": [ + { + "type": "string", + "description": "organizationId", + "name": "organizationId", + "in": "path", + "required": true + }, + { + "description": "input", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.UpdateUsersRequest" + } + } + } + ], + "responses": { + "200": { + "description": "OK" + } + } + }, "post": { "security": [ { @@ -9148,6 +9473,129 @@ const docTemplate = `{ } } }, + "github_com_openinfradev_tks-api_pkg_domain.Admin_CreateUserRequest": { + "type": "object", + "required": [ + "accountId", + "email", + "roles" + ], + "properties": { + "accountId": { + "type": "string" + }, + "adminPassword": { + "type": "string" + }, + "department": { + "type": "string", + "maxLength": 50, + "minLength": 0 + }, + "description": { + "type": "string", + "maxLength": 100, + "minLength": 0 + }, + "email": { + "type": "string" + }, + "name": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.UserCreationRole" + } + } + } + }, + "github_com_openinfradev_tks-api_pkg_domain.Admin_CreateUserResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + } + }, + "github_com_openinfradev_tks-api_pkg_domain.Admin_UpdateUserRequest": { + "type": "object", + "required": [ + "email", + "roles" + ], + "properties": { + "adminPassword": { + "type": "string" + }, + "department": { + "type": "string", + "maxLength": 50, + "minLength": 0 + }, + "description": { + "type": "string", + "maxLength": 100, + "minLength": 0 + }, + "email": { + "type": "string" + }, + "name": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.UserCreationRole" + } + } + } + }, + "github_com_openinfradev_tks-api_pkg_domain.Admin_UpdateUserResponse": { + "type": "object", + "properties": { + "user": { + "type": "object", + "properties": { + "accountId": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "department": { + "type": "string" + }, + "description": { + "type": "string" + }, + "email": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "organization": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } + }, + "updatedAt": { + "type": "string" + } + } + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.AppGroupResponse": { "type": "object", "properties": { @@ -9394,6 +9842,20 @@ const docTemplate = `{ } } }, + "github_com_openinfradev_tks-api_pkg_domain.AppendUsersToRoleRequest": { + "type": "object", + "required": [ + "users" + ], + "properties": { + "users": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.ApplicationResponse": { "type": "object", "properties": { @@ -9550,6 +10012,14 @@ const docTemplate = `{ } } }, + "github_com_openinfradev_tks-api_pkg_domain.CheckRoleNameResponse": { + "type": "object", + "properties": { + "isExist": { + "type": "boolean" + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.CheckStackTemplateNameResponse": { "type": "object", "properties": { @@ -10680,7 +11150,7 @@ const docTemplate = `{ "accountId", "email", "password", - "role" + "roles" ], "properties": { "accountId": { @@ -10705,12 +11175,11 @@ const docTemplate = `{ "password": { "type": "string" }, - "role": { - "type": "string", - "enum": [ - "admin", - "user" - ] + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.UserCreationRole" + } } } }, @@ -10741,8 +11210,11 @@ const docTemplate = `{ "organization": { "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse" + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } } } } @@ -10866,6 +11338,14 @@ const docTemplate = `{ } } }, + "github_com_openinfradev_tks-api_pkg_domain.DeleteUserRequest": { + "type": "object", + "properties": { + "adminPassword": { + "type": "string" + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.EndpointResponse": { "type": "object", "properties": { @@ -11268,8 +11748,11 @@ const docTemplate = `{ "organization": { "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse" + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } } } } @@ -11667,8 +12150,11 @@ const docTemplate = `{ "organization": { "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse" + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } }, "updatedAt": { "type": "string" @@ -11677,6 +12163,20 @@ const docTemplate = `{ } } }, + "github_com_openinfradev_tks-api_pkg_domain.GetUsersInRoleIdResponse": { + "type": "object", + "properties": { + "pagination": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PaginationResponse" + }, + "users": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleUserResponse" + } + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.GetUsersPermissionsResponse": { "type": "object", "properties": { @@ -11872,8 +12372,11 @@ const docTemplate = `{ "organization": { "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse" + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } }, "updatedAt": { "type": "string" @@ -11920,8 +12423,11 @@ const docTemplate = `{ "passwordExpired": { "type": "boolean" }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleIdRoleNameResponse" + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } }, "token": { "type": "string" @@ -12716,6 +13222,20 @@ const docTemplate = `{ } } }, + "github_com_openinfradev_tks-api_pkg_domain.RemoveUsersFromRoleRequest": { + "type": "object", + "required": [ + "users" + ], + "properties": { + "users": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.ResourceQuota": { "type": "object", "properties": { @@ -12744,49 +13264,6 @@ const docTemplate = `{ } } }, - "github_com_openinfradev_tks-api_pkg_domain.RoleIdRoleNameResponse": { - "type": "object", - "properties": { - "roleId": { - "type": "string" - }, - "roleName": { - "type": "string" - } - } - }, - "github_com_openinfradev_tks-api_pkg_domain.RoleResponse": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "creator": { - "type": "string" - }, - "description": { - "type": "string" - }, - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "organization": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" - }, - "organizationId": { - "type": "string" - }, - "type": { - "type": "string" - }, - "updatedAt": { - "type": "string" - } - } - }, "github_com_openinfradev_tks-api_pkg_domain.RollbackAppServeAppRequest": { "type": "object", "properties": { @@ -12892,6 +13369,17 @@ const docTemplate = `{ } } }, + "github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.SimpleStackTemplateResponse": { "type": "object", "properties": { @@ -13602,6 +14090,9 @@ const docTemplate = `{ "github_com_openinfradev_tks-api_pkg_domain.UpdateMyProfileRequest": { "type": "object", "required": [ + "department", + "email", + "name", "password" ], "properties": { @@ -13647,8 +14138,11 @@ const docTemplate = `{ "organization": { "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse" + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } } } } @@ -14049,11 +14543,21 @@ const docTemplate = `{ "type": "string", "maxLength": 100, "minLength": 0 + }, + "name": { + "type": "string", + "maxLength": 100, + "minLength": 0 } } }, "github_com_openinfradev_tks-api_pkg_domain.UpdateUserRequest": { "type": "object", + "required": [ + "email", + "name", + "roles" + ], "properties": { "department": { "type": "string", @@ -14069,16 +14573,13 @@ const docTemplate = `{ "type": "string" }, "name": { - "type": "string", - "maxLength": 30, - "minLength": 1 + "type": "string" }, - "role": { - "type": "string", - "enum": [ - "admin", - "user" - ] + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.UserCreationRole" + } } } }, @@ -14112,8 +14613,11 @@ const docTemplate = `{ "organization": { "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse" + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } }, "updatedAt": { "type": "string" @@ -14122,6 +14626,50 @@ const docTemplate = `{ } } }, + "github_com_openinfradev_tks-api_pkg_domain.UpdateUsersRequest": { + "type": "object", + "properties": { + "users": { + "type": "array", + "items": { + "type": "object", + "required": [ + "accountId", + "email", + "name", + "roles" + ], + "properties": { + "accountId": { + "type": "string" + }, + "department": { + "type": "string", + "maxLength": 50, + "minLength": 0 + }, + "description": { + "type": "string", + "maxLength": 100, + "minLength": 0 + }, + "email": { + "type": "string" + }, + "name": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.UserCreationRole" + } + } + } + } + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.UpdatedPolicyTemplateParameter": { "type": "object", "properties": { @@ -14136,6 +14684,17 @@ const docTemplate = `{ } } }, + "github_com_openinfradev_tks-api_pkg_domain.UserCreationRole": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.VerifyIdentityForLostIdRequest": { "type": "object", "required": [ @@ -14381,49 +14940,6 @@ const docTemplate = `{ } } }, - "github_com_openinfradev_tks-api_pkg_domain_admin.GetUserResponse": { - "type": "object", - "properties": { - "user": { - "type": "object", - "properties": { - "accountId": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "creator": { - "type": "string" - }, - "department": { - "type": "string" - }, - "description": { - "type": "string" - }, - "email": { - "type": "string" - }, - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "organization": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" - }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse" - }, - "updatedAt": { - "type": "string" - } - } - } - } - }, "github_com_openinfradev_tks-api_pkg_domain_admin.ListPolicyTemplateResponse": { "type": "object", "properties": { @@ -14607,77 +15123,6 @@ const docTemplate = `{ } } }, - "github_com_openinfradev_tks-api_pkg_domain_admin.UpdateUserRequest": { - "type": "object", - "required": [ - "email", - "role" - ], - "properties": { - "adminPassword": { - "type": "string" - }, - "department": { - "type": "string", - "maxLength": 50, - "minLength": 0 - }, - "description": { - "type": "string", - "maxLength": 100, - "minLength": 0 - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - }, - "role": { - "type": "string" - } - } - }, - "github_com_openinfradev_tks-api_pkg_domain_admin.UpdateUserResponse": { - "type": "object", - "properties": { - "user": { - "type": "object", - "properties": { - "accountId": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "department": { - "type": "string" - }, - "description": { - "type": "string" - }, - "email": { - "type": "string" - }, - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "organization": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" - }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse" - }, - "updatedAt": { - "type": "string" - } - } - } - } - }, "github_com_openinfradev_tks-api_pkg_httpErrors.RestError": { "type": "object", "properties": { diff --git a/api/swagger/swagger.json b/api/swagger/swagger.json index d513ac30..89f6e889 100644 --- a/api/swagger/swagger.json +++ b/api/swagger/swagger.json @@ -196,6 +196,45 @@ } } }, + "/admin/organizations": { + "post": { + "security": [ + { + "JWT": [] + } + ], + "description": "Create organization in Admin portal", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Organizations" + ], + "summary": "Create organization in Admin portal", + "parameters": [ + { + "description": "create organization request", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.CreateOrganizationRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object" + } + } + } + } + }, "/admin/organizations/{organizationId}/projects": { "get": { "security": [ @@ -235,6 +274,11 @@ }, "/admin/organizations/{organizationId}/roles": { "get": { + "security": [ + { + "JWT": [] + } + ], "description": "Admin List Tks Roles", "produces": [ "application/json" @@ -264,6 +308,11 @@ }, "/admin/organizations/{organizationId}/roles/{roleId}": { "get": { + "security": [ + { + "JWT": [] + } + ], "description": "Admin Get Tks Role", "produces": [ "application/json" @@ -298,9 +347,14 @@ } } }, - "/admin/organizations/{organizationId}/users/{accountId}": { - "get": { - "description": "Get user detail by admin", + "/admin/organizations/{organizationId}/users": { + "post": { + "security": [ + { + "JWT": [] + } + ], + "description": "Create user by admin in Admin Portal", "consumes": [ "application/json" ], @@ -310,7 +364,7 @@ "tags": [ "Users" ], - "summary": "Get user detail by admin", + "summary": "Create user by admin in Admin Portal", "parameters": [ { "type": "string", @@ -320,29 +374,33 @@ "required": true }, { - "type": "string", - "description": "accountId", - "name": "accountId", - "in": "path", - "required": true + "description": "create user request", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.Admin_CreateUserRequest" + } } ], "responses": { "200": { - "description": "OK", + "description": "create user response", "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain_admin.GetUserResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.Admin_CreateUserResponse" } } } - }, + } + }, + "/admin/organizations/{organizationId}/users/{accountId}": { "put": { "security": [ { "JWT": [] } ], - "description": "Update user by admin", + "description": "Update user by admin in Admin Portal", "consumes": [ "application/json" ], @@ -352,7 +410,7 @@ "tags": [ "Users" ], - "summary": "Update user by admin", + "summary": "Update user by admin in Admin Portal", "parameters": [ { "type": "string", @@ -374,7 +432,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain_admin.UpdateUserRequest" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.Admin_UpdateUserRequest" } } ], @@ -382,8 +440,56 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain_admin.UpdateUserResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.Admin_UpdateUserResponse" + } + } + } + }, + "delete": { + "security": [ + { + "JWT": [] + } + ], + "description": "Delete user by admin in Admin Portal", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Users" + ], + "summary": "Delete user by admin in Admin Portal", + "parameters": [ + { + "description": "input", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.DeleteUserRequest" } + }, + { + "type": "string", + "description": "organizationId", + "name": "organizationId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "accountId", + "name": "accountId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK" } } } @@ -2526,43 +2632,6 @@ } } } - }, - "post": { - "security": [ - { - "JWT": [] - } - ], - "description": "Create organization", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Organizations" - ], - "summary": "Create organization", - "parameters": [ - { - "description": "create organization request", - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.CreateOrganizationRequest" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "object" - } - } - } } }, "/organizations/name/{name}/existence": { @@ -7090,25 +7159,36 @@ } } }, - "/organizations/{organizationId}/stack-templates": { + "/organizations/{organizationId}/roles/{roleId}/users": { "get": { "security": [ { "JWT": [] } ], - "description": "Get Organization StackTemplates", - "consumes": [ - "application/json" - ], + "description": "Get Users By Role ID", "produces": [ "application/json" ], "tags": [ - "StackTemplates" + "Roles" ], - "summary": "Get Organization StackTemplates", + "summary": "Get Users By Role ID", "parameters": [ + { + "type": "string", + "description": "Organization ID", + "name": "organizationId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Role ID", + "name": "roleId", + "in": "path", + "required": true + }, { "type": "string", "description": "pageSize", @@ -7148,18 +7228,18 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetStackTemplatesResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetUsersInRoleIdResponse" } } } }, - "put": { + "post": { "security": [ { "JWT": [] } ], - "description": "Remove organization stackTemplates", + "description": "Append Users To Role", "consumes": [ "application/json" ], @@ -7167,17 +7247,31 @@ "application/json" ], "tags": [ - "StackTemplates" + "Roles" ], - "summary": "Remove organization stackTemplates", + "summary": "Append Users To Role", "parameters": [ { - "description": "Remove organization stack templates request", + "type": "string", + "description": "Organization ID", + "name": "organizationId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Role ID", + "name": "roleId", + "in": "path", + "required": true + }, + { + "description": "Append Users To Role Request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RemoveOrganizationStackTemplatesRequest" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.AppendUsersToRoleRequest" } } ], @@ -7187,13 +7281,13 @@ } } }, - "post": { + "delete": { "security": [ { "JWT": [] } ], - "description": "Add organization stackTemplates", + "description": "Remove Users From Role", "consumes": [ "application/json" ], @@ -7201,17 +7295,31 @@ "application/json" ], "tags": [ - "StackTemplates" + "Roles" ], - "summary": "Add organization stackTemplates", + "summary": "Remove Users From Role", "parameters": [ { - "description": "Add organization stack templates request", + "type": "string", + "description": "Organization ID", + "name": "organizationId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Role ID", + "name": "roleId", + "in": "path", + "required": true + }, + { + "description": "Remove Users From Role Request", "name": "body", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.AddOrganizationStackTemplatesRequest" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RemoveUsersFromRoleRequest" } } ], @@ -7222,42 +7330,55 @@ } } }, - "/organizations/{organizationId}/stack-templates/{stackTemplateId}": { + "/organizations/{organizationId}/roles/{roleName}/existence": { "get": { "security": [ { "JWT": [] } ], - "description": "Get Organization StackTemplate", - "consumes": [ - "application/json" - ], + "description": "Check whether the role name exists", "produces": [ "application/json" ], "tags": [ - "StackTemplates" + "Roles" + ], + "summary": "Check whether the role name exists", + "parameters": [ + { + "type": "string", + "description": "Organization ID", + "name": "organizationId", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Role Name", + "name": "roleName", + "in": "path", + "required": true + } ], - "summary": "Get Organization StackTemplate", "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetStackTemplateResponse" + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.CheckRoleNameResponse" } } } } }, - "/organizations/{organizationId}/stacks": { + "/organizations/{organizationId}/stack-templates": { "get": { "security": [ { "JWT": [] } ], - "description": "Get Stacks", + "description": "Get Organization StackTemplates", "consumes": [ "application/json" ], @@ -7265,16 +7386,176 @@ "application/json" ], "tags": [ - "Stacks" + "StackTemplates" ], - "summary": "Get Stacks", + "summary": "Get Organization StackTemplates", "parameters": [ { "type": "string", - "description": "organizationId", - "name": "organizationId", - "in": "path", - "required": true + "description": "pageSize", + "name": "pageSize", + "in": "query" + }, + { + "type": "string", + "description": "pageNumber", + "name": "pageNumber", + "in": "query" + }, + { + "type": "string", + "description": "sortColumn", + "name": "soertColumn", + "in": "query" + }, + { + "type": "string", + "description": "sortOrder", + "name": "sortOrder", + "in": "query" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv", + "description": "filters", + "name": "filters", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetStackTemplatesResponse" + } + } + } + }, + "put": { + "security": [ + { + "JWT": [] + } + ], + "description": "Remove organization stackTemplates", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "StackTemplates" + ], + "summary": "Remove organization stackTemplates", + "parameters": [ + { + "description": "Remove organization stack templates request", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RemoveOrganizationStackTemplatesRequest" + } + } + ], + "responses": { + "200": { + "description": "OK" + } + } + }, + "post": { + "security": [ + { + "JWT": [] + } + ], + "description": "Add organization stackTemplates", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "StackTemplates" + ], + "summary": "Add organization stackTemplates", + "parameters": [ + { + "description": "Add organization stack templates request", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.AddOrganizationStackTemplatesRequest" + } + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/organizations/{organizationId}/stack-templates/{stackTemplateId}": { + "get": { + "security": [ + { + "JWT": [] + } + ], + "description": "Get Organization StackTemplate", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "StackTemplates" + ], + "summary": "Get Organization StackTemplate", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetStackTemplateResponse" + } + } + } + } + }, + "/organizations/{organizationId}/stacks": { + "get": { + "security": [ + { + "JWT": [] + } + ], + "description": "Get Stacks", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Stacks" + ], + "summary": "Get Stacks", + "parameters": [ + { + "type": "string", + "description": "organizationId", + "name": "organizationId", + "in": "path", + "required": true }, { "type": "string", @@ -8454,6 +8735,50 @@ } } }, + "put": { + "security": [ + { + "JWT": [] + } + ], + "description": "Update multiple users", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Users" + ], + "summary": "Update multiple users", + "parameters": [ + { + "type": "string", + "description": "organizationId", + "name": "organizationId", + "in": "path", + "required": true + }, + { + "description": "input", + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.UpdateUsersRequest" + } + } + } + ], + "responses": { + "200": { + "description": "OK" + } + } + }, "post": { "security": [ { @@ -9142,6 +9467,129 @@ } } }, + "github_com_openinfradev_tks-api_pkg_domain.Admin_CreateUserRequest": { + "type": "object", + "required": [ + "accountId", + "email", + "roles" + ], + "properties": { + "accountId": { + "type": "string" + }, + "adminPassword": { + "type": "string" + }, + "department": { + "type": "string", + "maxLength": 50, + "minLength": 0 + }, + "description": { + "type": "string", + "maxLength": 100, + "minLength": 0 + }, + "email": { + "type": "string" + }, + "name": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.UserCreationRole" + } + } + } + }, + "github_com_openinfradev_tks-api_pkg_domain.Admin_CreateUserResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + } + }, + "github_com_openinfradev_tks-api_pkg_domain.Admin_UpdateUserRequest": { + "type": "object", + "required": [ + "email", + "roles" + ], + "properties": { + "adminPassword": { + "type": "string" + }, + "department": { + "type": "string", + "maxLength": 50, + "minLength": 0 + }, + "description": { + "type": "string", + "maxLength": 100, + "minLength": 0 + }, + "email": { + "type": "string" + }, + "name": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.UserCreationRole" + } + } + } + }, + "github_com_openinfradev_tks-api_pkg_domain.Admin_UpdateUserResponse": { + "type": "object", + "properties": { + "user": { + "type": "object", + "properties": { + "accountId": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "department": { + "type": "string" + }, + "description": { + "type": "string" + }, + "email": { + "type": "string" + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "organization": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } + }, + "updatedAt": { + "type": "string" + } + } + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.AppGroupResponse": { "type": "object", "properties": { @@ -9388,6 +9836,20 @@ } } }, + "github_com_openinfradev_tks-api_pkg_domain.AppendUsersToRoleRequest": { + "type": "object", + "required": [ + "users" + ], + "properties": { + "users": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.ApplicationResponse": { "type": "object", "properties": { @@ -9544,6 +10006,14 @@ } } }, + "github_com_openinfradev_tks-api_pkg_domain.CheckRoleNameResponse": { + "type": "object", + "properties": { + "isExist": { + "type": "boolean" + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.CheckStackTemplateNameResponse": { "type": "object", "properties": { @@ -10674,7 +11144,7 @@ "accountId", "email", "password", - "role" + "roles" ], "properties": { "accountId": { @@ -10699,12 +11169,11 @@ "password": { "type": "string" }, - "role": { - "type": "string", - "enum": [ - "admin", - "user" - ] + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.UserCreationRole" + } } } }, @@ -10735,8 +11204,11 @@ "organization": { "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse" + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } } } } @@ -10860,6 +11332,14 @@ } } }, + "github_com_openinfradev_tks-api_pkg_domain.DeleteUserRequest": { + "type": "object", + "properties": { + "adminPassword": { + "type": "string" + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.EndpointResponse": { "type": "object", "properties": { @@ -11262,8 +11742,11 @@ "organization": { "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse" + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } } } } @@ -11661,8 +12144,11 @@ "organization": { "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse" + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } }, "updatedAt": { "type": "string" @@ -11671,6 +12157,20 @@ } } }, + "github_com_openinfradev_tks-api_pkg_domain.GetUsersInRoleIdResponse": { + "type": "object", + "properties": { + "pagination": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.PaginationResponse" + }, + "users": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleUserResponse" + } + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.GetUsersPermissionsResponse": { "type": "object", "properties": { @@ -11866,8 +12366,11 @@ "organization": { "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse" + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } }, "updatedAt": { "type": "string" @@ -11914,8 +12417,11 @@ "passwordExpired": { "type": "boolean" }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleIdRoleNameResponse" + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } }, "token": { "type": "string" @@ -12710,6 +13216,20 @@ } } }, + "github_com_openinfradev_tks-api_pkg_domain.RemoveUsersFromRoleRequest": { + "type": "object", + "required": [ + "users" + ], + "properties": { + "users": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.ResourceQuota": { "type": "object", "properties": { @@ -12738,49 +13258,6 @@ } } }, - "github_com_openinfradev_tks-api_pkg_domain.RoleIdRoleNameResponse": { - "type": "object", - "properties": { - "roleId": { - "type": "string" - }, - "roleName": { - "type": "string" - } - } - }, - "github_com_openinfradev_tks-api_pkg_domain.RoleResponse": { - "type": "object", - "properties": { - "createdAt": { - "type": "string" - }, - "creator": { - "type": "string" - }, - "description": { - "type": "string" - }, - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "organization": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" - }, - "organizationId": { - "type": "string" - }, - "type": { - "type": "string" - }, - "updatedAt": { - "type": "string" - } - } - }, "github_com_openinfradev_tks-api_pkg_domain.RollbackAppServeAppRequest": { "type": "object", "properties": { @@ -12886,6 +13363,17 @@ } } }, + "github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.SimpleStackTemplateResponse": { "type": "object", "properties": { @@ -13596,6 +14084,9 @@ "github_com_openinfradev_tks-api_pkg_domain.UpdateMyProfileRequest": { "type": "object", "required": [ + "department", + "email", + "name", "password" ], "properties": { @@ -13641,8 +14132,11 @@ "organization": { "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse" + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } } } } @@ -14043,11 +14537,21 @@ "type": "string", "maxLength": 100, "minLength": 0 + }, + "name": { + "type": "string", + "maxLength": 100, + "minLength": 0 } } }, "github_com_openinfradev_tks-api_pkg_domain.UpdateUserRequest": { "type": "object", + "required": [ + "email", + "name", + "roles" + ], "properties": { "department": { "type": "string", @@ -14063,16 +14567,13 @@ "type": "string" }, "name": { - "type": "string", - "maxLength": 30, - "minLength": 1 + "type": "string" }, - "role": { - "type": "string", - "enum": [ - "admin", - "user" - ] + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.UserCreationRole" + } } } }, @@ -14106,8 +14607,11 @@ "organization": { "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse" + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse" + } }, "updatedAt": { "type": "string" @@ -14116,6 +14620,50 @@ } } }, + "github_com_openinfradev_tks-api_pkg_domain.UpdateUsersRequest": { + "type": "object", + "properties": { + "users": { + "type": "array", + "items": { + "type": "object", + "required": [ + "accountId", + "email", + "name", + "roles" + ], + "properties": { + "accountId": { + "type": "string" + }, + "department": { + "type": "string", + "maxLength": 50, + "minLength": 0 + }, + "description": { + "type": "string", + "maxLength": 100, + "minLength": 0 + }, + "email": { + "type": "string" + }, + "name": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.UserCreationRole" + } + } + } + } + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.UpdatedPolicyTemplateParameter": { "type": "object", "properties": { @@ -14130,6 +14678,17 @@ } } }, + "github_com_openinfradev_tks-api_pkg_domain.UserCreationRole": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + } + } + }, "github_com_openinfradev_tks-api_pkg_domain.VerifyIdentityForLostIdRequest": { "type": "object", "required": [ @@ -14375,49 +14934,6 @@ } } }, - "github_com_openinfradev_tks-api_pkg_domain_admin.GetUserResponse": { - "type": "object", - "properties": { - "user": { - "type": "object", - "properties": { - "accountId": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "creator": { - "type": "string" - }, - "department": { - "type": "string" - }, - "description": { - "type": "string" - }, - "email": { - "type": "string" - }, - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "organization": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" - }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse" - }, - "updatedAt": { - "type": "string" - } - } - } - } - }, "github_com_openinfradev_tks-api_pkg_domain_admin.ListPolicyTemplateResponse": { "type": "object", "properties": { @@ -14601,77 +15117,6 @@ } } }, - "github_com_openinfradev_tks-api_pkg_domain_admin.UpdateUserRequest": { - "type": "object", - "required": [ - "email", - "role" - ], - "properties": { - "adminPassword": { - "type": "string" - }, - "department": { - "type": "string", - "maxLength": 50, - "minLength": 0 - }, - "description": { - "type": "string", - "maxLength": 100, - "minLength": 0 - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - }, - "role": { - "type": "string" - } - } - }, - "github_com_openinfradev_tks-api_pkg_domain_admin.UpdateUserResponse": { - "type": "object", - "properties": { - "user": { - "type": "object", - "properties": { - "accountId": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "department": { - "type": "string" - }, - "description": { - "type": "string" - }, - "email": { - "type": "string" - }, - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "organization": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse" - }, - "role": { - "$ref": "#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse" - }, - "updatedAt": { - "type": "string" - } - } - } - } - }, "github_com_openinfradev_tks-api_pkg_httpErrors.RestError": { "type": "object", "properties": { diff --git a/api/swagger/swagger.yaml b/api/swagger/swagger.yaml index 6f4c6153..ec528918 100644 --- a/api/swagger/swagger.yaml +++ b/api/swagger/swagger.yaml @@ -165,6 +165,90 @@ definitions: $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.ProjectMemberRequest' type: array type: object + github_com_openinfradev_tks-api_pkg_domain.Admin_CreateUserRequest: + properties: + accountId: + type: string + adminPassword: + type: string + department: + maxLength: 50 + minLength: 0 + type: string + description: + maxLength: 100 + minLength: 0 + type: string + email: + type: string + name: + type: string + roles: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.UserCreationRole' + type: array + required: + - accountId + - email + - roles + type: object + github_com_openinfradev_tks-api_pkg_domain.Admin_CreateUserResponse: + properties: + id: + type: string + type: object + github_com_openinfradev_tks-api_pkg_domain.Admin_UpdateUserRequest: + properties: + adminPassword: + type: string + department: + maxLength: 50 + minLength: 0 + type: string + description: + maxLength: 100 + minLength: 0 + type: string + email: + type: string + name: + type: string + roles: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.UserCreationRole' + type: array + required: + - email + - roles + type: object + github_com_openinfradev_tks-api_pkg_domain.Admin_UpdateUserResponse: + properties: + user: + properties: + accountId: + type: string + createdAt: + type: string + department: + type: string + description: + type: string + email: + type: string + id: + type: string + name: + type: string + organization: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse' + roles: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse' + type: array + updatedAt: + type: string + type: object + type: object github_com_openinfradev_tks-api_pkg_domain.AppGroupResponse: properties: appGroupType: @@ -343,6 +427,15 @@ definitions: description: application version type: string type: object + github_com_openinfradev_tks-api_pkg_domain.AppendUsersToRoleRequest: + properties: + users: + items: + type: string + type: array + required: + - users + type: object github_com_openinfradev_tks-api_pkg_domain.ApplicationResponse: properties: appGroupId: @@ -451,6 +544,11 @@ definitions: existed: type: boolean type: object + github_com_openinfradev_tks-api_pkg_domain.CheckRoleNameResponse: + properties: + isExist: + type: boolean + type: object github_com_openinfradev_tks-api_pkg_domain.CheckStackTemplateNameResponse: properties: existed: @@ -1232,16 +1330,15 @@ definitions: type: string password: type: string - role: - enum: - - admin - - user - type: string + roles: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.UserCreationRole' + type: array required: - accountId - email - password - - role + - roles type: object github_com_openinfradev_tks-api_pkg_domain.CreateUserResponse: properties: @@ -1261,8 +1358,10 @@ definitions: type: string organization: $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse' - role: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse' + roles: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse' + type: array type: object type: object github_com_openinfradev_tks-api_pkg_domain.DashboardChartResponse: @@ -1344,6 +1443,11 @@ definitions: id: type: string type: object + github_com_openinfradev_tks-api_pkg_domain.DeleteUserRequest: + properties: + adminPassword: + type: string + type: object github_com_openinfradev_tks-api_pkg_domain.EndpointResponse: properties: group: @@ -1607,8 +1711,10 @@ definitions: type: string organization: $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse' - role: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse' + roles: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse' + type: array type: object type: object github_com_openinfradev_tks-api_pkg_domain.GetOrganizationResponse: @@ -1862,12 +1968,23 @@ definitions: type: string organization: $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse' - role: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse' + roles: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse' + type: array updatedAt: type: string type: object type: object + github_com_openinfradev_tks-api_pkg_domain.GetUsersInRoleIdResponse: + properties: + pagination: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.PaginationResponse' + users: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleUserResponse' + type: array + type: object github_com_openinfradev_tks-api_pkg_domain.GetUsersPermissionsResponse: properties: permissions: @@ -1996,8 +2113,10 @@ definitions: type: string organization: $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse' - role: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse' + roles: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse' + type: array updatedAt: type: string type: object @@ -2028,8 +2147,10 @@ definitions: $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse' passwordExpired: type: boolean - role: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleIdRoleNameResponse' + roles: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse' + type: array token: type: string type: object @@ -2564,6 +2685,15 @@ definitions: type: object type: array type: object + github_com_openinfradev_tks-api_pkg_domain.RemoveUsersFromRoleRequest: + properties: + users: + items: + type: string + type: array + required: + - users + type: object github_com_openinfradev_tks-api_pkg_domain.ResourceQuota: properties: quotas: @@ -2582,34 +2712,6 @@ definitions: usage: type: integer type: object - github_com_openinfradev_tks-api_pkg_domain.RoleIdRoleNameResponse: - properties: - roleId: - type: string - roleName: - type: string - type: object - github_com_openinfradev_tks-api_pkg_domain.RoleResponse: - properties: - createdAt: - type: string - creator: - type: string - description: - type: string - id: - type: string - name: - type: string - organization: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse' - organizationId: - type: string - type: - type: string - updatedAt: - type: string - type: object github_com_openinfradev_tks-api_pkg_domain.RollbackAppServeAppRequest: properties: taskId: @@ -2680,6 +2782,13 @@ definitions: example: v1.0.1 type: string type: object + github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse: + properties: + id: + type: string + name: + type: string + type: object github_com_openinfradev_tks-api_pkg_domain.SimpleStackTemplateResponse: properties: cloudService: @@ -3162,6 +3271,9 @@ definitions: password: type: string required: + - department + - email + - name - password type: object github_com_openinfradev_tks-api_pkg_domain.UpdateMyProfileResponse: @@ -3180,8 +3292,10 @@ definitions: type: string organization: $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse' - role: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse' + roles: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse' + type: array type: object type: object github_com_openinfradev_tks-api_pkg_domain.UpdateOrganizationRequest: @@ -3449,6 +3563,10 @@ definitions: maxLength: 100 minLength: 0 type: string + name: + maxLength: 100 + minLength: 0 + type: string type: object github_com_openinfradev_tks-api_pkg_domain.UpdateUserRequest: properties: @@ -3463,14 +3581,15 @@ definitions: email: type: string name: - maxLength: 30 - minLength: 1 - type: string - role: - enum: - - admin - - user type: string + roles: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.UserCreationRole' + type: array + required: + - email + - name + - roles type: object github_com_openinfradev_tks-api_pkg_domain.UpdateUserResponse: properties: @@ -3492,12 +3611,45 @@ definitions: type: string organization: $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse' - role: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse' + roles: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.SimpleRoleResponse' + type: array updatedAt: type: string type: object type: object + github_com_openinfradev_tks-api_pkg_domain.UpdateUsersRequest: + properties: + users: + items: + properties: + accountId: + type: string + department: + maxLength: 50 + minLength: 0 + type: string + description: + maxLength: 100 + minLength: 0 + type: string + email: + type: string + name: + type: string + roles: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.UserCreationRole' + type: array + required: + - accountId + - email + - name + - roles + type: object + type: array + type: object github_com_openinfradev_tks-api_pkg_domain.UpdatedPolicyTemplateParameter: properties: name: @@ -3507,6 +3659,13 @@ definitions: value: type: string type: object + github_com_openinfradev_tks-api_pkg_domain.UserCreationRole: + properties: + id: + type: string + required: + - id + type: object github_com_openinfradev_tks-api_pkg_domain.VerifyIdentityForLostIdRequest: properties: email: @@ -3674,34 +3833,6 @@ definitions: policyTemplate: $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain_admin.PolicyTemplateResponse' type: object - github_com_openinfradev_tks-api_pkg_domain_admin.GetUserResponse: - properties: - user: - properties: - accountId: - type: string - createdAt: - type: string - creator: - type: string - department: - type: string - description: - type: string - email: - type: string - id: - type: string - name: - type: string - organization: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse' - role: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse' - updatedAt: - type: string - type: object - type: object github_com_openinfradev_tks-api_pkg_domain_admin.ListPolicyTemplateResponse: properties: pagination: @@ -3828,54 +3959,6 @@ definitions: example: 필수 Label 검사 type: string type: object - github_com_openinfradev_tks-api_pkg_domain_admin.UpdateUserRequest: - properties: - adminPassword: - type: string - department: - maxLength: 50 - minLength: 0 - type: string - description: - maxLength: 100 - minLength: 0 - type: string - email: - type: string - name: - type: string - role: - type: string - required: - - email - - role - type: object - github_com_openinfradev_tks-api_pkg_domain_admin.UpdateUserResponse: - properties: - user: - properties: - accountId: - type: string - createdAt: - type: string - department: - type: string - description: - type: string - email: - type: string - id: - type: string - name: - type: string - organization: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.OrganizationResponse' - role: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.RoleResponse' - updatedAt: - type: string - type: object - type: object github_com_openinfradev_tks-api_pkg_httpErrors.RestError: properties: code: @@ -4013,6 +4096,30 @@ paths: summary: Get Audit tags: - Audits + /admin/organizations: + post: + consumes: + - application/json + description: Create organization in Admin portal + parameters: + - description: create organization request + in: body + name: body + required: true + schema: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.CreateOrganizationRequest' + produces: + - application/json + responses: + "200": + description: OK + schema: + type: object + security: + - JWT: [] + summary: Create organization in Admin portal + tags: + - Organizations /admin/organizations/{organizationId}/projects: get: consumes: @@ -4052,6 +4159,8 @@ paths: description: OK schema: $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.ListTksRoleResponse' + security: + - JWT: [] summary: Admin List Tks Roles tags: - Roles @@ -4076,15 +4185,52 @@ paths: description: OK schema: $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetTksRoleResponse' + security: + - JWT: [] summary: Admin Get Tks Role tags: - Roles + /admin/organizations/{organizationId}/users: + post: + consumes: + - application/json + description: Create user by admin in Admin Portal + parameters: + - description: organizationId + in: path + name: organizationId + required: true + type: string + - description: create user request + in: body + name: body + required: true + schema: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.Admin_CreateUserRequest' + produces: + - application/json + responses: + "200": + description: create user response + schema: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.Admin_CreateUserResponse' + security: + - JWT: [] + summary: Create user by admin in Admin Portal + tags: + - Users /admin/organizations/{organizationId}/users/{accountId}: - get: + delete: consumes: - application/json - description: Get user detail by admin + description: Delete user by admin in Admin Portal parameters: + - description: input + in: body + name: body + required: true + schema: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.DeleteUserRequest' - description: organizationId in: path name: organizationId @@ -4100,15 +4246,15 @@ paths: responses: "200": description: OK - schema: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain_admin.GetUserResponse' - summary: Get user detail by admin + security: + - JWT: [] + summary: Delete user by admin in Admin Portal tags: - Users put: consumes: - application/json - description: Update user by admin + description: Update user by admin in Admin Portal parameters: - description: organizationId in: path @@ -4125,17 +4271,17 @@ paths: name: body required: true schema: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain_admin.UpdateUserRequest' + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.Admin_UpdateUserRequest' produces: - application/json responses: "200": description: OK schema: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain_admin.UpdateUserResponse' + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.Admin_UpdateUserResponse' security: - JWT: [] - summary: Update user by admin + summary: Update user by admin in Admin Portal tags: - Users /admin/policy-templates: @@ -5496,29 +5642,6 @@ paths: summary: Get organization list tags: - Organizations - post: - consumes: - - application/json - description: Create organization - parameters: - - description: create organization request - in: body - name: body - required: true - schema: - $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.CreateOrganizationRequest' - produces: - - application/json - responses: - "200": - description: OK - schema: - type: object - security: - - JWT: [] - summary: Create organization - tags: - - Organizations /organizations/{organizationId}: delete: consumes: @@ -8408,6 +8531,143 @@ paths: summary: Update Permissions By Role ID tags: - Roles + /organizations/{organizationId}/roles/{roleId}/users: + delete: + consumes: + - application/json + description: Remove Users From Role + parameters: + - description: Organization ID + in: path + name: organizationId + required: true + type: string + - description: Role ID + in: path + name: roleId + required: true + type: string + - description: Remove Users From Role Request + in: body + name: body + required: true + schema: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.RemoveUsersFromRoleRequest' + produces: + - application/json + responses: + "200": + description: OK + security: + - JWT: [] + summary: Remove Users From Role + tags: + - Roles + get: + description: Get Users By Role ID + parameters: + - description: Organization ID + in: path + name: organizationId + required: true + type: string + - description: Role ID + in: path + name: roleId + required: true + type: string + - description: pageSize + in: query + name: pageSize + type: string + - description: pageNumber + in: query + name: pageNumber + type: string + - description: sortColumn + in: query + name: soertColumn + type: string + - description: sortOrder + in: query + name: sortOrder + type: string + - collectionFormat: csv + description: filters + in: query + items: + type: string + name: filters + type: array + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.GetUsersInRoleIdResponse' + security: + - JWT: [] + summary: Get Users By Role ID + tags: + - Roles + post: + consumes: + - application/json + description: Append Users To Role + parameters: + - description: Organization ID + in: path + name: organizationId + required: true + type: string + - description: Role ID + in: path + name: roleId + required: true + type: string + - description: Append Users To Role Request + in: body + name: body + required: true + schema: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.AppendUsersToRoleRequest' + produces: + - application/json + responses: + "200": + description: OK + security: + - JWT: [] + summary: Append Users To Role + tags: + - Roles + /organizations/{organizationId}/roles/{roleName}/existence: + get: + description: Check whether the role name exists + parameters: + - description: Organization ID + in: path + name: organizationId + required: true + type: string + - description: Role Name + in: path + name: roleName + required: true + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.CheckRoleNameResponse' + security: + - JWT: [] + summary: Check whether the role name exists + tags: + - Roles /organizations/{organizationId}/stack-templates: get: consumes: @@ -9308,6 +9568,34 @@ paths: summary: Create user tags: - Users + put: + consumes: + - application/json + description: Update multiple users + parameters: + - description: organizationId + in: path + name: organizationId + required: true + type: string + - description: input + in: body + name: body + required: true + schema: + items: + $ref: '#/definitions/github_com_openinfradev_tks-api_pkg_domain.UpdateUsersRequest' + type: array + produces: + - application/json + responses: + "200": + description: OK + security: + - JWT: [] + summary: Update multiple users + tags: + - Users /organizations/{organizationId}/users/{accountId}: delete: consumes: diff --git a/internal/delivery/http/role.go b/internal/delivery/http/role.go index fd738c2b..978f2275 100644 --- a/internal/delivery/http/role.go +++ b/internal/delivery/http/role.go @@ -515,9 +515,9 @@ func (h RoleHandler) Admin_GetTksRole(w http.ResponseWriter, r *http.Request) { // @Summary Check whether the role name exists // @Description Check whether the role name exists // @Produce json -// @Param organizationId path string true "Organization ID" -// @Param roleName path string true "Role Name" -// @Success 200 {object} domain.CheckRoleNameResponse +// @Param organizationId path string true "Organization ID" +// @Param roleName path string true "Role Name" +// @Success 200 {object} domain.CheckRoleNameResponse // @Router /organizations/{organizationId}/roles/{roleName}/existence [get] // @Security JWT func (h RoleHandler) IsRoleNameExisted(w http.ResponseWriter, r *http.Request) { @@ -558,8 +558,8 @@ func (h RoleHandler) IsRoleNameExisted(w http.ResponseWriter, r *http.Request) { // @Description Append Users To Role // @Accept json // @Produce json -// @Param organizationId path string true "Organization ID" -// @Param roleId path string true "Role ID" +// @Param organizationId path string true "Organization ID" +// @Param roleId path string true "Role ID" // @Param body body domain.AppendUsersToRoleRequest true "Append Users To Role Request" // @Success 200 // @Router /organizations/{organizationId}/roles/{roleId}/users [post] @@ -621,8 +621,8 @@ func (h RoleHandler) AppendUsersToRole(w http.ResponseWriter, r *http.Request) { // @Description Remove Users From Role // @Accept json // @Produce json -// @Param organizationId path string true "Organization ID" -// @Param roleId path string true "Role ID" +// @Param organizationId path string true "Organization ID" +// @Param roleId path string true "Role ID" // @Param body body domain.RemoveUsersFromRoleRequest true "Remove Users From Role Request" // @Success 200 // @Router /organizations/{organizationId}/roles/{roleId}/users [delete] @@ -688,14 +688,14 @@ func (h RoleHandler) RemoveUsersFromRole(w http.ResponseWriter, r *http.Request) // @Summary Get Users By Role ID // @Description Get Users By Role ID // @Produce json -// @Param organizationId path string true "Organization ID" -// @Param roleId path string true "Role ID" +// @Param organizationId path string true "Organization ID" +// @Param roleId path string true "Role ID" // @Param pageSize query string false "pageSize" // @Param pageNumber query string false "pageNumber" // @Param soertColumn query string false "sortColumn" // @Param sortOrder query string false "sortOrder" // @Param filters query []string false "filters" -// @Success 200 {object} domain.GetUsersInRoleIdResponse +// @Success 200 {object} domain.GetUsersInRoleIdResponse // @Router /organizations/{organizationId}/roles/{roleId}/users [get] // @Security JWT func (h RoleHandler) GetUsersInRoleId(w http.ResponseWriter, r *http.Request) { diff --git a/internal/delivery/http/system-notification-rule.go b/internal/delivery/http/system-notification-rule.go index a1ca5370..c87e22dc 100644 --- a/internal/delivery/http/system-notification-rule.go +++ b/internal/delivery/http/system-notification-rule.go @@ -301,8 +301,8 @@ func (h *SystemNotificationRuleHandler) CheckSystemNotificationRuleName(w http.R } } + // [TEST] /* - // [TEST] err = h.usecase.MakeDefaultSystemNotificationRules(r.Context(), "oolw6roj6", nil) if err != nil { ErrorJSON(w, r, err) diff --git a/internal/delivery/http/user.go b/internal/delivery/http/user.go index c9aa9678..4a572974 100644 --- a/internal/delivery/http/user.go +++ b/internal/delivery/http/user.go @@ -363,8 +363,8 @@ func (u UserHandler) Update(w http.ResponseWriter, r *http.Request) { // @Description Update multiple users // @Accept json // @Produce json -// @Param organizationId path string true "organizationId" -// @Param body body []domain.UpdateUsersRequest true "input" +// @Param organizationId path string true "organizationId" +// @Param body body []domain.UpdateUsersRequest true "input" // @Success 200 // @Router /organizations/{organizationId}/users [put] // @Security JWT @@ -932,9 +932,9 @@ func (u UserHandler) Admin_Create(w http.ResponseWriter, r *http.Request) { // @Description Delete user by admin in Admin Portal // @Accept json // @Produce json -// @Param body body domain.DeleteUserRequest true "input" -// @Param organizationId path string true "organizationId" -// @Param accountId path string true "accountId" +// @Param body body domain.DeleteUserRequest true "input" +// @Param organizationId path string true "organizationId" +// @Param accountId path string true "accountId" // @Success 200 // @Router /admin/organizations/{organizationId}/users/{accountId} [delete] // @Security JWT diff --git a/internal/usecase/system-notification-rule.go b/internal/usecase/system-notification-rule.go index 8dcc54f8..33ffaf0d 100644 --- a/internal/usecase/system-notification-rule.go +++ b/internal/usecase/system-notification-rule.go @@ -193,7 +193,7 @@ func (u *SystemNotificationRuleUsecase) MakeDefaultSystemNotificationRules(ctx c EnablePortal: true, }, TargetUsers: []model.User{organizationAdmin}, - MessageTitle: "스택 (<>)의 노드(<>)의 idle process의 cpu 점유율이 3분 동안 0% 입니다. (현재 사용률 {{$VALUE}})", + MessageTitle: "스택 (<>)의 노드(<>)의 idle process의 cpu 점유율이 3분 동안 0% 입니다. (현재 사용률 {{$value}})", MessageContent: "워커 노드 CPU가 과부하 상태입니다. 일시적인 서비스 Traffic 증가, Workload의 SW 오류, Server HW Fan Fail등 다양한 원인으로 인해 발생할 수 있습니다.", MessageActionProposal: "일시적인 Service Traffic의 증가가 관측되지 않았다면, Alert발생 노드에서 실행 되는 pod중 CPU 자원을 많이 점유하는 pod의 설정을 점검해 보시길 제안드립니다. 예를 들어 pod spec의 limit 설정으로 과도한 CPU자원 점유을 막을 수 있습니다.", Status: domain.SystemNotificationRuleStatus_PENDING, @@ -218,7 +218,7 @@ func (u *SystemNotificationRuleUsecase) MakeDefaultSystemNotificationRules(ctx c EnablePortal: true, }, TargetUsers: []model.User{organizationAdmin}, - MessageTitle: "스택 (<>)의 노드(<>)의 Memory 사용량이 3분동안 80% 를 넘어서고 있습니다. (현재 사용률 <>)", + MessageTitle: "스택 (<>)의 노드(<>)의 Memory 사용량이 3분동안 80% 를 넘어서고 있습니다. (현재 사용률 {{$value}})", MessageContent: "워커 노드의 Memory 사용량이 80%를 넘었습니다. 일시적인 서비스 증가 및 SW 오류등 다양한 원인으로 발생할 수 있습니다.", MessageActionProposal: "일시적인 Service Traffic의 증가가 관측되지 않았다면, Alert발생 노드에서 실행되는 pod중 Memory 사용량이 높은 pod들에 대한 점검을 제안드립니다.", Status: domain.SystemNotificationRuleStatus_PENDING, @@ -293,7 +293,7 @@ func (u *SystemNotificationRuleUsecase) MakeDefaultSystemNotificationRules(ctx c EnablePortal: true, }, TargetUsers: []model.User{organizationAdmin}, - MessageTitle: "스택 (<>)의 파드(<>)가 30분 동안 5회 이상 재기동 (<> 회)", + MessageTitle: "스택 (<>)의 파드(<>)가 30분 동안 5회 이상 재기동 ({{$value}} 회)", MessageContent: "특정 Pod가 빈번하게 재기동 되고 있습니다. 점검이 필요합니다. (<> 스택, <> 파드)", MessageActionProposal: "pod spec. 에 대한 점검이 필요합니다. pod의 log 및 status를 확인해 주세요.", Status: domain.SystemNotificationRuleStatus_PENDING, diff --git a/pkg/domain/system-notification-template.go b/pkg/domain/system-notification-template.go index d7f575fa..851fdb95 100644 --- a/pkg/domain/system-notification-template.go +++ b/pkg/domain/system-notification-template.go @@ -7,7 +7,7 @@ import ( const SN_TYPE_NODE_CPU_HIGH_LOAD = "node-cpu-high-load" const SN_TYPE_NODE_MEMORY_HIGH_UTILIZATION = "node-memory-high-utilization" const SN_TYPE_NODE_DISK_FULL = "node-disk-full" -const SN_TYPE_PVC_FULL = "pvc_full" +const SN_TYPE_PVC_FULL = "pvc-full" const SN_TYPE_POD_RESTART_FREQUENTLY = "pod-restart-frequently" type SystemNotificationTemplateResponse struct { diff --git a/scripts/init_postgres.sql b/scripts/init_postgres.sql index 27e7b678..e0feb969 100644 --- a/scripts/init_postgres.sql +++ b/scripts/init_postgres.sql @@ -57,15 +57,15 @@ insert into project_roles ( id, name, description, created_at, updated_at ) valu ## SystemNotificationTemplates insert into system_notification_templates ( id, name, description, is_system, metric_query, creator_id, updator_id, created_at, updated_at ) -values ('d42d716f-dd2e-429b-897d-b602f6382790', 'node-cpu-high-load', 'node-cpu-high-load', true, '(avg by (taco_cluster, instance) (rate(node_cpu_seconds_total{mode="idle"}[60s]))) < 0', null, null, now(), now() ); +values ('d42d716f-dd2e-429b-897d-b602f6382790', 'node-cpu-high-load', 'node-cpu-high-load', true, '(avg by (taco_cluster, instance) (rate(node_cpu_seconds_total{mode="idle"}[60s])))', null, null, now(), now() ); insert into system_notification_templates ( id, name, description, is_system, metric_query, creator_id, updator_id, created_at, updated_at ) -values ('f11eefa4-5a16-44fc-8dae-4662e7fba023', 'node-memory-high-utilization', true, 'node-memory-high-utilization', '(node_memory_MemAvailable_bytes/node_memory_MemTotal_bytes) < 0.2', null, null, now(), now() ); +values ('f11eefa4-5a16-44fc-8dae-4662e7fba023', 'node-memory-high-utilization', true, 'node-memory-high-utilization', '(node_memory_MemAvailable_bytes/node_memory_MemTotal_bytes)', null, null, now(), now() ); insert into system_notification_templates ( id, name, description, is_system, metric_query, creator_id, updator_id, created_at, updated_at ) -values ('1ec08b58-2fe1-49c5-bbab-3544ec8ce330', 'node-disk-full', 'node-disk-full', true, 'predict_linear(node_filesystem_free_bytes{mountpoint="/"}[6h], 24*3600) < 0', null, null, now(), now() ); +values ('1ec08b58-2fe1-49c5-bbab-3544ec8ce330', 'node-disk-full', 'node-disk-full', true, 'predict_linear(node_filesystem_free_bytes{mountpoint="/"}[6h], 24*3600)', null, null, now(), now() ); insert into system_notification_templates ( id, name, description, is_system, metric_query, creator_id, updator_id, created_at, updated_at ) -values ('68dcb92d-91cc-47d0-9b2f-2285d74f157f', 'pvc-full', 'pvc-full', true, 'predict_linear(kubelet_volume_stats_available_bytes[6h], 24*3600) < 0', null, null, now(), now() ); +values ('68dcb92d-91cc-47d0-9b2f-2285d74f157f', 'pvc-full', 'pvc-full', true, 'predict_linear(kubelet_volume_stats_available_bytes[6h], 24*3600)', null, null, now(), now() ); insert into system_notification_templates ( id, name, description, is_system, metric_query, creator_id, updator_id, created_at, updated_at ) -values ('46e9e216-364a-4a3f-9182-85b2c4c34f77', 'pod-restart-frequently', true, 'pod-restart-frequently', 'increase(kube_pod_container_status_restarts_total{namespace!="kube-system"}[60m:]) > 2', null, null, now(), now() ); +values ('46e9e216-364a-4a3f-9182-85b2c4c34f77', 'pod-restart-frequently', true, 'pod-restart-frequently', 'increase(kube_pod_container_status_restarts_total{namespace!="kube-system"}[60m:])', null, null, now(), now() ); ## SystemNotificationTemplates -> SystemNotificationMetricParameters insert into system_notification_metric_parameters ( "order", system_notification_template_id, key, value, created_at, updated_at ) @@ -89,4 +89,4 @@ values ( 0, '46e9e216-364a-4a3f-9182-85b2c4c34f77', 'STACK', '$labels.taco_clust insert into system_notification_metric_parameters ( "order", system_notification_template_id, key, value, created_at, updated_at ) values ( 1, '46e9e216-364a-4a3f-9182-85b2c4c34f77', 'POD', '$labels.pod', now(), now() ); insert into system_notification_metric_parameters ( "order", system_notification_template_id, key, value, created_at, updated_at ) -values ( 3, '46e9e216-364a-4a3f-9182-85b2c4c34f77', 'NAMESPACE', '$labels.namespace', now(), now() ); +values ( 2, '46e9e216-364a-4a3f-9182-85b2c4c34f77', 'NAMESPACE', '$labels.namespace', now(), now() );