Documentation ¶
Index ¶
- func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error
- func GetAWSSession(region string) (*session.Session, error)
- func Logger(inner http.Handler, name string) http.Handler
- func NewRouter(routers ...Router) *mux.Router
- func ReadFormFileToTempFile(r *http.Request, key string) (*os.File, error)
- type ApiResponse
- type Application
- type CloudFormationClient
- type DynamoClient
- type EC2Client
- type Instance
- type InstanceTag
- type QueryResults
- type Route
- type Router
- type Routes
- type S3Client
- type SQSClient
- type SSMClient
- type Stack
- type StackOutput
- type StackParameter
- type StackResource
- type StacksApiController
- type StacksApiRouter
- type StacksApiService
- type StacksApiServicer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeJSONResponse ¶
func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error
EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code
func GetAWSSession ¶
GetAWSSession returns a new AWS credentials session
Types ¶
type ApiResponse ¶
type Application ¶
type Application struct {
ApplicationName string `json:"ApplicationName"`
}
type CloudFormationClient ¶
type CloudFormationClient struct {
Client *cloudformation.CloudFormation
}
CloudFormationClient the client for the CloudFormation service.
func NewCloudFormationClient ¶
func NewCloudFormationClient(sess *session.Session) (*CloudFormationClient, error)
NewCloudFormationClient gets a CloudFormation client.
type DynamoClient ¶
type DynamoClient struct { Client *dynamodb.DynamoDB Table string PartitionKey string SortKey string }
DynamoClient the client for a DynamoDB table.
func NewDynamoClient ¶
func NewDynamoClient(sess *session.Session) (*DynamoClient, error)
NewDynamoClient gets a DynamoDB client.
func (*DynamoClient) GetAllStacks ¶
func (dc *DynamoClient) GetAllStacks() ([]*Stack, error)
GetAllStacks scans the table.
func (*DynamoClient) GetStacksByKeys ¶
func (dc *DynamoClient) GetStacksByKeys(partKey string, sortKey string) ([]*Stack, error)
GetStacksByKeys will get all stacks by partition and sort key.
func (*DynamoClient) GetStacksByPartitionKey ¶
func (dc *DynamoClient) GetStacksByPartitionKey(partKey string) ([]*Stack, error)
GetStacksByPartitionKey will get all stacks by partition key.
func (*DynamoClient) PutStack ¶
func (dc *DynamoClient) PutStack(stack Stack) error
PutStack puts a CloudFormation stack to DynamoDB
type Instance ¶
type Instance struct { ImageId string `json:"ImageId,omitempty"` LaunchTime string `json:"LaunchTime,omitempty"` InstanceTags []InstanceTag `json:"InstanceTags,omitempty"` Application Application `json:"Application,omitempty"` }
type InstanceTag ¶
type QueryResults ¶
type QueryResults struct { Stacks []*Stack // contains filtered or unexported fields }
QueryResults results of a DynamoDB query.
type Route ¶
type Route struct { Name string Method string Pattern string HandlerFunc http.HandlerFunc }
A Route defines the parameters for an api endpoint
type Router ¶
type Router interface {
Routes() Routes
}
Router defines the required methods for retrieving api routes
func NewStacksApiController ¶
func NewStacksApiController(s StacksApiServicer) Router
NewStacksApiController creates a default api controller
type SQSClient ¶
SQSClient the client for the SQS service.
func NewSQSClient ¶
NewSQSClient gets an SQS client.
func (*SQSClient) DeleteMessage ¶
func (sc *SQSClient) DeleteMessage(receiptHandle string) (output *sqs.DeleteMessageOutput)
DeleteMessage deletes a message from SQS and panics on any errors.
func (*SQSClient) SendMessage ¶
func (sc *SQSClient) SendMessage(input *sqs.SendMessageInput) (output *sqs.SendMessageOutput)
SendMessage sends a message to SQS and panics on any errors.
type Stack ¶
type Stack struct { PK string `json:"PK,omitempty"` SK string `json:"SK,omitempty"` StackName string `json:"StackName,omitempty"` StackId string `json:"StackId,omitempty"` StackStatus string `json:"StackStatus,omitempty"` CreationTime time.Time `json:"CreationTime,omitempty"` LastUpdateTime time.Time `json:"LastUpdateTime,omitempty"` StackParameters []StackParameter `json:"StackParameters,omitempty"` StackResources []StackResource `json:"StackResources,omitempty"` StackOutputs []StackOutput `json:"StackOutputs,omitempty"` }
type StackOutput ¶
type StackParameter ¶
type StackResource ¶
type StacksApiController ¶
type StacksApiController struct {
// contains filtered or unexported fields
}
A StacksApiController binds http requests to an api service and writes the service results to the http response
func (*StacksApiController) GetStacks ¶
func (c *StacksApiController) GetStacks(w http.ResponseWriter, r *http.Request)
GetStacks - Gets a list of more CloudFormation stacks.
func (*StacksApiController) PutStack ¶
func (c *StacksApiController) PutStack(w http.ResponseWriter, r *http.Request)
PutStack - Puts a CloudFormation stack to DynamoDB.
func (*StacksApiController) Routes ¶
func (c *StacksApiController) Routes() Routes
Routes returns all of the api route for the StacksApiController
type StacksApiRouter ¶
type StacksApiRouter interface { GetStacks(http.ResponseWriter, *http.Request) PutStack(http.ResponseWriter, *http.Request) }
StacksApiRouter defines the required methods for binding the api requests to a responses for the StacksApi The StacksApiRouter implementation should parse necessary information from the http request, pass the data to a StacksApiServicer to perform the required actions, then write the service results to the http response.
type StacksApiService ¶
type StacksApiService struct {
DynamoClient *DynamoClient
}
StacksApiService is a service that implents the logic for the StacksApiServicer This service should implement the business logic for every endpoint for the StacksApi API. Include any external packages or services that will be required by this service.
func (*StacksApiService) GetStacks ¶
func (s *StacksApiService) GetStacks(stackId string) (interface{}, error)
GetStacks - Gets one or more CloudFormation stacks.
func (*StacksApiService) PutStack ¶
func (s *StacksApiService) PutStack(stack Stack) (interface{}, error)
PutStack will save an stack to DynamoDB.
type StacksApiServicer ¶
type StacksApiServicer interface { GetStacks(string) (interface{}, error) PutStack(Stack) (interface{}, error) }
StacksApiServicer defines the api actions for the StacksApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.
func NewStacksApiService ¶
func NewStacksApiService(dynamoClient *DynamoClient) (StacksApiServicer, error)
NewStacksApiService creates a default api service
Source Files ¶
- api.go
- api_stacks.go
- api_stacks_service.go
- aws.go
- aws_cloudformation.go
- aws_dynamodb.go
- aws_ec2.go
- aws_s3.go
- aws_sqs.go
- aws_ssm.go
- logger.go
- model_api_response.go
- model_application.go
- model_instance.go
- model_instance_tag.go
- model_stack.go
- model_stack_output.go
- model_stack_parameter.go
- model_stack_resource.go
- routers.go