Class: Openlayer::Resources::Governance::RuleResults

Inherits:
Object
  • Object
show all
Defined in:
lib/openlayer/resources/governance/rule_results.rb,
sig/openlayer/resources/governance/rule_results.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ RuleResults

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RuleResults.

Parameters:



206
207
208
# File 'lib/openlayer/resources/governance/rule_results.rb', line 206

def initialize(client:)
  @client = client
end

Instance Method Details

#create_evidence(rule_result_id, description: nil, name: nil, storage_uri: nil, text: nil, url: nil, request_options: {}) ⇒ Openlayer::Models::Governance::RuleResultCreateEvidenceResponse

Some parameter documentations has been truncated, see Models::Governance::RuleResultCreateEvidenceParams for more details.

Attach evidence to a rule result, satisfying an evidence rule.

Send the field that matches the rule's evidenceType: storageUri for an uploaded document, text for a written statement, or url for a link.

For a document, upload the file first with POST /storage/presigned-url and send the resulting storage URI as storageUri.

Attaching evidence re-evaluates the rule result. If the rule sets renewalCadenceDays, the renewal window restarts from this evidence.

Parameters:

  • rule_result_id (String) —

    The rule result id.

  • description (String, nil) —

    A description of what the evidence shows.

  • name (String, nil) —

    The evidence name.

  • storage_uri (String, nil) —

    Where the uploaded file is stored. Set when the rule's evidenceType is `docume

  • text (String, nil) —

    The evidence text. Set when the rule's evidenceType is text.

  • url (String, nil) —

    A link to the evidence. Set when the rule's evidenceType is url.

  • request_options (Openlayer::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



161
162
163
164
165
166
167
168
169
170
# File 'lib/openlayer/resources/governance/rule_results.rb', line 161

def create_evidence(rule_result_id, params = {})
  parsed, options = Openlayer::Governance::RuleResultCreateEvidenceParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["rule-results/%1$s/evidence", rule_result_id],
    body: parsed,
    model: Openlayer::Models::Governance::RuleResultCreateEvidenceResponse,
    options: options
  )
end

#list(workspace_id, enabled_framework_only: nil, framework_id: nil, include_unframed: nil, page: nil, per_page: nil, project_id: nil, rule_id: nil, scope: nil, search_query: nil, status: nil, type: nil, request_options: {}) ⇒ Openlayer::Models::Governance::RuleResultListResponse

List rule results across a workspace.

A rule result is the compliance status of one rule for one entity: a project for project-scoped rules, or the workspace itself for workspace-scoped rules. This is the endpoint to poll or export when you want your current compliance state, filtered to a framework, a project, or a status.

Parameters:

  • workspace_id (String) —

    The workspace id.

  • enabled_framework_only (Boolean) —

    Only include items belonging to at least one enabled framework.

  • framework_id (String) —

    Only include items belonging to this framework.

  • include_unframed (Boolean) —

    Whether to include rules that are not part of any framework.

  • page (Integer) —

    The page to return in a paginated query.

  • per_page (Integer) —

    Maximum number of items to return per page.

  • project_id (String) —

    Only include items that apply to this project.

  • rule_id (String) —

    Only include results of this rule.

  • scope (Symbol, Openlayer::Models::Governance::RuleResultListParams::Scope) —

    Only include rules with this scope.

  • search_query (String) —

    Filter by a free-text search over names and descriptions.

  • status (Symbol, Openlayer::Models::Governance::RuleResultListParams::Status) —

    Only include items whose rule result has this compliance status.

  • type (Symbol, Openlayer::Models::Governance::RuleResultListParams::Type) —

    Only include rules of this type.

  • request_options (Openlayer::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/openlayer/resources/governance/rule_results.rb', line 107

def list(workspace_id, params = {})
  parsed, options = Openlayer::Governance::RuleResultListParams.dump_request(params)
  query = Openlayer::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["workspaces/%1$s/rule-results", workspace_id],
    query: query.transform_keys(
      enabled_framework_only: "enabledFrameworkOnly",
      framework_id: "frameworkId",
      include_unframed: "includeUnframed",
      per_page: "perPage",
      project_id: "projectId",
      rule_id: "ruleId",
      search_query: "searchQuery"
    ),
    model: Openlayer::Models::Governance::RuleResultListResponse,
    options: options
  )
end

#list_evidence(rule_result_id, page: nil, per_page: nil, request_options: {}) ⇒ Openlayer::Models::Governance::RuleResultListEvidenceResponse

List the evidence attached to a rule result.

Which field carries the evidence depends on the rule's evidenceType: storageUri for uploaded documents, text for written statements, and url for links.

Parameters:

  • rule_result_id (String) —

    The rule result id.

  • page (Integer) —

    The page to return in a paginated query.

  • per_page (Integer) —

    Maximum number of items to return per page.

  • request_options (Openlayer::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



191
192
193
194
195
196
197
198
199
200
201
# File 'lib/openlayer/resources/governance/rule_results.rb', line 191

def list_evidence(rule_result_id, params = {})
  parsed, options = Openlayer::Governance::RuleResultListEvidenceParams.dump_request(params)
  query = Openlayer::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["rule-results/%1$s/evidence", rule_result_id],
    query: query.transform_keys(per_page: "perPage"),
    model: Openlayer::Models::Governance::RuleResultListEvidenceResponse,
    options: options
  )
end

#retrieve(rule_result_id, request_options: {}) ⇒ Openlayer::Models::Governance::RuleResultRetrieveResponse

Retrieve a rule result by its id.

Alongside the status, the response carries the evaluation and renewal dates that explain it: dateLastEvaluated and dateOfNextEvaluation for platform rules, dateOfLatestEvidence and dateOfRenewal for evidence rules.

Parameters:

Returns:

See Also:



22
23
24
25
26
27
28
29
# File 'lib/openlayer/resources/governance/rule_results.rb', line 22

def retrieve(rule_result_id, params = {})
  @client.request(
    method: :get,
    path: ["rule-results/%1$s", rule_result_id],
    model: Openlayer::Models::Governance::RuleResultRetrieveResponse,
    options: params[:request_options]
  )
end

#update(rule_result_id, assignee_id: nil, blocked_by: nil, blocking: nil, deactivated: nil, deactivated_reason: nil, request_options: {}) ⇒ Openlayer::Models::Governance::RuleResultUpdateResponse

Update a rule result. Only the fields you send are changed.

Use this to assign an owner, or to exclude a single result from compliance without deactivating the rule everywhere. deactivatedReason is required when setting deactivated to true.

A result's status is computed by Openlayer and cannot be set directly.

Parameters:

Returns:

See Also:



58
59
60
61
62
63
64
65
66
67
# File 'lib/openlayer/resources/governance/rule_results.rb', line 58

def update(rule_result_id, params = {})
  parsed, options = Openlayer::Governance::RuleResultUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["rule-results/%1$s", rule_result_id],
    body: parsed,
    model: Openlayer::Models::Governance::RuleResultUpdateResponse,
    options: options
  )
end