Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding Getting Started guide #16

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
Binary file added public-api/.DS_Store
Binary file not shown.
29 changes: 29 additions & 0 deletions public-api/getting_started/add-custom-data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import requests
from datetime import datetime

cortex_tag = 'api-created-svc'
time_stamp= datetime.now().replace(microsecond=0).isoformat() + 'Z'

api_token = '<your-api-token-goes-here>'

api_url = 'https://api.getcortexapp.com/api/v1/catalog/' + cortex_tag + '/custom-data'
headers = {
'Authorization': 'Bearer ' + api_token,
'Content-Type': 'application/json'
}

json_body = {

"key": "some-internal-tool",
"value": {
"tool": "home-grown build tool",
"custom scan result": "failed!",
"details": { "scan-id": "456", "branch" : "main", "timestamp" : time_stamp }
},
"description": "Scan data uploaded by REST API"
}


resp = requests.post(url=api_url, json=json_body, headers=headers)
print(resp)
print(resp.text)
26 changes: 26 additions & 0 deletions public-api/getting_started/add-dependency.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import requests

api_token = '<your-api-token-goes-here>'

caller_tag = 'api-created-svc'
callee_tag = 'my-kafka-api'

api_url = 'https://api.getcortexapp.com/api/v1/catalog/' + caller_tag + '/dependencies/' + callee_tag
headers = {
'Authorization': 'Bearer ' + api_token,
'Content-Type': 'application/json'
}

json_body = {

"description": "This is a dependency created by the API",
"metadata": {
"tags": ["tier1", "external"]
}


}

resp = requests.post(url=api_url, json=json_body, headers=headers)
print(resp)
print(resp.text)
16 changes: 16 additions & 0 deletions public-api/getting_started/add-entity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import requests

api_token = '<your-api-token-goes-here>'

with open('./service-w-owner.yaml', 'rb') as f:
data = f.read()

api_url = 'https://api.getcortexapp.com/api/v1/open-api'
headers = {
'Authorization': 'Bearer ' + api_token,
'Content-Type': 'application/openapi'
}


resp = requests.post(url=api_url, data=data, headers=headers)
print(resp)
21 changes: 21 additions & 0 deletions public-api/getting_started/add-packages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import requests

cortex_tag = 'api-created-svc'
api_token = ''<your-api-token-goes-here>''
api_url = 'https://api.getcortexapp.com/api/v1/catalog/' + cortex_tag + '/packages/python/requirements'
headers = {
'Authorization': 'Bearer ' + api_token,
'Content-Type': 'application/json'
}
json_body = ''
with open('requirements.txt') as f:
body = f.read()
resp = requests.post(url=api_url, data=body, headers=headers)
print(resp)
print(resp.text)






30 changes: 30 additions & 0 deletions public-api/getting_started/add-team.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import requests

api_token = '<your-api-token-goes-here>'

api_url = 'https://api.getcortexapp.com/api/v1/teams'
headers = {
'Authorization': 'Bearer ' + api_token,
'Content-Type': 'application/json'
}

json_body = {

"type": "cortex",
"teamTag": "cortex-team",
"metadata": {
"name": "Cortex Managed Team",
"description": "Example of Cortex Managed Team created by API",
"summary": "API created team"
},
"links": [],
"slackChannels": [],
"additionalMembers": [],
"cortexTeam": {
"members": []
}
}

resp = requests.post(url=api_url, json=json_body, headers=headers)
print(resp)
print(resp.text)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public-api/getting_started/img/custom-data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public-api/getting_started/img/dependencies.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public-api/getting_started/img/deploy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public-api/getting_started/img/new-resource.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public-api/getting_started/img/new-service.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public-api/getting_started/img/new-team.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public-api/getting_started/img/packages.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public-api/getting_started/img/resource-def.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public-api/getting_started/img/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions public-api/getting_started/new-api-resource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
openapi: 3.0.0
info:
title: My new API
description: I wrote this
x-cortex-tag: my-new-api
x-cortex-type: api
x-cortex-definition:
version: 1.0.0

6 changes: 6 additions & 0 deletions public-api/getting_started/new-resource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
openapi: 3.0.1
info:
title: My Kafka
description: this was created by api
x-cortex-tag: my-kafka-api
x-cortex-type: aws-kafka
6 changes: 6 additions & 0 deletions public-api/getting_started/new-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
openapi: 3.0.0
info:
version: 1.0.0
title: API Created Service
description: Service for testing API
x-cortex-tag: api-created-svc
Loading