Skip to content

Commit

Permalink
multi-source: Implement logic on planner
Browse files Browse the repository at this point in the history
This commit implements the multi-source model in the planner.

Signed-off-by: Cosmin Tupangiu <[email protected]>
  • Loading branch information
tupyy committed Nov 27, 2024
1 parent 439c179 commit a9eb1ba
Show file tree
Hide file tree
Showing 26 changed files with 1,119 additions and 387 deletions.
31 changes: 23 additions & 8 deletions api/v1alpha1/agent/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ paths:
application/json:
schema:
$ref: '../openapi.yaml#/components/schemas/Error'
"500":
description: Internal Server Error
content:
application/json:
schema:
$ref: '../openapi.yaml#/components/schemas/Error'
/api/v1/agents/{id}/status:
put:
tags:
Expand All @@ -77,6 +83,12 @@ paths:
description: OK
"201":
description: OK
"400":
description: Bad Request
content:
application/json:
schema:
$ref: '../openapi.yaml#/components/schemas/Error'
"401":
description: Unauthorized
content:
Expand All @@ -89,6 +101,12 @@ paths:
application/json:
schema:
$ref: '../openapi.yaml#/components/schemas/Error'
"500":
description: Internal Server Error
content:
application/json:
schema:
$ref: '../openapi.yaml#/components/schemas/Error'
/health:
get:
tags:
Expand All @@ -104,18 +122,15 @@ components:
SourceStatusUpdate:
type: object
properties:
status:
type: string
statusInfo:
agentId:
type: string
format: uuid
inventory:
$ref: '../openapi.yaml#/components/schemas/Inventory'
credentialUrl:
type: string
required:
- status
- statusInfo
- credentialUrl
- inventory
- agentId

AgentStatusUpdate:
type: object
properties:
Expand Down
43 changes: 22 additions & 21 deletions api/v1alpha1/agent/spec.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions api/v1alpha1/agent/types.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions api/v1alpha1/common.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
package v1alpha1

func StringToSourceStatus(s string) SourceStatus {
switch s {
case string(SourceStatusError):
return SourceStatusError
case string(SourceStatusGatheringInitialInventory):
return SourceStatusGatheringInitialInventory
case string(SourceStatusUpToDate):
return SourceStatusUpToDate
case string(SourceStatusWaitingForCredentials):
return SourceStatusWaitingForCredentials
case string(SourceStatusNotConnected):
return SourceStatusNotConnected
default:
return SourceStatusNotConnected
}
}

func StringToAgentStatus(s string) AgentStatus {
switch s {
case string(AgentStatusError):
Expand Down
98 changes: 68 additions & 30 deletions api/v1alpha1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
post:
tags:
- source
description: create a source
operationId: createSource
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SourceCreate'
required: true
responses:
"201":
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/Source'
"400":
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
"401":
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
delete:
tags:
- source
Expand Down Expand Up @@ -243,6 +213,58 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error'
"500":
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/api/v1/agents/{id}:
delete:
tags:
- agent
description: delete an agent
operationId: deleteAgent
parameters:
- name: id
in: path
description: ID of the agent
required: true
schema:
type: string
format: uuid
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Agent"
"400":
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
"401":
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
"404":
description: NotFound
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
"500":
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'

/health:
get:
tags:
Expand Down Expand Up @@ -280,6 +302,10 @@ components:
format: date-time
sshKey:
type: string
agents:
type: array
items:
$ref: '#/components/schemas/SourceAgentItem'
required:
- id
- name
Expand All @@ -303,6 +329,18 @@ components:
items:
$ref: '#/components/schemas/Source'

SourceAgentItem:
type: object
properties:
id:
type: string
format: uuid
associated:
type: boolean
required:
- id
- associated

Error:
properties:
message:
Expand Down
60 changes: 30 additions & 30 deletions api/v1alpha1/spec.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions api/v1alpha1/types.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a9eb1ba

Please sign in to comment.