Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
VILLASframework
VILLASweb-backend-go
Commits
71e69688
Commit
71e69688
authored
Jan 25, 2021
by
Sonja Happ
Browse files
allow to set optional properties of IC to empty strings
parent
e383df74
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
routes/infrastructure-component/ic_validators.go
View file @
71e69688
...
...
@@ -107,30 +107,20 @@ func (r *AddICRequest) createIC(receivedViaAMQP bool) (InfrastructureComponent,
*
action
.
Properties
.
Category
=
r
.
InfrastructureComponent
.
Category
// set optional properties
if
r
.
InfrastructureComponent
.
Description
!=
""
{
action
.
Properties
.
Description
=
new
(
string
)
*
action
.
Properties
.
Description
=
r
.
InfrastructureComponent
.
Description
}
if
r
.
InfrastructureComponent
.
Location
!=
""
{
action
.
Properties
.
Location
=
new
(
string
)
*
action
.
Properties
.
Location
=
r
.
InfrastructureComponent
.
Location
}
if
r
.
InfrastructureComponent
.
APIURL
!=
""
{
action
.
Properties
.
API_url
=
new
(
string
)
*
action
.
Properties
.
API_url
=
r
.
InfrastructureComponent
.
APIURL
}
if
r
.
InfrastructureComponent
.
WebsocketURL
!=
""
{
action
.
Properties
.
WS_url
=
new
(
string
)
*
action
.
Properties
.
WS_url
=
r
.
InfrastructureComponent
.
WebsocketURL
}
if
r
.
InfrastructureComponent
.
UUID
!=
""
{
action
.
Properties
.
UUID
=
new
(
string
)
*
action
.
Properties
.
UUID
=
r
.
InfrastructureComponent
.
UUID
}
action
.
Properties
.
Description
=
new
(
string
)
*
action
.
Properties
.
Description
=
r
.
InfrastructureComponent
.
Description
action
.
Properties
.
Location
=
new
(
string
)
*
action
.
Properties
.
Location
=
r
.
InfrastructureComponent
.
Location
action
.
Properties
.
API_url
=
new
(
string
)
*
action
.
Properties
.
API_url
=
r
.
InfrastructureComponent
.
APIURL
action
.
Properties
.
WS_url
=
new
(
string
)
*
action
.
Properties
.
WS_url
=
r
.
InfrastructureComponent
.
WebsocketURL
action
.
Properties
.
UUID
=
new
(
string
)
*
action
.
Properties
.
UUID
=
r
.
InfrastructureComponent
.
UUID
log
.
Println
(
"AMQP: Sending request to create new IC"
)
err
=
sendActionAMQP
(
action
)
...
...
@@ -162,18 +152,6 @@ func (r *UpdateICRequest) updatedIC(oldIC InfrastructureComponent) Infrastructur
// Use the old InfrastructureComponent as a basis for the updated InfrastructureComponent `s`
s
:=
oldIC
if
r
.
InfrastructureComponent
.
UUID
!=
""
{
s
.
UUID
=
r
.
InfrastructureComponent
.
UUID
}
if
r
.
InfrastructureComponent
.
WebsocketURL
!=
""
{
s
.
WebsocketURL
=
r
.
InfrastructureComponent
.
WebsocketURL
}
if
r
.
InfrastructureComponent
.
APIURL
!=
""
{
s
.
APIURL
=
r
.
InfrastructureComponent
.
APIURL
}
if
r
.
InfrastructureComponent
.
Type
!=
""
{
s
.
Type
=
r
.
InfrastructureComponent
.
Type
}
...
...
@@ -190,13 +168,11 @@ func (r *UpdateICRequest) updatedIC(oldIC InfrastructureComponent) Infrastructur
s
.
State
=
r
.
InfrastructureComponent
.
State
}
if
r
.
InfrastructureComponent
.
Location
!=
""
{
s
.
Location
=
r
.
InfrastructureComponent
.
Location
}
if
r
.
InfrastructureComponent
.
Description
!=
""
{
s
.
Description
=
r
.
InfrastructureComponent
.
Description
}
s
.
UUID
=
r
.
InfrastructureComponent
.
UUID
s
.
WebsocketURL
=
r
.
InfrastructureComponent
.
WebsocketURL
s
.
APIURL
=
r
.
InfrastructureComponent
.
APIURL
s
.
Location
=
r
.
InfrastructureComponent
.
Location
s
.
Description
=
r
.
InfrastructureComponent
.
Description
// set last update time
s
.
StateUpdateAt
=
time
.
Now
()
.
Format
(
time
.
RFC1123
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment