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

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Assignments

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

Parameters:



99
100
101
# File 'lib/stigg/resources/v1/events/beta/customers/assignments.rb', line 99

def initialize(client:)
  @client = client
end

Instance Method Details

#list(id, after: nil, before: nil, capability_id: nil, entity_id: nil, limit: nil, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1::Events::Beta::Customers::AssignmentListResponse>

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

Returns a cursor-paginated list of capability assignments for the given customer. An assignment ties an entity to a capability with a usage limit and reset cadence.

Parameters:

  • id (String)

    Path param: The customer identifier (owner) the assignments belong to

  • after (String)

    Query param: Return items that come after this cursor

  • before (String)

    Query param: Return items that come before this cursor

  • capability_id (String)

    Query param: Filter assignments to a specific capability refId

  • entity_id (String)

    Query param: Filter assignments to a specific entity refId

  • limit (Integer)

    Query param: Maximum number of items to return

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



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/stigg/resources/v1/events/beta/customers/assignments.rb', line 41

def list(id, params = {})
  query_params = [:after, :before, :capability_id, :entity_id, :limit]
  parsed, options = Stigg::V1::Events::Beta::Customers::AssignmentListParams.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/assignments", id],
    query: query.transform_keys(capability_id: "capabilityId", entity_id: "entityId"),
    headers: parsed.except(*query_params).transform_keys(
      x_account_id: "x-account-id",
      x_environment_id: "x-environment-id"
    ),
    page: Stigg::Internal::MyCursorIDPage,
    model: Stigg::Models::V1::Events::Beta::Customers::AssignmentListResponse,
    options: options
  )
end

#upsert(id, assignments:, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Events::Beta::Customers::AssignmentUpsertResponse

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

Batched create-or-update of capability assignments. Existing assignments matched by (entityId, capabilityId) are updated; new pairs are created. On update, omitted fields (usageLimit, cadence) are preserved; on create both are required by the governance service.

Parameters:

  • id (String)

    Path param: The customer identifier (owner) the assignments belong to

  • assignments (Array<Stigg::Models::V1::Events::Beta::Customers::AssignmentUpsertParams::Assignment>)

    Body param: Assignments to upsert (1–100 per request)

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



83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/stigg/resources/v1/events/beta/customers/assignments.rb', line 83

def upsert(id, params)
  parsed, options = Stigg::V1::Events::Beta::Customers::AssignmentUpsertParams.dump_request(params)
  header_params = {x_account_id: "x-account-id", x_environment_id: "x-environment-id"}
  @client.request(
    method: :put,
    path: ["api/v1-beta/customers/%1$s/assignments", id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Stigg::Models::V1::Events::Beta::Customers::AssignmentUpsertResponse,
    options: options
  )
end