mirror of
https://github.com/paralus/paralus.git
synced 2026-03-04 18:10:21 +00:00
Add DeleteIdp rpc method
Signed-off-by: Akshay Gaikwad <akshay.gaikwad@rafay.co>
This commit is contained in:
@@ -110,6 +110,50 @@
|
||||
}
|
||||
},
|
||||
"/auth/v3/sso/idp/{id}": {
|
||||
"delete": {
|
||||
"summary": "DELETE /auth/v1/sso/idp/{id}/",
|
||||
"operationId": "Idp_DeleteIdp",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"properties": {}
|
||||
}
|
||||
},
|
||||
"204": {
|
||||
"description": "Returned when idp is deleted successfully.",
|
||||
"schema": {}
|
||||
},
|
||||
"403": {
|
||||
"description": "Returned when the user does not have permission to access the resource.",
|
||||
"schema": {}
|
||||
},
|
||||
"404": {
|
||||
"description": "Returned when the resource does not exist.",
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"format": "string"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/googlerpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Idp"
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"operationId": "Idp_UpdateIdp",
|
||||
"responses": {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/RafaySystems/rcloud-base/components/usermgmt/pkg/service"
|
||||
rpcv3 "github.com/RafaySystems/rcloud-base/components/usermgmt/proto/rpc/v3"
|
||||
userv3 "github.com/RafaySystems/rcloud-base/components/usermgmt/proto/types/userpb/v3"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
type idpServer struct {
|
||||
@@ -31,3 +32,7 @@ func (s *idpServer) GetSpConfigById(ctx context.Context, idpID *userv3.IdpID) (*
|
||||
func (s *idpServer) ListIdps(ctx context.Context, req *userv3.ListIdpsRequest) (*userv3.ListIdpsResponse, error) {
|
||||
return s.IdpService.ListIdps(ctx, req)
|
||||
}
|
||||
|
||||
func (s *idpServer) DeleteIdp(ctx context.Context, idpID *userv3.IdpID) (*emptypb.Empty, error) {
|
||||
return s.IdpService.DeleteIdp(ctx, idpID)
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
userv3 "github.com/RafaySystems/rcloud-base/components/usermgmt/proto/types/userpb/v3"
|
||||
"github.com/google/uuid"
|
||||
"github.com/uptrace/bun"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
const TimeLayout = "2006-01-02T15:04:05.999999Z"
|
||||
@@ -29,6 +30,7 @@ type IdpService interface {
|
||||
UpdateIdp(context.Context, *userv3.UpdateIdp) (*userv3.Idp, error)
|
||||
GetSpConfigById(context.Context, *userv3.IdpID) (*userv3.SpConfig, error)
|
||||
ListIdps(context.Context, *userv3.ListIdpsRequest) (*userv3.ListIdpsResponse, error)
|
||||
DeleteIdp(context.Context, *userv3.IdpID) (*emptypb.Empty, error)
|
||||
}
|
||||
|
||||
type idpService struct {
|
||||
@@ -278,3 +280,17 @@ func (s *idpService) ListIdps(ctx context.Context, req *userv3.ListIdpsRequest)
|
||||
}
|
||||
return rv, nil
|
||||
}
|
||||
|
||||
func (s *idpService) DeleteIdp(ctx context.Context, idpID *userv3.IdpID) (*emptypb.Empty, error) {
|
||||
id, err := uuid.Parse(idpID.GetId())
|
||||
if err != nil {
|
||||
return &emptypb.Empty{}, err
|
||||
}
|
||||
|
||||
entity := &models.Idp{}
|
||||
err = s.dao.Delete(ctx, id, entity)
|
||||
if err != nil {
|
||||
return &emptypb.Empty{}, err
|
||||
}
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ package rafay.dev.rpc.v3;
|
||||
import "google/api/annotations.proto";
|
||||
import "protoc-gen-openapiv2/options/annotations.proto";
|
||||
import "proto/types/userpb/v3/idp.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
|
||||
info : {
|
||||
@@ -86,7 +87,20 @@ service Idp {
|
||||
};
|
||||
|
||||
// DELETE /auth/v1/sso/idp/{id}/
|
||||
// Delete IdP
|
||||
rpc DeleteIdp(rafay.dev.types.user.v3.IdpID) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
delete : "/auth/v3/sso/idp/{id}"
|
||||
};
|
||||
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
responses : {
|
||||
key : "204"
|
||||
value : {
|
||||
description : "Returned when idp is deleted successfully."
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// endpooint /auth/v1/sso/idp/{id}/upload_metadata/
|
||||
// file content as request payload and response is Idp
|
||||
|
||||
Reference in New Issue
Block a user