Class: Cadenya::Resources::Tenants
- Inherits:
-
Object
- Object
- Cadenya::Resources::Tenants
- Defined in:
- lib/cadenya/resources/tenants.rb,
lib/cadenya/resources/tenants/subjects.rb,
sig/cadenya/resources/tenants.rbs,
sig/cadenya/resources/tenants/subjects.rbs
Overview
Read and erase tenants and the subjects under them. Tenants and subjects are created by assertion — on objective creation or widget session mint — never directly, so this service has no create or update: it exists to enumerate what assertions have produced, and to destroy it on request.
Defined Under Namespace
Classes: Subjects
Instance Attribute Summary collapse
-
#subjects ⇒ Cadenya::Resources::Tenants::Subjects
readonly
Read and erase tenants and the subjects under them.
Instance Method Summary collapse
-
#delete(id, workspace_id: nil, request_options: {}) ⇒ Cadenya::Models::Tenant
Some parameter documentations has been truncated, see Models::TenantDeleteParams for more details.
-
#initialize(client:) ⇒ Tenants
constructor
private
A new instance of Tenants.
-
#list(workspace_id: nil, cursor: nil, include_info: nil, labels: nil, limit: nil, query: nil, sort_order: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Tenant>
Some parameter documentations has been truncated, see Models::TenantListParams for more details.
-
#retrieve(id, workspace_id: nil, include_info: nil, request_options: {}) ⇒ Cadenya::Models::Tenant
Some parameter documentations has been truncated, see Models::TenantRetrieveParams for more details.
Constructor Details
#initialize(client:) ⇒ Tenants
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 Tenants.
136 137 138 139 |
# File 'lib/cadenya/resources/tenants.rb', line 136 def initialize(client:) @client = client @subjects = Cadenya::Resources::Tenants::Subjects.new(client: client) end |
Instance Attribute Details
#subjects ⇒ Cadenya::Resources::Tenants::Subjects (readonly)
Read and erase tenants and the subjects under them. Tenants and subjects are created by assertion — on objective creation or widget session mint — never directly, so this service has no create or update: it exists to enumerate what assertions have produced, and to destroy it on request.
15 16 17 |
# File 'lib/cadenya/resources/tenants.rb', line 15 def subjects @subjects end |
Instance Method Details
#delete(id, workspace_id: nil, request_options: {}) ⇒ Cadenya::Models::Tenant
Some parameter documentations has been truncated, see Models::TenantDeleteParams for more details.
Destroys the tenant, its subjects, every objective associated with it and
everything reachable from those objectives, and its widget sessions. This is the
full erasure hammer, wider than DELETE /widget_sessions, which removes only
what widget sessions created. The work runs in the background: this returns the
tenant in STATE_ERASING rather than a count of what was removed, since a large
tenant's history cannot be destroyed inside a request. Poll the tenant to follow
it — STATE_ERASING while it runs, NotFound once it finishes. Erasure is
terminal; a tenant cannot be recovered once it starts.
119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/cadenya/resources/tenants.rb', line 119 def delete(id, params = {}) parsed, = Cadenya::TenantDeleteParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id end @client.request( method: :delete, path: ["v1/workspaces/%1$s/tenants/%2$s", workspace_id, id], model: Cadenya::Tenant, options: ) end |
#list(workspace_id: nil, cursor: nil, include_info: nil, labels: nil, limit: nil, query: nil, sort_order: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Tenant>
Some parameter documentations has been truncated, see Models::TenantListParams for more details.
Lists the tenants asserted in a workspace, newest first. query matches against
a tenant's name and its external_id, for type-ahead filters.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/cadenya/resources/tenants.rb', line 79 def list(params = {}) parsed, = Cadenya::TenantListParams.dump_request(params) query = Cadenya::Internal::Util.encode_query_params(parsed) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id end @client.request( method: :get, path: ["v1/workspaces/%1$s/tenants", workspace_id], query: query.transform_keys(include_info: "includeInfo", sort_order: "sortOrder"), page: Cadenya::Internal::CursorPagination, model: Cadenya::Tenant, options: ) end |
#retrieve(id, workspace_id: nil, include_info: nil, request_options: {}) ⇒ Cadenya::Models::Tenant
Some parameter documentations has been truncated, see Models::TenantRetrieveParams for more details.
Retrieves a tenant by its canonical id or by the external_id:<value> form the
customer asserted it under.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/cadenya/resources/tenants.rb', line 36 def retrieve(id, params = {}) parsed, = Cadenya::TenantRetrieveParams.dump_request(params) query = Cadenya::Internal::Util.encode_query_params(parsed) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id end @client.request( method: :get, path: ["v1/workspaces/%1$s/tenants/%2$s", workspace_id, id], query: query.transform_keys(include_info: "includeInfo"), model: Cadenya::Tenant, options: ) end |