Skip to content

Commit

Permalink
Merge pull request #6 from meshcloud/feature/meshworkspace
Browse files Browse the repository at this point in the history
feat: update API version for meshCustomer to meshWorkspace rename
  • Loading branch information
JohannesRudolph authored Aug 2, 2023
2 parents 812ec2a + e01a7c9 commit c9ba775
Show file tree
Hide file tree
Showing 20 changed files with 83 additions and 77 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push]

jobs:
pytest:

timeout-minutes: 5
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
Expand All @@ -13,9 +13,9 @@ jobs:
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ schemas can more handle easily handle the dynamic schema nature of tags.

> Note that meshObject tag schemas can also be different from object to object in the same collection.

Consider the following example to understand how the transformation works. The `meshCustomer` has the following
Consider the following example to understand how the transformation works. The `meshWorkspace` has the following
JSON representation in the meshObject API:

```json
{
"apiVersion": "v1",
"kind": "meshCustomer",
"kind": "meshWorkspace",
"metadata": {
"name": "customer",
"createdOn": "2021-01-25T10:28:38Z"
Expand All @@ -78,7 +78,7 @@ The tap transforms this object into the following record representation
```json
{
"apiVersion": "v1",
"kind": "meshCustomer",
"kind": "meshWorkspace",
"metadata": {
"name": "customer",
"createdOn": "2021-01-25T10:28:38Z"
Expand Down
2 changes: 1 addition & 1 deletion makeSchemas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ main() {
if [[ -z $krakenApiSpecFile ]]; then usage "openapi.yaml file argument for kraken missing"; fi;

# meshfed-api
extractSchema "$apiSpecFile" "meshCustomer"
extractSchema "$apiSpecFile" "meshWorkspace"
extractSchema "$apiSpecFile" "meshProject"
extractSchema "$apiSpecFile" "meshPaymentMethod"
extractSchema "$apiSpecFile" "meshTenant"
Expand Down
2 changes: 1 addition & 1 deletion meltano.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins:
- discover
# TODO: please configure your meshObjects you want to add to the data ware house
select:
- meshCustomers.*
- meshWorkspaces.*
- meshProjects.*
- meshPaymentMethods.*
- meshTenants.*
Expand Down
4 changes: 2 additions & 2 deletions stub/meshobjects/meshchargebacks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"_embedded": {
"meshChargebacks": [
{
"apiVersion": "v1",
"apiVersion": "v2",
"kind": "meshChargeback",
"metadata": {
"name": "2022-06-06Z/demo-partner:unipipe-video:unipipe-service-broker-dev",
"createdOn": "2022-06-28T08:39:46.950195Z"
},
"spec": {
"customerIdentifier": "unipipe-video",
"workspaceIdentifier": "unipipe-video",
"projectIdentifier": "unipipe-service-broker-dev",
"partnerIdentifier": "demo-partner",
"period": "2022-06-06Z",
Expand Down
4 changes: 2 additions & 2 deletions stub/meshobjects/meshchargebacks?page=1&size=1.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"_embedded": {
"meshChargebacks": [
{
"apiVersion": "v1",
"apiVersion": "v2",
"kind": "meshChargeback",
"metadata": {
"name": "2022-06-06Z/demo-partner:unipipe-video:unipipe-service-broker-dev",
"createdOn": "2022-06-28T08:39:46.950195Z"
},
"spec": {
"customerIdentifier": "unipipe-video",
"workspaceIdentifier": "unipipe-video",
"projectIdentifier": "unipipe-service-broker-dev",
"partnerIdentifier": "demo-partner",
"period": "2022-06-06Z",
Expand Down
4 changes: 2 additions & 2 deletions stub/meshobjects/meshpaymentmethods.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"_embedded": {
"meshPaymentMethods": [
{
"apiVersion": "v1",
"apiVersion": "v2",
"kind": "meshPaymentMethod",
"metadata": {
"name": "default",
"ownedByCustomer": "managed-customer"
"ownedByWorkspace": "managed-customer"
},
"spec": {
"displayName": "Default",
Expand Down
8 changes: 4 additions & 4 deletions stub/meshobjects/meshprojects.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"_embedded": {
"meshProjects": [
{
"apiVersion": "v1",
"apiVersion": "v2",
"kind": "meshProject",
"metadata": {
"name": "test-metrics-metering-dev",
"ownedByCustomer": "managed-customer",
"ownedByWorkspace": "managed-customer",
"createdOn": "2021-01-27T07:49:12Z"
},
"spec": {
Expand All @@ -22,11 +22,11 @@
"href": "http://localhost:8000/api/meshobjects/meshprojects/managed-customer.test-metrics-metering-dev"
},
"meshtenants": {
"href": "http://localhost:8000/api/meshobjects/meshtenants?customerIdentifier=managed-customer&projectIdentifier=test-metrics-metering-dev{&platformIdentifier}",
"href": "http://localhost:8000/api/meshobjects/meshtenants?workspaceIdentifier=managed-customer&projectIdentifier=test-metrics-metering-dev{&platformIdentifier}",
"templated": true
},
"meshusers": {
"href": "http://localhost:8000/api/meshobjects/meshusers?customerIdentifier=managed-customer&projectIdentifier=test-metrics-metering-dev{&platformIdentifier,customerRole,projectRole}",
"href": "http://localhost:8000/api/meshobjects/meshusers?workspaceIdentifier=managed-customer&projectIdentifier=test-metrics-metering-dev{&platformIdentifier,customerRole,projectRole}",
"templated": true
},
"activePaymentMethod": {
Expand Down
6 changes: 3 additions & 3 deletions stub/meshobjects/meshtenants.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"_embedded": {
"meshTenants": [
{
"apiVersion": "v2",
"apiVersion": "v3",
"kind": "meshTenant",
"metadata": {
"ownedByProject": "tenant-import-aws-dev",
"ownedByCustomer": "managed-customer",
"ownedByWorkspace": "managed-customer",
"platformIdentifier": "aws.aws-meshstack-dev",
"assignedTags": {
"environment": ["dev"],
Expand All @@ -26,7 +26,7 @@
"href": "http://localhost:8000/api/meshobjects/meshtenants/managed-customer.tenant-import-aws-dev.aws.aws-meshstack-dev"
},
"meshusers": {
"href": "http://localhost:8000/api/meshobjects/meshusers?customerIdentifier=managed-customer&projectIdentifier=tenant-import-aws-dev&platformIdentifier=aws.aws-meshstack-dev{&customerRole,projectRole}",
"href": "http://localhost:8000/api/meshobjects/meshusers?workspaceIdentifier=managed-customer&projectIdentifier=tenant-import-aws-dev&platformIdentifier=aws.aws-meshstack-dev{&customerRole,projectRole}",
"templated": true
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"_embedded": {
"meshCustomers": [
"meshWorkspaces": [
{
"apiVersion": "v1",
"kind": "meshCustomer",
"kind": "meshWorkspace",
"metadata": {
"name": "admin-customer",
"createdOn": "2021-01-25T10:28:38Z"
Expand All @@ -16,38 +16,38 @@
},
"_links": {
"self": {
"href": "http://localhost:8000/api/meshobjects/meshcustomers/admin-customer"
"href": "http://localhost:8000/api/meshobjects/meshworkspaces/admin-customer"
},
"meshtenants": {
"href": "http://localhost:8000/api/meshobjects/meshtenants?customerIdentifier=admin-customer{&projectIdentifier,platformIdentifier}",
"href": "http://localhost:8000/api/meshobjects/meshtenants?workspaceIdentifier=admin-customer{&projectIdentifier,platformIdentifier}",
"templated": true
},
"meshprojects": {
"href": "http://localhost:8000/api/meshobjects/meshprojects?customerIdentifier=admin-customer"
"href": "http://localhost:8000/api/meshobjects/meshprojects?workspaceIdentifier=admin-customer"
},
"meshusers": {
"href": "http://localhost:8000/api/meshobjects/meshusers?customerIdentifier=admin-customer{&projectIdentifier,platformIdentifier,customerRole,projectRole}",
"href": "http://localhost:8000/api/meshobjects/meshusers?workspaceIdentifier=admin-customer{&projectIdentifier,platformIdentifier,customerRole,projectRole}",
"templated": true
},
"meshpaymentmethods": {
"href": "http://localhost:8000/api/meshobjects/meshpaymentmethods?customerIdentifier=admin-customer"
"href": "http://localhost:8000/api/meshobjects/meshpaymentmethods?workspaceIdentifier=admin-customer"
}
}
}
]
},
"_links": {
"first": {
"href": "http://localhost:8000/api/meshobjects/meshcustomers?page=0&size=1"
"href": "http://localhost:8000/api/meshobjects/meshworkspaces?page=0&size=1"
},
"self": {
"href": "http://localhost:8000/api/meshobjects/meshcustomers?size=1"
"href": "http://localhost:8000/api/meshobjects/meshworkspaces?size=1"
},
"next": {
"href": "http://localhost:8000/api/meshobjects/meshcustomers?page=1&size=1"
"href": "http://localhost:8000/api/meshobjects/meshworkspaces?page=1&size=1"
},
"last": {
"href": "http://localhost:8000/api/meshobjects/meshcustomers?page=44&size=1"
"href": "http://localhost:8000/api/meshobjects/meshworkspaces?page=44&size=1"
}
},
"page": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"_embedded": {
"meshCustomers": [
"meshWorkspaces": [
{
"apiVersion": "v1",
"kind": "meshCustomer",
"kind": "meshWorkspace",
"metadata": {
"name": "demo-customer",
"createdOn": "2021-01-25T10:28:38Z"
Expand All @@ -21,35 +21,35 @@
},
"_links": {
"self": {
"href": "http://localhost:8000/api/meshobjects/meshcustomers/demo-customer"
"href": "http://localhost:8000/api/meshobjects/meshworkspaces/demo-customer"
},
"meshtenants": {
"href": "http://localhost:8000/api/meshobjects/meshtenants?customerIdentifier=demo-customer{&projectIdentifier,platformIdentifier}",
"href": "http://localhost:8000/api/meshobjects/meshtenants?workspaceIdentifier=demo-customer{&projectIdentifier,platformIdentifier}",
"templated": true
},
"meshprojects": {
"href": "http://localhost:8000/api/meshobjects/meshprojects?customerIdentifier=demo-customer"
"href": "http://localhost:8000/api/meshobjects/meshprojects?workspaceIdentifier=demo-customer"
},
"meshusers": {
"href": "http://localhost:8000/api/meshobjects/meshusers?customerIdentifier=demo-customer{&projectIdentifier,platformIdentifier,customerRole,projectRole}",
"href": "http://localhost:8000/api/meshobjects/meshusers?workspaceIdentifier=demo-customer{&projectIdentifier,platformIdentifier,customerRole,projectRole}",
"templated": true
},
"meshpaymentmethods": {
"href": "http://localhost:8000/api/meshobjects/meshpaymentmethods?customerIdentifier=demo-customer"
"href": "http://localhost:8000/api/meshobjects/meshpaymentmethods?workspaceIdentifier=demo-customer"
}
}
}
]
},
"_links": {
"first": {
"href": "http://localhost:8000/api/meshobjects/meshcustomers?page=0&size=1"
"href": "http://localhost:8000/api/meshobjects/meshworkspaces?page=0&size=1"
},
"prev": {
"href": "http://localhost:8000/api/meshobjects/meshcustomers?page=0&size=1"
"href": "http://localhost:8000/api/meshobjects/meshworkspaces?page=0&size=1"
},
"self": {
"href": "http://localhost:8000/api/meshobjects/meshcustomers?page=1&size=1"
"href": "http://localhost:8000/api/meshobjects/meshworkspaces?page=1&size=1"
}
},
"page": {
Expand Down
4 changes: 4 additions & 0 deletions tap_meshstack/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ def prepare_request(
request_data = self.prepare_request_payload(context, next_page_token)
headers = self.http_headers

headers.update({
"accept": self.meshobject_version
})

authenticator = self.authenticator
if authenticator:
headers.update(authenticator.auth_headers or {})
Expand Down
6 changes: 3 additions & 3 deletions tap_meshstack/schemas/meshChargeback.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
"properties": {
"partnerIdentifier": {
"type": "string",
"description": "The meshPartner the meshCustomer of this meshChargeback belongs to."
"description": "The meshPartner the meshWorkspace of this meshChargeback belongs to."
},
"period": {
"type": "string",
"description": "The period of the meshChargeback, e.g. '2022-01-06Z'."
},
"customerIdentifier": {
"workspaceIdentifier": {
"type": "string",
"description": "The meshCustomer identifier this meshChargeback belongs to."
"description": "The meshWorkspace identifier this meshChargeback belongs to."
},
"projectIdentifier": {
"type": "string",
Expand Down
6 changes: 3 additions & 3 deletions tap_meshstack/schemas/meshPaymentMethod.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
"metadata": {
"type": "object",
"properties": {
"ownedByCustomer": {
"ownedByWorkspace": {
"type": "string",
"description": "The customerIdentifier as 'ownedByCustomer'."
"description": "The workspaceIdentifier as 'ownedByWorkspace'."
},
"name": {
"type": "string",
"description": "The paymentMethodIdentifier as 'name'."
}
},
"description": "Always contains the 'name' and (optional) 'ownedByCustomer' to uniquely identify the meshPaymentMethod."
"description": "Always contains the 'name' and (optional) 'ownedByWorkspace' to uniquely identify the meshPaymentMethod."
},
"apiVersion": {
"type": "string",
Expand Down
6 changes: 3 additions & 3 deletions tap_meshstack/schemas/meshProject.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"metadata": {
"type": "object",
"properties": {
"ownedByCustomer": {
"ownedByWorkspace": {
"type": "string",
"description": "The customerIdentifier as 'ownedByCustomer'."
"description": "The workspaceIdentifier as 'ownedByWorkspace'."
},
"deletedOn": {
"type": "string",
Expand All @@ -22,7 +22,7 @@
"description": "The meshProject has been created at this <<data_types,date>> (e.g. `2020-12-22T09:37:43Z`)."
}
},
"description": "Always contains the 'name' and 'ownedByCustomer' to uniquely identify the meshProject."
"description": "Always contains the 'name' and 'ownedByWorkspace' to uniquely identify the meshProject."
},
"apiVersion": {
"type": "string",
Expand Down
8 changes: 4 additions & 4 deletions tap_meshstack/schemas/meshTenant.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
"type": "string",
"description": "The identifier of the meshProject the meshTenant belongs to."
},
"ownedByCustomer": {
"ownedByWorkspace": {
"type": "string",
"description": "The identifier of the meshCustomer the meshTenant belongs to."
"description": "The identifier of the meshWorkspace the meshTenant belongs to."
},
"assignedTags": {
"type": "object",
"description": "The tags assigned to this meshTenant originating from meshCustomer, Payment Method and meshProject. Keep in mind, that values are an array. Also see our general section about <<tags>>"
"description": "The tags assigned to this meshTenant originating from meshWorkspace, Payment Method and meshProject. Keep in mind, that values are an array. Also see our general section about <<tags>>"
},
"platformIdentifier": {
"type": "string",
"description": "The identifier of the related platform instance"
}
},
"description": "Always contains the 'ownedByProject', 'ownedByCustomer' and 'platformIdentifier' to identify the meshTenant."
"description": "Always contains the 'ownedByProject', 'ownedByWorkspace' and 'platformIdentifier' to identify the meshTenant."
},
"apiVersion": {
"type": "string",
Expand Down
Loading

0 comments on commit c9ba775

Please sign in to comment.