cli/entity/envs.go
Christian Ivicevic 112651c113
Introduce optional replace semantics for railway variables set as an alternative to upsert (#265)
* Introduce optional replace semantics for variables set as an alternative to upsert

* Add a safety prompt for replace and a flag to skip it

* Update wordings, simplify function signature and add comment to warn about destructive query
2022-08-24 14:35:20 -07:00

49 lines
807 B
Go

package entity
type GetEnvsRequest struct {
ProjectID string
EnvironmentID string
ServiceID string
}
type GetEnvsForPluginRequest struct {
ProjectID string
EnvironmentID string
PluginID string
}
type UpdateEnvsRequest struct {
ProjectID string
EnvironmentID string
PluginID string
ServiceID string
Envs *Envs
Replace bool
}
type DeleteVariableRequest struct {
ProjectID string
EnvironmentID string
PluginID string
ServiceID string
Name string
}
type Envs map[string]string
func (e Envs) Get(name string) string {
return e[name]
}
func (e Envs) Set(name, value string) {
e[name] = value
}
func (e Envs) Has(name string) bool {
_, ok := e[name]
return ok
}
func (e Envs) Delete(name string) {
delete(e, name)
}