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

multi-source: Implement logic on planner #83

Merged
merged 1 commit into from
Nov 28, 2024
Merged
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
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:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove sshkey? Should be now part of agent.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to but it breaks the generation of ova I think.

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
Loading