Class: Stigg::Resources::V1::Events::Beta::Customers

Inherits:
Object
  • Object
show all
Defined in:
lib/stigg/resources/v1/events/beta/customers.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Customers

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

Parameters:



91
92
93
# File 'lib/stigg/resources/v1/events/beta/customers.rb', line 91

def initialize(client:)
  @client = client
end

Instance Method Details

#retrieve_governance(id, after: nil, currency_ids: nil, entity_id_search: nil, entity_type_ids: nil, feature_ids: nil, limit: nil, min_utilization: nil, order: nil, scope: nil, sort_by: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Events::Beta::CustomerRetrieveGovernanceResponse

Some parameter documentations has been truncated, see Models::V1::Events::Beta::CustomerRetrieveGovernanceParams for more details.

Queries the customer’s governance hierarchy tree, returning a cursor-paginated list of nodes with their usage configuration (limit, cadence, scope) and current usage, sortable and filterable by usage. Each node carries ‘parentId` so the tree can be rebuilt client-side. Usage is read from a periodically-refreshed read model and never gates access.

Parameters:

  • id (String)

    Path param: The customer external id.

  • after (String)

    Query param: Return items that come after this cursor

  • currency_ids (Array<String>)

    Query param: Currency ids to include, repeated per value (e.g. ‘?currencyIds=cre

  • entity_id_search (String)

    Query param: Case-insensitive substring match on the entity id (‘%`/`_` matched

  • entity_type_ids (Array<String>)

    Query param: Filter to one or more entity types, repeated per value (e.g. ‘?enti

  • feature_ids (Array<String>)

    Query param: Feature ids to include, repeated per value (e.g. ‘?featureIds=ai-to

  • limit (Integer)

    Query param: Maximum number of items to return

  • min_utilization (Float)

    Query param: Only nodes with utilization ≥ this value (e.g. 0.8 for ≥80%, 1 for

  • order (Symbol, Stigg::Models::V1::Events::Beta::CustomerRetrieveGovernanceParams::Order)

    Query param: Sort direction: ‘asc` or `desc` (default `desc`).

  • scope (Symbol, Stigg::Models::V1::Events::Beta::CustomerRetrieveGovernanceParams::Scope)

    Query param: Filter by configuration scope: ‘all` (default), `nodeWide` (`[]` on

  • sort_by (Symbol, Stigg::Models::V1::Events::Beta::CustomerRetrieveGovernanceParams::SortBy)

    Query param: Sort key: ‘utilization` (default, cross-capability-safe), `currentU

  • x_account_id (String)

    Header param: Account ID — optional when authenticating with a user JWT (Bearer

  • x_environment_id (String)

    Header param: Environment ID — required when authenticating with a user JWT (Bea

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

Returns:

See Also:



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
# File 'lib/stigg/resources/v1/events/beta/customers.rb', line 52

def retrieve_governance(id, params = {})
  query_params =
    [
      :after,
      :currency_ids,
      :entity_id_search,
      :entity_type_ids,
      :feature_ids,
      :limit,
      :min_utilization,
      :order,
      :scope,
      :sort_by
    ]
  parsed, options = Stigg::V1::Events::Beta::CustomerRetrieveGovernanceParams.dump_request(params)
  query = Stigg::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: ["api/v1-beta/customers/%1$s/governance", id],
    query: query.transform_keys(
      currency_ids: "currencyIds",
      entity_id_search: "entityIdSearch",
      entity_type_ids: "entityTypeIds",
      feature_ids: "featureIds",
      min_utilization: "minUtilization",
      sort_by: "sortBy"
    ),
    headers: parsed.except(*query_params).transform_keys(
      x_account_id: "x-account-id",
      x_environment_id: "x-environment-id"
    ),
    model: Stigg::Models::V1::Events::Beta::CustomerRetrieveGovernanceResponse,
    options: options
  )
end