diff --git a/components/usermgmt/proto/rpc/v3/group.proto b/components/usermgmt/proto/rpc/v3/group.proto new file mode 100644 index 0000000..5173477 --- /dev/null +++ b/components/usermgmt/proto/rpc/v3/group.proto @@ -0,0 +1,129 @@ +syntax = "proto3"; +package rafay.dev.rpc.v3; + +import "google/api/annotations.proto"; +import "gogoproto/gogo.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; +import "proto/types/userpb/v3/group.proto"; + +// Enable custom Marshal method. +option (gogoproto.marshaler_all) = true; +// Enable custom Unmarshal method. +option (gogoproto.unmarshaler_all) = true; +// Enable custom Size method (Required by Marshal and Unmarshal). +option (gogoproto.sizer_all) = true; +// Enable registration with golang/protobuf for the grpc-gateway. +option (gogoproto.goproto_registration) = true; +// Enable generation of XXX_MessageName methods for grpc-go/status. +option (gogoproto.messagename_all) = true; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info : { + title : "Group management Service" + version : "2.0" + contact : {name : "Rafay Dev"} + } + schemes : HTTPS + consumes : "application/json" + consumes : "application/yaml" + produces : "application/json" + produces : "application/yaml" + security_definitions : { + security : { + key : "BasicAuth" + value : {type : TYPE_BASIC} + } + security : { + key : "ApiKeyAuth" + value : {type : TYPE_API_KEY in : IN_HEADER name : "X-RAFAY-API-KEYID"} + } + } + security : { + security_requirement : { + key : "BasicAuth" + value : {} + } + security_requirement : { + key : "ApiKeyAuth" + value : {} + } + } + responses : { + key : "403" + value : { + description : "Returned when the group does not have permission to " + "access " + "the resource." + } + } + responses : { + key : "404" + value : { + description : "Returned when the resource does not exist." + schema : {json_schema : {type : STRING}} + } + } +}; + +// Add filtering with org as well +message GetGroupsRequest { + string project = 1 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Project", + description : "Project of user to filter by" + read_only : true + } ]; +} +message GetGroupRequest { string id = 1; } +message DeleteGroupRequest { string id = 1; } +message PutGroupRequest { + string id = 1; + rafay.dev.types.user.v3.Group group = 2; +} +message GetGroupsResponse { repeated rafay.dev.types.user.v3.Group group = 1; } +message GroupResponse { + string status = 1; + string message = 2; +} + +service Group { + rpc CreateGroup(rafay.dev.types.user.v3.Group) + returns (rafay.dev.types.user.v3.Group) { + option (google.api.http) = { + post : "/auth/v3/groups" + body : "*" + }; + + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + responses : { + key : "201" + value : {description : "Returned when group is created successfully."} + } + }; + }; + + rpc GetGroups(GetGroupsRequest) returns (GetGroupsResponse) { + option (google.api.http) = { + get : "/auth/v3/groups" + }; + }; + + rpc GetGroup(GetGroupRequest) returns (rafay.dev.types.user.v3.Group) { + option (google.api.http) = { + get : "/auth/v3/group/{id}" + }; + }; + + rpc UpdateGroup(PutGroupRequest) returns (GroupResponse) { + option (google.api.http) = { + put : "/auth/v3/group/{id}" + body : "group" + }; + }; + + rpc DeleteGroup(DeleteGroupRequest) returns (GroupResponse) { + option (google.api.http) = { + delete : "/auth/v3/group/{id}" + }; + }; +} \ No newline at end of file diff --git a/components/usermgmt/proto/rpc/v3/role.proto b/components/usermgmt/proto/rpc/v3/role.proto new file mode 100644 index 0000000..27063ed --- /dev/null +++ b/components/usermgmt/proto/rpc/v3/role.proto @@ -0,0 +1,120 @@ +syntax = "proto3"; +package rafay.dev.rpc.v3; + +import "google/api/annotations.proto"; +import "gogoproto/gogo.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; +import "proto/types/userpb/v3/role.proto"; + +// Enable custom Marshal method. +option (gogoproto.marshaler_all) = true; +// Enable custom Unmarshal method. +option (gogoproto.unmarshaler_all) = true; +// Enable custom Size method (Required by Marshal and Unmarshal). +option (gogoproto.sizer_all) = true; +// Enable registration with golang/protobuf for the grpc-gateway. +option (gogoproto.goproto_registration) = true; +// Enable generation of XXX_MessageName methods for grpc-go/status. +option (gogoproto.messagename_all) = true; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info : { + title : "Role management Service" + version : "2.0" + contact : {name : "Rafay Dev"} + } + schemes : HTTPS + consumes : "application/json" + consumes : "application/yaml" + produces : "application/json" + produces : "application/yaml" + security_definitions : { + security : { + key : "BasicAuth" + value : {type : TYPE_BASIC} + } + security : { + key : "ApiKeyAuth" + value : {type : TYPE_API_KEY in : IN_HEADER name : "X-RAFAY-API-KEYID"} + } + } + security : { + security_requirement : { + key : "BasicAuth" + value : {} + } + security_requirement : { + key : "ApiKeyAuth" + value : {} + } + } + responses : { + key : "403" + value : { + description : "Returned when the role does not have permission to access " + "the resource." + } + } + responses : { + key : "404" + value : { + description : "Returned when the resource does not exist." + schema : {json_schema : {type : STRING}} + } + } +}; + +message GetRolesRequest {} +message GetRoleRequest { string id = 1; } +message DeleteRoleRequest { string id = 1; } +message PutRoleRequest { + string id = 1; + rafay.dev.types.user.v3.Role role = 2; +} +message GetRolesResponse { repeated rafay.dev.types.user.v3.Role role = 1; } +message RoleResponse { + string status = 1; + string message = 2; +} + +service Role { + rpc CreateRole(rafay.dev.types.user.v3.Role) + returns (rafay.dev.types.user.v3.Role) { + option (google.api.http) = { + post : "/auth/v3/roles" + body : "*" + }; + + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + responses : { + key : "201" + value : {description : "Returned when role is created successfully."} + } + }; + }; + + rpc GetRoles(GetRolesRequest) returns (GetRolesResponse) { + option (google.api.http) = { + get : "/auth/v3/roles" + }; + }; + + rpc GetRole(GetRoleRequest) returns (rafay.dev.types.user.v3.Role) { + option (google.api.http) = { + get : "/auth/v3/role/{id}" + }; + }; + + rpc UpdateRole(PutRoleRequest) returns (RoleResponse) { + option (google.api.http) = { + put : "/auth/v3/role/{id}" + body : "role" + }; + }; + + rpc DeleteRole(DeleteRoleRequest) returns (RoleResponse) { + option (google.api.http) = { + delete : "/auth/v3/role/{id}" + }; + }; +} \ No newline at end of file diff --git a/components/usermgmt/proto/rpc/v3/rolepermission.proto b/components/usermgmt/proto/rpc/v3/rolepermission.proto new file mode 100644 index 0000000..9c9ca4f --- /dev/null +++ b/components/usermgmt/proto/rpc/v3/rolepermission.proto @@ -0,0 +1,99 @@ +syntax = "proto3"; +package rafay.dev.rpc.v3; + +import "google/api/annotations.proto"; +import "gogoproto/gogo.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; +import "proto/types/userpb/v3/rolepermission.proto"; + +// Enable custom Marshal method. +option (gogoproto.marshaler_all) = true; +// Enable custom Unmarshal method. +option (gogoproto.unmarshaler_all) = true; +// Enable custom Size method (Required by Marshal and Unmarshal). +option (gogoproto.sizer_all) = true; +// Enable registration with golang/protobuf for the grpc-gateway. +option (gogoproto.goproto_registration) = true; +// Enable generation of XXX_MessageName methods for grpc-go/status. +option (gogoproto.messagename_all) = true; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info : { + title : "Rolepermission management Service" + version : "2.0" + contact : {name : "Rafay Dev"} + } + schemes : HTTPS + consumes : "application/json" + consumes : "application/yaml" + produces : "application/json" + produces : "application/yaml" + security_definitions : { + security : { + key : "BasicAuth" + value : {type : TYPE_BASIC} + } + security : { + key : "ApiKeyAuth" + value : {type : TYPE_API_KEY in : IN_HEADER name : "X-RAFAY-API-KEYID"} + } + } + security : { + security_requirement : { + key : "BasicAuth" + value : {} + } + security_requirement : { + key : "ApiKeyAuth" + value : {} + } + } + responses : { + key : "403" + value : { + description : "Returned when the rolepermission does not have permission " + "to access " + "the resource." + } + } + responses : { + key : "404" + value : { + description : "Returned when the resource does not exist." + schema : {json_schema : {type : STRING}} + } + } +}; + +message GetRolepermissionsRequest {} +message GetRolepermissionRequest { + string id = 1 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Id", + description : "Id of the rolepermission resource" + } ]; +} +message GetRolepermissionsResponse { + repeated rafay.dev.types.user.v3.RolePermission rolepermissions = 1 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "RolePermissions", + description : "List of the rolepermission resources" + } ]; + +} + +service Rolepermission { + rpc GetRolepermissions(GetRolepermissionsRequest) + returns (GetRolepermissionsResponse) { + option (google.api.http) = { + get : "/auth/v3/rolepermissions" + }; + }; + + rpc GetRolepermission(GetRolepermissionRequest) + returns (rafay.dev.types.user.v3.RolePermission) { + option (google.api.http) = { + get : "/auth/v3/rolepermission/{id}" + }; + }; +} \ No newline at end of file diff --git a/components/usermgmt/proto/rpc/v3/user.proto b/components/usermgmt/proto/rpc/v3/user.proto new file mode 100644 index 0000000..f181039 --- /dev/null +++ b/components/usermgmt/proto/rpc/v3/user.proto @@ -0,0 +1,121 @@ +syntax = "proto3"; +package rafay.dev.rpc.v3; + +import "google/api/annotations.proto"; +import "gogoproto/gogo.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; +import "proto/types/userpb/v3/user.proto"; + +// Enable custom Marshal method. +option (gogoproto.marshaler_all) = true; +// Enable custom Unmarshal method. +option (gogoproto.unmarshaler_all) = true; +// Enable custom Size method (Required by Marshal and Unmarshal). +option (gogoproto.sizer_all) = true; +// Enable registration with golang/protobuf for the grpc-gateway. +option (gogoproto.goproto_registration) = true; +// Enable generation of XXX_MessageName methods for grpc-go/status. +option (gogoproto.messagename_all) = true; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info : { + title : "User management Service" + version : "2.0" + contact : {name : "Rafay Dev"} + } + schemes : HTTPS + consumes : "application/json" + consumes : "application/yaml" + produces : "application/json" + produces : "application/yaml" + security_definitions : { + security : { + key : "BasicAuth" + value : {type : TYPE_BASIC} + } + security : { + key : "ApiKeyAuth" + value : {type : TYPE_API_KEY in : IN_HEADER name : "X-RAFAY-API-KEYID"} + } + } + security : { + security_requirement : { + key : "BasicAuth" + value : {} + } + security_requirement : { + key : "ApiKeyAuth" + value : {} + } + } + responses : { + key : "403" + value : { + description : "Returned when the user does not have permission to access " + "the resource." + } + } + responses : { + key : "404" + value : { + description : "Returned when the resource does not exist." + schema : {json_schema : {type : STRING}} + } + } +}; + +// Add option to filter by more org and group +message GetUsersRequest { string project = 1; } +message GetUserRequest { string userid = 1; } +message DeleteUserRequest { string userid = 1; } +message PutUserRequest { + string userid = 1; + rafay.dev.types.user.v3.User user = 2; +} +message GetUsersResponse { repeated rafay.dev.types.user.v3.User user = 1; } +message UserResponse { + string status = 1; + string message = 2; +} + +service User { + rpc CreateUser(rafay.dev.types.user.v3.User) + returns (rafay.dev.types.user.v3.User) { + option (google.api.http) = { + post : "/auth/v3/users" + body : "*" + }; + + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + responses : { + key : "201" + value : {description : "Returned when user is created successfully."} + } + }; + }; + + rpc GetUsers(GetUsersRequest) returns (GetUsersResponse) { + option (google.api.http) = { + get : "/auth/v3/users" + }; + }; + + rpc GetUser(GetUserRequest) returns (rafay.dev.types.user.v3.User) { + option (google.api.http) = { + get : "/auth/v3/user/{userid}" + }; + }; + + rpc UpdateUser(PutUserRequest) returns (UserResponse) { + option (google.api.http) = { + put : "/auth/v3/user/{userid}" + body : "user" + }; + }; + + rpc DeleteUser(DeleteUserRequest) returns (UserResponse) { + option (google.api.http) = { + delete : "/auth/v3/user/{userid}" + }; + }; +} \ No newline at end of file diff --git a/components/usermgmt/proto/types/userpb/v3/group.proto b/components/usermgmt/proto/types/userpb/v3/group.proto index 9dd545f..041e675 100644 --- a/components/usermgmt/proto/types/userpb/v3/group.proto +++ b/components/usermgmt/proto/types/userpb/v3/group.proto @@ -3,6 +3,7 @@ package rafay.dev.types.user.v3; import "proto/types/commonpb/v3/common.proto"; import "proto/types/systempb/v3/project.proto"; +import "proto/types/userpb/v3/role.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; // import "google/api/field_behavior.proto"; @@ -14,22 +15,110 @@ message Group { required : [ "apiVersion", "kind", "metadata", "spec" ] } }; - string apiVersion = 1; // usermgmt.k8smgmt.io/v3 - string kind = 2; // default : "Group" - rafay.dev.types.common.v3.Metadata metadata = 3; - GroupSpec spec = 4; - rafay.dev.types.common.v3.Status status = 5; + string apiVersion = 1 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "API Version", + description : "API Version of the group resource" + default : "usermgmt.k8smgmt.io/v3" + } ]; + string kind = 2 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Kind", + description : "Kind of the group resource" + default : "Pipeline" + } ]; + rafay.dev.types.common.v3.Metadata metadata = 3 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Metadata", + description : "Metadata of the group resource" + } ]; + GroupSpec spec = 4 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Metadata", + description : "Metadata of the group resource" + } ]; + rafay.dev.types.common.v3.Status status = 5 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Status", + description : "Status of the resource" + read_only : true + } ]; +} + +message ProjectRole { + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema : { + title : "ProjectRole" + description : "Project and role pairing for permission" + } + }; + rafay.dev.types.system.v3.Project project = 1 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Project" + description : "Project" + } ]; + rafay.dev.types.user.v3.Role role = 2 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Role" + description : "Role" + } ]; } message GroupSpec { - repeated rafay.dev.types.system.v3.Project projects = 1; - repeated string users = 2; - string type = 3; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema : { + title : "Group Specification" + description : "Group specification" + } + }; + repeated ProjectRole projectroles = 1 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "ProjectRoles" + description : "ProjectRole groups for permission" + } ]; + repeated string users = 2 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Users" + description : "List of users for group" + } ]; + string type = 3 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Type" + description : "Type of group" + } ]; } message GroupList { - string apiVersion = 1; - string kind = 2; - rafay.dev.types.common.v3.ListMetadata metadata = 3; - repeated Group items = 4; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema : { + title : "GroupList" + description : "Group list" + read_only : true + } + }; + + string apiVersion = 1 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "API Version", + description : "API Version of the group list resource" + read_only : true + } ]; + string kind = 2 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Kind", + description : "Kind of the group list resource" + read_only : true + } ]; + rafay.dev.types.common.v3.ListMetadata metadata = 3 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Metadata", + description : "Metadata of the group list resource" + read_only : true + } ]; + repeated Group items = 4 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Items", + description : "List of the group resources" + read_only : true + } ]; } diff --git a/components/usermgmt/proto/types/userpb/v3/role.proto b/components/usermgmt/proto/types/userpb/v3/role.proto index 15afa5f..2e08031 100644 --- a/components/usermgmt/proto/types/userpb/v3/role.proto +++ b/components/usermgmt/proto/types/userpb/v3/role.proto @@ -15,18 +15,80 @@ message Role { } }; - string apiVersion = 1; // default : "usermgmt.k8smgmt.io/v3" - string kind = 2; // default : "Role" - rafay.dev.types.common.v3.Metadata metadata = 3; - RoleSpec spec = 4; - rafay.dev.types.common.v3.Status status = 5; + string apiVersion = 1 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "API Version", + description : "API Version of the Role resource" + default : "usermgmt.k8smgmt.io/v3" + } ]; + string kind = 2 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Kind", + description : "Kind of the role resource" + default : "Role" + } ]; + rafay.dev.types.common.v3.Metadata metadata = 3 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Metadata", + description : "Metadata of the role resource" + } ]; + RoleSpec spec = 4 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Spec", + description : "Spec of the role resource" + } ]; + rafay.dev.types.common.v3.Status status = 5 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Status", + description : "Status of the resource" + read_only : true + } ]; } -message RoleSpec { repeated rafay.dev.types.user.v3.RolePermission rolepermissions = 1; } +message RoleSpec { + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema : { + title : "Role Specification" + description : "Role specification" + } + }; + repeated rafay.dev.types.user.v3.RolePermission rolepermissions = 1 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "RolePermissions" + description : "Permissions for the role" + } ]; +} message RoleList { - string apiVersion = 1; - string kind = 2; - rafay.dev.types.common.v3.ListMetadata metadata = 3; - repeated Role items = 4; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema : { + title : "RoleList" + description : "Role list" + read_only : true + } + }; + string apiVersion = 1 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "API Version", + description : "API Version of the role list resource" + read_only : true + } ]; + string kind = 2 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Kind", + description : "Kind of the role list resource" + read_only : true + } ]; + rafay.dev.types.common.v3.ListMetadata metadata = 3 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Metadata", + description : "Metadata of the role list resource" + read_only : true + } ]; + repeated Role items = 4 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Items", + description : "List of role resources" + read_only : true + } ]; } diff --git a/components/usermgmt/proto/types/userpb/v3/rolepermission.proto b/components/usermgmt/proto/types/userpb/v3/rolepermission.proto index 4bc7f14..a993684 100644 --- a/components/usermgmt/proto/types/userpb/v3/rolepermission.proto +++ b/components/usermgmt/proto/types/userpb/v3/rolepermission.proto @@ -14,18 +14,80 @@ message RolePermission { } }; - string apiVersion = 1; // default : "usermgmt.k8smgmt.io/v3" - string kind = 2; // default : "RolePermission" - rafay.dev.types.common.v3.Metadata metadata = 3; - RolePermissionSpec spec = 4; - rafay.dev.types.common.v3.Status status = 5; + string apiVersion = 1 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "API Version", + description : "API Version of the role permission resource" + default : "usermgmt.k8smgmt.io/v3" + } ]; + string kind = 2 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Kind", + description : "Kind of the role permission resource" + default : "RolePermission" + } ]; + rafay.dev.types.common.v3.Metadata metadata = 3 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Metadata", + description : "Metadata of the role permission resource" + } ]; + RolePermissionSpec spec = 4 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Metadata", + description : "Metadata of the role permission resource" + } ]; + rafay.dev.types.common.v3.Status status = 5 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Status", + description : "Status of the resource" + read_only : true + } ]; } -message RolePermissionSpec { repeated string permissions = 1; } +message RolePermissionSpec { + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema : { + title : "RolePermission Specification" + description : "RolePermisson specification" + } + }; + repeated string permissions = 1 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Permissions" + description : "List of permisions for role" + } ]; +} message RolePermissionList { - string apiVersion = 1; - string kind = 2; - rafay.dev.types.common.v3.ListMetadata metadata = 3; - repeated RolePermission items = 4; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema : { + title : "RolePermissionList" + description : "RolePeList list" + read_only : true + } + }; + string apiVersion = 1 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "API Version", + description : "API Version of the role permission list resource" + read_only : true + } ]; + string kind = 2 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Kind", + description : "Kind of the role permission list resource" + read_only : true + } ]; + rafay.dev.types.common.v3.ListMetadata metadata = 3 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Metadata", + description : "Metadata of the role permission list resource" + read_only : true + } ]; + repeated RolePermission items = 4 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Items", + description : "List of the role permission resources" + read_only : true + } ]; } diff --git a/components/usermgmt/proto/types/userpb/v3/user.proto b/components/usermgmt/proto/types/userpb/v3/user.proto index 1e9c701..b5d354a 100644 --- a/components/usermgmt/proto/types/userpb/v3/user.proto +++ b/components/usermgmt/proto/types/userpb/v3/user.proto @@ -18,32 +18,146 @@ message User { } }; - string apiVersion = 1; // default : "usermgmt.k8smgmt.io/v3" - string kind = 2; // default : "User" - rafay.dev.types.common.v3.Metadata metadata = 3; - UserSpec spec = 4; - rafay.dev.types.common.v3.Status status = 5; + string apiVersion = 1 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "API Version", + description : "API Version of the user resource" + default : "usermgmt.k8smgmt.io/v3" + } ]; + string kind = 2 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Kind", + description : "Kind of the user resource" + default : "User" + } ]; + rafay.dev.types.common.v3.Metadata metadata = 3 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Metadata", + description : "Metadata of the user resource" + } ]; + UserSpec spec = 4 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Spec", + description : "Spec of the user resource" + } ]; + + rafay.dev.types.common.v3.Status status = 5 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Status", + description : "Status of the resource" + read_only : true + } ]; } message UserSpec { - string firstName = 1; - string lastName = 2; - string username = 3; - string phone = 4; - string password = 5; - string totpRequired = 6; - string totpSecret = 7; - repeated rafay.dev.types.user.v3.Role roles = 8; - repeated rafay.dev.types.user.v3.Group group = 9; - repeated rafay.dev.types.system.v3.Project project = 10; - bool emailVerified = 11; - bool phoneVerified = 12; - bool totpVerified = 13; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema : { + title : "User Specification" + description : "User specification" + } + }; + string firstName = 1 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "FirstName" + description : "First name of the user" + } ]; + string lastName = 2 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "LastName" + description : "Last name of the user" + } ]; + string username = 3 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Username" + description : "Username of the user" + } ]; + string phone = 4 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Phone" + description : "Phone number of the user" + } ]; + string password = 5 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Password" + description : "Password of the user" + } ]; + string totpRequired = 6 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "TotpRequired" + description : "Flag to specify if TOTP is required" + } ]; + string totpSecret = 7 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "TotpSecret" + description : "Secret for TOTP" + } ]; + repeated rafay.dev.types.user.v3.Role roles = 8 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Roles" + description : "Roles of the user" + } ]; + repeated rafay.dev.types.user.v3.Group groups = 9 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Group" + description : "Groups of the user" + } ]; + repeated rafay.dev.types.system.v3.Project projects = 10 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Projects" + description : "Projects of the user" + } ]; + bool emailVerified = 11 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "EmailVerified" + description : "Flag to show if the email of the user was verified" + read_only : true + } ]; + bool phoneVerified = 12 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "PhoneVerified" + description : "Flag to show if phone number of the user was verified" + read_only : true + } ]; + bool totpVerified = 13 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "TotpVerified" + description : "Flag to show if the TOTP of the user was verified" + read_only : true + } ]; } message UserList { - string apiVersion = 1; - string kind = 2; - rafay.dev.types.common.v3.ListMetadata metadata = 3; - repeated User items = 4; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema : { + title : "UserList" + description : "User list" + read_only : true + } + }; + string apiVersion = 1 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "API Version", + description : "API Version of the user list resource" + default : "usermgmt.k8smgmt.io/v3" + read_only : true + } ]; + string kind = 2 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Kind", + description : "Kind of the user list resource" + default : "UserList" + read_only : true + } ]; + rafay.dev.types.common.v3.ListMetadata metadata = 3 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Metadata", + description : "Metadata of the user list resource" + read_only : true + } ]; + repeated User items = 4 + [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + title : "Items", + description : "List of the user resources" + read_only : true + } ]; }