Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
Extend Varkes to Support Cloud Events (#295)
Browse files Browse the repository at this point in the history
* test

* package lock

* Extend varkes to support cloud events
 Please enter the commit message for your changes. Lines starting

* Extend UI to Send Cloud Events

* Package and Formatting Changes

* add binary cloud event
fix uuid

* Add logic to enable event-tracing

* Implement review comments
  • Loading branch information
grischperl authored Nov 10, 2021
1 parent fb86eab commit f5a140e
Show file tree
Hide file tree
Showing 22 changed files with 5,473 additions and 744 deletions.
3 changes: 3 additions & 0 deletions examples/kyma-mock/apis/connector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ components:
eventsUrl:
type: 'string'
example: 'https://gateway.test.cluster.kyma.cx/{APP_NAME}/v1/events'
cloudeventsUrl:
type: 'string'
example: 'https://gateway.test.cluster.kyma.cx/{APP_NAME}/events'
certificatesUrl:
type: 'string'
example: 'https://certificate-service.kyma.cluster.cx/v1/applications'
Expand Down
129 changes: 129 additions & 0 deletions examples/kyma-mock/apis/events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,53 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/APIError'
/events:
post:
summary: 'Publish a cloud event'
operationId: 'publishCloudEvent'
tags:
- 'publish'
requestBody:
description: 'The event to be published'
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PublishBinaryCloudRequest'
application/cloudevents+json:
schema:
$ref: '#/components/schemas/PublishCloudRequest'
responses:
'200':
description: 'The event was successfully published'
content:
application/json:
schema:
$ref: '#/components/schemas/PublishCloudResponse'
'400':
description: 'Bad Request'
content:
application/json:
schema:
$ref: '#/components/schemas/APIError'
'401':
description: 'Authentication failure'
content:
application/json:
schema:
$ref: '#/components/schemas/APIError'
'403':
description: 'Not authorized'
content:
application/json:
schema:
$ref: '#/components/schemas/APIError'
'500':
description: 'Server error'
content:
application/json:
schema:
$ref: '#/components/schemas/APIError'
components:
schemas:
PublishRequest:
Expand Down Expand Up @@ -93,6 +140,66 @@ components:
- event-type-version
- event-time
- data
PublishCloudRequest:
type: object
description: A Publish request
properties:
id:
description: Identifies the event.
type: string
pattern: '^[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}$'
example: 'A234-1234-1234'
source:
description: Identifies the context in which an event happened.
type: string
pattern: '(\/[a-zA-Z0-9]+){1,}'
example: '/cloudevents/spec/pull/123'
specversion:
description: The version of the CloudEvents specification which the event uses.
type: string
pattern: '^[0-9]{1}.[0-9]{1}$'
example: '1.0'
type:
description: This attribute contains a value describing the type of event related to the originating occurrence.
type: string
pattern: '^[a-zA-Z]+([_\-\.]?[a-zA-Z0-9]+)*$'
example: 'sap.kyma.FreightOrder.Arrived.v1'
data:
$ref: '#/components/schemas/AnyValue'
required:
- id
- source
- specversion
- type
- data
PublishBinaryCloudRequest:
type: object
description: A Publish request
properties:
id:
description: Identifies the event.
type: string
pattern: '^[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}$'
example: 'A234-1234-1234'
source:
description: Identifies the context in which an event happened.
type: string
pattern: '(\/[a-zA-Z0-9]+){1,}'
example: '/cloudevents/spec/pull/123'
specversion:
description: The version of the CloudEvents specification which the event uses.
type: string
pattern: '^[0-9]{1}.[0-9]{1}$'
example: '1.0'
type:
description: This attribute contains a value describing the type of event related to the originating occurrence.
type: string
pattern: '^[a-zA-Z]+([_\-\.]?[a-zA-Z0-9]+)*$'
example: 'sap.kyma.FreightOrder.Arrived.v1'
data:
$ref: '#/components/schemas/AnyValue'
required:
- data
PublishResponse:
type: object
description: A Publish response
Expand All @@ -104,6 +211,28 @@ components:
example: '31109198-4d69-4ae0-972d-76117f3748c8'
required:
- event-id
PublishCloudResponse:
type: object
description: A Publish response
properties:
id:
description: Identifies the event.
type: string
pattern: '^[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}$'
example: 'A234-1234-1234'
required:
- id
PublishBinaryCloudResponse:
type: object
description: A Publish response
properties:
ce-id:
description: Identifies the event.
type: string
pattern: '^[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}$'
example: 'A234-1234-1234'
required:
- ce-id
AnyValue:
description: Can be any value but null. nullable false
APIError:
Expand Down
2 changes: 2 additions & 0 deletions examples/kyma-mock/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function customizeMock(app) {
api: {
metadataUrl: localDomain + '/metadata/v1/metadata/services',
eventsUrl: localDomain + '/events/v1/events',
cloudeventsUrl: localDomain + '/events/events',
certificatesUrl: localDomain + '/metadata/v1/applications/certificates',
infoUrl: localDomain + '/connector/v1/applications/management/info'
},
Expand All @@ -67,6 +68,7 @@ function customizeMock(app) {
urls:
{
eventsUrl: localDomain + "/events/v1/events",
cloudeventsUrl: localDomain + "events/events",
metadataUrl:
localDomain + "/metadata/v1/metadata/services",
renewCertUrl:
Expand Down
Loading

0 comments on commit f5a140e

Please sign in to comment.