Documentation ¶
Overview ¶
Copyright © 2023 FRG
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- func Execute()
- func FaviconHandler(w http.ResponseWriter, r *http.Request)
- type APIHandler
- func (h *APIHandler) GetServerBank(tags map[string]string) (*ServerBank, error)
- func (h *APIHandler) IndexHandler(w http.ResponseWriter, _ *http.Request)
- func (h *APIHandler) PowerOffAll(sb *ServerBank) error
- func (h *APIHandler) PowerOnAll(sb *ServerBank) error
- func (h *APIHandler) ToggleHandler(w http.ResponseWriter, _ *http.Request)
- type AWSProvider
- type AzureProfile
- type AzureProvider
- type CloudProvider
- type Server
- type ServerBank
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func FaviconHandler ¶
func FaviconHandler(w http.ResponseWriter, r *http.Request)
Types ¶
type APIHandler ¶
type APIHandler struct {
// contains filtered or unexported fields
}
APIHandler handles the API endpoints.
func (*APIHandler) GetServerBank ¶
func (h *APIHandler) GetServerBank(tags map[string]string) (*ServerBank, error)
GetServerBank based on providers
func (*APIHandler) IndexHandler ¶
func (h *APIHandler) IndexHandler(w http.ResponseWriter, _ *http.Request)
IndexHandler handles the index page.
func (*APIHandler) PowerOffAll ¶
func (h *APIHandler) PowerOffAll(sb *ServerBank) error
func (*APIHandler) PowerOnAll ¶
func (h *APIHandler) PowerOnAll(sb *ServerBank) error
PowerOnAll based on providers
func (*APIHandler) ToggleHandler ¶
func (h *APIHandler) ToggleHandler(w http.ResponseWriter, _ *http.Request)
ToggleHandler handles the start/stop button toggle.
type AWSProvider ¶ added in v0.2.0
type AWSProvider struct {
// contains filtered or unexported fields
}
func (*AWSProvider) GetServerBank ¶ added in v0.2.0
func (h *AWSProvider) GetServerBank(tags map[string]string) (*ServerBank, error)
GetServerBank queries AWS EC2 instances based on the specified tags.
func (*AWSProvider) GetStatus ¶ added in v0.2.0
func (h *AWSProvider) GetStatus() string
GetStatus implements CloudProvider.
func (*AWSProvider) PowerOffAll ¶ added in v0.2.0
func (h *AWSProvider) PowerOffAll(sb *ServerBank) error
PowerOffAll powers off all the servers in the bank and updates their statuses.
func (*AWSProvider) PowerOnAll ¶ added in v0.2.0
func (h *AWSProvider) PowerOnAll(sb *ServerBank) error
PowerOnAll powers on all the servers in the bank and updates their statuses.
type AzureProfile ¶ added in v0.2.0
type AzureProvider ¶ added in v0.2.0
type AzureProvider struct {
// contains filtered or unexported fields
}
AzureProvider implements CloudProvider for Azure VM
func (*AzureProvider) GetServerBank ¶ added in v0.2.0
func (a *AzureProvider) GetServerBank(tags map[string]string) (*ServerBank, error)
GetServerBank queries Azure VM instances based on the specified tags.
func (*AzureProvider) GetStatus ¶ added in v0.2.0
func (a *AzureProvider) GetStatus() string
GetStatus implements CloudProvider.
func (*AzureProvider) PowerOffAll ¶ added in v0.2.0
func (a *AzureProvider) PowerOffAll(sb *ServerBank) error
PowerOffAll powers off all the servers in the bank and updates their statuses.
func (*AzureProvider) PowerOnAll ¶ added in v0.2.0
func (a *AzureProvider) PowerOnAll(sb *ServerBank) error
PowerOnAll powers on all the servers in the bank and updates their statuses.
type CloudProvider ¶ added in v0.2.0
type CloudProvider interface { GetServerBank(tags map[string]string) (*ServerBank, error) PowerOnAll(*ServerBank) error PowerOffAll(*ServerBank) error GetStatus() string }
CloudProvider defines common operations for cloud providers
type ServerBank ¶
type ServerBank struct {
Servers []*Server
}
ServerBank represents a bank of AWS servers.
func (*ServerBank) GetStatus ¶
func (sb *ServerBank) GetStatus() string
GetStatus returns the overall status of the server bank.