Documentation ¶
Index ¶
- func GenerateToken() string
- type EnvironmentInput
- type Server
- func (s *Server) ConfirmUpload(ctx context.Context, token string) error
- func (s *Server) CreateEnvironment(ctx context.Context, input *EnvironmentInput) error
- func (s *Server) PutDeployment(ctx context.Context, input *model.Deployment) error
- func (s *Server) PutFunction(ctx context.Context, input *model.Function) (*UploadRequest, error)
- type UploadRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateToken ¶
func GenerateToken() string
GenerateToken generates a new ulid token. The token is lexiographically stortable and includes a millisecond precision timestamp. Example token: 01AN4Z07BY79KA1307SR9X4MV3
See: https://github.com/oklog/ulid for more
Types ¶
type EnvironmentInput ¶
type EnvironmentInput struct { // Name is the name that identifies the environment. Name string // Labels are used to map a deployment to the environment. Labels map[string]string // Infrastructure is the type of infrastructure the environment is for Infrastructure model.InfraType // Username is the username used to authenticate to the infrastructure // provider. Username string // Password is the password used to authenticate to the infrastructure // provider. Password string // AWS contains AWS environment specific information AWS *model.InfrastructureAWS }
EnvironmentInput is the input to specify when creating an environment. The credentials are stored in the secret store so the underlying state.Environment does not contain these fields.
type Server ¶
type Server struct { StateStore statestore SecretStore backend.Writer SourceStore filestore.SourceTarget GenerateToken func() string }
Server is the fragments server that accepts models and keeps them in the store.
func New ¶
func New(statestore statestore, secretstore backend.Writer, sourceTarget filestore.SourceTarget) *Server
New creates a new server. Upload tokens are generated by server.GenerateToken.
func (*Server) ConfirmUpload ¶
ConfirmUpload is called by the client when the source has been uploaded
func (*Server) CreateEnvironment ¶
func (s *Server) CreateEnvironment(ctx context.Context, input *EnvironmentInput) error
CreateEnvironment creates a new target deployment environment. Returns an error if an environment with the same name already exists.
func (*Server) PutDeployment ¶
PutDeployment creates or updates a deployment. In case the deployment already exists it is updated.
func (*Server) PutFunction ¶
PutFunction creates or updates a function. In case the function already exists it is updated. If not, source upload is requested.
type UploadRequest ¶
type UploadRequest struct { // Token is the token to use when confirming the upload. Token string // URL is where to upload the source code. The source must be uploaded as a // tar.gz. After completion the upload should be confirmed. URL string }
UploadRequest is a request for source code, returned from the server.