-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathNSX Security Groups Manager.cat.rb
More file actions
77 lines (64 loc) · 1.61 KB
/
NSX Security Groups Manager.cat.rb
File metadata and controls
77 lines (64 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name 'NSX Security Groups Manager'
short_description " \n
Manage NSX Security Groups."
long_description " \n
Manage NSX Security Groups (experimental)."
type 'application'
rs_ca_ver 20161221
import 'plugins/nsx'
import 'sys_log'
###
# User Inputs
###
###
# Local Definitions
###
define audit_log($summary, $details) do
rs_cm.audit_entries.create(
notify: "None",
audit_entry: {
auditee_href: @@deployment,
summary: $summary,
detail: $details
}
)
end
define skip_not_found_error() do
if $_error["message"] =~ "/not found/i"
log_info($_error["type"] + ": " + $_error["message"])
$_error_behavior = "skip"
end
end
define start_debugging() do
if $$debugging == false || logic_and($$debugging != false, $$debugging != true)
initiate_debug_report()
$$debugging = true
end
end
define stop_debugging() do
if $$debugging == true
$debug_report = complete_debug_report()
call sys_log.detail($debug_report)
$$debugging = false
end
end
define list_nsx_security_groups() on_error: stop_debugging() do
call start_debugging()
call sys_log.set_task_target(@@deployment)
$fields = {}
$security_groups = nsx.securitygroup.list($fields)
call audit_log('nsx security groups', to_s($security_groups))
call stop_debugging()
end
###
# Outputs
###
# todo
###
# Operations
###
operation 'list_nsx_security_groups' do
description 'Lists all NSX Security Groups'
definition 'list_nsx_security_groups'
label 'List NSX Security Groups'
end