Commit 43982452 authored by Lukas Burgey's avatar Lukas Burgey
Browse files

Change the script API

Removes the obsolete credentials field from Input.
Renames the badly named field Questionnaire to Answers in Input.
parent 91d2d788
...@@ -16,6 +16,8 @@ type ( ...@@ -16,6 +16,8 @@ type (
// UserCredentialStates serves to inform the backend about the per credential states // UserCredentialStates serves to inform the backend about the per credential states
// after the script run // after the script run
// This maps a credential type like "ssh_key" to a map of the states of credentials of this
// type.
UserCredentialStates map[string]map[string]State UserCredentialStates map[string]map[string]State
// UserCredentials maps a credential type to the credentials of this type // UserCredentials maps a credential type to the credentials of this type
...@@ -39,42 +41,35 @@ type ( ...@@ -39,42 +41,35 @@ type (
// User describes the user of this deployment task // User describes the user of this deployment task
User User `json:"user"` User User `json:"user"`
// Credentials the credentials to deploy // Answers is an answered questionnaire
// maps the credential type to the according credentials
//
// This is now located in Input.User.Credentials
// This field will therefore be removed in the future!
Credentials UserCredentials `json:"credentials,omitempty"`
// 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,omitempty"` Answers map[string]string `json:"answers,omitempty"`
} }
// Output of the deployment script // Output of the deployment script
Output struct { Output struct {
// State of the deployment, after the script execution // State describes the state of the deployment, after the script execution.
// when State == Questionnaire then Output.Questionnaire *must* be set // When State == Questionnaire then Output.Questionnaire *must* be set.
// when State == Deployed then Output.Credentials *can* be set // When State == Deployed then Output.Credentials *can* be set.
State State `json:"state"` State State `json:"state"`
// Message for the user // Msg is a message for the user.
Msg string `json:"message"` Msg string `json:"message"`
// Questionnaire requested by the script // Questionnaire requested by the script
// Ignored when State is not Questionnaire // This field is Ignored when Output.State is not Questionnaire.
// Maps a question name to a description of the question // Questionnaire maps a question name to a question.
Questionnaire map[string]string `json:"questionnaire,omitempty"` Questionnaire map[string]string `json:"questionnaire,omitempty"`
// Credentials for the user // Credentials are additionnal credentials for the user.
// Ignored when State is not Deployed // Examples are additional passwords.
// Maps a credential name to a credential value // This field is ignored by the client when Output.State is not Deployed.
// Credentials maps a credential name to a credential value.
Credentials map[string]string `json:"credentials,omitempty"` Credentials map[string]string `json:"credentials,omitempty"`
// UserCredentialStates are the State s of the credentials found in Input.User.Credentials. // UserCredentialStates are the State s of the credentials found in Input.User.Credentials.
//
// 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 field is not given. // Output.State if this field is not given.
UserCredentialStates UserCredentialStates `json:"user_credential_states,omitempty"` UserCredentialStates UserCredentialStates `json:"user_credential_states,omitempty"`
......
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