Initial cloud-services repo - gateway service + pkg modules

This commit is contained in:
Chris Rai
2026-01-30 23:14:52 -05:00
commit fbb820d7b3
1037 changed files with 171318 additions and 0 deletions

1492
pkg/grpc/sms/sms.pb.go Normal file

File diff suppressed because it is too large Load Diff

120
pkg/grpc/sms/sms.proto Normal file
View File

@@ -0,0 +1,120 @@
syntax = "proto3";
option go_package = "grpc/sms";
service SMSService {
rpc HandleSMSSend(SendSMSRequest) returns (SMSDetailsResponse) {}
rpc HandleSMSQueue(SendSMSRequest) returns (SMSQueueResponse) {}
rpc HandleGetProducts(GetAvailableProductsRequest) returns (GetAvailableProductsResponse) {}
rpc HandleChangeRatePlan(ChangeRatePlanRequest) returns (ChangeRatePlanResponse) {}
rpc HandleCustomAttributes(CustomAtributesRequest) returns (CustomAtributeResponse) {}
rpc HandleDeviceDetails(DeviceDetailsRequest) returns (DeviceDetailsResponse) {}
}
message SendSMSRequest {
string ICCID = 1;
string messageText = 3;
enum MsgEncoding {
LITERAL = 0;
BASE64 = 1;
}
optional MsgEncoding messageEncoding = 4;
enum DataCoding {
ZERO = 0;
ONE = 1;
THREE = 3;
FOUR = 4;
EIGHT = 8;
}
optional DataCoding dataCoding = 5;
optional string tpvp = 6;
bool await = 7;
string KafkaServiceTarget = 8;
}
message SMSDetailsResponse {
string smsMsgID = 1;
enum Status {
Unknown = 0;
Received = 1;
Cancelled = 2;
CancelFailed = 3;
CancelPending = 4;
Delivered = 5;
Pending = 6;
Failed = 7;
}
Status status = 2;
string messageText = 3;
string senderLogin = 4;
string sentTo = 5;
string sentFrom = 6;
string msgType = 7;
string dateSent = 8;
string dateModified = 9;
string ICCID = 10;
}
message SMSQueueResponse {
string smsMsgID = 1;
bool sentSuccessful = 2;
}
message ChangeRatePlanRequest {
string productId = 1;
string ICCID = 2;
string accountId = 3;
}
message ChangeRatePlanResponse {
string ICCID = 1;
}
message CustomAtributesRequest {
string ICCID = 1;
string accountCustom1 = 2;
}
message CustomAtributeResponse {
string ICCID = 1;
}
message GetAvailableProductsRequest {
string accountId = 1;
repeated string productType = 2;
repeated string productClassification = 3;
}
message RatePlan {
string ratePlanName = 1;
string planType = 2;
string planStatus = 3;
string chargeUnit = 4;
}
message AvailableTmobileProduct {
string id = 1;
string productId = 2;
string shortDescription = 3;
string longDescription = 4;
string status = 5;
string effectiveDate = 6;
string expirationDate = 7;
RatePlan ratePlan = 8;
}
message GetAvailableProductsResponse {
repeated AvailableTmobileProduct availableProducts = 1;
}
message DeviceDetailsRequest {
string ICCID = 1;
}
message DeviceDetailsResponse {
string ICCID = 1;
string ratePlan = 2;
string accountId = 3;
string accountCustom1 = 4;
string status = 5;
}

294
pkg/grpc/sms/sms_grpc.pb.go Normal file
View File

