Class: Openlayer::Resources::Governance::Frameworks

Inherits:
Object
  • Object
show all
Defined in:
lib/openlayer/resources/governance/frameworks.rb,
lib/openlayer/resources/governance/frameworks/sections.rb,
lib/openlayer/resources/governance/frameworks/documents.rb,
lib/openlayer/resources/governance/frameworks/subsections.rb,
sig/openlayer/resources/governance/frameworks.rbs,
sig/openlayer/resources/governance/frameworks/sections.rbs,
sig/openlayer/resources/governance/frameworks/documents.rbs,
sig/openlayer/resources/governance/frameworks/subsections.rbs

Defined Under Namespace

Classes: Documents, Sections, Subsections

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Frameworks

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 Frameworks.

Parameters:



335
336
337
338
339
340
# File 'lib/openlayer/resources/governance/frameworks.rb', line 335

def initialize(client:)
  @client = client
  @documents = Openlayer::Resources::Governance::Frameworks::Documents.new(client: client)
  @sections = Openlayer::Resources::Governance::Frameworks::Sections.new(client: client)
  @subsections = Openlayer::Resources::Governance::Frameworks::Subsections.new(client: client)
end

Instance Attribute Details

#documents ⇒ Openlayer::Resources::Governance::Frameworks::Documents (readonly)



8
9
10
# File 'lib/openlayer/resources/governance/frameworks.rb', line 8

def documents
  @documents
end

#sections ⇒ Openlayer::Resources::Governance::Frameworks::Sections (readonly)



11
12
13
# File 'lib/openlayer/resources/governance/frameworks.rb', line 11

def sections
  @sections
end

#subsections ⇒ Openlayer::Resources::Governance::Frameworks::Subsections (readonly)



14
15
16
# File 'lib/openlayer/resources/governance/frameworks.rb', line 14

def subsections
  @subsections
end

Instance Method Details

#create(workspace_id, name:, description: nil, enabled: nil, project_selector: nil, tags: nil, request_options: {}) ⇒ Openlayer::Models::Governance::FrameworkCreateResponse

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

Create a custom governance framework in a workspace.

Use this to track compliance against an internal policy, or against a standard Openlayer does not ship as a built-in framework. A new framework starts with no rules -- add them from the Openlayer app, or map an existing rule to it.

A framework is created disabled unless you pass enabled: true. While it is disabled its rules are not evaluated and do not count towards compliance.

Parameters:

  • workspace_id (String) —

    The workspace id.

  • name (String) —

    The framework name.

  • description (String, nil) —

    A short description of the framework.

  • enabled (Boolean) —

    Whether the framework is active. Rules of a disabled framework are not evaluated

  • project_selector (Openlayer::Models::Governance::FrameworkCreateParams::ProjectSelector, nil) —

    Determines which projects the framework applies to. An empty or null match a

  • tags (Array<String>) —

    Free-form labels on the framework.

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

Returns:

See Also:



47
48
49
50
51
52
53
54
55
56
# File 'lib/openlayer/resources/governance/frameworks.rb', line 47

def create(workspace_id, params)
  parsed, options = Openlayer::Governance::FrameworkCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["workspaces/%1$s/frameworks", workspace_id],
    body: parsed,
    model: Openlayer::Models::Governance::FrameworkCreateResponse,
    options: options
  )
end

#export(framework_id, project_id: nil, request_options: {}) ⇒ Openlayer::Models::Governance::FrameworkExportResponse

Export a framework's evidence and progress as an audit-ready zip archive.

The archive holds every evidence file uploaded against the framework's evidence-based rules, a markdown report of the framework's progress and the status of all its rules (broken down by documentation section when the framework has documents), and CSV manifests of rules and evidence with SHA-256 checksums.

Send projectId to export one project's compliance with the framework. Omit it for the workspace-wide view across every project in the framework, including workspace-scoped rules.

