Class: Infrawrench::AccountsNamespace
- Inherits:
-
Object
- Object
- Infrawrench::AccountsNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.accounts
Instance Attribute Summary collapse
-
#credentials ⇒ AccountsCredentialsNamespace
readonly
client.accounts.credentials. -
#sync_type ⇒ AccountsSyncTypeNamespace
readonly
client.accounts.sync_type.
Instance Method Summary collapse
-
#create(body:, org_id: nil, request_options: nil) ⇒ Hash
Create an account.
-
#delete(id:, org_id: nil, request_options: nil) ⇒ Hash
Delete an account.
-
#detail(id:, org_id: nil, request_options: nil) ⇒ Hash
Account metadata + resource type list.
-
#initialize(transport) ⇒ AccountsNamespace
constructor
private
A new instance of AccountsNamespace.
-
#list(org_id: nil, request_options: nil) ⇒ Array<Hash>
List accounts in this organization.
-
#plugins(org_id: nil, request_options: nil) ⇒ Array<Hash>
List installed plugins and their credential fields.
-
#resources(id:, org_id: nil, top_level_only: nil, request_options: nil) ⇒ Array<Hash>
List cached resources for an account.
-
#sync(id:, org_id: nil, request_options: nil) ⇒ Hash
Sync all resource types for an account.
-
#update(id:, body:, org_id: nil, request_options: nil) ⇒ Hash
Update an account (rename and/or change bastion binding).
Constructor Details
#initialize(transport) ⇒ AccountsNamespace
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 AccountsNamespace.
127 128 129 130 131 |
# File 'lib/infrawrench/client.rb', line 127 def initialize(transport) @transport = transport @credentials = AccountsCredentialsNamespace.new(@transport) @sync_type = AccountsSyncTypeNamespace.new(@transport) end |
Instance Attribute Details
#credentials ⇒ AccountsCredentialsNamespace (readonly)
Returns client.accounts.credentials.
121 122 123 |
# File 'lib/infrawrench/client.rb', line 121 def credentials @credentials end |
#sync_type ⇒ AccountsSyncTypeNamespace (readonly)
Returns client.accounts.sync_type.
123 124 125 |
# File 'lib/infrawrench/client.rb', line 123 def sync_type @sync_type end |
Instance Method Details
#create(body:, org_id: nil, request_options: nil) ⇒ Hash
Create an account
Stores encrypted credentials and triggers a first sync. syncError is set
if the initial sync failed (the account row is still created).
Requires permission: accounts:write.
POST /api/org/orgId/accounts
Raises on 400: Bad request
151 152 153 154 155 156 157 158 159 |
# File 'lib/infrawrench/client.rb', line 151 def create(body:, org_id: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/accounts", path_params: { "orgId" => org_id }, body: body, request_options: ) end |
#delete(id:, org_id: nil, request_options: nil) ⇒ Hash
Delete an account
Requires permission: accounts:delete.
DELETE /api/org/orgId/accounts/id
173 174 175 176 177 178 179 180 |
# File 'lib/infrawrench/client.rb', line 173 def delete(id:, org_id: nil, request_options: nil) @transport.request( http_method: "DELETE", path: "/api/org/{orgId}/accounts/{id}", path_params: { "orgId" => org_id, "id" => id }, request_options: ) end |
#detail(id:, org_id: nil, request_options: nil) ⇒ Hash
Account metadata + resource type list
Requires permission: accounts:read.
GET /api/org/orgId/accounts/id/detail
Raises on 404: Not found
196 197 198 199 200 201 202 203 |
# File 'lib/infrawrench/client.rb', line 196 def detail(id:, org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/accounts/{id}/detail", path_params: { "orgId" => org_id, "id" => id }, request_options: ) end |
#list(org_id: nil, request_options: nil) ⇒ Array<Hash>
List accounts in this organization
Requires permission: accounts:read.
GET /api/org/orgId/accounts
217 218 219 220 221 222 223 224 |
# File 'lib/infrawrench/client.rb', line 217 def list(org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/accounts", path_params: { "orgId" => org_id }, request_options: ) end |
#plugins(org_id: nil, request_options: nil) ⇒ Array<Hash>
List installed plugins and their credential fields
Requires permission: accounts:read.
GET /api/org/orgId/accounts/plugins
238 239 240 241 242 243 244 245 |
# File 'lib/infrawrench/client.rb', line 238 def plugins(org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/accounts/plugins", path_params: { "orgId" => org_id }, request_options: ) end |
#resources(id:, org_id: nil, top_level_only: nil, request_options: nil) ⇒ Array<Hash>
List cached resources for an account
Requires permission: resources:read.
GET /api/org/orgId/accounts/id/resources
262 263 264 265 266 267 268 269 270 |
# File 'lib/infrawrench/client.rb', line 262 def resources(id:, org_id: nil, top_level_only: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/accounts/{id}/resources", path_params: { "orgId" => org_id, "id" => id }, query: { "topLevelOnly" => top_level_only }, request_options: ) end |
#sync(id:, org_id: nil, request_options: nil) ⇒ Hash
Sync all resource types for an account
Requires permission: resources:read.
POST /api/org/orgId/accounts/id/sync
284 285 286 287 288 289 290 291 |
# File 'lib/infrawrench/client.rb', line 284 def sync(id:, org_id: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/accounts/{id}/sync", path_params: { "orgId" => org_id, "id" => id }, request_options: ) end |
#update(id:, body:, org_id: nil, request_options: nil) ⇒ Hash
Update an account (rename and/or change bastion binding)
Requires permission: accounts:write.
PATCH /api/org/orgId/accounts/id
Raises on 400: Bad request
Raises on 404: Not found
310 311 312 313 314 315 316 317 318 |
# File 'lib/infrawrench/client.rb', line 310 def update(id:, body:, org_id: nil, request_options: nil) @transport.request( http_method: "PATCH", path: "/api/org/{orgId}/accounts/{id}", path_params: { "orgId" => org_id, "id" => id }, body: body, request_options: ) end |