Skip to content

Commit

Permalink
renaming HostIdWithAnsibleHost to HostAttribute
Browse files Browse the repository at this point in the history
  • Loading branch information
tahmidefaz committed Jul 29, 2024
1 parent 0d868a4 commit ab832f9
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 62 deletions.
14 changes: 7 additions & 7 deletions internal/api/controllers/private/highlevelConnectionStatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type rhcSatellite struct {
SatelliteInstanceID string
SatelliteOrgID string
SatelliteVersion string
HostsWithAnsibleHosts []HostIdWithAnsibleHost
HostsWithAnsibleHosts []HostAttribute
SourceID string
RhcClientID *string
SourceAvailabilityStatus *string
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
}
Expand Down Expand Up @@ -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)
Expand All @@ -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},
}
}
}
Expand Down Expand Up @@ -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")
Expand Down
70 changes: 35 additions & 35 deletions internal/api/controllers/private/spec.gen.go

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

16 changes: 8 additions & 8 deletions internal/api/controllers/private/types.gen.go

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

16 changes: 8 additions & 8 deletions internal/api/tests/private/client.gen.go

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

4 changes: 2 additions & 2 deletions internal/api/tests/private/highLevelConnectionStatus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
4 changes: 2 additions & 2 deletions schema/private.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ components:
systems_info:
type: array
items:
$ref: '#/components/schemas/HostIdWithAnsibleHost'
$ref: '#/components/schemas/HostAttribute'
required:
- recipient
- org_id
Expand All @@ -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:
Expand Down

0 comments on commit ab832f9

Please sign in to comment.