Class: Infrawrench::ChangesNamespace
- Inherits:
-
Object
- Object
- Infrawrench::ChangesNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.changes
Instance Attribute Summary collapse
-
#alert_settings ⇒ ChangesAlertSettingsNamespace
readonly
client.changes.alert_settings. -
#revert ⇒ ChangesRevertNamespace
readonly
client.changes.revert.
Instance Method Summary collapse
-
#cost_impacts(org_id: nil, body: nil, request_options: nil) ⇒ Hash
Cost impact of a page of changes.
-
#get(org_id: nil, page: nil, page_size: nil, account_id: nil, resource_id: nil, kind: nil, from: nil, to: nil, request_options: nil) ⇒ Hash
Org-wide change timeline (paginated, filterable).
-
#initialize(transport) ⇒ ChangesNamespace
constructor
private
A new instance of ChangesNamespace.
-
#resource(resource_id:, org_id: nil, limit: nil, request_options: nil) ⇒ Hash
Change timeline for one resource.
Constructor Details
#initialize(transport) ⇒ ChangesNamespace
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 ChangesNamespace.
3139 3140 3141 3142 3143 |
# File 'lib/infrawrench/client.rb', line 3139 def initialize(transport) @transport = transport @alert_settings = ChangesAlertSettingsNamespace.new(@transport) @revert = ChangesRevertNamespace.new(@transport) end |
Instance Attribute Details
#alert_settings ⇒ ChangesAlertSettingsNamespace (readonly)
Returns client.changes.alert_settings.
3133 3134 3135 |
# File 'lib/infrawrench/client.rb', line 3133 def alert_settings @alert_settings end |
#revert ⇒ ChangesRevertNamespace (readonly)
Returns client.changes.revert.
3135 3136 3137 |
# File 'lib/infrawrench/client.rb', line 3135 def revert @revert end |
Instance Method Details
#cost_impacts(org_id: nil, body: nil, request_options: nil) ⇒ Hash
Cost impact of a page of changes
For each change, compares the resource's per-day spend over the window before it against the window after, and reports the difference as a run-rate delta.
A POST because it takes a list of ids, not because it writes: nothing is stored. The answer is recomputed on every call, deliberately — provider cost arrives late and is then restated, so a stored number would be a wrong number that never corrects itself.
Both windows exclude the change's own day (spend on it is half old shape, half new) and today (an accruing day always reads as a dip), and are clamped symmetrically to the days cost collection actually covers.
Requires permission: costs:read.
POST /api/org/orgId/changes/cost-impacts
Raises on 400: Bad request
3173 3174 3175 3176 3177 3178 3179 3180 3181 |
# File 'lib/infrawrench/client.rb', line 3173 def cost_impacts(org_id: nil, body: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/changes/cost-impacts", path_params: { "orgId" => org_id }, body: body, request_options: ) end |
#get(org_id: nil, page: nil, page_size: nil, account_id: nil, resource_id: nil, kind: nil, from: nil, to: nil, request_options: nil) ⇒ Hash
Org-wide change timeline (paginated, filterable)
Change events recorded by the resource poller: each poll cycle diffs the freshly fetched state against the stored snapshot and records resources that appeared, changed a stored field, or disappeared upstream. Cross-provider by construction — the diff runs on the generic stored record, so every plugin's resources show up here.
Requires permission: resources:read.
GET /api/org/orgId/changes
Raises on 400: Bad request
3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 |
# File 'lib/infrawrench/client.rb', line 3210 def get( org_id: nil, page: nil, page_size: nil, account_id: nil, resource_id: nil, kind: nil, from: nil, to: nil, request_options: nil ) @transport.request( http_method: "GET", path: "/api/org/{orgId}/changes", path_params: { "orgId" => org_id }, query: { "page" => page, "pageSize" => page_size, "accountId" => account_id, "resourceId" => resource_id, "kind" => kind, "from" => from, "to" => to }, request_options: ) end |
#resource(resource_id:, org_id: nil, limit: nil, request_options: nil) ⇒ Hash
Change timeline for one resource
Recent change events for a single resource, newest first. The resource id travels as a query parameter because composite ids contain slashes and colons.
Requires permission: resources:read.
GET /api/org/orgId/changes/resource
Raises on 400: Bad request
3258 3259 3260 3261 3262 3263 3264 3265 3266 |
# File 'lib/infrawrench/client.rb', line 3258 def resource(resource_id:, org_id: nil, limit: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/changes/resource", path_params: { "orgId" => org_id }, query: { "resourceId" => resource_id, "limit" => limit }, request_options: ) end |