mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-06 08:15:48 -04:00
Remove state file
This commit is contained in:
parent
0d1fd8fb2a
commit
1556e239ca
28 changed files with 381 additions and 319 deletions
|
@ -6,7 +6,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
package cloudprovider
|
||||
|
||||
import "strings"
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//go:generate stringer -type=Provider
|
||||
|
||||
|
@ -21,6 +24,21 @@ const (
|
|||
QEMU
|
||||
)
|
||||
|
||||
// MarshalJSON marshals the Provider to JSON string.
|
||||
func (p Provider) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(p.String())
|
||||
}
|
||||
|
||||
// UnmarshalJSON unmarshals the Provider from JSON string.
|
||||
func (p *Provider) UnmarshalJSON(b []byte) error {
|
||||
var s string
|
||||
if err := json.Unmarshal(b, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
*p = FromString(s)
|
||||
return nil
|
||||
}
|
||||
|
||||
// FromString returns cloud provider from string.
|
||||
func FromString(s string) Provider {
|
||||
s = strings.ToLower(s)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue