Class: EmassClient::SystemsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/emass_client/api/systems_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ SystemsApi



19
20
21
# File 'lib/emass_client/api/systems_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/emass_client/api/systems_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_system(system_id, opts = {}) ⇒ SystemResponse

Get system information for a specific system Returns the system matching provided parameters

Options Hash (opts):

  • :include_package (Boolean)

    **Include Package**: Indicates if additional packages information is retrieved for queried system. (default to true)

  • :policy (String)

    **System Policy**: Filter query by system policy. If no value is specified and more than one policy is available, the default return is the RMF policy information. (default to ‘rmf’)



29
30
31
32
# File 'lib/emass_client/api/systems_api.rb', line 29

def get_system(system_id, opts = {})
  data, _status_code, _headers = get_system_with_http_info(system_id, opts)
  data
end

#get_system_with_http_info(system_id, opts = {}) ⇒ Array<(SystemResponse, Integer, Hash)>

Get system information for a specific system Returns the system matching provided parameters

Options Hash (opts):

  • :include_package (Boolean)

    **Include Package**: Indicates if additional packages information is retrieved for queried system. (default to true)

  • :policy (String)

    **System Policy**: Filter query by system policy. If no value is specified and more than one policy is available, the default return is the RMF policy information. (default to ‘rmf’)



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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/emass_client/api/systems_api.rb', line 41

def get_system_with_http_info(system_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SystemsApi.get_system ...'
  end
  # verify the required parameter 'system_id' is set
  if @api_client.config.client_side_validation && system_id.nil?
    fail ArgumentError, "Missing the required parameter 'system_id' when calling SystemsApi.get_system"
  end
  allowable_values = ["diacap", "rmf", "reporting", "unknown_default_open_api"]
  if @api_client.config.client_side_validation && opts[:'policy'] && !allowable_values.include?(opts[:'policy'])
    fail ArgumentError, "invalid value for \"policy\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/systems/{systemId}'.sub('{' + 'systemId' + '}', CGI.escape(system_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'includePackage'] = opts[:'include_package'] if !opts[:'include_package'].nil?
  query_params[:'policy'] = opts[:'policy'] if !opts[:'policy'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'SystemResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apiKey', 'mockType', 'userId']

  new_options = opts.merge(
    :operation => :"SystemsApi.get_system",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SystemsApi#get_system\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_systems(opts = {}) ⇒ SystemsResponse

Get system information Returns all system(s) that match the query parameters

Options Hash (opts):

  • :include_package (Boolean)

    **Include Package**: Indicates if additional packages information is retrieved for queried system. (default to true)

  • :registration_type (String)

    **Registration Type**: Filter record by selected registration type (single value or comma delimited values). *Available values:* assessAndAuthorize, assessOnly, guest, regular, functional, cloudServiceProvider, commonControlProvider (default to ‘regular’)

  • :ditpr_id (String)

    **DITPR ID**: Filter query by DoD Information Technology (IT) Portfolio Repository (DITPR).

  • :coams_id (String)

    **COAMS ID**: Filter query by Cyber Operational Attributes Management System (COAMS).

  • :policy (String)

    **System Policy**: Filter query by system policy. If no value is specified and more than one policy is available, the default return is the RMF policy information. (default to ‘rmf’)

  • :include_ditpr_metrics (Boolean)

    **Include DITPR**: Indicates if DITPR metrics are retrieved. This query string parameter can only be used in conjunction with the following parameters:&lt;br&gt; &lt;ul&gt; &lt;li&gt;registrationType&lt;/li&gt; &lt;li&gt;policy&lt;/li&gt; &lt;/ul&gt; (default to false)

  • :include_decommissioned (Boolean)

    **Include Decommissioned Systems**: Indicates if decommissioned systems are retrieved. If no value is specified, the default returns true to include decommissioned systems. (default to true)

  • :reports_for_scorecard (Boolean)

    **DoD Cyber Hygiene Scorecard**: Indicates if the system reports to the DoD Cyber Hygiene Scorecard. (default to true)



107
108
109
110
# File 'lib/emass_client/api/systems_api.rb', line 107

def get_systems(opts = {})
  data, _status_code, _headers = get_systems_with_http_info(opts)
  data
end

#get_systems_with_http_info(opts = {}) ⇒ Array<(SystemsResponse, Integer, Hash)>

Get system information Returns all system(s) that match the query parameters

Options Hash (opts):

  • :include_package (Boolean)

    **Include Package**: Indicates if additional packages information is retrieved for queried system. (default to true)

  • :registration_type (String)

    **Registration Type**: Filter record by selected registration type (single value or comma delimited values). *Available values:* assessAndAuthorize, assessOnly, guest, regular, functional, cloudServiceProvider, commonControlProvider (default to ‘regular’)

  • :ditpr_id (String)

    **DITPR ID**: Filter query by DoD Information Technology (IT) Portfolio Repository (DITPR).

  • :coams_id (String)

    **COAMS ID**: Filter query by Cyber Operational Attributes Management System (COAMS).

  • :policy (String)

    **System Policy**: Filter query by system policy. If no value is specified and more than one policy is available, the default return is the RMF policy information. (default to ‘rmf’)

  • :include_ditpr_metrics (Boolean)

    **Include DITPR**: Indicates if DITPR metrics are retrieved. This query string parameter can only be used in conjunction with the following parameters:&lt;br&gt; &lt;ul&gt; &lt;li&gt;registrationType&lt;/li&gt; &lt;li&gt;policy&lt;/li&gt; &lt;/ul&gt; (default to false)

  • :include_decommissioned (Boolean)

    **Include Decommissioned Systems**: Indicates if decommissioned systems are retrieved. If no value is specified, the default returns true to include decommissioned systems. (default to true)

  • :reports_for_scorecard (Boolean)

    **DoD Cyber Hygiene Scorecard**: Indicates if the system reports to the DoD Cyber Hygiene Scorecard. (default to true)



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/emass_client/api/systems_api.rb', line 124

def get_systems_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SystemsApi.get_systems ...'
  end
  allowable_values = ["diacap", "rmf", "reporting", "unknown_default_open_api"]
  if @api_client.config.client_side_validation && opts[:'policy'] && !allowable_values.include?(opts[:'policy'])
    fail ArgumentError, "invalid value for \"policy\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/systems'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'includePackage'] = opts[:'include_package'] if !opts[:'include_package'].nil?
  query_params[:'registrationType'] = opts[:'registration_type'] if !opts[:'registration_type'].nil?
  query_params[:'ditprId'] = opts[:'ditpr_id'] if !opts[:'ditpr_id'].nil?
  query_params[:'coamsId'] = opts[:'coams_id'] if !opts[:'coams_id'].nil?
  query_params[:'policy'] = opts[:'policy'] if !opts[:'policy'].nil?
  query_params[:'includeDitprMetrics'] = opts[:'include_ditpr_metrics'] if !opts[:'include_ditpr_metrics'].nil?
  query_params[:'includeDecommissioned'] = opts[:'include_decommissioned'] if !opts[:'include_decommissioned'].nil?
  query_params[:'reportsForScorecard'] = opts[:'reports_for_scorecard'] if !opts[:'reports_for_scorecard'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'SystemsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['apiKey', 'mockType', 'userId']

  new_options = opts.merge(
    :operation => :"SystemsApi.get_systems",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SystemsApi#get_systems\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end