Commit 456d73af authored by Lukas Burgey's avatar Lukas Burgey

Adapt to adjustments at the API

parent 3e9845b3
...@@ -6,14 +6,9 @@ import ( ...@@ -6,14 +6,9 @@ import (
) )
type ( type (
// SSHKey of a user
SSHKey struct {
Name string `json:"name"`
Key string `json:"key"`
}
// Credential is currently a ssh key, but may be a password hash in the future // Credential is currently a ssh key, but may be a password hash in the future
Credential struct { Credential struct {
ID int `json:"id,omitempty"`
Type string `json:"type,omitempty"` Type string `json:"type,omitempty"`
Name string `json:"name"` Name string `json:"name"`
Value string `json:"value"` Value string `json:"value"`
...@@ -23,6 +18,9 @@ type ( ...@@ -23,6 +18,9 @@ type (
// after the script run // after the script run
UserCredentialStates map[string]map[string]State UserCredentialStates map[string]map[string]State
// UserCredentials maps a credential type to the credentials of this type
UserCredentials map[string][]Credential
// Group a group of which User is a member of // Group a group of which User is a member of
Group struct { Group struct {
Name string `json:"name"` Name string `json:"name"`
...@@ -33,11 +31,11 @@ type ( ...@@ -33,11 +31,11 @@ type (
// User describes the user info // User describes the user info
User struct { User struct {
// TODO maybe just handover the raw userinfo // Email string `json:"email"`
Email string `json:"email"` // Groups []Group `json:"groups"`
// TODO maybe just handover the raw userinfo
//Groups []Group `json:"groups"` UserInfo UserInfo `json:"userinfo"`
UserInfo UserInfo `json:"userinfo"` Credentials UserCredentials `json:"credentials,omitempty"`
} }
// Input of the deployment script // Input of the deployment script
...@@ -51,13 +49,14 @@ type ( ...@@ -51,13 +49,14 @@ type (
// Credentials the credentials to deploy // Credentials the credentials to deploy
// maps the credential type to the according credentials // maps the credential type to the according credentials
Credentials map[string][]Credential `json:"credentials"` // TODO this should move into Input.User
Credentials UserCredentials `json:"credentials,omitempty"`
// Questionnaire is an answered questionnaire // Questionnaire is an answered questionnaire
// Maps a question name to the answer of the user // Maps a question name to the answer of the user
// The keys (question names) *must* be identical to those of the Output.Questionnaire // The keys (question names) *must* be identical to those of the Output.Questionnaire
// containing the questions // containing the questions
Questionnaire map[string]string `json:"questionnaire"` Questionnaire map[string]string `json:"questionnaire,omitempty"`
} }
// Output of the deployment script // Output of the deployment script
...@@ -74,17 +73,17 @@ type ( ...@@ -74,17 +73,17 @@ type (
// Questionnaire requested by the script // Questionnaire requested by the script
// Ignored when State is not Questionnaire // Ignored when State is not Questionnaire
// Maps a question name to a description of the question // Maps a question name to a description of the question
Questionnaire map[string]string `json:"questionnaire"` Questionnaire map[string]string `json:"questionnaire,omitempty"`
// Credentials for the user // Credentials for the user
// Ignored when State is not Deployed // Ignored when State is not Deployed
// Maps a credential name to a credential value // Maps a credential name to a credential value
Credentials map[string]string `json:"credentials"` Credentials map[string]string `json:"credentials,omitempty"`
// UserCredentialStates states of the credentials provided by the user (not by the script!) // UserCredentialStates states of the credentials provided by the user (not by the script!)
// This field is not mandatory! The client will assume that all credentials have the State // This field is not mandatory! The client will assume that all credentials have the State
// Output.State if this is not given // Output.State if this is not given
UserCredentialStates UserCredentialStates `json:"user_credential_states"` UserCredentialStates UserCredentialStates `json:"user_credential_states,omitempty"`
} }
// State is a string enum // State is a string enum
...@@ -123,10 +122,6 @@ func (u User) String() string { ...@@ -123,10 +122,6 @@ func (u User) String() string {
return "" return ""
} }
func (k SSHKey) String() string {
return k.Name
}
func (i Input) String() string { func (i Input) String() string {
iBytes, err := i.Marshal() iBytes, err := i.Marshal()
if err != nil { if err != nil {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment