Class: Cadenya::Resources::WorkspaceAdmin
- Inherits:
-
Object
- Object
- Cadenya::Resources::WorkspaceAdmin
- Defined in:
- lib/cadenya/resources/workspace_admin.rb,
lib/cadenya/resources/workspace_admin/members.rb,
lib/cadenya/resources/workspace_admin/profiles.rb
Overview
Administer workspaces across the account: create and archive workspaces and manage their membership. These operations are account-scoped and require the admin role (a token whose profile holds the WorkOS admin role); they live under /v1/account/workspaces rather than the workspace-scoped /v1/workspaces tree so an admin can manage any workspace in the account, including ones they are not themselves a member of.
Defined Under Namespace
Instance Attribute Summary collapse
-
#members ⇒ Cadenya::Resources::WorkspaceAdmin::Members
readonly
Administer workspaces across the account: create and archive workspaces and manage their membership.
-
#profiles ⇒ Cadenya::Resources::WorkspaceAdmin::Profiles
readonly
Administer workspaces across the account: create and archive workspaces and manage their membership.
Instance Method Summary collapse
-
#archive(workspace_id, request_options: {}) ⇒ nil
Archives a workspace (soft delete).
-
#create(metadata:, spec:, request_options: {}) ⇒ Cadenya::Models::Workspace
Some parameter documentations has been truncated, see Models::WorkspaceAdminCreateParams for more details.
-
#initialize(client:) ⇒ WorkspaceAdmin
constructor
private
A new instance of WorkspaceAdmin.
-
#list(cursor: nil, include_archived: nil, limit: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Workspace>
Some parameter documentations has been truncated, see Models::WorkspaceAdminListParams for more details.
-
#retrieve(workspace_id, request_options: {}) ⇒ Cadenya::Models::Workspace
Retrieves a workspace in the account by ID.
-
#update(workspace_id, metadata: nil, spec: nil, update_mask: nil, request_options: {}) ⇒ Cadenya::Models::Workspace
Some parameter documentations has been truncated, see Models::WorkspaceAdminUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ WorkspaceAdmin
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 WorkspaceAdmin.
166 167 168 169 170 |
# File 'lib/cadenya/resources/workspace_admin.rb', line 166 def initialize(client:) @client = client @members = Cadenya::Resources::WorkspaceAdmin::Members.new(client: client) @profiles = Cadenya::Resources::WorkspaceAdmin::Profiles.new(client: client) end |
Instance Attribute Details
#members ⇒ Cadenya::Resources::WorkspaceAdmin::Members (readonly)
Administer workspaces across the account: create and archive workspaces and manage their membership. These operations are account-scoped and require the admin role (a token whose profile holds the WorkOS admin role); they live under /v1/account/workspaces rather than the workspace-scoped /v1/workspaces tree so an admin can manage any workspace in the account, including ones they are not themselves a member of.
19 20 21 |
# File 'lib/cadenya/resources/workspace_admin.rb', line 19 def members @members end |
#profiles ⇒ Cadenya::Resources::WorkspaceAdmin::Profiles (readonly)
Administer workspaces across the account: create and archive workspaces and manage their membership. These operations are account-scoped and require the admin role (a token whose profile holds the WorkOS admin role); they live under /v1/account/workspaces rather than the workspace-scoped /v1/workspaces tree so an admin can manage any workspace in the account, including ones they are not themselves a member of.
28 29 30 |
# File 'lib/cadenya/resources/workspace_admin.rb', line 28 def profiles @profiles end |
Instance Method Details
#archive(workspace_id, request_options: {}) ⇒ nil
Archives a workspace (soft delete). The workspace is retained, but any subsequent request scoped to it returns a permission error. Archiving the account’s last active (non-archived) workspace is not allowed and returns FailedPrecondition. Admin only.
154 155 156 157 158 159 160 161 |
# File 'lib/cadenya/resources/workspace_admin.rb', line 154 def archive(workspace_id, params = {}) @client.request( method: :delete, path: ["v1/account/workspaces/%1$s", workspace_id], model: NilClass, options: params[:request_options] ) end |
#create(metadata:, spec:, request_options: {}) ⇒ Cadenya::Models::Workspace
Some parameter documentations has been truncated, see Models::WorkspaceAdminCreateParams for more details.
Creates a new workspace in the account. Admin only.
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/cadenya/resources/workspace_admin.rb', line 46 def create(params) parsed, = Cadenya::WorkspaceAdminCreateParams.dump_request(params) @client.request( method: :post, path: "v1/account/workspaces", body: parsed, model: Cadenya::Workspace, options: ) end |
#list(cursor: nil, include_archived: nil, limit: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Workspace>
Some parameter documentations has been truncated, see Models::WorkspaceAdminListParams for more details.
Lists every workspace in the account, optionally including archived ones. Admin only.
127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/cadenya/resources/workspace_admin.rb', line 127 def list(params = {}) parsed, = Cadenya::WorkspaceAdminListParams.dump_request(params) query = Cadenya::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/account/workspaces", query: query.transform_keys(include_archived: "includeArchived"), page: Cadenya::Internal::CursorPagination, model: Cadenya::Workspace, options: ) end |
#retrieve(workspace_id, request_options: {}) ⇒ Cadenya::Models::Workspace
Retrieves a workspace in the account by ID. Admin only.
68 69 70 71 72 73 74 75 |
# File 'lib/cadenya/resources/workspace_admin.rb', line 68 def retrieve(workspace_id, params = {}) @client.request( method: :get, path: ["v1/account/workspaces/%1$s", workspace_id], model: Cadenya::Workspace, options: params[:request_options] ) end |
#update(workspace_id, metadata: nil, spec: nil, update_mask: nil, request_options: {}) ⇒ Cadenya::Models::Workspace
Some parameter documentations has been truncated, see Models::WorkspaceAdminUpdateParams for more details.
Updates a workspace’s metadata (e.g. name) and spec. Admin only.
97 98 99 100 101 102 103 104 105 106 |
# File 'lib/cadenya/resources/workspace_admin.rb', line 97 def update(workspace_id, params = {}) parsed, = Cadenya::WorkspaceAdminUpdateParams.dump_request(params) @client.request( method: :patch, path: ["v1/account/workspaces/%1$s", workspace_id], body: parsed, model: Cadenya::Workspace, options: ) end |