Documentation
¶
Overview ¶
Package mock implements helpers to mock infractl calls and outputs for tests.
Index ¶
- func InfractlCreateCluster(args ...string) (string, error)
- func InfractlDeleteCluster(clusterID string) error
- func InfractlGetStatusForID(clusterID string) (string, error)
- func InfractlLifespan(clusterID string, lifespanUpdate string) error
- func InfractlLogs(clusterID string) (*v1.LogsResponse, error)
- func InfractlWhoami() (string, error)
- func PrepareCommand(cmd *cobra.Command, asJSON bool, args ...string) *bytes.Buffer
- func RetrieveCommandOutput(buf *bytes.Buffer) (string, error)
- func RetrieveCommandOutputJSON(buf *bytes.Buffer, outJSON interface{}) error
- type ClusterResponse
- type FlavorListResponse
- type FlavorResponse
- type JanitorFindResponse
- type ListClusterReponse
- type StatusResponse
- type WhoamiResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InfractlCreateCluster ¶
InfractlCreateCluster is a wrapper for 'infractl create ...'.
func InfractlDeleteCluster ¶
InfractlDeleteCluster is a wrapper for 'infractl delete <clusterID>'.
func InfractlGetStatusForID ¶
InfractlGetStatusForID is a wrapper for 'infractl get <clusterID> --json'.
func InfractlLifespan ¶
InfractlLifespan is a wrapper for 'infractl lifespan <clusterID> <lifespanUpdate>'.
func InfractlLogs ¶
func InfractlLogs(clusterID string) (*v1.LogsResponse, error)
InfractlLogs is a wrapper for 'infractl logs <clusterID> --json'.
func InfractlWhoami ¶
InfractlWhoami is a wrapper for 'infractl whoami'.
func PrepareCommand ¶
PrepareCommand adds common flags and default args to a cobra.Command for test simulation.
func RetrieveCommandOutput ¶
RetrieveCommandOutput stringifies the contents of a buffer to read a command's output.
func RetrieveCommandOutputJSON ¶
RetrieveCommandOutputJSON parses the contents of a buffer to a map.
Types ¶
type ClusterResponse ¶
ClusterResponse helper maps to the JSON response for infractl operations related to clusters. We use this instead of v1.Cluster because Go cannot parse the Status string back to the enum.
func InfractlGetCluster ¶
func InfractlGetCluster(clusterID string) (ClusterResponse, error)
InfractlGetCluster is a wrapper for 'infractl get <clusterID' --json'.
type FlavorListResponse ¶
type FlavorListResponse struct {
Flavors []FlavorResponse
}
FlavorListResponse maps to the JSON response for infractl flavor list operations.
func InfractlFlavorList ¶
func InfractlFlavorList(all bool) (FlavorListResponse, error)
InfractlFlavorList is a wrapper for 'infractl flavor list --json'.
type FlavorResponse ¶
type FlavorResponse struct {
ID string
Name string
Description string
Availability string
Parameters map[string]v1.Parameter
Artifacts map[string]v1.FlavorArtifact
}
FlavorResponse maps to the JSON response for infractl flavor get operations.
func InfractlFlavorGet ¶
func InfractlFlavorGet(flavorID string) (FlavorResponse, error)
InfractlFlavorGet is a wrapper for 'infractl flavor get <flavorID> --json'.
type JanitorFindResponse ¶
JanitorFindResponse maps to the JSON response for infractl janitor find-gcp operations.
func InfractlJanitorFindGCP ¶
func InfractlJanitorFindGCP(quiet bool) (JanitorFindResponse, error)
InfractlJanitorFindGCP is a wrapper for infractl janitor find-gcp'.
type ListClusterReponse ¶
type ListClusterReponse struct {
Clusters []struct {
ID string
}
}
ListClusterReponse maps to the JSON response for infractl list operations.
func InfractlList ¶
func InfractlList(args ...string) (ListClusterReponse, error)
InfractlList is a wrapper for 'infractl list <args>'.
type StatusResponse ¶
type StatusResponse struct {
Status v1.InfraStatus
}
StatusResponse helper maps to the JSON response for infractl status operations.
type WhoamiResponse ¶
type WhoamiResponse struct {
Principal v1.WhoamiResponse_ServiceAccount
}
WhoamiResponse helper maps to the JSON response for infractl whoami operations.