Module: Zanshin::SDK::OrganizationScanTargets
- Included in:
- Client
- Defined in:
- lib/zanshin/organization_scan_targets.rb
Overview
Zanshin SDK Organization Scan Target
Instance Method Summary collapse
-
#check_organization_scan_target(organization_id, scan_target_id) ⇒ Object
Check scan target [#reference](api.zanshin.tenchisecurity.com/#operation/checkOrganizationScanTarget).
-
#create_organization_scan_target(organization_id, name, credential, schedule = '0 0 * * *') ⇒ Object
Create a new scan target in organization [#reference](api.zanshin.tenchisecurity.com/#operation/createOrganizationScanTargets).
-
#delete_organization_scan_target(organization_id, scan_target_id) ⇒ Object
Delete scan target of organization [#reference](api.zanshin.tenchisecurity.com/#operation/deleteOrganizationScanTargetById).
-
#get_organization_scan_target(organization_id, scan_target_id) ⇒ Object
Get scan target details of organization [#reference](api.zanshin.tenchisecurity.com/#operation/getOrganizationScanTargetById).
-
#get_organization_scan_target_scan(organization_id, scan_target_id, scan_id) ⇒ Object
Get scan of scan target [#reference](api.zanshin.tenchisecurity.com/#operation/getOrganizationScanTargetScanSlot).
-
#iter_organization_scan_target_scans(organization_id, scan_target_id) ⇒ Object
Scans Enumerator of an Scan Target [#reference](api.zanshin.tenchisecurity.com/#operation/getOrganizationScanTargetScans).
-
#iter_organization_scan_targets(organization_id) ⇒ Object
Scan Targets Enumerator of an organization [#reference](api.zanshin.tenchisecurity.com/#operation/getOrganizationScanTargets).
-
#start_organization_scan_target_scan(organization_id, scan_target_id) ⇒ Object
Starts a scan on the specified scan target [#reference](api.zanshin.tenchisecurity.com/#operation/scanOrganizationScanTarget).
-
#stop_organization_scan_target_scan(organization_id, scan_target_id) ⇒ Object
Stop a scan on the specific scan target.
-
#update_organization_scan_target(organization_id, scan_target_id, name = nil, schedule = nil) ⇒ Object
Update scan target of organization [#reference](api.zanshin.tenchisecurity.com/#operation/editOrganizationMembersById).
Instance Method Details
#check_organization_scan_target(organization_id, scan_target_id) ⇒ Object
Check scan target [#reference](api.zanshin.tenchisecurity.com/#operation/checkOrganizationScanTarget)
131 132 133 134 135 136 |
# File 'lib/zanshin/organization_scan_targets.rb', line 131 def check_organization_scan_target(organization_id, scan_target_id) @http.request( 'POST', "/organizations/#{validate_uuid(organization_id)}/scantargets/#{validate_uuid(scan_target_id)}/check" ) end |
#create_organization_scan_target(organization_id, name, credential, schedule = '0 0 * * *') ⇒ Object
Create a new scan target in organization [#reference](api.zanshin.tenchisecurity.com/#operation/createOrganizationScanTargets)
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/zanshin/organization_scan_targets.rb', line 37 def create_organization_scan_target(organization_id, name, credential, schedule = '0 0 * * *') unless [ScanTarget::AWS, ScanTarget::Azure, ScanTarget::GCP, ScanTarget::HUAWEI, ScanTarget::DOMAIN].include? credential.class raise "#{credential.class} is invalid instance of Zanshin::SDK::ScanTarget classes" end body = { 'kind' => credential.class::KIND, 'name' => name, 'credential' => credential.to_json, 'schedule' => schedule } @http.request('POST', "/organizations/#{validate_uuid(organization_id)}/scantargets", body) end |
#delete_organization_scan_target(organization_id, scan_target_id) ⇒ Object
Delete scan target of organization [#reference](api.zanshin.tenchisecurity.com/#operation/deleteOrganizationScanTargetById)
89 90 91 92 |
# File 'lib/zanshin/organization_scan_targets.rb', line 89 def delete_organization_scan_target(organization_id, scan_target_id) @http.request('DELETE', "/organizations/#{validate_uuid(organization_id)}/scantargets/#{validate_uuid(scan_target_id)}") end |
#get_organization_scan_target(organization_id, scan_target_id) ⇒ Object
Get scan target details of organization [#reference](api.zanshin.tenchisecurity.com/#operation/getOrganizationScanTargetById)
57 58 59 60 |
# File 'lib/zanshin/organization_scan_targets.rb', line 57 def get_organization_scan_target(organization_id, scan_target_id) @http.request('GET', "/organizations/#{validate_uuid(organization_id)}/scantargets/#{validate_uuid(scan_target_id)}") end |
#get_organization_scan_target_scan(organization_id, scan_target_id, scan_id) ⇒ Object
Get scan of scan target [#reference](api.zanshin.tenchisecurity.com/#operation/getOrganizationScanTargetScanSlot)
168 169 170 171 172 173 174 |
# File 'lib/zanshin/organization_scan_targets.rb', line 168 def get_organization_scan_target_scan(organization_id, scan_target_id, scan_id) @http.request( 'GET', "/organizations/#{validate_uuid(organization_id)}/scantargets/#{ validate_uuid(scan_target_id)}/scans/#{validate_uuid(scan_id)}" ) end |
#iter_organization_scan_target_scans(organization_id, scan_target_id) ⇒ Object
Scans Enumerator of an Scan Target [#reference](api.zanshin.tenchisecurity.com/#operation/getOrganizationScanTargetScans)
149 150 151 152 153 154 155 156 157 158 |
# File 'lib/zanshin/organization_scan_targets.rb', line 149 def iter_organization_scan_target_scans(organization_id, scan_target_id) Enumerator.new do |yielder| @http.request( 'GET', "/organizations/#{validate_uuid(organization_id)}/scantargets/#{validate_uuid(scan_target_id)}/scans" ).each do |e| yielder.yield e end end end |
#iter_organization_scan_targets(organization_id) ⇒ Object
Scan Targets Enumerator of an organization [#reference](api.zanshin.tenchisecurity.com/#operation/getOrganizationScanTargets)
19 20 21 22 23 24 25 |
# File 'lib/zanshin/organization_scan_targets.rb', line 19 def iter_organization_scan_targets(organization_id) Enumerator.new do |yielder| @http.request('GET', "/organizations/#{validate_uuid(organization_id)}/scantargets").each do |e| yielder.yield e end end end |
#start_organization_scan_target_scan(organization_id, scan_target_id) ⇒ Object
Starts a scan on the specified scan target [#reference](api.zanshin.tenchisecurity.com/#operation/scanOrganizationScanTarget)
101 102 103 104 105 106 |
# File 'lib/zanshin/organization_scan_targets.rb', line 101 def start_organization_scan_target_scan(organization_id, scan_target_id) @http.request( 'POST', "/organizations/#{validate_uuid(organization_id)}/scantargets/#{validate_uuid(scan_target_id)}/scan" ) end |
#stop_organization_scan_target_scan(organization_id, scan_target_id) ⇒ Object
Stop a scan on the specific scan target
117 118 119 120 121 122 |
# File 'lib/zanshin/organization_scan_targets.rb', line 117 def stop_organization_scan_target_scan(organization_id, scan_target_id) @http.request( 'POST', "/organizations/#{validate_uuid(organization_id)}/scantargets/#{validate_uuid(scan_target_id)}/stop" ) end |
#update_organization_scan_target(organization_id, scan_target_id, name = nil, schedule = nil) ⇒ Object
Update scan target of organization [#reference](api.zanshin.tenchisecurity.com/#operation/editOrganizationMembersById)
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/zanshin/organization_scan_targets.rb', line 71 def update_organization_scan_target(organization_id, scan_target_id, name = nil, schedule = nil) body = { 'name' => name, 'schedule' => schedule } @http.request('PUT', "/organizations/#{validate_uuid(organization_id)}/scantargets/#{validate_uuid(scan_target_id)}", body) end |