This repository contains two main subprojects demonstrating different API paradigms for asset management and car rental systems:
- question1_restful_api: RESTful API implementation using Ballerina
- question2_grpc: gRPC API implementation using Ballerina
- Project Structure
- Technologies Used
- Setup Instructions
- question1_restful_api
- question2_grpc
- Development Environment
- License
Asset_Mangement/
├── question1_restful_api/
│ ├── Ballerina.toml
│ ├── main.bal
│ ├── types.bal
│ ├── client/
│ │ ├── client.bal
│ │ └── curl_tests.ps1
│ ├── .devcontainer.json
│ └── .gitignore
├── question2_grpc/
│ ├── Ballerina.toml
│ ├── car_rental_pb.bal
│ ├── car_rental.proto
│ ├── Dependencies.toml
│ ├── descriptor.bal
│ ├── server.bal
│ ├── types.bal
│ ├── client/
│ │ └── client.bal
│ ├── tests/
│ │ ├── server_helpers_test.bal
│ │ └── types_test.bal
│ ├── target/
│ │ └── ...
│ ├── start-server.ps1
│ ├── .devcontainer.json
│ └── .gitignore
└── README.md
- Ballerina: Programming language for cloud-native applications
- gRPC: Remote Procedure Call framework
- PowerShell: For running scripts on Windows
- Protocol Buffers: For gRPC service definitions
- Install Ballerina: Ballerina Installation Guide
- Clone the Repository:
git clone <repo-url> cd Asset_Mangement
- Install Dependencies:
- For gRPC, ensure Protocol Buffers compiler (
protoc) is installed. - Use Ballerina's package manager for dependencies.
- For gRPC, ensure Protocol Buffers compiler (
Implements a RESTful API for asset management using Ballerina. It provides endpoints for managing assets, including creation, retrieval, updating, and deletion.
main.bal: Entry point for the RESTful API server.types.bal: Contains type definitions for assets and related entities.client/client.bal: Ballerina client for interacting with the REST API.client/curl_tests.ps1: PowerShell script for testing API endpoints usingcurl..devcontainer.json: Development container configuration..gitignore: Git ignore rules.
- Start the Server:
bal run main.bal
- Test Endpoints:
- Use
client/client.balfor programmatic access. - Use
curl_tests.ps1to run endpoint tests via PowerShell.
- Use
- Run the PowerShell script:
./client/curl_tests.ps1
- Use Ballerina test framework for any test files (if present).
Implements a gRPC API for a car rental system using Ballerina. It demonstrates service definition via Protocol Buffers and server/client implementation in Ballerina.
car_rental.proto: Protocol Buffers definition for the car rental service.car_rental_pb.bal: Auto-generated Ballerina code from the proto file.server.bal: gRPC server implementation.client/client.bal: gRPC client implementation.types.bal: Type definitions for car rental entities.descriptor.bal: Service descriptors for gRPC.Dependencies.toml: Dependency management for Ballerina modules.start-server.ps1: PowerShell script to start the gRPC server.tests/: Contains Ballerina test files for server helpers and types.target/: Build artifacts and cache..devcontainer.json: Development container configuration..gitignore: Git ignore rules.
- Generate Ballerina Code from Proto (if not already generated):
bal grpc --input car_rental.proto --output car_rental_pb.bal
- Start the Server:
./start-server.ps1
- Run the Client:
bal run client/client.bal
- Run Ballerina tests:
bal test tests/
- .devcontainer.json files are provided for both subprojects to support development in containerized environments (e.g., VS Code Remote Containers).
- .gitignore files ensure build artifacts and environment files are not tracked.
This project is for educational purposes. Please refer to your institution's guidelines for usage and distribution.