diff --git a/internal/api/controllers/private/highlevelConnectionStatus.go b/internal/api/controllers/private/highlevelConnectionStatus.go index 832c61b9..11fb6fc0 100644 --- a/internal/api/controllers/private/highlevelConnectionStatus.go +++ b/internal/api/controllers/private/highlevelConnectionStatus.go @@ -115,7 +115,9 @@ func formatConnectionResponse(satID *string, satOrgID *string, rhcClientID *stri var formatedSatID SatelliteId var formatedSatOrgID SatelliteOrgId var formatedRHCClientID public.RunRecipient - var formatedAnsibleHost AnsibleHost + + var formattedAnsibleHost AnsibleHost + formattedHostWithAnsibleHost := make([]HostIdWithAnsibleHost, len(hosts)) if satID != nil { formatedSatID = SatelliteId(*satID) @@ -130,11 +132,12 @@ func formatConnectionResponse(satID *string, satOrgID *string, rhcClientID *stri } if ansibleHost != nil { - formatedAnsibleHost = AnsibleHost(*ansibleHost) + formattedAnsibleHost = AnsibleHost(*ansibleHost) } for i, host := range hosts { formatedHosts[i] = HostId(host) + formattedHostWithAnsibleHost[i] = HostIdWithAnsibleHost{HostId: HostId(host), AnsibleHost: formattedAnsibleHost} } connectionInfo := RecipientWithConnectionInfo{ @@ -145,7 +148,7 @@ func formatConnectionResponse(satID *string, satOrgID *string, rhcClientID *stri SatOrgId: formatedSatOrgID, Status: status, Systems: formatedHosts, - AnsibleHost: formatedAnsibleHost, + SystemsInfo: formattedHostWithAnsibleHost, } return connectionInfo diff --git a/internal/api/controllers/private/spec.gen.go b/internal/api/controllers/private/spec.gen.go index 77afa90b..515f50d2 100644 --- a/internal/api/controllers/private/spec.gen.go +++ b/internal/api/controllers/private/spec.gen.go @@ -135,40 +135,41 @@ func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/9RZ3XPbuBH/VzBoH9oZSqJkO5fRUxOn02iaO2fydQ+JxwOSKxE5EOABIH26jP73zoIk", - "SErUhx2rTd8sE1jsYn/72w98o7HKciVBWkPn36gGkytpwP14yZJ38Hs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KbqqX", + "atfbkztmSFRwYclSq2x/1Ne3nTBZN1ccE1P/Akt653E8AG3cy6eboumEBjsv1YJZXgLBXp1ubjb/CQAA", + "//8834Lj3iUAAA==", } // GetSwagger returns the Swagger specification corresponding to the generated code diff --git a/internal/api/controllers/private/types.gen.go b/internal/api/controllers/private/types.gen.go index c2a756ab..a61710e6 100644 --- a/internal/api/controllers/private/types.gen.go +++ b/internal/api/controllers/private/types.gen.go @@ -36,6 +36,17 @@ type HighLevelRecipientStatus []RecipientWithConnectionInfo // HostId defines model for HostId. type HostId string +// HostIdWithAnsibleHost defines model for HostIdWithAnsibleHost. +type HostIdWithAnsibleHost struct { + + // Host name as known to Ansible inventory. + // Used to identify the host in status reports. + AnsibleHost AnsibleHost `json:"ansible_host"` + + // Identifies a record of the Host-Inventory service + HostId HostId `json:"host_id"` +} + // HostsWithOrgId defines model for HostsWithOrgId. type HostsWithOrgId struct { Hosts []string `json:"hosts"` @@ -83,10 +94,6 @@ const ( // RecipientWithConnectionInfo defines model for RecipientWithConnectionInfo. type RecipientWithConnectionInfo struct { - // Host name as known to Ansible inventory. - // Used to identify the host in status reports. - AnsibleHost AnsibleHost `json:"ansible_host"` - // Identifies the organization that the given resource belongs to OrgId OrgId `json:"org_id"` @@ -103,8 +110,9 @@ type RecipientWithConnectionInfo struct { SatOrgId SatelliteOrgId `json:"sat_org_id"` // Indicates the current run status of the recipient - Status string `json:"status"` - Systems []HostId `json:"systems"` + Status string `json:"status"` + Systems []HostId `json:"systems"` + SystemsInfo []HostIdWithAnsibleHost `json:"systems_info"` } // RecipientWithOrg defines model for RecipientWithOrg. diff --git a/internal/api/tests/private/client.gen.go b/internal/api/tests/private/client.gen.go index b8d30aac..8eb8411c 100644 --- a/internal/api/tests/private/client.gen.go +++ b/internal/api/tests/private/client.gen.go @@ -46,6 +46,17 @@ type HighLevelRecipientStatus []RecipientWithConnectionInfo // HostId defines model for HostId. type HostId string +// HostIdWithAnsibleHost defines model for HostIdWithAnsibleHost. +type HostIdWithAnsibleHost struct { + + // Host name as known to Ansible inventory. + // Used to identify the host in status reports. + AnsibleHost AnsibleHost `json:"ansible_host"` + + // Identifies a record of the Host-Inventory service + HostId HostId `json:"host_id"` +} + // HostsWithOrgId defines model for HostsWithOrgId. type HostsWithOrgId struct { Hosts []string `json:"hosts"` @@ -93,10 +104,6 @@ const ( // RecipientWithConnectionInfo defines model for RecipientWithConnectionInfo. type RecipientWithConnectionInfo struct { - // Host name as known to Ansible inventory. - // Used to identify the host in status reports. - AnsibleHost AnsibleHost `json:"ansible_host"` - // Identifies the organization that the given resource belongs to OrgId OrgId `json:"org_id"` @@ -113,8 +120,9 @@ type RecipientWithConnectionInfo struct { SatOrgId SatelliteOrgId `json:"sat_org_id"` // Indicates the current run status of the recipient - Status string `json:"status"` - Systems []HostId `json:"systems"` + Status string `json:"status"` + Systems []HostId `json:"systems"` + SystemsInfo []HostIdWithAnsibleHost `json:"systems_info"` } // RecipientWithOrg defines model for RecipientWithOrg. diff --git a/internal/api/tests/private/highLevelConnectionStatus_test.go b/internal/api/tests/private/highLevelConnectionStatus_test.go index e6dbe74a..44c8953a 100644 --- a/internal/api/tests/private/highLevelConnectionStatus_test.go +++ b/internal/api/tests/private/highLevelConnectionStatus_test.go @@ -34,7 +34,9 @@ var _ = Describe("high level connection status", func() { satOrgID := SatelliteOrgId("5") satelliteHost := []HostId{"c484f980-ab8d-401b-90e7-aa1d4ccf8c0e"} directConnectHost := []HostId{"fe30b997-c15a-44a9-89df-c236c3b5c540"} - ansibleHost := AnsibleHost("test-ansible-host") + + satelliteHostWithAnsibleHost := []HostIdWithAnsibleHost{{HostId: "c484f980-ab8d-401b-90e7-aa1d4ccf8c0e", AnsibleHost: ""}} + directConnectHostWithAnsibleHost := []HostIdWithAnsibleHost{{HostId: "fe30b997-c15a-44a9-89df-c236c3b5c540", AnsibleHost: "test-ansible-host"}} payload := ApiInternalHighlevelConnectionStatusJSONRequestBody{ Hosts: []string{"c484f980-ab8d-401b-90e7-aa1d4ccf8c0e"}, @@ -52,7 +54,7 @@ var _ = Describe("high level connection status", func() { Expect((*result)[0].SatOrgId).To(Equal(satOrgID)) Expect((*result)[0].Status).To(Equal("connected")) Expect((*result)[0].Systems).To(Equal(satelliteHost)) - Expect((*result)[0].AnsibleHost).To(BeEmpty()) + Expect((*result)[0].SystemsInfo).To(Equal(satelliteHostWithAnsibleHost)) Expect((*result)[1].Recipient).To(Equal(public.RunRecipient("32af5948-301f-449a-a25b-ff34c83264a2"))) Expect((*result)[1].RecipientType).To(Equal(RecipientType_directConnect)) @@ -61,6 +63,6 @@ var _ = Describe("high level connection status", func() { Expect((*result)[1].SatOrgId).To(BeEmpty()) Expect((*result)[1].Status).To(Equal("connected")) Expect((*result)[1].Systems).To(Equal(directConnectHost)) - Expect((*result)[1].AnsibleHost).To(Equal(ansibleHost)) + Expect((*result)[1].SystemsInfo).To(Equal(directConnectHostWithAnsibleHost)) }) }) diff --git a/schema/private.openapi.yaml b/schema/private.openapi.yaml index 9640eacc..aadd4572 100644 --- a/schema/private.openapi.yaml +++ b/schema/private.openapi.yaml @@ -331,8 +331,10 @@ components: description: Indicates the current run status of the recipient type: string enum: [connected, disconnected, rhc_not_configured] - ansible_host: - $ref: '#/components/schemas/AnsibleHost' + systems_info: + type: array + items: + $ref: '#/components/schemas/HostIdWithAnsibleHost' required: - recipient - org_id @@ -341,7 +343,7 @@ components: - sat_org_id - systems - status - - ansible_host + - systems_info HighLevelRecipientStatus: @@ -354,6 +356,18 @@ components: type: string minLength: 1 + HostIdWithAnsibleHost: + description: An object containing the host id and the ansible host name + type: object + properties: + host_id: + $ref: '#/components/schemas/HostId' + ansible_host: + $ref: '#/components/schemas/AnsibleHost' + required: + - host_id + - ansible_host + SatelliteId: description: Identifier of the Satellite instance in the uuid v4/v5 format type: string