Skip to content

Commit

Permalink
Merge pull request #21 from BananaOps/docs/udates-documentation
Browse files Browse the repository at this point in the history
docs: add docs forr events and lock
  • Loading branch information
jplanckeel authored Oct 4, 2024
2 parents 8313c11 + 8a9c9b4 commit 318a550
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 89 deletions.
93 changes: 4 additions & 89 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Each time an event is created, we create a log in json format, which enables tra
- [x] Link a pull_request to an event
- [x] Calculates the time between two linked events
- [ ] Cli to create and search event
- [ ] Lock deployment endpoint
- [x] Lock deployment endpoint
- [ ] Add to cli lock and unlock function
- [ ] Config file for cli
- [ ] function search event of the day on cli
Expand Down Expand Up @@ -64,98 +64,13 @@ To run test:
make test
```

## Documentations

## Grpc Call
### Events

You can use Grpcurl to call grpc api

### Create an Event
### Locks

```bash
grpcurl --plaintext -d '{
"attributes": {
"message": "deployment service serverless version v0.0.1",
"priority": "4",
"service": "service-event",
"source": "github_action",
"status": "1",
"type": "1"
},
"links": {
"pull_request_link": "https://github.com/bananaops/tracker/pull/240"
},
"title": "Deployment service lambda"
}' localhost:8765 tracker.event.v1alpha1.EventService/CreateEvent

```

### List Events

```bash
grpcurl --plaintext localhost:8765 tracker.event.v1alpha1.EventService/ListEvents

```

### Get Event Id

```bash
grpcurl --plaintext -d '{
"id": "3ac2d880-ad52-4d50-b60d-9b44f54ae58f"
}' localhost:8765 tracker.event.v1alpha1.EventService/GetEvent

```

### Get Search Event

```bash
// With Priority P1
grpcurl --plaintext -d '{
"priority": "1"
}' localhost:8765 tracker.event.v1alpha1.EventService/SearchEvents

// With Priority P1 and Start Date
grpcurl --plaintext -d '{
"priority": "1",
"start_date": "2024-02-27"
}' localhost:8765 tracker.event.v1alpha1.EventService/SearchEvents

// With Priority P1 and End Date
grpcurl --plaintext -d '{
"priority": "1",
"end_date": "2024-02-28T15:04:05-07:00"
}' localhost:8765 tracker.event.v1alpha1.EventService/SearchEvents

```

### Create Lock

```bash
grpcurl --plaintext -d '{
"service": "tracker-service",
"who": "jplanckeel"
}' localhost:8765 tracker.lock.v1alpha1.LockService/CreateLock
```
### Get Lock

```bash
grpcurl --plaintext -d '{
"id": "2db91b8b-84ab-4e20-86e0-2104366bec5e"
}' localhost:8765 tracker.lock.v1alpha1.LockService/GetLock
```

### Delete Lock

```bash
grpcurl --plaintext -d '{
"id": "2db91b8b-84ab-4e20-86e0-2104366bec5e"
}' localhost:8765 tracker.lock.v1alpha1.LockService/UnLock
```

### List Locks

```bash
grpcurl --plaintext localhost:8765 tracker.lock.v1alpha1.LockService/ListLocks
```

## Contributing

Expand Down
113 changes: 113 additions & 0 deletions docs/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Events Documentation

## Grpc Call

You can use Grpcurl to call grpc api

### Create an Event

```bash
grpcurl --plaintext -d '{
"attributes": {
"message": "deployment service serverless version v0.0.1",
"priority": "1",
"service": "service-event",
"source": "github_action",
"status": "1",
"type": "1"
},
"links": {
"pull_request_link": "https://github.com/bananaops/tracker/pull/240"
},
"title": "Deployment service lambda"
}' localhost:8765 tracker.event.v1alpha1.EventService/CreateEvent

```

### List Events

```bash
grpcurl --plaintext localhost:8765 tracker.event.v1alpha1.EventService/ListEvents

```

### Get Event Id

```bash
grpcurl --plaintext -d '{
"id": "3ac2d880-ad52-4d50-b60d-9b44f54ae58f"
}' localhost:8765 tracker.event.v1alpha1.EventService/GetEvent

```

### Get Search Event

```bash
// With Priority P1
grpcurl --plaintext -d '{
"priority": "1"
}' localhost:8765 tracker.event.v1alpha1.EventService/SearchEvents

// With Priority P1 and Start Date
grpcurl --plaintext -d '{
"priority": "1",
"start_date": "2024-02-27"
}' localhost:8765 tracker.event.v1alpha1.EventService/SearchEvents

// With Priority P1 and End Date
grpcurl --plaintext -d '{
"priority": "1",
"end_date": "2024-02-28T15:04:05-07:00"
}' localhost:8765 tracker.event.v1alpha1.EventService/SearchEvents

```

## Rest Call

### Create an Event

```bash
curl -X POST localhost:8080/api/v1alpha1/event -d '
{
"title": "Deployment service lambda",
"attributes": {
"message": "deployment service version v0.0.1",
"source": "github_action",
"type": 1,
"priority": 1,
"relatedId": "",
"service": "service-event",
"status": 1
},
"links": {
"pullRequestLink": "https://github.com/bananaops/events-tracker/pull/240"
}
}'
```


### List Events

```bash
curl "http://localhost:8080/api/v1alpha1/events/list"
```

### Get Event Id

```bash
curl "localhost:8080/api/v1alpha1/event/a5fa1d90-44c9-4d4a-a436-930a9ee37e79"
```

### Get Search Event

```bash
// With Priority P3
curl "localhost:8080/api/v1alpha1/events/search?priority=3"

// With Priority P1 and Start Date
curl "localhost:8080/api/v1alpha1/events/search?start_date=2024-03-01"

// With Priority P1 and End Date
curl "localhost:8080/api/v1alpha1/events/search?end_date=2024-03-01"

```
68 changes: 68 additions & 0 deletions docs/locks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Lock Documentation

## Grpc Call

You can use Grpcurl to call grpc api


### Create Lock

```bash
grpcurl --plaintext -d '{
"service": "tracker-service",
"who": "jplanckeel"
}' localhost:8765 tracker.lock.v1alpha1.LockService/CreateLock
```

### List Locks

```bash
grpcurl --plaintext localhost:8765 tracker.lock.v1alpha1.LockService/ListLocks
```

### Get Lock

```bash
grpcurl --plaintext -d '{
"id": "2db91b8b-84ab-4e20-86e0-2104366bec5e"
}' localhost:8765 tracker.lock.v1alpha1.LockService/GetLock
```

### Delete Lock

```bash
grpcurl --plaintext -d '{
"id": "2db91b8b-84ab-4e20-86e0-2104366bec5e"
}' localhost:8765 tracker.lock.v1alpha1.LockService/UnLock
```

## Rest Call


### Create Lock

```bash
curl -X POST localhost:8080/api/v1alpha1/lock -d '
{
"service": "tracker-service",
"who": "jplanckeel"
}'
```

### List Locks

```bash
curl "localhost:8080/api/v1alpha1/locks/list"
```

### Get Lock

```bash
curl "localhost:8080/api/v1alpha1/lock/57fcab51-c8ab-4f92-8d10-b41e456e8354"
```

### Delete Lock

```bash
curl -X DELETE "localhost:8080/api/v1alpha1/unlock/e8ac122e-13cb-4abe-a127-98ec87acfb77"
```

0 comments on commit 318a550

Please sign in to comment.