diff --git a/coralogix/clientset/clientset.go b/coralogix/clientset/clientset.go index cb70b98d..9cb0cf50 100644 --- a/coralogix/clientset/clientset.go +++ b/coralogix/clientset/clientset.go @@ -23,6 +23,7 @@ type ClientSet struct { apiKeys *ApikeysClient groups *GroupsClient users *UsersClient + customRole *RolesClient } func (c *ClientSet) RuleGroups() *RuleGroupsClient { @@ -97,6 +98,10 @@ func (c *ClientSet) ApiKeys() *ApikeysClient { return c.apiKeys } +func (c *ClientSet) CustomRoles() *RolesClient { + return c.customRole +} + func (c *ClientSet) SLOs() *SLOsClient { return c.slos } @@ -140,5 +145,6 @@ func NewClientSet(targetUrl, apiKey, orgKey string) *ClientSet { apiKeys: NewApiKeysClient(teamsCPC), groups: NewGroupsClient(teamsCPC), users: NewUsersClient(teamsCPC), + customRole: NewRolesClient(teamsCPC), } } diff --git a/coralogix/clientset/grpc/roles/permissions.pb.go b/coralogix/clientset/grpc/roles/permissions.pb.go new file mode 100644 index 00000000..fe331b13 --- /dev/null +++ b/coralogix/clientset/grpc/roles/permissions.pb.go @@ -0,0 +1,312 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v4.25.1 +// source: permissions.proto + +package __ + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ListAllPermissionsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListAllPermissionsRequest) Reset() { + *x = ListAllPermissionsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_permissions_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListAllPermissionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListAllPermissionsRequest) ProtoMessage() {} + +func (x *ListAllPermissionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_permissions_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListAllPermissionsRequest.ProtoReflect.Descriptor instead. +func (*ListAllPermissionsRequest) Descriptor() ([]byte, []int) { + return file_permissions_proto_rawDescGZIP(), []int{0} +} + +type Permission struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Expression *string `protobuf:"bytes,1,opt,name=expression,proto3,oneof" json:"expression,omitempty"` + Description *string `protobuf:"bytes,2,opt,name=description,proto3,oneof" json:"description,omitempty"` + DocLink *string `protobuf:"bytes,3,opt,name=doc_link,json=docLink,proto3,oneof" json:"doc_link,omitempty"` + Explanation *string `protobuf:"bytes,4,opt,name=explanation,proto3,oneof" json:"explanation,omitempty"` +} + +func (x *Permission) Reset() { + *x = Permission{} + if protoimpl.UnsafeEnabled { + mi := &file_permissions_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Permission) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Permission) ProtoMessage() {} + +func (x *Permission) ProtoReflect() protoreflect.Message { + mi := &file_permissions_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Permission.ProtoReflect.Descriptor instead. +func (*Permission) Descriptor() ([]byte, []int) { + return file_permissions_proto_rawDescGZIP(), []int{1} +} + +func (x *Permission) GetExpression() string { + if x != nil && x.Expression != nil { + return *x.Expression + } + return "" +} + +func (x *Permission) GetDescription() string { + if x != nil && x.Description != nil { + return *x.Description + } + return "" +} + +func (x *Permission) GetDocLink() string { + if x != nil && x.DocLink != nil { + return *x.DocLink + } + return "" +} + +func (x *Permission) GetExplanation() string { + if x != nil && x.Explanation != nil { + return *x.Explanation + } + return "" +} + +type ListAllPermissionsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Permissions []*Permission `protobuf:"bytes,1,rep,name=permissions,proto3" json:"permissions,omitempty"` +} + +func (x *ListAllPermissionsResponse) Reset() { + *x = ListAllPermissionsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_permissions_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListAllPermissionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListAllPermissionsResponse) ProtoMessage() {} + +func (x *ListAllPermissionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_permissions_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListAllPermissionsResponse.ProtoReflect.Descriptor instead. +func (*ListAllPermissionsResponse) Descriptor() ([]byte, []int) { + return file_permissions_proto_rawDescGZIP(), []int{2} +} + +func (x *ListAllPermissionsResponse) GetPermissions() []*Permission { + if x != nil { + return x.Permissions + } + return nil +} + +var File_permissions_proto protoreflect.FileDescriptor + +var file_permissions_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, 0x67, + 0x69, 0x78, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x61, 0x61, 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, 0x2e, + 0x76, 0x32, 0x22, 0x1b, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x50, 0x65, 0x72, + 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, + 0xdb, 0x01, 0x0a, 0x0a, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x23, + 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x1e, 0x0a, 0x08, 0x64, 0x6f, + 0x63, 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x07, + 0x64, 0x6f, 0x63, 0x4c, 0x69, 0x6e, 0x6b, 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0b, 0x65, 0x78, + 0x70, 0x6c, 0x61, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x03, 0x52, 0x0b, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, + 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x6f, 0x63, 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x42, 0x0e, 0x0a, + 0x0c, 0x5f, 0x65, 0x78, 0x70, 0x6c, 0x61, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x69, 0x0a, + 0x1a, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x0b, 0x70, + 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, + 0x61, 0x70, 0x69, 0x73, 0x2e, 0x61, 0x61, 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, + 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x70, 0x65, 0x72, + 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x32, 0xa0, 0x01, 0x0a, 0x12, 0x50, 0x65, 0x72, + 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x89, 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x50, 0x65, 0x72, 0x6d, 0x69, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x38, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x72, + 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x61, 0x61, 0x61, 0x2e, 0x72, + 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x50, 0x65, + 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x39, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, + 0x61, 0x70, 0x69, 0x73, 0x2e, 0x61, 0x61, 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x6c, 0x6c, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x03, 0x5a, 0x01, 0x2e, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_permissions_proto_rawDescOnce sync.Once + file_permissions_proto_rawDescData = file_permissions_proto_rawDesc +) + +func file_permissions_proto_rawDescGZIP() []byte { + file_permissions_proto_rawDescOnce.Do(func() { + file_permissions_proto_rawDescData = protoimpl.X.CompressGZIP(file_permissions_proto_rawDescData) + }) + return file_permissions_proto_rawDescData +} + +var file_permissions_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_permissions_proto_goTypes = []interface{}{ + (*ListAllPermissionsRequest)(nil), // 0: com.coralogixapis.aaa.rbac.v2.ListAllPermissionsRequest + (*Permission)(nil), // 1: com.coralogixapis.aaa.rbac.v2.Permission + (*ListAllPermissionsResponse)(nil), // 2: com.coralogixapis.aaa.rbac.v2.ListAllPermissionsResponse +} +var file_permissions_proto_depIdxs = []int32{ + 1, // 0: com.coralogixapis.aaa.rbac.v2.ListAllPermissionsResponse.permissions:type_name -> com.coralogixapis.aaa.rbac.v2.Permission + 0, // 1: com.coralogixapis.aaa.rbac.v2.PermissionsService.ListAllPermissions:input_type -> com.coralogixapis.aaa.rbac.v2.ListAllPermissionsRequest + 2, // 2: com.coralogixapis.aaa.rbac.v2.PermissionsService.ListAllPermissions:output_type -> com.coralogixapis.aaa.rbac.v2.ListAllPermissionsResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_permissions_proto_init() } +func file_permissions_proto_init() { + if File_permissions_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_permissions_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListAllPermissionsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_permissions_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Permission); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_permissions_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListAllPermissionsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_permissions_proto_msgTypes[1].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_permissions_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_permissions_proto_goTypes, + DependencyIndexes: file_permissions_proto_depIdxs, + MessageInfos: file_permissions_proto_msgTypes, + }.Build() + File_permissions_proto = out.File + file_permissions_proto_rawDesc = nil + file_permissions_proto_goTypes = nil + file_permissions_proto_depIdxs = nil +} diff --git a/coralogix/clientset/grpc/roles/permissions_grpc.pb.go b/coralogix/clientset/grpc/roles/permissions_grpc.pb.go new file mode 100644 index 00000000..72e00d73 --- /dev/null +++ b/coralogix/clientset/grpc/roles/permissions_grpc.pb.go @@ -0,0 +1,105 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v4.25.1 +// source: permissions.proto + +package __ + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// PermissionsServiceClient is the client API for PermissionsService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type PermissionsServiceClient interface { + ListAllPermissions(ctx context.Context, in *ListAllPermissionsRequest, opts ...grpc.CallOption) (*ListAllPermissionsResponse, error) +} + +type permissionsServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewPermissionsServiceClient(cc grpc.ClientConnInterface) PermissionsServiceClient { + return &permissionsServiceClient{cc} +} + +func (c *permissionsServiceClient) ListAllPermissions(ctx context.Context, in *ListAllPermissionsRequest, opts ...grpc.CallOption) (*ListAllPermissionsResponse, error) { + out := new(ListAllPermissionsResponse) + err := c.cc.Invoke(ctx, "/com.coralogixapis.aaa.rbac.v2.PermissionsService/ListAllPermissions", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PermissionsServiceServer is the server API for PermissionsService service. +// All implementations must embed UnimplementedPermissionsServiceServer +// for forward compatibility +type PermissionsServiceServer interface { + ListAllPermissions(context.Context, *ListAllPermissionsRequest) (*ListAllPermissionsResponse, error) + mustEmbedUnimplementedPermissionsServiceServer() +} + +// UnimplementedPermissionsServiceServer must be embedded to have forward compatible implementations. +type UnimplementedPermissionsServiceServer struct { +} + +func (UnimplementedPermissionsServiceServer) ListAllPermissions(context.Context, *ListAllPermissionsRequest) (*ListAllPermissionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListAllPermissions not implemented") +} +func (UnimplementedPermissionsServiceServer) mustEmbedUnimplementedPermissionsServiceServer() {} + +// UnsafePermissionsServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PermissionsServiceServer will +// result in compilation errors. +type UnsafePermissionsServiceServer interface { + mustEmbedUnimplementedPermissionsServiceServer() +} + +func RegisterPermissionsServiceServer(s grpc.ServiceRegistrar, srv PermissionsServiceServer) { + s.RegisterService(&PermissionsService_ServiceDesc, srv) +} + +func _PermissionsService_ListAllPermissions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListAllPermissionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PermissionsServiceServer).ListAllPermissions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/com.coralogixapis.aaa.rbac.v2.PermissionsService/ListAllPermissions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PermissionsServiceServer).ListAllPermissions(ctx, req.(*ListAllPermissionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// PermissionsService_ServiceDesc is the grpc.ServiceDesc for PermissionsService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var PermissionsService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "com.coralogixapis.aaa.rbac.v2.PermissionsService", + HandlerType: (*PermissionsServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListAllPermissions", + Handler: _PermissionsService_ListAllPermissions_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "permissions.proto", +} diff --git a/coralogix/clientset/grpc/roles/roles.pb.go b/coralogix/clientset/grpc/roles/roles.pb.go new file mode 100644 index 00000000..e22e0100 --- /dev/null +++ b/coralogix/clientset/grpc/roles/roles.pb.go @@ -0,0 +1,1274 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v4.25.1 +// source: roles.proto + +package __ + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SystemRole struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RoleId uint32 `protobuf:"varint,1,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + Permissions []string `protobuf:"bytes,4,rep,name=permissions,proto3" json:"permissions,omitempty"` +} + +func (x *SystemRole) Reset() { + *x = SystemRole{} + if protoimpl.UnsafeEnabled { + mi := &file_roles_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SystemRole) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemRole) ProtoMessage() {} + +func (x *SystemRole) ProtoReflect() protoreflect.Message { + mi := &file_roles_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SystemRole.ProtoReflect.Descriptor instead. +func (*SystemRole) Descriptor() ([]byte, []int) { + return file_roles_proto_rawDescGZIP(), []int{0} +} + +func (x *SystemRole) GetRoleId() uint32 { + if x != nil { + return x.RoleId + } + return 0 +} + +func (x *SystemRole) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *SystemRole) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *SystemRole) GetPermissions() []string { + if x != nil { + return x.Permissions + } + return nil +} + +type CustomRole struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RoleId uint32 `protobuf:"varint,1,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` + TeamId uint32 `protobuf:"varint,2,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + ParentRoleId uint32 `protobuf:"varint,5,opt,name=parent_role_id,json=parentRoleId,proto3" json:"parent_role_id,omitempty"` + Permissions []string `protobuf:"bytes,6,rep,name=permissions,proto3" json:"permissions,omitempty"` + ParentRoleName string `protobuf:"bytes,7,opt,name=parent_role_name,json=parentRoleName,proto3" json:"parent_role_name,omitempty"` +} + +func (x *CustomRole) Reset() { + *x = CustomRole{} + if protoimpl.UnsafeEnabled { + mi := &file_roles_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CustomRole) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CustomRole) ProtoMessage() {} + +func (x *CustomRole) ProtoReflect() protoreflect.Message { + mi := &file_roles_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CustomRole.ProtoReflect.Descriptor instead. +func (*CustomRole) Descriptor() ([]byte, []int) { + return file_roles_proto_rawDescGZIP(), []int{1} +} + +func (x *CustomRole) GetRoleId() uint32 { + if x != nil { + return x.RoleId + } + return 0 +} + +func (x *CustomRole) GetTeamId() uint32 { + if x != nil { + return x.TeamId + } + return 0 +} + +func (x *CustomRole) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CustomRole) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *CustomRole) GetParentRoleId() uint32 { + if x != nil { + return x.ParentRoleId + } + return 0 +} + +func (x *CustomRole) GetPermissions() []string { + if x != nil { + return x.Permissions + } + return nil +} + +func (x *CustomRole) GetParentRoleName() string { + if x != nil { + return x.ParentRoleName + } + return "" +} + +type GetCustomRoleRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RoleId uint32 `protobuf:"varint,1,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` +} + +func (x *GetCustomRoleRequest) Reset() { + *x = GetCustomRoleRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_roles_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCustomRoleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCustomRoleRequest) ProtoMessage() {} + +func (x *GetCustomRoleRequest) ProtoReflect() protoreflect.Message { + mi := &file_roles_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCustomRoleRequest.ProtoReflect.Descriptor instead. +func (*GetCustomRoleRequest) Descriptor() ([]byte, []int) { + return file_roles_proto_rawDescGZIP(), []int{2} +} + +func (x *GetCustomRoleRequest) GetRoleId() uint32 { + if x != nil { + return x.RoleId + } + return 0 +} + +type GetCustomRoleResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Role *CustomRole `protobuf:"bytes,1,opt,name=role,proto3,oneof" json:"role,omitempty"` +} + +func (x *GetCustomRoleResponse) Reset() { + *x = GetCustomRoleResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_roles_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCustomRoleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCustomRoleResponse) ProtoMessage() {} + +func (x *GetCustomRoleResponse) ProtoReflect() protoreflect.Message { + mi := &file_roles_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCustomRoleResponse.ProtoReflect.Descriptor instead. +func (*GetCustomRoleResponse) Descriptor() ([]byte, []int) { + return file_roles_proto_rawDescGZIP(), []int{3} +} + +func (x *GetCustomRoleResponse) GetRole() *CustomRole { + if x != nil { + return x.Role + } + return nil +} + +type ListSystemRolesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListSystemRolesRequest) Reset() { + *x = ListSystemRolesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_roles_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListSystemRolesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSystemRolesRequest) ProtoMessage() {} + +func (x *ListSystemRolesRequest) ProtoReflect() protoreflect.Message { + mi := &file_roles_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSystemRolesRequest.ProtoReflect.Descriptor instead. +func (*ListSystemRolesRequest) Descriptor() ([]byte, []int) { + return file_roles_proto_rawDescGZIP(), []int{4} +} + +type ListSystemRolesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Roles []*SystemRole `protobuf:"bytes,1,rep,name=roles,proto3" json:"roles,omitempty"` +} + +func (x *ListSystemRolesResponse) Reset() { + *x = ListSystemRolesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_roles_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListSystemRolesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSystemRolesResponse) ProtoMessage() {} + +func (x *ListSystemRolesResponse) ProtoReflect() protoreflect.Message { + mi := &file_roles_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSystemRolesResponse.ProtoReflect.Descriptor instead. +func (*ListSystemRolesResponse) Descriptor() ([]byte, []int) { + return file_roles_proto_rawDescGZIP(), []int{5} +} + +func (x *ListSystemRolesResponse) GetRoles() []*SystemRole { + if x != nil { + return x.Roles + } + return nil +} + +type CreateRoleRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TeamId uint32 `protobuf:"varint,1,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + Permissions []string `protobuf:"bytes,5,rep,name=permissions,proto3" json:"permissions,omitempty"` + // Types that are assignable to ParentRole: + // *CreateRoleRequest_ParentRoleId + // *CreateRoleRequest_ParentRoleName + ParentRole isCreateRoleRequest_ParentRole `protobuf_oneof:"parent_role"` +} + +func (x *CreateRoleRequest) Reset() { + *x = CreateRoleRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_roles_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateRoleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateRoleRequest) ProtoMessage() {} + +func (x *CreateRoleRequest) ProtoReflect() protoreflect.Message { + mi := &file_roles_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateRoleRequest.ProtoReflect.Descriptor instead. +func (*CreateRoleRequest) Descriptor() ([]byte, []int) { + return file_roles_proto_rawDescGZIP(), []int{6} +} + +func (x *CreateRoleRequest) GetTeamId() uint32 { + if x != nil { + return x.TeamId + } + return 0 +} + +func (x *CreateRoleRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateRoleRequest) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *CreateRoleRequest) GetPermissions() []string { + if x != nil { + return x.Permissions + } + return nil +} + +func (m *CreateRoleRequest) GetParentRole() isCreateRoleRequest_ParentRole { + if m != nil { + return m.ParentRole + } + return nil +} + +func (x *CreateRoleRequest) GetParentRoleId() uint32 { + if x, ok := x.GetParentRole().(*CreateRoleRequest_ParentRoleId); ok { + return x.ParentRoleId + } + return 0 +} + +func (x *CreateRoleRequest) GetParentRoleName() string { + if x, ok := x.GetParentRole().(*CreateRoleRequest_ParentRoleName); ok { + return x.ParentRoleName + } + return "" +} + +type isCreateRoleRequest_ParentRole interface { + isCreateRoleRequest_ParentRole() +} + +type CreateRoleRequest_ParentRoleId struct { + ParentRoleId uint32 `protobuf:"varint,6,opt,name=parent_role_id,json=parentRoleId,proto3,oneof"` +} + +type CreateRoleRequest_ParentRoleName struct { + ParentRoleName string `protobuf:"bytes,7,opt,name=parent_role_name,json=parentRoleName,proto3,oneof"` +} + +func (*CreateRoleRequest_ParentRoleId) isCreateRoleRequest_ParentRole() {} + +func (*CreateRoleRequest_ParentRoleName) isCreateRoleRequest_ParentRole() {} + +type CreateRoleResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *CreateRoleResponse) Reset() { + *x = CreateRoleResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_roles_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateRoleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateRoleResponse) ProtoMessage() {} + +func (x *CreateRoleResponse) ProtoReflect() protoreflect.Message { + mi := &file_roles_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateRoleResponse.ProtoReflect.Descriptor instead. +func (*CreateRoleResponse) Descriptor() ([]byte, []int) { + return file_roles_proto_rawDescGZIP(), []int{7} +} + +func (x *CreateRoleResponse) GetId() uint32 { + if x != nil { + return x.Id + } + return 0 +} + +type UpdateRoleRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RoleId uint32 `protobuf:"varint,1,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` + NewName *string `protobuf:"bytes,2,opt,name=new_name,json=newName,proto3,oneof" json:"new_name,omitempty"` + NewDescription *string `protobuf:"bytes,3,opt,name=new_description,json=newDescription,proto3,oneof" json:"new_description,omitempty"` + NewPermissions *Permissions `protobuf:"bytes,4,opt,name=new_permissions,json=newPermissions,proto3,oneof" json:"new_permissions,omitempty"` +} + +func (x *UpdateRoleRequest) Reset() { + *x = UpdateRoleRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_roles_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateRoleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateRoleRequest) ProtoMessage() {} + +func (x *UpdateRoleRequest) ProtoReflect() protoreflect.Message { + mi := &file_roles_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateRoleRequest.ProtoReflect.Descriptor instead. +func (*UpdateRoleRequest) Descriptor() ([]byte, []int) { + return file_roles_proto_rawDescGZIP(), []int{8} +} + +func (x *UpdateRoleRequest) GetRoleId() uint32 { + if x != nil { + return x.RoleId + } + return 0 +} + +func (x *UpdateRoleRequest) GetNewName() string { + if x != nil && x.NewName != nil { + return *x.NewName + } + return "" +} + +func (x *UpdateRoleRequest) GetNewDescription() string { + if x != nil && x.NewDescription != nil { + return *x.NewDescription + } + return "" +} + +func (x *UpdateRoleRequest) GetNewPermissions() *Permissions { + if x != nil { + return x.NewPermissions + } + return nil +} + +type Permissions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Permissions []string `protobuf:"bytes,1,rep,name=permissions,proto3" json:"permissions,omitempty"` +} + +func (x *Permissions) Reset() { + *x = Permissions{} + if protoimpl.UnsafeEnabled { + mi := &file_roles_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Permissions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Permissions) ProtoMessage() {} + +func (x *Permissions) ProtoReflect() protoreflect.Message { + mi := &file_roles_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Permissions.ProtoReflect.Descriptor instead. +func (*Permissions) Descriptor() ([]byte, []int) { + return file_roles_proto_rawDescGZIP(), []int{9} +} + +func (x *Permissions) GetPermissions() []string { + if x != nil { + return x.Permissions + } + return nil +} + +type UpdateRoleResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateRoleResponse) Reset() { + *x = UpdateRoleResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_roles_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateRoleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateRoleResponse) ProtoMessage() {} + +func (x *UpdateRoleResponse) ProtoReflect() protoreflect.Message { + mi := &file_roles_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateRoleResponse.ProtoReflect.Descriptor instead. +func (*UpdateRoleResponse) Descriptor() ([]byte, []int) { + return file_roles_proto_rawDescGZIP(), []int{10} +} + +type ListCustomRolesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TeamId uint32 `protobuf:"varint,1,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty"` +} + +func (x *ListCustomRolesRequest) Reset() { + *x = ListCustomRolesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_roles_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListCustomRolesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListCustomRolesRequest) ProtoMessage() {} + +func (x *ListCustomRolesRequest) ProtoReflect() protoreflect.Message { + mi := &file_roles_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListCustomRolesRequest.ProtoReflect.Descriptor instead. +func (*ListCustomRolesRequest) Descriptor() ([]byte, []int) { + return file_roles_proto_rawDescGZIP(), []int{11} +} + +func (x *ListCustomRolesRequest) GetTeamId() uint32 { + if x != nil { + return x.TeamId + } + return 0 +} + +type ListCustomRolesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Roles []*CustomRole `protobuf:"bytes,1,rep,name=roles,proto3" json:"roles,omitempty"` +} + +func (x *ListCustomRolesResponse) Reset() { + *x = ListCustomRolesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_roles_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListCustomRolesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListCustomRolesResponse) ProtoMessage() {} + +func (x *ListCustomRolesResponse) ProtoReflect() protoreflect.Message { + mi := &file_roles_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListCustomRolesResponse.ProtoReflect.Descriptor instead. +func (*ListCustomRolesResponse) Descriptor() ([]byte, []int) { + return file_roles_proto_rawDescGZIP(), []int{12} +} + +func (x *ListCustomRolesResponse) GetRoles() []*CustomRole { + if x != nil { + return x.Roles + } + return nil +} + +type DeleteRoleRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RoleId uint32 `protobuf:"varint,1,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"` +} + +func (x *DeleteRoleRequest) Reset() { + *x = DeleteRoleRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_roles_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRoleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRoleRequest) ProtoMessage() {} + +func (x *DeleteRoleRequest) ProtoReflect() protoreflect.Message { + mi := &file_roles_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRoleRequest.ProtoReflect.Descriptor instead. +func (*DeleteRoleRequest) Descriptor() ([]byte, []int) { + return file_roles_proto_rawDescGZIP(), []int{13} +} + +func (x *DeleteRoleRequest) GetRoleId() uint32 { + if x != nil { + return x.RoleId + } + return 0 +} + +type DeleteRoleResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteRoleResponse) Reset() { + *x = DeleteRoleResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_roles_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteRoleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteRoleResponse) ProtoMessage() {} + +func (x *DeleteRoleResponse) ProtoReflect() protoreflect.Message { + mi := &file_roles_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteRoleResponse.ProtoReflect.Descriptor instead. +func (*DeleteRoleResponse) Descriptor() ([]byte, []int) { + return file_roles_proto_rawDescGZIP(), []int{14} +} + +var File_roles_proto protoreflect.FileDescriptor + +var file_roles_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1d, 0x63, + 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, 0x61, 0x70, 0x69, 0x73, + 0x2e, 0x61, 0x61, 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, 0x22, 0x7d, 0x0a, 0x0a, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x6f, + 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x72, 0x6f, 0x6c, + 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x65, 0x72, + 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, + 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xe6, 0x01, 0x0a, 0x0a, + 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x6f, + 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x72, 0x6f, 0x6c, + 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x74, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x0e, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x6f, 0x6c, + 0x65, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x65, + 0x6e, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x65, 0x72, 0x6d, + 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x70, + 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x28, 0x0a, 0x10, 0x70, 0x61, + 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x6c, 0x65, + 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x2f, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x43, 0x75, 0x73, 0x74, 0x6f, + 0x6d, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, + 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x72, + 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x22, 0x64, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x43, 0x75, 0x73, 0x74, + 0x6f, 0x6d, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, + 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, + 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, 0x61, 0x70, 0x69, 0x73, + 0x2e, 0x61, 0x61, 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x75, 0x73, + 0x74, 0x6f, 0x6d, 0x52, 0x6f, 0x6c, 0x65, 0x48, 0x00, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x88, + 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x22, 0x18, 0x0a, 0x16, 0x4c, + 0x69, 0x73, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5a, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x3f, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x29, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, 0x61, + 0x70, 0x69, 0x73, 0x2e, 0x61, 0x61, 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, 0x2e, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, + 0x73, 0x22, 0xed, 0x01, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x65, 0x61, 0x6d, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x74, 0x65, 0x61, 0x6d, 0x49, 0x64, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x65, 0x72, + 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x70, 0x61, 0x72, 0x65, + 0x6e, 0x74, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x00, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x49, 0x64, + 0x12, 0x2a, 0x0a, 0x10, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x70, 0x61, + 0x72, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x0d, 0x0a, 0x0b, + 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x4a, 0x04, 0x08, 0x04, 0x10, + 0x05, 0x22, 0x24, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x22, 0x89, 0x02, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, + 0x07, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, + 0x72, 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x08, 0x6e, 0x65, 0x77, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x4e, + 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x2c, 0x0a, 0x0f, 0x6e, 0x65, 0x77, 0x5f, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x01, 0x52, 0x0e, 0x6e, 0x65, 0x77, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x88, 0x01, 0x01, 0x12, 0x58, 0x0a, 0x0f, 0x6e, 0x65, 0x77, 0x5f, 0x70, 0x65, 0x72, 0x6d, + 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, + 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, 0x61, 0x70, 0x69, + 0x73, 0x2e, 0x61, 0x61, 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x65, + 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x48, 0x02, 0x52, 0x0e, 0x6e, 0x65, 0x77, + 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x88, 0x01, 0x01, 0x42, 0x0b, + 0x0a, 0x09, 0x5f, 0x6e, 0x65, 0x77, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x12, 0x0a, 0x10, 0x5f, + 0x6e, 0x65, 0x77, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, + 0x12, 0x0a, 0x10, 0x5f, 0x6e, 0x65, 0x77, 0x5f, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x73, 0x22, 0x2f, 0x0a, 0x0b, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x14, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x6f, + 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x31, 0x0a, 0x16, 0x4c, 0x69, + 0x73, 0x74, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x74, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x22, 0x5a, 0x0a, + 0x17, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x52, 0x6f, 0x6c, 0x65, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, + 0x72, 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x61, 0x61, 0x61, 0x2e, + 0x72, 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x52, 0x6f, + 0x6c, 0x65, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x22, 0x2c, 0x0a, 0x11, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, + 0x0a, 0x07, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x06, 0x72, 0x6f, 0x6c, 0x65, 0x49, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xf2, 0x05, + 0x0a, 0x15, 0x52, 0x6f, 0x6c, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x80, 0x01, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x35, 0x2e, 0x63, 0x6f, + 0x6d, 0x2e, 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, 0x61, 0x70, 0x69, 0x73, 0x2e, + 0x61, 0x61, 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, 0x67, + 0x69, 0x78, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x61, 0x61, 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, 0x2e, + 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x52, 0x6f, 0x6c, + 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x80, 0x01, 0x0a, 0x0f, 0x4c, + 0x69, 0x73, 0x74, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x35, + 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, 0x61, 0x70, + 0x69, 0x73, 0x2e, 0x61, 0x61, 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x36, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x72, 0x61, + 0x6c, 0x6f, 0x67, 0x69, 0x78, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x61, 0x61, 0x61, 0x2e, 0x72, 0x62, + 0x61, 0x63, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, + 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7a, 0x0a, + 0x0d, 0x47, 0x65, 0x74, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x33, + 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, 0x61, 0x70, + 0x69, 0x73, 0x2e, 0x61, 0x61, 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, 0x2e, 0x47, + 0x65, 0x74, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, + 0x67, 0x69, 0x78, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x61, 0x61, 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, + 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x52, 0x6f, 0x6c, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x71, 0x0a, 0x0a, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x30, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, + 0x72, 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x61, 0x61, 0x61, 0x2e, + 0x72, 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x6f, + 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, + 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x61, 0x61, + 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x71, 0x0a, 0x0a, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x30, 0x2e, 0x63, 0x6f, 0x6d, + 0x2e, 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, 0x61, 0x70, 0x69, 0x73, 0x2e, 0x61, + 0x61, 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, + 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, 0x61, 0x70, 0x69, 0x73, + 0x2e, 0x61, 0x61, 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x71, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x30, 0x2e, + 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, 0x61, 0x70, 0x69, + 0x73, 0x2e, 0x61, 0x61, 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x31, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x72, 0x61, 0x6c, 0x6f, 0x67, 0x69, 0x78, 0x61, + 0x70, 0x69, 0x73, 0x2e, 0x61, 0x61, 0x61, 0x2e, 0x72, 0x62, 0x61, 0x63, 0x2e, 0x76, 0x32, 0x2e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x42, 0x03, 0x5a, 0x01, 0x2e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_roles_proto_rawDescOnce sync.Once + file_roles_proto_rawDescData = file_roles_proto_rawDesc +) + +func file_roles_proto_rawDescGZIP() []byte { + file_roles_proto_rawDescOnce.Do(func() { + file_roles_proto_rawDescData = protoimpl.X.CompressGZIP(file_roles_proto_rawDescData) + }) + return file_roles_proto_rawDescData +} + +var file_roles_proto_msgTypes = make([]protoimpl.MessageInfo, 15) +var file_roles_proto_goTypes = []interface{}{ + (*SystemRole)(nil), // 0: com.coralogixapis.aaa.rbac.v2.SystemRole + (*CustomRole)(nil), // 1: com.coralogixapis.aaa.rbac.v2.CustomRole + (*GetCustomRoleRequest)(nil), // 2: com.coralogixapis.aaa.rbac.v2.GetCustomRoleRequest + (*GetCustomRoleResponse)(nil), // 3: com.coralogixapis.aaa.rbac.v2.GetCustomRoleResponse + (*ListSystemRolesRequest)(nil), // 4: com.coralogixapis.aaa.rbac.v2.ListSystemRolesRequest + (*ListSystemRolesResponse)(nil), // 5: com.coralogixapis.aaa.rbac.v2.ListSystemRolesResponse + (*CreateRoleRequest)(nil), // 6: com.coralogixapis.aaa.rbac.v2.CreateRoleRequest + (*CreateRoleResponse)(nil), // 7: com.coralogixapis.aaa.rbac.v2.CreateRoleResponse + (*UpdateRoleRequest)(nil), // 8: com.coralogixapis.aaa.rbac.v2.UpdateRoleRequest + (*Permissions)(nil), // 9: com.coralogixapis.aaa.rbac.v2.Permissions + (*UpdateRoleResponse)(nil), // 10: com.coralogixapis.aaa.rbac.v2.UpdateRoleResponse + (*ListCustomRolesRequest)(nil), // 11: com.coralogixapis.aaa.rbac.v2.ListCustomRolesRequest + (*ListCustomRolesResponse)(nil), // 12: com.coralogixapis.aaa.rbac.v2.ListCustomRolesResponse + (*DeleteRoleRequest)(nil), // 13: com.coralogixapis.aaa.rbac.v2.DeleteRoleRequest + (*DeleteRoleResponse)(nil), // 14: com.coralogixapis.aaa.rbac.v2.DeleteRoleResponse +} +var file_roles_proto_depIdxs = []int32{ + 1, // 0: com.coralogixapis.aaa.rbac.v2.GetCustomRoleResponse.role:type_name -> com.coralogixapis.aaa.rbac.v2.CustomRole + 0, // 1: com.coralogixapis.aaa.rbac.v2.ListSystemRolesResponse.roles:type_name -> com.coralogixapis.aaa.rbac.v2.SystemRole + 9, // 2: com.coralogixapis.aaa.rbac.v2.UpdateRoleRequest.new_permissions:type_name -> com.coralogixapis.aaa.rbac.v2.Permissions + 1, // 3: com.coralogixapis.aaa.rbac.v2.ListCustomRolesResponse.roles:type_name -> com.coralogixapis.aaa.rbac.v2.CustomRole + 4, // 4: com.coralogixapis.aaa.rbac.v2.RoleManagementService.ListSystemRoles:input_type -> com.coralogixapis.aaa.rbac.v2.ListSystemRolesRequest + 11, // 5: com.coralogixapis.aaa.rbac.v2.RoleManagementService.ListCustomRoles:input_type -> com.coralogixapis.aaa.rbac.v2.ListCustomRolesRequest + 2, // 6: com.coralogixapis.aaa.rbac.v2.RoleManagementService.GetCustomRole:input_type -> com.coralogixapis.aaa.rbac.v2.GetCustomRoleRequest + 6, // 7: com.coralogixapis.aaa.rbac.v2.RoleManagementService.CreateRole:input_type -> com.coralogixapis.aaa.rbac.v2.CreateRoleRequest + 8, // 8: com.coralogixapis.aaa.rbac.v2.RoleManagementService.UpdateRole:input_type -> com.coralogixapis.aaa.rbac.v2.UpdateRoleRequest + 13, // 9: com.coralogixapis.aaa.rbac.v2.RoleManagementService.DeleteRole:input_type -> com.coralogixapis.aaa.rbac.v2.DeleteRoleRequest + 5, // 10: com.coralogixapis.aaa.rbac.v2.RoleManagementService.ListSystemRoles:output_type -> com.coralogixapis.aaa.rbac.v2.ListSystemRolesResponse + 12, // 11: com.coralogixapis.aaa.rbac.v2.RoleManagementService.ListCustomRoles:output_type -> com.coralogixapis.aaa.rbac.v2.ListCustomRolesResponse + 3, // 12: com.coralogixapis.aaa.rbac.v2.RoleManagementService.GetCustomRole:output_type -> com.coralogixapis.aaa.rbac.v2.GetCustomRoleResponse + 7, // 13: com.coralogixapis.aaa.rbac.v2.RoleManagementService.CreateRole:output_type -> com.coralogixapis.aaa.rbac.v2.CreateRoleResponse + 10, // 14: com.coralogixapis.aaa.rbac.v2.RoleManagementService.UpdateRole:output_type -> com.coralogixapis.aaa.rbac.v2.UpdateRoleResponse + 14, // 15: com.coralogixapis.aaa.rbac.v2.RoleManagementService.DeleteRole:output_type -> com.coralogixapis.aaa.rbac.v2.DeleteRoleResponse + 10, // [10:16] is the sub-list for method output_type + 4, // [4:10] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_roles_proto_init() } +func file_roles_proto_init() { + if File_roles_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_roles_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SystemRole); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_roles_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CustomRole); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_roles_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCustomRoleRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_roles_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCustomRoleResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_roles_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListSystemRolesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_roles_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListSystemRolesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_roles_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateRoleRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_roles_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateRoleResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_roles_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateRoleRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_roles_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Permissions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_roles_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateRoleResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_roles_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListCustomRolesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_roles_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListCustomRolesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_roles_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRoleRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_roles_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRoleResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_roles_proto_msgTypes[3].OneofWrappers = []interface{}{} + file_roles_proto_msgTypes[6].OneofWrappers = []interface{}{ + (*CreateRoleRequest_ParentRoleId)(nil), + (*CreateRoleRequest_ParentRoleName)(nil), + } + file_roles_proto_msgTypes[8].OneofWrappers = []interface{}{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_roles_proto_rawDesc, + NumEnums: 0, + NumMessages: 15, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_roles_proto_goTypes, + DependencyIndexes: file_roles_proto_depIdxs, + MessageInfos: file_roles_proto_msgTypes, + }.Build() + File_roles_proto = out.File + file_roles_proto_rawDesc = nil + file_roles_proto_goTypes = nil + file_roles_proto_depIdxs = nil +} diff --git a/coralogix/clientset/grpc/roles/roles_grpc.pb.go b/coralogix/clientset/grpc/roles/roles_grpc.pb.go new file mode 100644 index 00000000..a43457b7 --- /dev/null +++ b/coralogix/clientset/grpc/roles/roles_grpc.pb.go @@ -0,0 +1,285 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v4.25.1 +// source: roles.proto + +package __ + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// RoleManagementServiceClient is the client API for RoleManagementService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type RoleManagementServiceClient interface { + ListSystemRoles(ctx context.Context, in *ListSystemRolesRequest, opts ...grpc.CallOption) (*ListSystemRolesResponse, error) + ListCustomRoles(ctx context.Context, in *ListCustomRolesRequest, opts ...grpc.CallOption) (*ListCustomRolesResponse, error) + GetCustomRole(ctx context.Context, in *GetCustomRoleRequest, opts ...grpc.CallOption) (*GetCustomRoleResponse, error) + CreateRole(ctx context.Context, in *CreateRoleRequest, opts ...grpc.CallOption) (*CreateRoleResponse, error) + UpdateRole(ctx context.Context, in *UpdateRoleRequest, opts ...grpc.CallOption) (*UpdateRoleResponse, error) + DeleteRole(ctx context.Context, in *DeleteRoleRequest, opts ...grpc.CallOption) (*DeleteRoleResponse, error) +} + +type roleManagementServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewRoleManagementServiceClient(cc grpc.ClientConnInterface) RoleManagementServiceClient { + return &roleManagementServiceClient{cc} +} + +func (c *roleManagementServiceClient) ListSystemRoles(ctx context.Context, in *ListSystemRolesRequest, opts ...grpc.CallOption) (*ListSystemRolesResponse, error) { + out := new(ListSystemRolesResponse) + err := c.cc.Invoke(ctx, "/com.coralogixapis.aaa.rbac.v2.RoleManagementService/ListSystemRoles", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *roleManagementServiceClient) ListCustomRoles(ctx context.Context, in *ListCustomRolesRequest, opts ...grpc.CallOption) (*ListCustomRolesResponse, error) { + out := new(ListCustomRolesResponse) + err := c.cc.Invoke(ctx, "/com.coralogixapis.aaa.rbac.v2.RoleManagementService/ListCustomRoles", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *roleManagementServiceClient) GetCustomRole(ctx context.Context, in *GetCustomRoleRequest, opts ...grpc.CallOption) (*GetCustomRoleResponse, error) { + out := new(GetCustomRoleResponse) + err := c.cc.Invoke(ctx, "/com.coralogixapis.aaa.rbac.v2.RoleManagementService/GetCustomRole", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *roleManagementServiceClient) CreateRole(ctx context.Context, in *CreateRoleRequest, opts ...grpc.CallOption) (*CreateRoleResponse, error) { + out := new(CreateRoleResponse) + err := c.cc.Invoke(ctx, "/com.coralogixapis.aaa.rbac.v2.RoleManagementService/CreateRole", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *roleManagementServiceClient) UpdateRole(ctx context.Context, in *UpdateRoleRequest, opts ...grpc.CallOption) (*UpdateRoleResponse, error) { + out := new(UpdateRoleResponse) + err := c.cc.Invoke(ctx, "/com.coralogixapis.aaa.rbac.v2.RoleManagementService/UpdateRole", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *roleManagementServiceClient) DeleteRole(ctx context.Context, in *DeleteRoleRequest, opts ...grpc.CallOption) (*DeleteRoleResponse, error) { + out := new(DeleteRoleResponse) + err := c.cc.Invoke(ctx, "/com.coralogixapis.aaa.rbac.v2.RoleManagementService/DeleteRole", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// RoleManagementServiceServer is the server API for RoleManagementService service. +// All implementations must embed UnimplementedRoleManagementServiceServer +// for forward compatibility +type RoleManagementServiceServer interface { + ListSystemRoles(context.Context, *ListSystemRolesRequest) (*ListSystemRolesResponse, error) + ListCustomRoles(context.Context, *ListCustomRolesRequest) (*ListCustomRolesResponse, error) + GetCustomRole(context.Context, *GetCustomRoleRequest) (*GetCustomRoleResponse, error) + CreateRole(context.Context, *CreateRoleRequest) (*CreateRoleResponse, error) + UpdateRole(context.Context, *UpdateRoleRequest) (*UpdateRoleResponse, error) + DeleteRole(context.Context, *DeleteRoleRequest) (*DeleteRoleResponse, error) + mustEmbedUnimplementedRoleManagementServiceServer() +} + +// UnimplementedRoleManagementServiceServer must be embedded to have forward compatible implementations. +type UnimplementedRoleManagementServiceServer struct { +} + +func (UnimplementedRoleManagementServiceServer) ListSystemRoles(context.Context, *ListSystemRolesRequest) (*ListSystemRolesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListSystemRoles not implemented") +} +func (UnimplementedRoleManagementServiceServer) ListCustomRoles(context.Context, *ListCustomRolesRequest) (*ListCustomRolesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListCustomRoles not implemented") +} +func (UnimplementedRoleManagementServiceServer) GetCustomRole(context.Context, *GetCustomRoleRequest) (*GetCustomRoleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCustomRole not implemented") +} +func (UnimplementedRoleManagementServiceServer) CreateRole(context.Context, *CreateRoleRequest) (*CreateRoleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateRole not implemented") +} +func (UnimplementedRoleManagementServiceServer) UpdateRole(context.Context, *UpdateRoleRequest) (*UpdateRoleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateRole not implemented") +} +func (UnimplementedRoleManagementServiceServer) DeleteRole(context.Context, *DeleteRoleRequest) (*DeleteRoleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteRole not implemented") +} +func (UnimplementedRoleManagementServiceServer) mustEmbedUnimplementedRoleManagementServiceServer() {} + +// UnsafeRoleManagementServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to RoleManagementServiceServer will +// result in compilation errors. +type UnsafeRoleManagementServiceServer interface { + mustEmbedUnimplementedRoleManagementServiceServer() +} + +func RegisterRoleManagementServiceServer(s grpc.ServiceRegistrar, srv RoleManagementServiceServer) { + s.RegisterService(&RoleManagementService_ServiceDesc, srv) +} + +func _RoleManagementService_ListSystemRoles_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListSystemRolesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RoleManagementServiceServer).ListSystemRoles(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/com.coralogixapis.aaa.rbac.v2.RoleManagementService/ListSystemRoles", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RoleManagementServiceServer).ListSystemRoles(ctx, req.(*ListSystemRolesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RoleManagementService_ListCustomRoles_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListCustomRolesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RoleManagementServiceServer).ListCustomRoles(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/com.coralogixapis.aaa.rbac.v2.RoleManagementService/ListCustomRoles", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RoleManagementServiceServer).ListCustomRoles(ctx, req.(*ListCustomRolesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RoleManagementService_GetCustomRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCustomRoleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RoleManagementServiceServer).GetCustomRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/com.coralogixapis.aaa.rbac.v2.RoleManagementService/GetCustomRole", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RoleManagementServiceServer).GetCustomRole(ctx, req.(*GetCustomRoleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RoleManagementService_CreateRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateRoleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RoleManagementServiceServer).CreateRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/com.coralogixapis.aaa.rbac.v2.RoleManagementService/CreateRole", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RoleManagementServiceServer).CreateRole(ctx, req.(*CreateRoleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RoleManagementService_UpdateRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateRoleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RoleManagementServiceServer).UpdateRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/com.coralogixapis.aaa.rbac.v2.RoleManagementService/UpdateRole", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RoleManagementServiceServer).UpdateRole(ctx, req.(*UpdateRoleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RoleManagementService_DeleteRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRoleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RoleManagementServiceServer).DeleteRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/com.coralogixapis.aaa.rbac.v2.RoleManagementService/DeleteRole", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RoleManagementServiceServer).DeleteRole(ctx, req.(*DeleteRoleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// RoleManagementService_ServiceDesc is the grpc.ServiceDesc for RoleManagementService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var RoleManagementService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "com.coralogixapis.aaa.rbac.v2.RoleManagementService", + HandlerType: (*RoleManagementServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListSystemRoles", + Handler: _RoleManagementService_ListSystemRoles_Handler, + }, + { + MethodName: "ListCustomRoles", + Handler: _RoleManagementService_ListCustomRoles_Handler, + }, + { + MethodName: "GetCustomRole", + Handler: _RoleManagementService_GetCustomRole_Handler, + }, + { + MethodName: "CreateRole", + Handler: _RoleManagementService_CreateRole_Handler, + }, + { + MethodName: "UpdateRole", + Handler: _RoleManagementService_UpdateRole_Handler, + }, + { + MethodName: "DeleteRole", + Handler: _RoleManagementService_DeleteRole_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "roles.proto", +} diff --git a/coralogix/clientset/roles-client.go b/coralogix/clientset/roles-client.go new file mode 100644 index 00000000..32370ca2 --- /dev/null +++ b/coralogix/clientset/roles-client.go @@ -0,0 +1,66 @@ +package clientset + +import ( + "context" + roles "terraform-provider-coralogix/coralogix/clientset/grpc/roles" +) + +type RolesClient struct { + callPropertiesCreator *CallPropertiesCreator +} + +func (t RolesClient) CreateRole(ctx context.Context, req *roles.CreateRoleRequest) (*roles.CreateRoleResponse, error) { + callProperties, err := t.callPropertiesCreator.GetCallProperties(ctx) + if err != nil { + return nil, err + } + + conn := callProperties.Connection + defer conn.Close() + client := roles.NewRoleManagementServiceClient(conn) + + return client.CreateRole(callProperties.Ctx, req, callProperties.CallOptions...) +} + +func (t RolesClient) UpdateRole(ctx context.Context, req *roles.UpdateRoleRequest) (*roles.UpdateRoleResponse, error) { + callProperties, err := t.callPropertiesCreator.GetCallProperties(ctx) + if err != nil { + return nil, err + } + conn := callProperties.Connection + defer conn.Close() + + client := roles.NewRoleManagementServiceClient(conn) + + return client.UpdateRole(callProperties.Ctx, req, callProperties.CallOptions...) +} + +func (t RolesClient) DeleteRole(ctx context.Context, req *roles.DeleteRoleRequest) (*roles.DeleteRoleResponse, error) { + callProperties, err := t.callPropertiesCreator.GetCallProperties(ctx) + if err != nil { + return nil, err + } + conn := callProperties.Connection + defer conn.Close() + + client := roles.NewRoleManagementServiceClient(conn) + + return client.DeleteRole(callProperties.Ctx, req, callProperties.CallOptions...) +} + +func (t RolesClient) GetRole(ctx context.Context, req *roles.GetCustomRoleRequest) (*roles.GetCustomRoleResponse, error) { + callProperties, err := t.callPropertiesCreator.GetCallProperties(ctx) + if err != nil { + return nil, err + } + + conn := callProperties.Connection + defer conn.Close() + client := roles.NewRoleManagementServiceClient(conn) + + return client.GetCustomRole(callProperties.Ctx, req, callProperties.CallOptions...) +} + +func NewRolesClient(c *CallPropertiesCreator) *RolesClient { + return &RolesClient{callPropertiesCreator: c} +} diff --git a/coralogix/data_source_coralogix_api_key.go b/coralogix/data_source_coralogix_api_key.go index 1c97d496..25a764c6 100644 --- a/coralogix/data_source_coralogix_api_key.go +++ b/coralogix/data_source_coralogix_api_key.go @@ -83,7 +83,7 @@ func (d *ApiKeyDataSource) Read(ctx context.Context, req datasource.ReadRequest, } else { resp.Diagnostics.AddError( "Error reading Action", - formatRpcErrors(err, getActionURL, protojson.Format(getApiKey)), + formatRpcErrors(err, getApiKeyPath, protojson.Format(getApiKey)), ) } return diff --git a/coralogix/data_source_coralogix_custom_role.go b/coralogix/data_source_coralogix_custom_role.go new file mode 100644 index 00000000..977c07f3 --- /dev/null +++ b/coralogix/data_source_coralogix_custom_role.go @@ -0,0 +1,104 @@ +package coralogix + +import ( + "context" + "fmt" + "log" + "strconv" + roles "terraform-provider-coralogix/coralogix/clientset/grpc/roles" + + "google.golang.org/protobuf/encoding/protojson" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/resource" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "terraform-provider-coralogix/coralogix/clientset" +) + +var _ datasource.DataSourceWithConfigure = &CustomRoleDataSource{} + +func NewCustomRoleDataSource() datasource.DataSource { + return &CustomRoleDataSource{} +} + +type CustomRoleDataSource struct { + client *clientset.RolesClient +} + +func (d *CustomRoleDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_custom_role" +} + +func (d *CustomRoleDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + if req.ProviderData == nil { + return + } + + clientSet, ok := req.ProviderData.(*clientset.ClientSet) + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *clientset.ClientSet, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + return + } + + d.client = clientSet.CustomRoles() +} + +func (d *CustomRoleDataSource) Schema(ctx context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { + var r CustomRoleSource + var resourceResp resource.SchemaResponse + r.Schema(ctx, resource.SchemaRequest{}, &resourceResp) + + resp.Schema = frameworkDatasourceSchemaFromFrameworkResourceSchema(resourceResp.Schema) +} + +func (d *CustomRoleDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + var data *RolesModel + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + log.Printf("[INFO] Reading Custom Role") + + if resp.Diagnostics.HasError() { + return + } + + //Get refreshed Action value from Coralogix + roleId, err := strconv.Atoi(data.ID.ValueString()) + if err != nil { + resp.Diagnostics.AddError("Invalid Id", "Custom role id must be an int") + return + } + log.Printf("[INFO] Reading Custom Role: %v", roleId) + getCustomRoleReuest := &roles.GetCustomRoleRequest{ + RoleId: uint32(roleId), + } + + createCustomRoleResponse, err := d.client.GetRole(ctx, getCustomRoleReuest) + if err != nil { + log.Printf("[ERROR] Received error: %#v", err) + if status.Code(err) == codes.NotFound { + resp.Diagnostics.AddWarning( + fmt.Sprintf("Custom role %q is in state, but no longer exists in Coralogix backend", roleId), + fmt.Sprintf("%v will be recreated when you apply", roleId), + ) + } else { + resp.Diagnostics.AddError( + "Error reading custom role", + formatRpcErrors(err, getRolePath, protojson.Format(getCustomRoleReuest)), + ) + } + return + } + log.Printf("[INFO] Received Custom Role: %s", protojson.Format(createCustomRoleResponse)) + + model, diags := flatterCustomRole(ctx, createCustomRoleResponse.GetRole()) + if diags.HasError() { + resp.Diagnostics.Append(diags...) + return + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &model)...) +} diff --git a/coralogix/data_source_coralogix_custom_role_test.go b/coralogix/data_source_coralogix_custom_role_test.go new file mode 100644 index 00000000..77e85a9c --- /dev/null +++ b/coralogix/data_source_coralogix_custom_role_test.go @@ -0,0 +1,34 @@ +package coralogix + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +var customRoleSourceName = "data." + customRoleResourceName + +func TestAccCoralogixDataSourceCustomRole(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testCustomRoleResource() + + testCustomRoleResource_read(), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr(customRoleSourceName, "name", "Test Custom Role"), + resource.TestCheckResourceAttr(customRoleSourceName, "description", "This role is created with terraform!"), + resource.TestCheckResourceAttr(customRoleSourceName, "parent_role", "Standard User"), + ), + }, + }, + }) +} + +func testCustomRoleResource_read() string { + return `data "coralogix_custom_role" "test" { + id = coralogix_custom_role.test.id +} +` +} diff --git a/coralogix/provider.go b/coralogix/provider.go index 5195f477..7b7a9c24 100644 --- a/coralogix/provider.go +++ b/coralogix/provider.go @@ -336,6 +336,7 @@ func (p *coralogixProvider) DataSources(context.Context) []func() datasource.Dat NewSLODataSource, NewDashboardsFoldersDataSource, NewApiKeyDataSource, + NewCustomRoleDataSource, NewGroupDataSource, NewUserDataSource, } @@ -360,6 +361,7 @@ func (p *coralogixProvider) Resources(context.Context) []func() resource.Resourc NewMovingQuotaResource, NewSLOResource, NewDashboardsFolderResource, + NewCustomRoleSource, NewGroupResource, NewUserResource, } diff --git a/coralogix/resource_coralogix_api_key.go b/coralogix/resource_coralogix_api_key.go index ab3f1f5b..d8f623d7 100644 --- a/coralogix/resource_coralogix_api_key.go +++ b/coralogix/resource_coralogix_api_key.go @@ -316,7 +316,7 @@ func (r *ApiKeyResource) Delete(ctx context.Context, req resource.DeleteRequest, return } - log.Printf("[INFO] Dashboard %s deleted", id) + log.Printf("[INFO] Api Key %s deleted", id) } func (r *ApiKeyResource) getKeyInfo(ctx context.Context, id *string, keyValue *string, diags diag.Diagnostics) (*ApiKeyModel, diag.Diagnostics) { diff --git a/coralogix/resource_coralogix_custom_role.go b/coralogix/resource_coralogix_custom_role.go new file mode 100644 index 00000000..360c9806 --- /dev/null +++ b/coralogix/resource_coralogix_custom_role.go @@ -0,0 +1,363 @@ +package coralogix + +import ( + "context" + "fmt" + "github.com/hashicorp/terraform-plugin-framework-validators/setvalidator" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/encoding/protojson" + "log" + "strconv" + "terraform-provider-coralogix/coralogix/clientset" + roles "terraform-provider-coralogix/coralogix/clientset/grpc/roles" +) + +var ( + getRolePath = "com.coralogixapis.aaa.rbac.v2.RoleManagementService/GetCustomRole" + createRolePath = "com.coralogixapis.aaa.rbac.v2.RoleManagementService/CreateRole" + deleteRolePath = "com.coralogixapis.aaa.rbac.v2.RoleManagementService/DeleteRole" + updateRolePath = "com.coralogixapis.aaa.rbac.v2.RoleManagementService/UpdateRole" +) + +func NewCustomRoleSource() resource.Resource { + return &CustomRoleSource{} +} + +type CustomRoleSource struct { + client *clientset.RolesClient +} + +func (c *CustomRoleSource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_custom_role" +} + +type RolesModel struct { + ID types.String `tfsdk:"id"` + Name types.String `tfsdk:"name"` + Description types.String `tfsdk:"description"` + ParentRole types.String `tfsdk:"parent_role"` + Permissions types.Set `tfsdk:"permissions"` + TeamId types.String `tfsdk:"team_id"` +} + +func (c *CustomRoleSource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + if req.ProviderData == nil { + return + } + + clientSet, ok := req.ProviderData.(*clientset.ClientSet) + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *clientset.ClientSet, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + return + } + + c.client = clientSet.CustomRoles() +} + +func (c *CustomRoleSource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { + resp.Schema = schema.Schema{ + Version: 0, + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: "Custom Role ID.", + }, + "name": schema.StringAttribute{ + Required: true, + MarkdownDescription: "Custom Role name.", + }, + "description": schema.StringAttribute{ + Required: true, + MarkdownDescription: "Custom Role description.", + }, + "team_id": schema.StringAttribute{ + Required: true, + MarkdownDescription: "Custom Role teamId.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.RequiresReplace(), + }, + }, + "parent_role": schema.StringAttribute{ + Required: true, + MarkdownDescription: "Parent role name", + }, + "permissions": schema.SetAttribute{ + Required: true, + ElementType: types.StringType, + MarkdownDescription: "Custom role permissions", + Validators: []validator.Set{ + setvalidator.SizeAtLeast(1), + }, + }, + }, + MarkdownDescription: "Coralogix Custom roles.", + } +} + +func (c *CustomRoleSource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + var desiredState *RolesModel + diags := req.Plan.Get(ctx, &desiredState) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + createCustomRoleRequest, diags := makeCreateCustomRoleRequest(ctx, desiredState) + if diags.HasError() { + resp.Diagnostics = diags + return + } + + log.Printf("[INFO] Creating Custom Role: %s", protojson.Format(createCustomRoleRequest)) + createCustomRoleResponse, err := c.client.CreateRole(ctx, createCustomRoleRequest) + if err != nil { + log.Printf("[ERROR] Received error: %s", err.Error()) + if status.Code(err) == codes.PermissionDenied || status.Code(err) == codes.Unauthenticated { + resp.Diagnostics.AddError( + "Error creating Custom Role", + fmt.Sprintf("permission denied for url - %s\ncheck your org-key and permissions", createRolePath), + ) + } else { + resp.Diagnostics.AddError( + "Error creating Custom Role", + formatRpcErrors(err, createRolePath, protojson.Format(createCustomRoleRequest)), + ) + } + return + } + log.Printf("[INFO] Created custom role with ID: %v", createCustomRoleResponse.Id) + + desiredState.ID = types.StringValue(strconv.FormatInt(int64(createCustomRoleResponse.Id), 10)) + + // Set state to fully populated data + diags = resp.State.Set(ctx, desiredState) + resp.Diagnostics.Append(diags...) +} + +func (c *CustomRoleSource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + var currentState *RolesModel + diags := req.State.Get(ctx, ¤tState) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + roleId, err := strconv.Atoi(currentState.ID.ValueString()) + if err != nil { + resp.Diagnostics.AddError("Invalid Id", "Custom role id must be an int") + return + } + model, done := c.getRoleById(ctx, uint32(roleId)) + + if done.HasError() { + resp.Diagnostics.Append(diags...) + return + } + + diags = resp.State.Set(ctx, model) + resp.Diagnostics.Append(diags...) +} + +func (c *CustomRoleSource) getRoleById(ctx context.Context, roleId uint32) (*RolesModel, diag.Diagnostics) { + var diags diag.Diagnostics + getCustomRoleRequest := roles.GetCustomRoleRequest{ + RoleId: roleId, + } + + createCustomRoleResponse, err := c.client.GetRole(ctx, &getCustomRoleRequest) + if err != nil { + log.Printf("[ERROR] Received error: %s", err.Error()) + if status.Code(err) == codes.PermissionDenied || status.Code(err) == codes.Unauthenticated { + diags.AddError( + "Error creating Custom Role", + fmt.Sprintf("permission denied for url - %s\ncheck your org-key and permissions", getRolePath), + ) + } else { + diags.AddError( + "Error getting Custom Role", + formatRpcErrors(err, getRolePath, protojson.Format(&getCustomRoleRequest)), + ) + } + return nil, diags + } + + model, diags := flatterCustomRole(ctx, createCustomRoleResponse.GetRole()) + if diags.HasError() { + return nil, diags + } + + return model, nil +} + +func (c *CustomRoleSource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + var currentState, desiredState *RolesModel + diags := req.State.Get(ctx, ¤tState) + resp.Diagnostics.Append(diags...) + + if resp.Diagnostics.HasError() { + return + } + diags = req.Plan.Get(ctx, &desiredState) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + roleId, err := strconv.Atoi(currentState.ID.ValueString()) + if err != nil { + resp.Diagnostics.AddError("Invalid Id", "Custom role id must be an int") + return + } + var updateRoleRequest = roles.UpdateRoleRequest{ + RoleId: uint32(roleId), + } + + if currentState.TeamId != desiredState.TeamId { + diags.AddError("Custom role update error", "TeamId can not be updated!") + resp.Diagnostics.Append(diags...) + return + } + if currentState.ParentRole != desiredState.ParentRole { + diags.AddError("Custom role update error", "ParentRole can not be updated!") + resp.Diagnostics.Append(diags...) + return + } + + if currentState.Name != desiredState.Name { + updateRoleRequest.NewName = desiredState.Name.ValueStringPointer() + } + if currentState.Description != desiredState.Description { + updateRoleRequest.NewDescription = desiredState.Description.ValueStringPointer() + } + + if !currentState.Permissions.Equal(desiredState.Permissions) { + permissions, diags := typeStringSliceToStringSlice(ctx, desiredState.Permissions.Elements()) + if diags.HasError() { + diags.AddError("Custom role update error", "Error extracting permissions") + resp.Diagnostics.Append(diags...) + return + } + updateRoleRequest.NewPermissions = &roles.Permissions{ + Permissions: permissions, + } + } + + _, err = c.client.UpdateRole(ctx, &updateRoleRequest) + if err != nil { + log.Printf("[ERROR] Received error: %s", err.Error()) + if status.Code(err) == codes.PermissionDenied || status.Code(err) == codes.Unauthenticated { + resp.Diagnostics.AddError( + "Error deleting Custom Role", + fmt.Sprintf("permission denied for url - %s\ncheck your org-key and permissions", updateRolePath), + ) + } else { + resp.Diagnostics.AddError( + "Error updating custom role", + formatRpcErrors(err, updateRolePath, protojson.Format(&updateRoleRequest)), + ) + } + return + } + + log.Printf("[INFO] Custom Role %v updated", roleId) + + if diags.HasError() { + return + } + + // Set state to fully populated data + resp.Diagnostics.Append(resp.State.Set(ctx, desiredState)...) +} + +func (c *CustomRoleSource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) +} + +func (c *CustomRoleSource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + var currentState *RolesModel + diags := req.State.Get(ctx, ¤tState) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + id, err := strconv.Atoi(currentState.ID.ValueString()) + if err != nil { + resp.Diagnostics.AddError("Invalid Id", "Custom role id must be an int") + return + } + deleteRoleRequest := roles.DeleteRoleRequest{ + RoleId: uint32(id), + } + + _, err = c.client.DeleteRole(ctx, &deleteRoleRequest) + if err != nil { + log.Printf("[ERROR] Received error: %s", err.Error()) + if status.Code(err) == codes.PermissionDenied || status.Code(err) == codes.Unauthenticated { + resp.Diagnostics.AddError( + "Error deleting Custom Role", + fmt.Sprintf("permission denied for url - %s\ncheck your org-key and permissions", deleteRolePath), + ) + } else { + resp.Diagnostics.AddError( + "Error deleting Custom Role", + formatRpcErrors(err, deleteRolePath, protojson.Format(&deleteRoleRequest)), + ) + } + return + } + + log.Printf("[INFO] Custom Role %v deleted", id) +} + +func makeCreateCustomRoleRequest(ctx context.Context, roleModel *RolesModel) (*roles.CreateRoleRequest, diag.Diagnostics) { + permissions, diags := typeStringSliceToStringSlice(ctx, roleModel.Permissions.Elements()) + if diags.HasError() { + return nil, diags + } + teamId, err := strconv.Atoi(roleModel.TeamId.ValueString()) + if err != nil { + diags.AddError("Invalid teamId", "Team id should be an integer") + return nil, diags + } + return &roles.CreateRoleRequest{ + Name: roleModel.Name.ValueString(), + Description: roleModel.Description.ValueString(), + Permissions: permissions, + TeamId: uint32(teamId), + ParentRole: &roles.CreateRoleRequest_ParentRoleName{ParentRoleName: roleModel.ParentRole.ValueString()}, + }, nil +} + +func flatterCustomRole(ctx context.Context, customRole *roles.CustomRole) (*RolesModel, diag.Diagnostics) { + var diags diag.Diagnostics + + permissions, diags := types.SetValueFrom(ctx, types.StringType, customRole.Permissions) + if diags.HasError() { + return nil, diags + } + + model := RolesModel{ + ID: types.StringValue(strconv.Itoa(int(customRole.RoleId))), + TeamId: types.StringValue(strconv.Itoa(int(customRole.TeamId))), + ParentRole: types.StringValue(customRole.ParentRoleName), + Permissions: permissions, + Description: types.StringValue(customRole.Description), + Name: types.StringValue(customRole.Name), + } + + return &model, nil +} diff --git a/coralogix/resource_coralogix_custom_role_test.go b/coralogix/resource_coralogix_custom_role_test.go new file mode 100644 index 00000000..ee300543 --- /dev/null +++ b/coralogix/resource_coralogix_custom_role_test.go @@ -0,0 +1,64 @@ +package coralogix + +import ( + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +var ( + customRoleResourceName = "coralogix_custom_role.test" +) + +func TestCustomRole(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testCustomRoleResource(), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr(customRoleResourceName, "name", "Test Custom Role"), + resource.TestCheckResourceAttr(customRoleResourceName, "description", "This role is created with terraform!"), + resource.TestCheckResourceAttr(customRoleResourceName, "parent_role", "Standard User"), + ), + }, + { + ResourceName: customRoleResourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testCustomRoleUpdateResource(), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr(customRoleResourceName, "name", "Test Custom Role Renamed"), + resource.TestCheckResourceAttr(customRoleResourceName, "description", "This role is renamed with terraform!"), + resource.TestCheckResourceAttr(customRoleResourceName, "parent_role", "Standard User"), + ), + }, + }, + }) +} + +func testCustomRoleResource() string { + return strings.Replace(`resource "coralogix_custom_role" "test" { + name = "Test Custom Role" + description = "This role is created with terraform!" + parent_role = "Standard User" + permissions = ["spans.events2metrics:UpdateConfig"] + team_id = "" +} +`, "", teamID, 1) +} + +func testCustomRoleUpdateResource() string { + return strings.Replace(`resource "coralogix_custom_role" "test" { + name = "Test Custom Role Renamed" + description = "This role is renamed with terraform!" + parent_role = "Standard User" + permissions = ["spans.events2metrics:UpdateConfig", "spans.events2metrics:ReadConfig"] + team_id = "" +} +`, "", teamID, 1) +} diff --git a/docs/data-sources/custom_role.md b/docs/data-sources/custom_role.md new file mode 100644 index 00000000..224cb7cb --- /dev/null +++ b/docs/data-sources/custom_role.md @@ -0,0 +1,28 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "coralogix_custom_role Data Source - terraform-provider-coralogix" +subcategory: "" +description: |- + Coralogix Api keys. +--- + +# coralogix_custom_role (Data Source) + +Coralogix Api keys. + + + + +## Schema + +### Required + +- `id` (String) Custom Role ID. + +### Read-Only + +- `description` (String) Custom Role description. +- `name` (String) Custom Role name. +- `parent_role` (String) Parent role name +- `permissions` (Set of String) Custom role permissions +- `team_id` (Number) Custom Role teamId. diff --git a/docs/resources/custom_role.md b/docs/resources/custom_role.md new file mode 100644 index 00000000..50feb80c --- /dev/null +++ b/docs/resources/custom_role.md @@ -0,0 +1,28 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "coralogix_custom_role Resource - terraform-provider-coralogix" +subcategory: "" +description: |- + Coralogix Api keys. +--- + +# coralogix_custom_role (Resource) + +Coralogix Api keys. + + + + +## Schema + +### Required + +- `description` (String) Custom Role description. +- `name` (String) Custom Role name. +- `parent_role` (String) Parent role name +- `permissions` (Set of String) Custom role permissions +- `team_id` (Number) Custom Role teamId. + +### Read-Only + +- `id` (String) Custom Role ID. diff --git a/examples/custom_role/main.tf b/examples/custom_role/main.tf new file mode 100644 index 00000000..8a7e45ea --- /dev/null +++ b/examples/custom_role/main.tf @@ -0,0 +1,21 @@ +terraform { + required_providers { + coralogix = { + version = "~> 1.10" + source = "coralogix/coralogix" + } + } +} + +provider "coralogix" { + org_key = "" + domain = "" +} + +resource "coralogix_custom_role" "example" { + name = "Example custom role" + description = "This role is created with terraform!" + parent_role = "Standard User" + permissions = ["spans.events2metrics:UpdateConfig"] + team_id = 563577 +}