The export runs as a background task, so this returns 202 immediately. To collect the archive:

  1. Poll GET /background-tasks/{taskId} with the returned taskResultId until complete is true.
  2. Read outputs.storageUri off that task.
  3. Exchange it for a download link at GET /storage/presigned-url?storageUri=<uri>.

Rate limited to 2 requests per minute per framework. Asking for an export while an identical one is still queued returns that task rather than starting a second one.

Parameters:

  • framework_id (String) —

    The framework id.

  • project_id (String, nil) —

    Scope the export to this project. It must belong to the framework.

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

Returns:

See Also:



225
226
227
228
229
230
231
232
233
234
# File 'lib/openlayer/resources/governance/frameworks.rb', line 225

def export(framework_id, params = {})
  parsed, options = Openlayer::Governance::FrameworkExportParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["frameworks/%1$s/export", framework_id],
    body: parsed,
    model: Openlayer::Models::Governance::FrameworkExportResponse,
    options: options
  )
end

#list(workspace_id, asc: nil, completion_operator: nil, completion_value: nil, enabled: nil, include_rule_stats: nil, page: nil, per_page: nil, project_id: nil, search_query: nil, sort_column: nil, tags: nil, request_options: {}) ⇒ Openlayer::Models::Governance::FrameworkListResponse

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

List the governance frameworks in a workspace.

A framework is a set of rules -- drawn from a regulation, a standard, or your own internal policy -- that Openlayer tracks compliance against. Use this endpoint to find the framework you want to report on, then read its rules and rule results.

Parameters:

  • workspace_id (String) —

    The workspace id.

  • asc (Boolean) —

    Whether to sort in ascending order.

  • completion_operator (Symbol, Openlayer::Models::Governance::FrameworkListParams::CompletionOperator) —

    How to compare each framework's completion percentage with completionValue. Mu

  • completion_value (Integer) —

    The completion percentage to compare against, from 0 to 100.

  • enabled (Boolean) —

    Only include frameworks that are enabled (or disabled).

  • include_rule_stats (Boolean) —

    Whether to include a ruleStats object on each framework, with its rule result

  • 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.

  • search_query (String) —

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

  • sort_column (Symbol, Openlayer::Models::Governance::FrameworkListParams::SortColumn) —

    The column to sort on.

  • tags (Array<String>) —

    Only include frameworks carrying all of these tags.

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

Returns:

See Also:



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/openlayer/resources/governance/frameworks.rb', line 170

def list(workspace_id, params = {})
  parsed, options = Openlayer::Governance::FrameworkListParams.dump_request(params)
  query = Openlayer::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["workspaces/%1$s/frameworks", workspace_id],
    query: query.transform_keys(
      completion_operator: "completionOperator",
      completion_value: "completionValue",
      include_rule_stats: "includeRuleStats",
      per_page: "perPage",
      project_id: "projectId",
      search_query: "searchQuery",
      sort_column: "sortColumn"
    ),
    model: Openlayer::Models::Governance::FrameworkListResponse,
    options: options
  )
end

#list_project_rule_stats(framework_id, asc: nil, page: nil, per_page: nil, sort_column: nil, request_options: {}) ⇒ Openlayer::Models::Governance::FrameworkListProjectRuleStatsResponse

Get a compliance roll-up for a framework, one row per project it applies to.

Each row counts the project's rule results by status, so you can report on where a framework is complete and where it is not without fetching every individual rule result.

Parameters:

Returns:

See Also:



259
260
261
262
263
264
265
266
267
268
269
# File 'lib/openlayer/resources/governance/frameworks.rb', line 259

def list_project_rule_stats(framework_id, params = {})
  parsed, options = Openlayer::Governance::FrameworkListProjectRuleStatsParams.dump_request(params)
  query = Openlayer::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["frameworks/%1$s/project-rule-stats", framework_id],
    query: query.transform_keys(per_page: "perPage", sort_column: "sortColumn"),
    model: Openlayer::Models::Governance::FrameworkListProjectRuleStatsResponse,
    options: options
  )