@@ -0,0 +1,294 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc v4.25.3
// source: sms/sms.proto
package sms
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
const (
SMSService_HandleSMSSend_FullMethodName = "/SMSService/HandleSMSSend"
SMSService_HandleSMSQueue_FullMethodName = "/SMSService/HandleSMSQueue"
SMSService_HandleGetProducts_FullMethodName = "/SMSService/HandleGetProducts"
SMSService_HandleChangeRatePlan_FullMethodName = "/SMSService/HandleChangeRatePlan"
SMSService_HandleCustomAttributes_FullMethodName = "/SMSService/HandleCustomAttributes"
SMSService_HandleDeviceDetails_FullMethodName = "/SMSService/HandleDeviceDetails"
)
// SMSServiceClient is the client API for SMSService 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 SMSServiceClient interface {
HandleSMSSend(ctx context.Context, in *SendSMSRequest, opts ...grpc.CallOption) (*SMSDetailsResponse, error)
HandleSMSQueue(ctx context.Context, in *SendSMSRequest, opts ...grpc.CallOption) (*SMSQueueResponse, error)
HandleGetProducts(ctx context.Context, in *GetAvailableProductsRequest, opts ...grpc.CallOption) (*GetAvailableProductsResponse, error)
HandleChangeRatePlan(ctx context.Context, in *ChangeRatePlanRequest, opts ...grpc.CallOption) (*ChangeRatePlanResponse, error)
HandleCustomAttributes(ctx context.Context, in *CustomAtributesRequest, opts ...grpc.CallOption) (*CustomAtributeResponse, error)
HandleDeviceDetails(ctx context.Context, in *DeviceDetailsRequest, opts ...grpc.CallOption) (*DeviceDetailsResponse, error)
}
type sMSServiceClient struct {
cc grpc.ClientConnInterface
}
func NewSMSServiceClient(cc grpc.ClientConnInterface) SMSServiceClient {
return &sMSServiceClient{cc}
}
func (c *sMSServiceClient) HandleSMSSend(ctx context.Context, in *SendSMSRequest, opts ...grpc.CallOption) (*SMSDetailsResponse, error) {
out := new(SMSDetailsResponse)
err := c.cc.Invoke(ctx, SMSService_HandleSMSSend_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *sMSServiceClient) HandleSMSQueue(ctx context.Context, in *SendSMSRequest, opts ...grpc.CallOption) (*SMSQueueResponse, error) {
out := new(SMSQueueResponse)
err := c.cc.Invoke(ctx, SMSService_HandleSMSQueue_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *sMSServiceClient) HandleGetProducts(ctx context.Context, in *GetAvailableProductsRequest, opts ...grpc.CallOption) (*GetAvailableProductsResponse, error) {
out := new(GetAvailableProductsResponse)
err := c.cc.Invoke(ctx, SMSService_HandleGetProducts_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *sMSServiceClient) HandleChangeRatePlan(ctx context.Context, in *ChangeRatePlanRequest, opts ...grpc.CallOption) (*ChangeRatePlanResponse, error) {
out := new(ChangeRatePlanResponse)
err := c.cc.Invoke(ctx, SMSService_HandleChangeRatePlan_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *sMSServiceClient) HandleCustomAttributes(ctx context.Context, in *CustomAtributesRequest, opts ...grpc.CallOption) (*CustomAtributeResponse, error) {
out := new(CustomAtributeResponse)
err := c.cc.Invoke(ctx, SMSService_HandleCustomAttributes_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *sMSServiceClient) HandleDeviceDetails(ctx context.Context, in *DeviceDetailsRequest, opts ...grpc.CallOption) (*DeviceDetailsResponse, error) {
out := new(DeviceDetailsResponse)
err := c.cc.Invoke(ctx, SMSService_HandleDeviceDetails_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// SMSServiceServer is the server API for SMSService service.
// All implementations must embed UnimplementedSMSServiceServer
// for forward compatibility
type SMSServiceServer interface {
HandleSMSSend(context.Context, *SendSMSRequest) (*SMSDetailsResponse, error)
HandleSMSQueue(context.Context, *SendSMSRequest) (*SMSQueueResponse, error)
HandleGetProducts(context.Context, *GetAvailableProductsRequest) (*GetAvailableProductsResponse, error)
HandleChangeRatePlan(context.Context, *ChangeRatePlanRequest) (*ChangeRatePlanResponse, error)
HandleCustomAttributes(context.Context, *CustomAtributesRequest) (*CustomAtributeResponse, error)
HandleDeviceDetails(context.Context, *DeviceDetailsRequest) (*DeviceDetailsResponse, error)
mustEmbedUnimplementedSMSServiceServer()
}
// UnimplementedSMSServiceServer must be embedded to have forward compatible implementations.
type UnimplementedSMSServiceServer struct {
}
func (UnimplementedSMSServiceServer) HandleSMSSend(context.Context, *SendSMSRequest) (*SMSDetailsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method HandleSMSSend not implemented")
}
func (UnimplementedSMSServiceServer) HandleSMSQueue(context.Context, *SendSMSRequest) (*SMSQueueResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method HandleSMSQueue not implemented")
}
func (UnimplementedSMSServiceServer) HandleGetProducts(context.Context, *GetAvailableProductsRequest) (*GetAvailableProductsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method HandleGetProducts not implemented")
}
func (UnimplementedSMSServiceServer) HandleChangeRatePlan(context.Context, *ChangeRatePlanRequest) (*ChangeRatePlanResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method HandleChangeRatePlan not implemented")
}
func (UnimplementedSMSServiceServer) HandleCustomAttributes(context.Context, *CustomAtributesRequest) (*CustomAtributeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method HandleCustomAttributes not implemented")
}
func (UnimplementedSMSServiceServer) HandleDeviceDetails(context.Context, *DeviceDetailsRequest) (*DeviceDetailsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method HandleDeviceDetails not implemented")
}
func (UnimplementedSMSServiceServer) mustEmbedUnimplementedSMSServiceServer() {}
// UnsafeSMSServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to SMSServiceServer will
// result in compilation errors.
type UnsafeSMSServiceServer interface {
mustEmbedUnimplementedSMSServiceServer()
}
func RegisterSMSServiceServer(s grpc.ServiceRegistrar, srv SMSServiceServer) {
s.RegisterService(&SMSService_ServiceDesc, srv)
}
func _SMSService_HandleSMSSend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SendSMSRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SMSServiceServer).HandleSMSSend(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SMSService_HandleSMSSend_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SMSServiceServer).HandleSMSSend(ctx, req.(*SendSMSRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SMSService_HandleSMSQueue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SendSMSRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SMSServiceServer).HandleSMSQueue(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SMSService_HandleSMSQueue_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SMSServiceServer).HandleSMSQueue(ctx, req.(*SendSMSRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SMSService_HandleGetProducts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetAvailableProductsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SMSServiceServer).HandleGetProducts(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SMSService_HandleGetProducts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SMSServiceServer).HandleGetProducts(ctx, req.(*GetAvailableProductsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SMSService_HandleChangeRatePlan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ChangeRatePlanRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SMSServiceServer).HandleChangeRatePlan(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SMSService_HandleChangeRatePlan_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SMSServiceServer).HandleChangeRatePlan(ctx, req.(*ChangeRatePlanRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SMSService_HandleCustomAttributes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CustomAtributesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SMSServiceServer).HandleCustomAttributes(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SMSService_HandleCustomAttributes_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SMSServiceServer).HandleCustomAttributes(ctx, req.(*CustomAtributesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SMSService_HandleDeviceDetails_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeviceDetailsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SMSServiceServer).HandleDeviceDetails(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: SMSService_HandleDeviceDetails_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SMSServiceServer).HandleDeviceDetails(ctx, req.(*DeviceDetailsRequest))
}
return interceptor(ctx, in, info, handler)
}
// SMSService_ServiceDesc is the grpc.ServiceDesc for SMSService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var SMSService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "SMSService",
HandlerType: (*SMSServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "HandleSMSSend",
Handler: _SMSService_HandleSMSSend_Handler,
},
{
MethodName: "HandleSMSQueue",
Handler: _SMSService_HandleSMSQueue_Handler,
},
{
MethodName: "HandleGetProducts",
Handler: _SMSService_HandleGetProducts_Handler,
},
{
MethodName: "HandleChangeRatePlan",
Handler: _SMSService_HandleChangeRatePlan_Handler,
},
{
MethodName: "HandleCustomAttributes",
Handler: _SMSService_HandleCustomAttributes_Handler,
},
{
MethodName: "HandleDeviceDetails",
Handler: _SMSService_HandleDeviceDetails_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "sms/sms.proto",
}

57
pkg/grpc/sms/smsmock.go Normal file
View File

@@ -0,0 +1,57 @@
package sms
import (
"context"
"google.golang.org/grpc"
)
type SMSSendHandlerFunc func(ctx context.Context, in *SendSMSRequest, opts ...grpc.CallOption) (*SMSDetailsResponse, error)
func NewSMSMock(handler SMSSendHandlerFunc) SMSMock {
return SMSMock{
SMSSendHandler: handler,
}
}
func NewSMSMockSuccess() SMSMock {
return SMSMock{
SMSSendHandler: func(ctx context.Context, in *SendSMSRequest, opts ...grpc.CallOption) (*SMSDetailsResponse, error) {
return nil, nil
},
}
}
type SMSMock struct {
SMSSendHandler SMSSendHandlerFunc
UnimplementedSMSServiceServer
queueResponse *SMSQueueResponse
queueResponseError error
}
func (m *SMSMock) HandleSMSSend(ctx context.Context, in *SendSMSRequest, opts ...grpc.CallOption) (*SMSDetailsResponse, error) {
return m.SMSSendHandler(ctx, in, opts...)
}
// HandleSMSQueue implements sms.SMSServiceClient.
func (m *SMSMock) HandleSMSQueue(ctx context.Context, in *SendSMSRequest, opts ...grpc.CallOption) (*SMSQueueResponse, error) {
return m.queueResponse, m.queueResponseError
}
func (m *SMSMock) SetHandleSMSQueueResponse(response *SMSQueueResponse, err error) {
m.queueResponse = response
m.queueResponseError = err
}
func (m *SMSMock) HandleGetProducts(ctx context.Context, in *GetAvailableProductsRequest, opts ...grpc.CallOption) (*GetAvailableProductsResponse, error) {
return nil, nil
}
func (m *SMSMock) HandleChangeRatePlan(ctx context.Context, in *ChangeRatePlanRequest, opts ...grpc.CallOption) (*ChangeRatePlanResponse, error) {
return nil, nil
}
func (m *SMSMock) HandleCustomAttributes(ctx context.Context, in *CustomAtributesRequest, opts ...grpc.CallOption) (*CustomAtributeResponse, error) {
return nil, nil
}
func (m *SMSMock) HandleDeviceDetails(ctx context.Context, in *DeviceDetailsRequest, opts ...grpc.CallOption) (*DeviceDetailsResponse, error) {
return nil, nil
}