-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from ostelco/develop
Develop to master
- Loading branch information
Showing
170 changed files
with
4,307 additions
and
746 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
# Compiled class file | ||
*.class | ||
|
||
.classpath | ||
.project | ||
.settings | ||
|
||
# Log file | ||
*.log | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,32 @@ | ||
# ostelco-core | ||
|
||
[![Build Status](https://travis-ci.org/ostelco/ostelco-core.svg?branch=master)](https://travis-ci.org/ostelco/ostelco-core) [![codebeat badge](https://codebeat.co/badges/e4c26ba7-75d6-48d2-a3d0-f72988998642)](https://codebeat.co/projects/github-com-ostelco-ostelco-core-master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/e7b2ae0440104a5e8ae6fa5e919147dc)](https://www.codacy.com/app/la3lma/ostelco-core?utm_source=github.com&utm_medium=referral&utm_content=ostelco/ostelco-core&utm_campaign=Badge_Grade)[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/e7b2ae0440104a5e8ae6fa5e919147dc)](https://www.codacy.com/app/la3lma/ostelco-core?utm_source=github.com&utm_medium=referral&utm_content=ostelco/ostelco-core&utm_campaign=Badge_Coverage) | ||
Mono Repository for core protocols and services around a OCS/BSS for packet data. For each service please see the individual Readme.md files. | ||
|
||
[general documentation](./docs/README.md) | ||
|
||
[analytics](./analytics/README.md) | ||
|
||
[auth-server](./auth-server/README.md) | ||
|
||
[diameter-stack](./diameter-stack/README.md) | ||
|
||
[diameter-test](./diameter-test/README.md) | ||
|
||
[exporter](./exporter/README.md) | ||
|
||
[ext-pgw](./ext-pgw/README.md) | ||
|
||
[ocs-api](./ocs-api/README.md) | ||
|
||
[ocsgw](./ocsgw/README.md) | ||
|
||
[ostelco-lib](./ostelco-lib/README.md) | ||
|
||
[prime](./prime/README.md) | ||
|
||
[pseudonym-server](./pseudonym-server/README.md) | ||
|
||
[seagull](./seagull/README.md) | ||
|
||
[![Build Status](https://travis-ci.org/ostelco/ostelco-core.svg?branch=master)](https://travis-ci.org/ostelco/ostelco-core) [![codebeat badge](https://codebeat.co/badges/e4c26ba7-75d6-48d2-a3d0-f72988998642)](https://codebeat.co/projects/github-com-ostelco-ostelco-core-master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/e7b2ae0440104a5e8ae6fa5e919147dc)](https://www.codacy.com/app/la3lma/ostelco-core?utm_source=github.com&utm_medium=referral&utm_content=ostelco/ostelco-core&utm_campaign=Badge_Grade)[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/e7b2ae0440104a5e8ae6fa5e919147dc)](https://www.codacy.com/app/la3lma/ostelco-core?utm_source=github.com&utm_medium=referral&utm_content=ostelco/ostelco-core&utm_campaign=Badge_Coverage) | ||
|
||
Core protocols and services |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Admin API | ||
|
||
* Admin API is for back-office admin management. | ||
* Each of the _Resources_ are listed below shall have Create-Read-Update-Delete operations. | ||
|
||
### Product Class | ||
|
||
id: <product class id> | ||
properties: | ||
<multi-level template> | ||
|
||
### Product | ||
|
||
##### Product for Client API | ||
|
||
sku: <product sku> | ||
class: <product class id> | ||
price: | ||
amount: <amount> | ||
currency: <currency code> | ||
properties: | ||
<multi-level object> | ||
|
||
##### Additional attributes of Product for Admin API | ||
|
||
visibility: | ||
flag: <boolean> | ||
start_date: <datetime> | ||
end_date: <datetime> | ||
|
||
### Segment | ||
|
||
id: <segment id> | ||
description: <optional human understandable text> | ||
export_id: <export id used to de-anonymize subscriber ids> | ||
type: <EXTERNAL or CONDITIONAL> | ||
subscribers: | ||
<list of subscribers - for type=EXTERNAL only> | ||
condition: <boolean expression - for type=CONDITIONAL> | ||
|
||
### Offer | ||
|
||
id: <offer id> | ||
segment_id: <segment id> | ||
products: | ||
<list of products> | ||
validity (visibility): | ||
start_date: <start date of an offer> | ||
end_date: <end date of an offer> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
plugins { | ||
id "java-library" | ||
id "org.jetbrains.kotlin.jvm" version "1.2.41" | ||
} | ||
|
||
dependencies { | ||
|
||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion" | ||
implementation project(":prime-api") | ||
implementation "io.dropwizard:dropwizard-auth:$dropwizardVersion" | ||
|
||
testImplementation "io.dropwizard:dropwizard-testing:$dropwizardVersion" | ||
} |
21 changes: 21 additions & 0 deletions
21
admin-api/src/main/kotlin/org/ostelco/prime/admin/api/AdminService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.ostelco.prime.admin.api | ||
|
||
import com.fasterxml.jackson.annotation.JsonTypeName | ||
import io.dropwizard.setup.Environment | ||
import org.ostelco.prime.getResource | ||
import org.ostelco.prime.provider.Service | ||
import org.ostelco.prime.storage.DataStore | ||
|
||
@JsonTypeName("admin") | ||
class AdminService: Service { | ||
|
||
private var datastore: DataStore = getResource() | ||
|
||
override fun init(env: Environment) { | ||
val jerseySever = env.jersey() | ||
jerseySever.register(OfferResource(datastore)) | ||
jerseySever.register(SegmentResource(datastore)) | ||
jerseySever.register(ProductResource(datastore)) | ||
jerseySever.register(ProductClassResource(datastore)) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
admin-api/src/main/kotlin/org/ostelco/prime/admin/api/Model.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.ostelco.prime.admin.api | ||
|
||
import org.ostelco.prime.model.Entity | ||
|
||
class Offer : Entity { | ||
override var id: String = "" | ||
var segments: Array<String> = emptyArray() | ||
var products: Array<String> = emptyArray() | ||
} | ||
|
||
class Segment : Entity { | ||
override var id: String = "" | ||
var subscribers: Array<String> = emptyArray() | ||
} |
101 changes: 101 additions & 0 deletions
101
admin-api/src/main/kotlin/org/ostelco/prime/admin/api/Resources.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package org.ostelco.prime.admin.api | ||
|
||
|
||
import org.ostelco.prime.model.AdminProduct | ||
import org.ostelco.prime.model.ProductClass | ||
import org.ostelco.prime.storage.DataStore | ||
import javax.ws.rs.GET | ||
import javax.ws.rs.POST | ||
import javax.ws.rs.PUT | ||
import javax.ws.rs.Path | ||
import javax.ws.rs.PathParam | ||
|
||
@Path("/offers") | ||
class OfferResource(private val dataStore: DataStore) { | ||
|
||
@GET | ||
fun getOffers() = dataStore.getOffers().map { it.id } | ||
|
||
@GET | ||
@Path("/{offer-id}") | ||
fun getOffer(@PathParam("offer-id") offerId: String) = dataStore.getOffer(offerId) | ||
|
||
@POST | ||
fun createOffer(offer: Offer) = dataStore.createOffer(toStoredOffer(offer)) | ||
|
||
private fun toStoredOffer(offer: Offer): org.ostelco.prime.model.Offer { | ||
val storedOffer = org.ostelco.prime.model.Offer() | ||
storedOffer.id = offer.id | ||
storedOffer.segments = offer.segments.map { dataStore.getSegment(it) }.requireNoNulls() | ||
storedOffer.products = offer.products.map { dataStore.getProduct(it) }.requireNoNulls() | ||
return storedOffer | ||
} | ||
} | ||
|
||
@Path("/segments") | ||
class SegmentResource(private val dataStore: DataStore) { | ||
|
||
@GET | ||
fun getSegments() = dataStore.getSegments().map { it.id } | ||
|
||
@GET | ||
@Path("/{segment-id}") | ||
fun getSegment(@PathParam("segment-id") segmentId: String) = dataStore.getSegment(segmentId) | ||
|
||
@POST | ||
fun createSegment(segment: Segment) = dataStore.createSegment(toStoredSegment(segment)) | ||
|
||
@PUT | ||
@Path("/{segment-id}") | ||
fun updateSegment( | ||
@PathParam("segment-id") segmentId: String, | ||
segment: Segment): Boolean { | ||
segment.id = segmentId | ||
return dataStore.updateSegment(toStoredSegment(segment)) | ||
} | ||
|
||
private fun toStoredSegment(segment: Segment): org.ostelco.prime.model.Segment { | ||
val storedSegment = org.ostelco.prime.model.Segment() | ||
storedSegment.id = segment.id | ||
storedSegment.subscribers = segment.subscribers.map { dataStore.getSubscriber(it) }.requireNoNulls() | ||
return storedSegment | ||
} | ||
} | ||
|
||
@Path("/products") | ||
class ProductResource(private val dataStore: DataStore) { | ||
|
||
@GET | ||
fun getProducts() = dataStore.getProducts().map { it.id } | ||
|
||
@GET | ||
@Path("/{product-sku}") | ||
fun getProducts(@PathParam("product-sku") productSku: String) = dataStore.getProduct(productSku) | ||
|
||
@POST | ||
fun createProduct(product: AdminProduct) = dataStore.createProduct(product) | ||
} | ||
|
||
@Path("/product_classes") | ||
class ProductClassResource(private val dataStore: DataStore) { | ||
|
||
@GET | ||
fun getProductClasses() = dataStore.getProductClasses().map { it.id } | ||
|
||
@GET | ||
@Path("/{product-class-id}") | ||
fun getProductClass(@PathParam("product-class-id") productClassId: String) | ||
= dataStore.getProductClass(productClassId) | ||
|
||
@POST | ||
fun createProductClass(productClass: ProductClass) = dataStore.createProductClass(productClass) | ||
|
||
@PUT | ||
@Path("/{product-class-id}") | ||
fun updateProductClass( | ||
@PathParam("product-class-id") productClassId: String, | ||
productClass: ProductClass): Boolean { | ||
productClass.id = productClassId | ||
return dataStore.updateProductClass(productClass) | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
admin-api/src/main/resources/META-INF/services/io.dropwizard.jackson.Discoverable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.ostelco.prime.provider.Service |
1 change: 1 addition & 0 deletions
1
admin-api/src/main/resources/META-INF/services/org.ostelco.prime.provider.Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.ostelco.prime.admin.api.AdminService |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
# Auth Server | ||
|
||
Path: /auth/token | ||
Port: 8080 | ||
Method: GET | ||
Header: X-MSISDN - Will be header injected by PGw. | ||
Response: JWT Firebase Token for given MSISDN. | ||
|
||
Path: /auth/token | ||
Port: 8080 | ||
Method: GET | ||
Header: X-MSISDN - Will be header injected by P-GW. | ||
Response: JWT Firebase Token for given MSISDN. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/bin/ | ||
*.orig.* | ||
*.toc.* | ||
pom.xml |
Oops, something went wrong.