Skip to content

CodeGrogu/Asset-Mangement

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 

Repository files navigation

Asset Management Project

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

Table of Contents


Project Structure

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

Technologies Used

  • Ballerina: Programming language for cloud-native applications
  • gRPC: Remote Procedure Call framework
  • PowerShell: For running scripts on Windows
  • Protocol Buffers: For gRPC service definitions

Setup Instructions

  1. Install Ballerina: Ballerina Installation Guide
  2. Clone the Repository:
    git clone <repo-url>
    cd Asset_Mangement
  3. Install Dependencies:
    • For gRPC, ensure Protocol Buffers compiler (protoc) is installed.
    • Use Ballerina's package manager for dependencies.

question1_restful_api

Overview

Implements a RESTful API for asset management using Ballerina. It provides endpoints for managing assets, including creation, retrieval, updating, and deletion.

Key Files

  • 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 using curl.
  • .devcontainer.json: Development container configuration.
  • .gitignore: Git ignore rules.

How to Run

  1. Start the Server:
    bal run main.bal
  2. Test Endpoints:
    • Use client/client.bal for programmatic access.
    • Use curl_tests.ps1 to run endpoint tests via PowerShell.

Testing

  • Run the PowerShell script:
    ./client/curl_tests.ps1
  • Use Ballerina test framework for any test files (if present).

question2_grpc

Overview

Implements a gRPC API for a car rental system using Ballerina. It demonstrates service definition via Protocol Buffers and server/client implementation in Ballerina.

Key Files

  • 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.

How to Run

  1. Generate Ballerina Code from Proto (if not already generated):
    bal grpc --input car_rental.proto --output car_rental_pb.bal
  2. Start the Server:
    ./start-server.ps1
  3. Run the Client:
    bal run client/client.bal

Testing

  • Run Ballerina tests:
    bal test tests/

Development Environment

  • .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.

License

This project is for educational purposes. Please refer to your institution's guidelines for usage and distribution.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors