Skip to content

Commit

Permalink
agent/api: Add version and associated fields
Browse files Browse the repository at this point in the history
In the agent api _version_ and _associated_ fields are added.
Also, the _version_ is added to the agent model.

Signed-off-by: Cosmin Tupangiu <cosmin@redhat.com>
  • Loading branch information
tupyy authored and machacekondra committed Nov 15, 2024
1 parent 6ac0f8d commit bc6dfe8
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 54 deletions.
3 changes: 3 additions & 0 deletions api/v1alpha1/agent/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,11 @@ components:
type: string
credentialUrl:
type: string
version:
type: string
required:
- status
- statusInfo
- credentialUrl
- id
- version
42 changes: 21 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.

1 change: 1 addition & 0 deletions api/v1alpha1/agent/types.gen.go

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

9 changes: 9 additions & 0 deletions api/v1alpha1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,22 @@ components:
updatedAt:
type: string
format: date-time
deletedAt:
type: string
format: date-time
associated:
type: boolean
version:
type: string
required:
- id
- status
- statusInfo
- credentialUrl
- createdAt
- updatedAt
- associated
- version

AgentList:
type: array
Expand Down
58 changes: 29 additions & 29 deletions api/v1alpha1/spec.gen.go

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

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

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

8 changes: 4 additions & 4 deletions internal/store/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
)

const (
insertAgentStm = "INSERT INTO agents (id, status, status_info, cred_url) VALUES ('%s', '%s', '%s', '%s');"
insertAgentWithSourceStm = "INSERT INTO agents (id, status, status_info, cred_url, source_id) VALUES ('%s', '%s', '%s', '%s', '%s');"
insertAgentWithUpdateAtStm = "INSERT INTO agents (id, status, status_info, cred_url, updated_at) VALUES ('%s', '%s', '%s', '%s', '%s');"
insertAgentWithDeletedAtStm = "INSERT INTO agents (id, status, status_info, cred_url, deleted_at) VALUES ('%s', '%s', '%s', '%s', '%s');"
insertAgentStm = "INSERT INTO agents (id, status, status_info, cred_url, version) VALUES ('%s', '%s', '%s', '%s', 'version_1');"
insertAgentWithSourceStm = "INSERT INTO agents (id, status, status_info, cred_url, source_id, version) VALUES ('%s', '%s', '%s', '%s', '%s', 'version_1');"
insertAgentWithUpdateAtStm = "INSERT INTO agents (id, status, status_info, cred_url, updated_at, version) VALUES ('%s', '%s', '%s', '%s', '%s', 'version_1');"
insertAgentWithDeletedAtStm = "INSERT INTO agents (id, status, status_info, cred_url, deleted_at, version) VALUES ('%s', '%s', '%s', '%s', '%s', 'version_1');"
)

var _ = Describe("agent store", Ordered, func() {
Expand Down
3 changes: 3 additions & 0 deletions internal/store/model/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type Agent struct {
CredUrl string
SourceID *string
Source *Source
Version string
}

type AgentList []Agent
Expand All @@ -35,6 +36,7 @@ func NewAgentFromApiResource(resource *apiAgent.AgentStatusUpdate) *Agent {
Status: resource.Status,
StatusInfo: resource.StatusInfo,
CredUrl: resource.CredentialUrl,
Version: resource.Version,
}
}

Expand All @@ -46,6 +48,7 @@ func (a *Agent) ToApiResource() api.Agent {
CreatedAt: a.CreatedAt,
UpdatedAt: a.UpdatedAt,
CredentialUrl: a.CredUrl,
Version: a.Version,
}

if a.SourceID != nil {
Expand Down

0 comments on commit bc6dfe8

Please sign in to comment.