Class: Openlayer::Resources::Governance::Rules
- Inherits:
-
Object
- Object
- Openlayer::Resources::Governance::Rules
- Defined in:
- lib/openlayer/resources/governance/rules.rb,
sig/openlayer/resources/governance/rules.rbs
Instance Method Summary collapse
-
#create(workspace_id, name:, scope:, type:, assignee_id: nil, automation_params: nil, automation_type: nil, deactivated: nil, description: nil, evidence_type: nil, renewal_cadence_days: nil, tag_ids: nil, request_options: {}) ⇒ Openlayer::Models::Governance::RuleCreateResponse
Some parameter documentations has been truncated, see Models::Governance::RuleCreateParams for more details.
-
#delete(rule_id, request_options: {}) ⇒ nil
Delete a governance rule and its rule results.
-
#initialize(client:) ⇒ Rules
constructor
private
A new instance of Rules.
-
#list(workspace_id, asc: nil, assignee_id: nil, deactivated: nil, enabled_framework_only: nil, framework_id: nil, group: nil, include_results: nil, include_unframed: nil, page: nil, per_page: nil, project_id: nil, scope: nil, search_query: nil, sort_by: nil, status: nil, tags: nil, type: nil, request_options: {}) ⇒ Openlayer::Models::Governance::RuleListResponse
Some parameter documentations has been truncated, see Models::Governance::RuleListParams for more details.
-
#retrieve(rule_id, request_options: {}) ⇒ Openlayer::Models::Governance::RuleRetrieveResponse
Retrieve a governance rule by its id, including the frameworks it belongs to and its tags.
-
#update(rule_id, assignee_id: nil, deactivated: nil, description: nil, name: nil, renewal_cadence_days: nil, tag_ids: nil, request_options: {}) ⇒ Openlayer::Models::Governance::RuleUpdateResponse
Some parameter documentations has been truncated, see Models::Governance::RuleUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Rules
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 Rules.
235 236 237 |
# File 'lib/openlayer/resources/governance/rules.rb', line 235 def initialize(client:) @client = client end |
Instance Method Details
#create(workspace_id, name:, scope:, type:, assignee_id: nil, automation_params: nil, automation_type: nil, deactivated: nil, description: nil, evidence_type: nil, renewal_cadence_days: nil, tag_ids: nil, request_options: {}) ⇒ Openlayer::Models::Governance::RuleCreateResponse
Some parameter documentations has been truncated, see Models::Governance::RuleCreateParams for more details.
Create a governance rule in a workspace.
A rule is one requirement. Its type decides how it is satisfied, and the two
types accept different fields:
platformrules are evaluated automatically from the state of your workspace. SetautomationTypeto the signal to check. Theirscopemust beproject, andevidenceTypeandrenewalCadenceDaysmust be omitted ornull.evidencerules are satisfied by attaching evidence. SetevidenceTypeto the kind of evidence that satisfies them.automationTypeandautomationParamsmust be omitted ornull.
A new rule belongs to no framework. Map it to one from the Openlayer app.
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/openlayer/resources/governance/rules.rb', line 55 def create(workspace_id, params) parsed, = Openlayer::Governance::RuleCreateParams.dump_request(params) @client.request( method: :post, path: ["workspaces/%1$s/rules", workspace_id], body: parsed, model: Openlayer::Models::Governance::RuleCreateResponse, options: ) end |
#delete(rule_id, request_options: {}) ⇒ nil
Delete a governance rule and its rule results.
Only rules you created can be deleted. Rules that ship with Openlayer report
immutable: true and cannot be deleted -- exclude one from compliance by
setting deactivated with PUT /rules/{ruleId} instead.
223 224 225 226 227 228 229 230 |
# File 'lib/openlayer/resources/governance/rules.rb', line 223 def delete(rule_id, params = {}) @client.request( method: :delete, path: ["rules/%1$s", rule_id], model: NilClass, options: params[:request_options] ) end |
#list(workspace_id, asc: nil, assignee_id: nil, deactivated: nil, enabled_framework_only: nil, framework_id: nil, group: nil, include_results: nil, include_unframed: nil, page: nil, per_page: nil, project_id: nil, scope: nil, search_query: nil, sort_by: nil, status: nil, tags: nil, type: nil, request_options: {}) ⇒ Openlayer::Models::Governance::RuleListResponse
Some parameter documentations has been truncated, see Models::Governance::RuleListParams for more details.
List the governance rules in a workspace.
A rule is a single requirement Openlayer tracks. platform rules are evaluated
automatically from the state of your workspace; evidence rules are satisfied
by attaching evidence. A rule can belong to several frameworks at once, and
rules that belong to none are returned too unless you pass
includeUnframed=false.
Pass includeResults=true to get each rule's compliance results inline instead
of fetching them separately.
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/openlayer/resources/governance/rules.rb', line 186 def list(workspace_id, params = {}) parsed, = Openlayer::Governance::RuleListParams.dump_request(params) query = Openlayer::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["workspaces/%1$s/rules", workspace_id], query: query.transform_keys( assignee_id: "assigneeId", enabled_framework_only: "enabledFrameworkOnly", framework_id: "frameworkId", include_results: "includeResults", include_unframed: "includeUnframed", per_page: "perPage", project_id: "projectId", search_query: "searchQuery", sort_by: "sortBy" ), model: Openlayer::Models::Governance::RuleListResponse, options: ) end |
#retrieve(rule_id, request_options: {}) ⇒ Openlayer::Models::Governance::RuleRetrieveResponse
Retrieve a governance rule by its id, including the frameworks it belongs to and its tags.
78 79 80 81 82 83 84 85 |
# File 'lib/openlayer/resources/governance/rules.rb', line 78 def retrieve(rule_id, params = {}) @client.request( method: :get, path: ["rules/%1$s", rule_id], model: Openlayer::Models::Governance::RuleRetrieveResponse, options: params[:request_options] ) end |
#update(rule_id, assignee_id: nil, deactivated: nil, description: nil, name: nil, renewal_cadence_days: nil, tag_ids: nil, request_options: {}) ⇒ Openlayer::Models::Governance::RuleUpdateResponse
Some parameter documentations has been truncated, see Models::Governance::RuleUpdateParams for more details.
Update a governance rule. Only the fields you send are changed.
Rules that ship with Openlayer report immutable: true and cannot be edited.
A rule's scope, type, evidenceType, and automation are fixed once it
exists -- create a new rule instead of converting one.
118 119 120 121 122 123 124 125 126 127 |
# File 'lib/openlayer/resources/governance/rules.rb', line 118 def update(rule_id, params = {}) parsed, = Openlayer::Governance::RuleUpdateParams.dump_request(params) @client.request( method: :put, path: ["rules/%1$s", rule_id], body: parsed, model: Openlayer::Models::Governance::RuleUpdateResponse, options: ) end |