diff --git a/api/v1alpha1/agent/spec.gen.go b/api/v1alpha1/agent/spec.gen.go index 1a2e69a..14d6012 100644 --- a/api/v1alpha1/agent/spec.gen.go +++ b/api/v1alpha1/agent/spec.gen.go @@ -19,29 +19,28 @@ import ( // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+RYTW/jNhD9KwLbo2w56fbiW+Luh7FNGiTI7iHwgZHGEjcSyZKjGGng/16QFG3ZomVt", - "mixa9GaLw5nh45t5Iz2TVFRScOCoyfSZ6LSAitqfZzlwvEGKtb6VGUUwD6USEhQysCapggw4MlreqtI8", - "wCcJZEo0KsZzso4Jy4KPtXXbszTnSxFcfgSlmeCBtXVMFPxZMwUZmd75EDsO472MbX5bn4vY+xT33yBF", - "E++9UkJ1T16B1jS3kGSgU8Uk2qycfeSX4yNJervFOiZzvlS0GymjSDUK5f4xhEp3jZYKYEYlTRk+fTxv", - "gcM4Qg7KnAQF0vKokX1yDFu72vUY7+cRArR5QJWiT+Z/ITReiRUoQzV3GpplzMBJy6udUx5Kt+XdeNNX", - "oGZlrRHUDmQHt29y4YAroR76kM4e9YphWgTJyWkFwQUPK/C6asjJM6oM+TJmzO5rBPvPu49JzXUtpVBm", - "YREHKqGkfJ4Nviyb25ALcbfq8NM9VPpkoA6t78ffGu87795Xlw+tW4nbxRA6ypw/Akehnrr3xnx1/axg", - "Sabkp2Tb+JKm6yWuBA22KfCGPn32X2bOzOxwZOm1vtAdcHwg5yBu0gyd7YLlipqqmGtd9zYDqjVoXQHH", - "IBdTUe+stO61pPdQHmeUM4vbgbzbIQS7EbVKA2pCc69Cm4P1wencWJWaI1ShSKkCipCd2eMuhaookqkh", - "EYyQVYH27AVrY1vXViG6Zm2m9VPKG/b1B62Lz/B0RCp98+ACR6ngHFLXM1aUIeP5aCnUaKtvhk1gxSsm", - "OcUCjMMR48wsjrb5x6SWIxQjq/ChPnNEkGs7G3wHxntksvhaYOLDmt1EaEcLMW2fEqHSECkzHlp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MZteXN1eHJ2MxqMcy8JSxtCwuRm/ouuCcg4qOrueRUeR7RUR", + "8EwKZu+4fqCSimewYBwyG4ESOJWMTMgvo/Ho2PBAMbe0J1Sy5Ok4cfNP8sKyOtk8kGWF3Vem6/uRk4rE", + "IsIcHBRiTTXxn5EJcf219Zi3phUtwc3397u6Z79taWNmzWD1b4iJa/GbyEBVQdx8ORgyL8zdYdB4LjLb", + "slPBsRlXqZQFSy385Kt2D/2N6r6c6X6vqGsXwloK41+j4GQ87rL55+/GQyfj431bp+7Um8B0HxQssm1T", + "5zSLbhwvzubx+9u847TCXCj2t4vS0+PvcNGPgoMx9uv3YHVmpjVOi+gW1BOoyAvGBKmpevdu2iNzs+Qz", + "0ZXeYamoQBY03c1FLSFlCwZZ5HR10vLGHWtPwgMS02v3Ov83yRmY+Ovt/mKA7snWN0QQCpEfLcfHp+9v", + "9ErgB1Hx7D+U503SuETPgRZoP+ItIZDUbjtKc0gfO6n7yZ0d2llaEBqrc4tfW6Au0d18kpB6Xv8TAAD/", + "/wejlOySFwAA", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/api/v1alpha1/spec.gen.go b/api/v1alpha1/spec.gen.go index 6512652..78ec427 100644 --- a/api/v1alpha1/spec.gen.go +++ b/api/v1alpha1/spec.gen.go @@ -18,37 +18,37 @@ import ( // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+xYUXPbNhL+Kxj0Zu6FkpxcbuZGb4qbNJo2iSdu3YfED2twJaImAQZYSuPL6L/fACAl", - "SoQo2k3cXMdvEgEsdr/9dvEBX7jQRakVKrJ8+oVbkWEB/udsiYrcj9LoEg1J9J/BWi0kEKbuH92VyKf8", - "RuscQfFNwoVBNzjzSxfaFEB8ylMgHJEskCfNGktGqmW9JEVFEvLfTN6yupuRYo73NCrTqCWrKyNwfmSQ", - "gCofJaqq4NOPXGkaCa0UChdwwtcgSarlaKHNaOe25QlHY7ThCV8CZegMjqSSbnAk1QoVaXPH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afdaWnlkttyod712rts", - "vbwJbA9vZBO+ud78LwAA//+CrTRXXCcAAA==", + "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", + "AAAA//+FHN/SayYAAA==", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/api/v1alpha1/types.gen.go b/api/v1alpha1/types.gen.go index 8e86fdf..9febfe4 100644 --- a/api/v1alpha1/types.gen.go +++ b/api/v1alpha1/types.gen.go @@ -27,15 +27,6 @@ const ( Unsupported InfraNetworksType = "unsupported" ) -// Defines values for SourceStatus. -const ( - SourceStatusError SourceStatus = "error" - SourceStatusGatheringInitialInventory SourceStatus = "gathering-initial-inventory" - SourceStatusNotConnected SourceStatus = "not-connected" - SourceStatusUpToDate SourceStatus = "up-to-date" - SourceStatusWaitingForCredentials SourceStatus = "waiting-for-credentials" -) - // Agent defines model for Agent. type Agent struct { Associated bool `json:"associated"` @@ -100,20 +91,13 @@ type MigrationIssues = []struct { // Source defines model for Source. type Source struct { - Agents *[]SourceAgentItem `json:"agents,omitempty"` - CreatedAt time.Time `json:"createdAt"` - Id openapi_types.UUID `json:"id"` - Inventory *Inventory `json:"inventory,omitempty"` - Name string `json:"name"` - SshKey *string `json:"sshKey,omitempty"` - Status SourceStatus `json:"status"` - StatusInfo string `json:"statusInfo"` - UpdatedAt time.Time `json:"updatedAt"` + Agents *[]SourceAgentItem `json:"agents,omitempty"` + CreatedAt time.Time `json:"createdAt"` + Id openapi_types.UUID `json:"id"` + Inventory *Inventory `json:"inventory,omitempty"` + UpdatedAt time.Time `json:"updatedAt"` } -// SourceStatus defines model for Source.Status. -type SourceStatus string - // SourceAgentItem defines model for SourceAgentItem. type SourceAgentItem struct { Associated bool `json:"associated"` diff --git a/internal/cli/get.go b/internal/cli/get.go index ec861ef..d55cb7c 100644 --- a/internal/cli/get.go +++ b/internal/cli/get.go @@ -165,8 +165,8 @@ func printTable(response interface{}, kind string, id *uuid.UUID) error { } func printSourcesTable(w *tabwriter.Writer, sources ...api.Source) { - fmt.Fprintln(w, "ID\tNAME\tSTATUS") + fmt.Fprintln(w, "ID") for _, s := range sources { - fmt.Fprintf(w, "%s\t%s\t%s\n", s.Id, s.Name, s.Status) + fmt.Fprintf(w, "%s\n", s.Id) } } diff --git a/internal/store/source_test.go b/internal/store/source_test.go index 4f32457..791fc7f 100644 --- a/internal/store/source_test.go +++ b/internal/store/source_test.go @@ -46,6 +46,24 @@ var _ = Describe("source store", Ordered, func() { Expect(sources).To(HaveLen(2)) }) + It("successfully list all the sources -- with agents", func() { + sourceID := uuid.NewString() + agentID := uuid.NewString() + tx := gormdb.Exec(fmt.Sprintf(insertAgentStm, agentID, "not-connected", "status-info-1", "cred_url-1")) + Expect(tx.Error).To(BeNil()) + tx = gormdb.Exec(fmt.Sprintf(insertSourceStm, sourceID)) + Expect(tx.Error).To(BeNil()) + tx = gormdb.Exec(fmt.Sprintf("UPDATE agents set source_id = '%s';", sourceID)) + Expect(tx.Error).To(BeNil()) + + sources, err := s.Source().List(context.TODO()) + Expect(err).To(BeNil()) + Expect(sources).To(HaveLen(1)) + agents := *sources[0].Agents + Expect(agents).To(HaveLen(1)) + Expect(agents[0].Id.String()).To(Equal(agentID)) + }) + It("list all sources -- no sources", func() { sources, err := s.Source().List(context.TODO()) Expect(err).To(BeNil()) @@ -53,6 +71,7 @@ var _ = Describe("source store", Ordered, func() { }) AfterEach(func() { + gormdb.Exec("DELETE from agents;") gormdb.Exec("DELETE from sources;") }) })