2
0

connectionstatus.go 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package cloud
  2. // ConnectionStatus communicates the status of a cloud connection in a way that is general enough to apply to each
  3. // Cloud Provider, but still give actionable information on how to trouble shoot one the four failing statuses.
  4. type ConnectionStatus string
  5. const (
  6. // InitialStatus is the zero value of CloudConnectionStatus and means that cloud connection is untested. Once
  7. // CloudConnection Status has been changed in should not return to this value. This status is assigned on creation
  8. // to the cloud provider
  9. InitialStatus ConnectionStatus = "No Connection"
  10. // InvalidConfiguration means that Cloud Configuration is missing required values to connect to cloud provider.
  11. // This status is assigned during failures in the provider implementation of getCloudConfig()
  12. InvalidConfiguration = "Invalid Configuration"
  13. // FailedConnection means that all required Cloud Configuration values are filled in, but a connection with the
  14. // Cloud Provider cannot be established. This is indicative of a typo in one of the Cloud Configuration values or an
  15. // issue in how the connection was set up in the Cloud Provider's Console. The assignment of this status varies
  16. // between implementations, but should happen if an error is thrown when an interaction with an object from
  17. // the Cloud Service Provider's sdk occurs.
  18. FailedConnection = "Failed Connection"
  19. // ParseError indicates an issue with our functions which parse responses
  20. ParseError = "Parse Error"
  21. // MissingData means that the Cloud Integration is properly configured, but the cloud provider is not returning
  22. // billing/cost and usage data. This status is indicative of the billing/cost and usage data export of the Cloud Provider
  23. // being incorrectly set up or the export being set up in the last 48 hours and not having started populating data yet.
  24. // This status is set when a query has been successfully made but the results come back empty. If the cloud provider,
  25. // already has a SUCCESSFUL_CONNECTION status then this status should not be set, because this indicates that the specific
  26. // query made may have been empty.
  27. MissingData = "Data Missing"
  28. // SuccessfulConnection means that the Cloud Integration is properly configured and returning data. This status is
  29. // set on any successful query where data is returned
  30. SuccessfulConnection = "Connection Successful"
  31. )
  32. func (cs ConnectionStatus) String() string {
  33. return string(cs)
  34. }
  35. // EmptyChecker provides an interface for to check if a result is empty which can be useful for setting a MissingData status
  36. type EmptyChecker interface {
  37. IsEmpty() bool
  38. }