Class: Stigg::Resources::V1Beta::Customers::Assignments
- Inherits:
-
Object
- Object
- Stigg::Resources::V1Beta::Customers::Assignments
- Defined in:
- lib/stigg/resources/v1_beta/customers/assignments.rb
Instance Method Summary collapse
-
#initialize(client:) ⇒ Assignments
constructor
private
A new instance of Assignments.
-
#list(id, after: nil, before: nil, capability_id: nil, entity_id: nil, limit: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1Beta::Customers::AssignmentListResponse>
Returns a cursor-paginated list of capability assignments for the given customer.
-
#upsert(id, assignments:, request_options: {}) ⇒ Stigg::Models::V1Beta::Customers::AssignmentUpsertResponse
Batched create-or-update of capability assignments.
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.
74 75 76 |
# File 'lib/stigg/resources/v1_beta/customers/assignments.rb', line 74 def initialize(client:) @client = client end |
Instance Method Details
#list(id, after: nil, before: nil, capability_id: nil, entity_id: nil, limit: nil, request_options: {}) ⇒ Stigg::Internal::MyCursorIDPage<Stigg::Models::V1Beta::Customers::AssignmentListResponse>
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.
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/stigg/resources/v1_beta/customers/assignments.rb', line 31 def list(id, params = {}) parsed, = Stigg::V1Beta::Customers::AssignmentListParams.dump_request(params) query = Stigg::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["api/v1-beta/customers/%1$s/assignments", id], query: query.transform_keys(capability_id: "capabilityId", entity_id: "entityId"), page: Stigg::Internal::MyCursorIDPage, model: Stigg::Models::V1Beta::Customers::AssignmentListResponse, options: ) end |
#upsert(id, assignments:, request_options: {}) ⇒ Stigg::Models::V1Beta::Customers::AssignmentUpsertResponse
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.
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/stigg/resources/v1_beta/customers/assignments.rb', line 60 def upsert(id, params) parsed, = Stigg::V1Beta::Customers::AssignmentUpsertParams.dump_request(params) @client.request( method: :put, path: ["api/v1-beta/customers/%1$s/assignments", id], body: parsed, model: Stigg::Models::V1Beta::Customers::AssignmentUpsertResponse, options: ) end |