end

#list_projects(framework_id, page: nil, per_page: nil, request_options: {}) ⇒ Openlayer::Models::Governance::FrameworkListProjectsResponse

List the projects a framework applies to.

Which projects a framework covers is determined by its projectSelector. A framework with an empty selector applies to every project in the workspace.

Parameters:

  • framework_id (String) —

    The framework 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:



289
290
291
292
293
294
295
296
297
298
299
# File 'lib/openlayer/resources/governance/frameworks.rb', line 289

def list_projects(framework_id, params = {})
  parsed, options = Openlayer::Governance::FrameworkListProjectsParams.dump_request(params)
  query = Openlayer::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["frameworks/%1$s/projects", framework_id],
    query: query.transform_keys(per_page: "perPage"),
    model: Openlayer::Models::Governance::FrameworkListProjectsResponse,
    options: options
  )
end

#list_rules(framework_id, page: nil, per_page: nil, request_options: {}) ⇒ Openlayer::Models::Governance::FrameworkListRulesResponse

List the rules that belong to a framework.

To read the compliance status of these rules, use List rule results with the frameworkId filter, or fetch the results of an individual rule.

Parameters:

  • framework_id (String) —

    The framework 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:



320
321
322
323
324
325
326
327
328
329
330
# File 'lib/openlayer/resources/governance/frameworks.rb', line 320

def list_rules(framework_id, params = {})
  parsed, options = Openlayer::Governance::FrameworkListRulesParams.dump_request(params)
  query = Openlayer::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["frameworks/%1$s/rules", framework_id],
    query: query.transform_keys(per_page: "perPage"),
    model: Openlayer::Models::Governance::FrameworkListRulesResponse,
    options: options
  )
end

#retrieve(framework_id, request_options: {}) ⇒ Openlayer::Models::Governance::FrameworkRetrieveResponse

Retrieve a governance framework by its id.

Parameters:

Returns:

See Also:



69
70
71
72
73
74
75
76
# File 'lib/openlayer/resources/governance/frameworks.rb', line 69

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

#update(framework_id, avatar: nil, description: nil, enabled: nil, extended_description: nil, href: nil, name: nil, project_selector: nil, tags: nil, request_options: {}) ⇒ Openlayer::Models::Governance::FrameworkUpdateResponse

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

Update a governance framework.

The most common use is activating or deactivating a framework for the workspace by setting enabled. Rules of a disabled framework are not evaluated and do not count towards compliance.

Frameworks that ship with Openlayer report immutable: true. For those, only enabled, tags, and projectSelector can be changed -- their name and definition are managed by Openlayer.

Only the fields you send are changed.

Parameters:

  • framework_id (String) —

    The framework id.

  • avatar (Openlayer::Models::Governance::FrameworkUpdateParams::Avatar, nil) —

    The icon shown for the framework.

  • description (String, nil) —

    A short description of the framework.

  • enabled (Boolean) —

    Whether the framework is active. Rules of a disabled framework are not evaluated

  • extended_description (Hash{Symbol=>Object}, nil) —

    A longer, rich-text description, as a TipTap JSON document.

  • href (String, nil) —

    A link to the external standard or regulation the framework is based on.

  • name (String) —

    The framework name.

  • project_selector (Openlayer::Models::Governance::FrameworkUpdateParams::ProjectSelector, nil) —

    Determines which projects the framework applies to. An empty or null match a

  • tags (Array<String>) —

    Free-form labels on the framework.

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

Returns:

See Also:



118
119
120
121
122
123
124
125
126
127
# File 'lib/openlayer/resources/governance/frameworks.rb', line 118

def update(framework_id, params = {})
  parsed, options = Openlayer::Governance::FrameworkUpdateParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["frameworks/%1$s", framework_id],
    body: parsed,
    model: Openlayer::Models::Governance::FrameworkUpdateResponse,
    options: options
  )
end