-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add declaration "touch" which resolves #33. also begin work on OpenAP…
…I docs #4.
- Loading branch information
1 parent
92fac01
commit 33375ef
Showing
12 changed files
with
252 additions
and
20 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
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,92 @@ | ||
openapi: 3.0.0 | ||
info: | ||
version: 0.1.0 | ||
title: KMFDDM server API | ||
servers: | ||
- url: http://[::1]:9002/ | ||
paths: | ||
/version: | ||
get: | ||
description: Returns the running KMFDDM server version | ||
responses: | ||
'200': | ||
description: Successful response | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
version: | ||
type: string | ||
example: "v0.1.0" | ||
/v1/declarations/{id}/touch: | ||
post: | ||
description: Updates a declaration's `ServerToken` only. | ||
security: | ||
- basicAuth: [] | ||
responses: | ||
'204': | ||
description: Declaration server token successfully updated. | ||
'401': | ||
$ref: '#/components/responses/UnauthorizedError' | ||
'400': | ||
$ref: '#/components/responses/JSONBadRequest' | ||
'500': | ||
$ref: '#/components/responses/JSONError' | ||
parameters: | ||
- $ref: '#/components/parameters/declarationID' | ||
components: | ||
parameters: | ||
declarationID: | ||
name: id | ||
in: path | ||
description: Identifier of the declaration. | ||
required: true | ||
style: simple | ||
schema: | ||
type: string | ||
example: 'com.example.test' | ||
securitySchemes: | ||
basicAuth: | ||
type: http | ||
scheme: basic | ||
responses: | ||
UnauthorizedError: | ||
description: API key is missing or invalid. | ||
headers: | ||
WWW-Authenticate: | ||
schema: | ||
type: string | ||
BadRequest: | ||
description: There was a problem with the supplied request. The request was in an incorrect format or other request data error. See server logs for more information. | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
example: Bad Request | ||
Error: | ||
description: An internal server error occured on this endpoint. See server logs for more information. | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
example: Internal Server Error | ||
JSONBadRequest: | ||
description: There was a problem with the supplied request. The request was in an incorrect format or other request data error. | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/JSONError' | ||
JSONError: | ||
description: An internal server error occured on this endpoint. | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/JSONError' | ||
schemas: | ||
JSONError: | ||
type: object | ||
properties: | ||
error: | ||
type: string | ||
example: "it was sunny outside" |
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
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,2 +1,2 @@ | ||
ALTER TABLE declarations ADD COLUMN touched_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL; | ||
ALTER TABLE declarations MODIFY COLUMN server_token CHAR(40) AS (SHA1(CONCAT(identifier, type, payload, created_at, touched_at))) STORED NOT NULL; | ||
ALTER TABLE declarations ADD COLUMN touched_ct INT DEFAULT 0 NOT NULL; | ||
ALTER TABLE declarations MODIFY COLUMN server_token CHAR(40) AS (SHA1(CONCAT(identifier, type, payload, created_at, touched_ct))) STORED NOT NULL; |
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,11 @@ | ||
// Package storage defines shared types and interfaces for storage. | ||
package storage | ||
|
||
import ( | ||
"context" | ||
) | ||
|
||
type Toucher interface { | ||
// TouchDeclaration forces a change only to a declaration's ServerToken. | ||
TouchDeclaration(ctx context.Context, declarationID string) error | ||
} |
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
Oops, something went wrong.