Skip to content

Commit 8ab8f99

Browse files
Added flags for keepLastAttempt, maxProvidersRetry
1 parent 1e8962d commit 8ab8f99

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

orchent.go

+26-17
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"strings"
1919
)
2020

21-
const OrchentVersion string = "1.2.0"
21+
const OrchentVersion string = "1.2.1"
2222

2323
var (
2424
app = kingpin.New("orchent", "The orchestrator client. \n \nPlease either store your access token in 'ORCHENT_TOKEN' or set the account to use with oidc-agent in the 'ORCHENT_AGENT_ACCOUNT' and the socket of the oidc-agent in the 'OIDC_SOCK' environment variable: \n export ORCHENT_TOKEN=<your access token> \n OR \n export OIDC_SOCK=<path to the oidc-agent socket> (usually this is already exported) \n export ORCHENT_AGENT_ACCOUNT=<account to use> \nIf you need to specify the file containing the trusted root CAs use the 'ORCHENT_CAFILE' environment variable: \n export ORCHENT_CAFILE=<path to file containing trusted CAs>\n \n").Version(OrchentVersion)
@@ -32,16 +32,20 @@ var (
3232
showDep = app.Command("depshow", "show a specific deployment")
3333
showDepUuid = showDep.Arg("uuid", "the uuid of the deployment to display").Required().String()
3434

35-
createDep = app.Command("depcreate", "create a new deployment")
36-
createDepCallback = createDep.Flag("callback", "the callback url").Default("").String()
37-
createDepTemplate = createDep.Arg("template", "the tosca template file").Required().File()
38-
createDepParameter = createDep.Arg("parameter", "the parameter to set (json object)").Required().String()
39-
40-
updateDep = app.Command("depupdate", "update the given deployment")
41-
updateDepCallback = updateDep.Flag("callback", "the callback url").Default("").String()
42-
updateDepUuid = updateDep.Arg("uuid", "the uuid of the deployment to update").Required().String()
43-
updateDepTemplate = updateDep.Arg("template", "the tosca template file").Required().File()
44-
updateDepParameter = updateDep.Arg("parameter", "the parameter to set (json object)").Required().String()
35+
createDep = app.Command("depcreate", "create a new deployment")
36+
createDepCallback = createDep.Flag("callback", "the callback url").Default("").String()
37+
createDepMaxProvidersRetry = createDep.Flag("maxProvidersRetry", "Maximum number of cloud providers to be used in case of failure (Default: UNBOUNDED).").Uint8()
38+
createDepKeepLastAttempt = createDep.Flag("keepLastAttempt", "In case of failure, keep the resources allocated in the last try (Default: true).").Default("true").Enum("true", "false")
39+
createDepTemplate = createDep.Arg("template", "the tosca template file").Required().File()
40+
createDepParameter = createDep.Arg("parameter", "the parameter to set (json object)").Required().String()
41+
42+
updateDep = app.Command("depupdate", "update the given deployment")
43+
updateDepCallback = updateDep.Flag("callback", "the callback url").Default("").String()
44+
updateDepMaxProvidersRetry = updateDep.Flag("maxProvidersRetry", "Maximum number of cloud providers to be used in case of failure (Default: UNBOUNDED).").Uint8()
45+
updateDepKeepLastAttempt = updateDep.Flag("keepLastAttempt", "In case of failure, keep the resources allocated in the last try (Default: true).").Default("true").Enum("true", "false")
46+
updateDepUuid = updateDep.Arg("uuid", "the uuid of the deployment to update").Required().String()
47+
updateDepTemplate = updateDep.Arg("template", "the tosca template file").Required().File()
48+
updateDepParameter = updateDep.Arg("parameter", "the parameter to set (json object)").Required().String()
4549

4650
depTemplate = app.Command("deptemplate", "show the template of the given deployment")
4751
templateDepUuid = depTemplate.Arg("uuid", "the uuid of the deployment to get the template").Required().String()
@@ -177,9 +181,11 @@ type OrchentResourceList struct {
177181
}
178182

179183
type OrchentCreateRequest struct {
180-
Template string `json:"template"`
181-
Parameters map[string]interface{} `json:"parameters"`
182-
Callback string `json:"callback,omitempty"`
184+
Template string `json:"template"`
185+
Parameters map[string]interface{} `json:"parameters"`
186+
Callback string `json:"callback,omitempty"`
187+
MaxProvidersRetry uint8 `json:"maxProvidersRetry,omitempty"`
188+
KeepLastAttempt string `json:"keepLastAttempt,omitempty"`
183189
}
184190

185191
func (depList OrchentDeploymentList) String() string {
@@ -371,7 +377,8 @@ func receive_and_print_deploymentlist(complete *sling.Sling, before int, after i
371377
}
372378
}
373379

374-
func deployment_create_update(templateFile *os.File, parameter string, callback string, depUuid *string, base *sling.Sling) {
380+
func deployment_create_update(templateFile *os.File, parameter string, callback string, maxProvidersRetry uint8, keepLastAttempt string, depUuid *string, base *sling.Sling) {
381+
375382
var parameterMap map[string]interface{}
376383
paramErr := json.Unmarshal([]byte(parameter), &parameterMap)
377384
if paramErr != nil {
@@ -396,6 +403,8 @@ func deployment_create_update(templateFile *os.File, parameter string, callback
396403
Template: template,
397404
Parameters: parameterMap,
398405
Callback: callback,
406+
MaxProvidersRetry: maxProvidersRetry,
407+
KeepLastAttempt: keepLastAttempt,
399408
}
400409
deployment := new(OrchentDeployment)
401410
orchentError := new(OrchentError)
@@ -700,13 +709,13 @@ func main() {
700709
case createDep.FullCommand():
701710
baseUrl := get_base_url()
702711
base := base_connection(baseUrl)
703-
deployment_create_update(*createDepTemplate, *createDepParameter, *createDepCallback, nil, base)
712+
deployment_create_update(*createDepTemplate, *createDepParameter, *createDepCallback, *createDepMaxProvidersRetry, *createDepKeepLastAttempt, nil, base)
704713

705714
case updateDep.FullCommand():
706715
baseUrl := get_base_url()
707716
base := base_connection(baseUrl)
708717
uuid := try_alias_uuid(*updateDepUuid, aliases)
709-
deployment_create_update(*updateDepTemplate, *updateDepParameter, *updateDepCallback, &uuid, base)
718+
deployment_create_update(*updateDepTemplate, *updateDepParameter, *updateDepCallback, *updateDepMaxProvidersRetry, *updateDepKeepLastAttempt, &uuid, base)
710719

711720
case depTemplate.FullCommand():
712721
baseUrl := get_base_url()

0 commit comments

Comments
 (0)