diff --git a/internal/api/controllers/private/highlevelConnectionStatus.go b/internal/api/controllers/private/highlevelConnectionStatus.go index 053ffbba..70e45ad2 100644 --- a/internal/api/controllers/private/highlevelConnectionStatus.go +++ b/internal/api/controllers/private/highlevelConnectionStatus.go @@ -15,7 +15,7 @@ type rhcSatellite struct { SatelliteInstanceID string SatelliteOrgID string SatelliteVersion string - HostsWithAnsibleHosts []HostIdWithAnsibleHost + HostsWithAnsibleHosts []HostAttribute SourceID string RhcClientID *string SourceAvailabilityStatus *string @@ -110,7 +110,7 @@ func sortHostsByRecipient(details []inventory.HostDetails) (satelliteDetails []i return satelliteConnectedHosts, directConnectedHosts, hostsNotConnected } -func formatConnectionResponse(satID *string, satOrgID *string, rhcClientID *string, orgID OrgId, hosts []HostIdWithAnsibleHost, recipientType string, status string) RecipientWithConnectionInfo { +func formatConnectionResponse(satID *string, satOrgID *string, rhcClientID *string, orgID OrgId, hosts []HostAttribute, recipientType string, status string) RecipientWithConnectionInfo { formatedHosts := make([]HostId, len(hosts)) var formatedSatID SatelliteId var formatedSatOrgID SatelliteOrgId @@ -167,7 +167,7 @@ func getDirectConnectStatus(ctx echo.Context, client connectors.CloudConnectorCl if host.AnsibleHost != nil { ansibleHost = AnsibleHost(*host.AnsibleHost) } - hostWithAnsibleHost := []HostIdWithAnsibleHost{{ansibleHost, HostId(host.ID)}} + hostWithAnsibleHost := []HostAttribute{{ansibleHost, HostId(host.ID)}} responses = append(responses, formatConnectionResponse(nil, nil, host.RHCClientID, orgId, hostWithAnsibleHost, string(RecipientType_directConnect), connectionStatus)) } @@ -200,7 +200,7 @@ func groupHostsBySatellite(hostDetails []inventory.HostDetails) map[string]*rhcS if host.AnsibleHost != nil { ansibleHost = AnsibleHost(*host.AnsibleHost) } - hostWithAnsibleHost := HostIdWithAnsibleHost{ansibleHost, HostId(host.ID)} + hostWithAnsibleHost := HostAttribute{ansibleHost, HostId(host.ID)} if exists { hostsGroupedBySatellite[satInstanceAndOrg].HostsWithAnsibleHosts = append(hostsGroupedBySatellite[satInstanceAndOrg].HostsWithAnsibleHosts, hostWithAnsibleHost) @@ -209,7 +209,7 @@ func groupHostsBySatellite(hostDetails []inventory.HostDetails) map[string]*rhcS SatelliteInstanceID: *host.SatelliteInstanceID, SatelliteOrgID: *host.SatelliteOrgID, SatelliteVersion: *host.SatelliteVersion, - HostsWithAnsibleHosts: []HostIdWithAnsibleHost{hostWithAnsibleHost}, + HostsWithAnsibleHosts: []HostAttribute{hostWithAnsibleHost}, } } } @@ -259,10 +259,10 @@ func createSatelliteConnectionResponses(ctx echo.Context, hostsGroupedBySatellit } func getRHCStatus(hostDetails []inventory.HostDetails, orgID OrgId) RecipientWithConnectionInfo { - hostIDs := make([]HostIdWithAnsibleHost, len(hostDetails)) + hostIDs := make([]HostAttribute, len(hostDetails)) for i, host := range hostDetails { - hostIDs[i] = HostIdWithAnsibleHost{AnsibleHost(*host.AnsibleHost), HostId(host.ID)} + hostIDs[i] = HostAttribute{AnsibleHost(*host.AnsibleHost), HostId(host.ID)} } return formatConnectionResponse(nil, nil, nil, orgID, hostIDs, "none", "rhc_not_configured") diff --git a/internal/api/controllers/private/spec.gen.go b/internal/api/controllers/private/spec.gen.go index 515f50d2..7943995d 100644 --- a/internal/api/controllers/private/spec.gen.go +++ b/internal/api/controllers/private/spec.gen.go @@ -135,41 +135,41 @@ func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/9Ra3XPbuBH/VzBoH9oZSqJkO5fRUx2n02iaO2fydQ+JxwOSKxE5EOABIH26jP73zoIk", - "SEq0JDtW675FJnaxH7/9RL7TWGW5kiCtofPvVIPJlTTgfrxiyXv4vQBj8VespAXp/snyXPCYWa7k5JtR", - "Ev9m4hQyhv/6q4YlndO/TFrWk+qrmfxTa6XpZrMJaAIm1jxHJnSOd5HmMvxaEyC/S2l4JOCNquTo0+Ff", - "iWQZEGbIb1LdSWIVq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buxdNN0XRCg50XasEsL4Fgr043N5v/BAAA", + "//97np35ziUAAA==", } // 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 a61710e6..7db16652 100644 --- a/internal/api/controllers/private/types.gen.go +++ b/internal/api/controllers/private/types.gen.go @@ -33,11 +33,8 @@ type Error struct { // HighLevelRecipientStatus defines model for HighLevelRecipientStatus. type HighLevelRecipientStatus []RecipientWithConnectionInfo -// HostId defines model for HostId. -type HostId string - -// HostIdWithAnsibleHost defines model for HostIdWithAnsibleHost. -type HostIdWithAnsibleHost struct { +// HostAttribute defines model for HostAttribute. +type HostAttribute struct { // Host name as known to Ansible inventory. // Used to identify the host in status reports. @@ -47,6 +44,9 @@ type HostIdWithAnsibleHost struct { HostId HostId `json:"host_id"` } +// HostId defines model for HostId. +type HostId string + // HostsWithOrgId defines model for HostsWithOrgId. type HostsWithOrgId struct { Hosts []string `json:"hosts"` @@ -110,9 +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"` - SystemsInfo []HostIdWithAnsibleHost `json:"systems_info"` + Status string `json:"status"` + Systems []HostId `json:"systems"` + SystemsInfo []HostAttribute `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 8eb8411c..f6ccd02c 100644 --- a/internal/api/tests/private/client.gen.go +++ b/internal/api/tests/private/client.gen.go @@ -43,11 +43,8 @@ type Error struct { // HighLevelRecipientStatus defines model for HighLevelRecipientStatus. type HighLevelRecipientStatus []RecipientWithConnectionInfo -// HostId defines model for HostId. -type HostId string - -// HostIdWithAnsibleHost defines model for HostIdWithAnsibleHost. -type HostIdWithAnsibleHost struct { +// HostAttribute defines model for HostAttribute. +type HostAttribute struct { // Host name as known to Ansible inventory. // Used to identify the host in status reports. @@ -57,6 +54,9 @@ type HostIdWithAnsibleHost struct { HostId HostId `json:"host_id"` } +// HostId defines model for HostId. +type HostId string + // HostsWithOrgId defines model for HostsWithOrgId. type HostsWithOrgId struct { Hosts []string `json:"hosts"` @@ -120,9 +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"` - SystemsInfo []HostIdWithAnsibleHost `json:"systems_info"` + Status string `json:"status"` + Systems []HostId `json:"systems"` + SystemsInfo []HostAttribute `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 44c8953a..9deb8a4c 100644 --- a/internal/api/tests/private/highLevelConnectionStatus_test.go +++ b/internal/api/tests/private/highLevelConnectionStatus_test.go @@ -35,8 +35,8 @@ var _ = Describe("high level connection status", func() { satelliteHost := []HostId{"c484f980-ab8d-401b-90e7-aa1d4ccf8c0e"} directConnectHost := []HostId{"fe30b997-c15a-44a9-89df-c236c3b5c540"} - satelliteHostWithAnsibleHost := []HostIdWithAnsibleHost{{HostId: "c484f980-ab8d-401b-90e7-aa1d4ccf8c0e", AnsibleHost: ""}} - directConnectHostWithAnsibleHost := []HostIdWithAnsibleHost{{HostId: "fe30b997-c15a-44a9-89df-c236c3b5c540", AnsibleHost: "test-ansible-host"}} + satelliteHostWithAnsibleHost := []HostAttribute{{HostId: "c484f980-ab8d-401b-90e7-aa1d4ccf8c0e", AnsibleHost: ""}} + directConnectHostWithAnsibleHost := []HostAttribute{{HostId: "fe30b997-c15a-44a9-89df-c236c3b5c540", AnsibleHost: "test-ansible-host"}} payload := ApiInternalHighlevelConnectionStatusJSONRequestBody{ Hosts: []string{"c484f980-ab8d-401b-90e7-aa1d4ccf8c0e"}, diff --git a/schema/private.openapi.yaml b/schema/private.openapi.yaml index aadd4572..20dcefd1 100644 --- a/schema/private.openapi.yaml +++ b/schema/private.openapi.yaml @@ -334,7 +334,7 @@ components: systems_info: type: array items: - $ref: '#/components/schemas/HostIdWithAnsibleHost' + $ref: '#/components/schemas/HostAttribute' required: - recipient - org_id @@ -356,7 +356,7 @@ components: type: string minLength: 1 - HostIdWithAnsibleHost: + HostAttribute: description: An object containing the host id and the ansible host name type: object properties: