Debian Codegraph @

src/anthropic/resources/beta/organization/workspaces/workspaces.py

raw
1 from __future__ import annotations
2
3 from typing import Dict, List, Optional
4
5 import httpx2
6
7 from .members import (
8 Members,
9 AsyncMembers,
10 MembersWithRawResponse,
11 AsyncMembersWithRawResponse,
12 MembersWithStreamingResponse,
13 AsyncMembersWithStreamingResponse,
14 )
15 from ....._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
16 from ....._utils import is_given, path_template, strip_not_given
17 from ....._compat import cached_property
18 from .rate_limits import (
19 RateLimits,
20 AsyncRateLimits,
21 RateLimitsWithRawResponse,
22 AsyncRateLimitsWithRawResponse,
23 RateLimitsWithStreamingResponse,
24 AsyncRateLimitsWithStreamingResponse,
25 )
26 from ....._resource import SyncAPIResource, AsyncAPIResource
27 from ....._response import (
28 to_raw_response_wrapper,
29 to_streamed_response_wrapper,
30 async_to_raw_response_wrapper,
31 async_to_streamed_response_wrapper,
32 )
33 from .....pagination import SyncPage, AsyncPage
34 from ....._base_client import AsyncPaginator, make_request_options
35 from .service_accounts import (
36 ServiceAccounts,
37 AsyncServiceAccounts,
38 ServiceAccountsWithRawResponse,
39 AsyncServiceAccountsWithRawResponse,
40 ServiceAccountsWithStreamingResponse,
41 AsyncServiceAccountsWithStreamingResponse,
42 )
43 from .....types.anthropic_beta_param import AnthropicBetaParam
44 from .....types.beta.organization.beta_workspace import BetaWorkspace
45 from .....types.beta.organization.beta_data_residency_create_config_param import BetaDataResidencyCreateConfigParam
46 from .....types.beta.organization.beta_data_residency_update_config_param import BetaDataResidencyUpdateConfigParam
47
48 __all__ = ["Workspaces", "AsyncWorkspaces"]
49
50
51 class Workspaces(SyncAPIResource):
52 @cached_property
53 def rate_limits(self) -> RateLimits:
54 return RateLimits(self._client)
55
56 @cached_property
57 def members(self) -> Members:
58 return Members(self._client)
59
60 @cached_property
61 def service_accounts(self) -> ServiceAccounts:
62 return ServiceAccounts(self._client)
63
64 @cached_property
65 def with_raw_response(self) -> WorkspacesWithRawResponse:
66 """
67 This property can be used as a prefix for any HTTP method call to return
68 the raw response object instead of the parsed content.
69
70 For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers
71 """
72 return WorkspacesWithRawResponse(self)
73
74 @cached_property
75 def with_streaming_response(self) -> WorkspacesWithStreamingResponse:
76 """
77 An alternative to `.with_raw_response` that doesn't eagerly read the response body.
78
79 For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response
80 """
81 return WorkspacesWithStreamingResponse(self)
82
83 def create(
84 self,
85 *,
86 name: str,
87 data_residency: Optional[BetaDataResidencyCreateConfigParam] | Omit = omit,
88 display_color: Optional[str] | Omit = omit,
89 external_key_id: Optional[str] | Omit = omit,
90 tags: Optional[Dict[str, str]] | Omit = omit,
91 betas: List[AnthropicBetaParam] | Omit = omit,
92 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
93 # The extra values given here take precedence over values defined on the client or passed to this method.
94 extra_headers: Headers | None = None,
95 extra_query: Query | None = None,
96 extra_body: Body | None = None,
97 timeout: float | httpx2.Timeout | None | NotGiven = not_given,
98 ) -> BetaWorkspace:
99 """
100 Create Workspace
101
102 Args:
103 name: Name of the Workspace.
104
105 data_residency: Data residency configuration for the workspace. If omitted, defaults to
106 `workspace_geo: "us"`, `allowed_inference_geos: "unrestricted"`, and
107 `default_inference_geo: "global"`.
108
109 display_color: Hex color code representing the Workspace in the Anthropic Console.
110
111 external_key_id: ID of the customer-managed encryption key (CMEK) configuration to use for this
112 Workspace. Setting this field requires CMEK to be enabled for your organization.
113 When set, data stored for this Workspace is encrypted with the referenced key.
114 Create key configurations with the External Keys API. On Claude Platform on AWS
115 the value is the AWS KMS key ARN, and the key must be a single-Region key in the
116 same AWS account and Region as the Workspace. On that platform the key is
117 validated against this Workspace when it is attached, so a key-policy problem is
118 reported as an error on this request. This field is write-once: once a key is
119 attached to a Workspace it cannot be detached or replaced. To rotate key
120 material, rotate the underlying key on your cloud KMS; the `external_key_id`
121 stays the same.
122
123 tags: User-defined tags as string key-value pairs. Keys may not begin with
124 `anthropic`.
125
126 betas: Optional header to specify the beta version(s) you want to use.
127
128 extra_headers: Send extra headers
129
130 extra_query: Add additional query parameters to the request
131
132 extra_body: Add additional JSON properties to the request
133
134 timeout: Override the client-level default timeout for this request, in seconds
135 """
136 extra_headers = {
137 **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}),
138 **(extra_headers or {}),
139 }
140 return self._post(
141 "/v1/organizations/workspaces?beta=true",
142 body={
143 "name": name,
144 "data_residency": data_residency,
145 "display_color": display_color,
146 "external_key_id": external_key_id,
147 "tags": tags,
148 },
149 options=make_request_options(
150 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
151 ),
152 cast_to=BetaWorkspace,
153 )
154
155 def retrieve(
156 self,
157 workspace_id: str,
158 *,
159 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
160 # The extra values given here take precedence over values defined on the client or passed to this method.
161 extra_headers: Headers | None = None,
162 extra_query: Query | None = None,
163 extra_body: Body | None = None,
164 timeout: float | httpx2.Timeout | None | NotGiven = not_given,
165 ) -> BetaWorkspace:
166 """
167 Get Workspace
168
169 Args:
170 workspace_id: ID of the Workspace.
171
172 extra_headers: Send extra headers
173
174 extra_query: Add additional query parameters to the request
175
176 extra_body: Add additional JSON properties to the request
177
178 timeout: Override the client-level default timeout for this request, in seconds
179 """
180 if not workspace_id:
181 raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}")
182 return self._get(
183 path_template("/v1/organizations/workspaces/{workspace_id}?beta=true", workspace_id=workspace_id),
184 options=make_request_options(
185 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
186 ),
187 cast_to=BetaWorkspace,
188 )
189
190 def update(
191 self,
192 workspace_id: str,
193 *,
194 data_residency: Optional[BetaDataResidencyUpdateConfigParam] | Omit = omit,
195 display_color: str | Omit = omit,
196 external_key_id: str | Omit = omit,
197 name: str | Omit = omit,
198 tags: Optional[Dict[str, Optional[str]]] | Omit = omit,
199 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
200 # The extra values given here take precedence over values defined on the client or passed to this method.
201 extra_headers: Headers | None = None,
202 extra_query: Query | None = None,
203 extra_body: Body | None = None,
204 timeout: float | httpx2.Timeout | None | NotGiven = not_given,
205 ) -> BetaWorkspace:
206 """
207 Update Workspace
208
209 Args:
210 data_residency: Data residency configuration for the workspace.
211
212 display_color: Hex color code representing the Workspace in the Anthropic Console.
213
214 external_key_id: ID of the customer-managed encryption key (CMEK) configuration to use for this
215 Workspace. Setting this field requires CMEK to be enabled for your organization.
216 When set, data stored for this Workspace is encrypted with the referenced key.
217 Create key configurations with the External Keys API. On Claude Platform on AWS
218 the value is the AWS KMS key ARN, and the key must be a single-Region key in the
219 same AWS account and Region as the Workspace. On that platform the key is
220 validated against this Workspace when it is attached, so a key-policy problem is
221 reported as an error on this request. This field is write-once: once a key is
222 attached to a Workspace it cannot be detached or replaced. To rotate key
223 material, rotate the underlying key on your cloud KMS; the `external_key_id`
224 stays the same.
225
226 name: Name of the Workspace.
227
228 tags: User-defined tags as string key-value pairs. Keys may not begin with
229 `anthropic`.
230
231 extra_headers: Send extra headers
232
233 extra_query: Add additional query parameters to the request
234
235 extra_body: Add additional JSON properties to the request
236
237 timeout: Override the client-level default timeout for this request, in seconds
238 """
239 if not workspace_id:
240 raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}")
241 return self._post(
242 path_template("/v1/organizations/workspaces/{workspace_id}?beta=true", workspace_id=workspace_id),
243 body={
244 "data_residency": data_residency,
245 "display_color": display_color,
246 "external_key_id": external_key_id,
247 "name": name,
248 "tags": tags,
249 },
250 options=make_request_options(
251 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
252 ),
253 cast_to=BetaWorkspace,
254 )
255
256 def list(
257 self,
258 *,
259 after_id: str | Omit = omit,
260 before_id: str | Omit = omit,
261 include_archived: bool | Omit = omit,
262 limit: int | Omit = omit,
263 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
264 # The extra values given here take precedence over values defined on the client or passed to this method.
265 extra_headers: Headers | None = None,
266 extra_query: Query | None = None,
267 extra_body: Body | None = None,
268 timeout: float | httpx2.Timeout | None | NotGiven = not_given,
269 ) -> SyncPage[BetaWorkspace]:
270 """
271 List Workspaces
272
273 Args:
274 after_id: ID of the object to use as a cursor for pagination. When provided, returns the
275 page of results immediately after this object.
276
277 before_id: ID of the object to use as a cursor for pagination. When provided, returns the
278 page of results immediately before this object.
279
280 include_archived: Whether to include Workspaces that have been archived in the response
281
282 limit: Number of items to return per page.
283
284 Defaults to `20`. Ranges from `1` to `1000`.
285
286 extra_headers: Send extra headers
287
288 extra_query: Add additional query parameters to the request
289
290 extra_body: Add additional JSON properties to the request
291
292 timeout: Override the client-level default timeout for this request, in seconds
293 """
294 return self._get_api_list(
295 "/v1/organizations/workspaces?beta=true",
296 page=SyncPage[BetaWorkspace],
297 options=make_request_options(
298 extra_headers=extra_headers,
299 extra_query=extra_query,
300 extra_body=extra_body,
301 timeout=timeout,
302 query={
303 "after_id": after_id,
304 "before_id": before_id,
305 "include_archived": include_archived,
306 "limit": limit,
307 },
308 ),
309 model=BetaWorkspace,
310 )
311
312 def archive(
313 self,
314 workspace_id: str,
315 *,
316 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
317 # The extra values given here take precedence over values defined on the client or passed to this method.
318 extra_headers: Headers | None = None,
319 extra_query: Query | None = None,
320 extra_body: Body | None = None,
321 timeout: float | httpx2.Timeout | None | NotGiven = not_given,
322 ) -> BetaWorkspace:
323 """
324 Archive Workspace
325
326 Args:
327 extra_headers: Send extra headers
328
329 extra_query: Add additional query parameters to the request
330
331 extra_body: Add additional JSON properties to the request
332
333 timeout: Override the client-level default timeout for this request, in seconds
334 """
335 if not workspace_id:
336 raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}")
337 return self._post(
338 path_template("/v1/organizations/workspaces/{workspace_id}/archive?beta=true", workspace_id=workspace_id),
339 options=make_request_options(
340 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
341 ),
342 cast_to=BetaWorkspace,
343 )
344
345
346 class AsyncWorkspaces(AsyncAPIResource):
347 @cached_property
348 def rate_limits(self) -> AsyncRateLimits:
349 return AsyncRateLimits(self._client)
350
351 @cached_property
352 def members(self) -> AsyncMembers:
353 return AsyncMembers(self._client)
354
355 @cached_property
356 def service_accounts(self) -> AsyncServiceAccounts:
357 return AsyncServiceAccounts(self._client)
358
359 @cached_property
360 def with_raw_response(self) -> AsyncWorkspacesWithRawResponse:
361 """
362 This property can be used as a prefix for any HTTP method call to return
363 the raw response object instead of the parsed content.
364
365 For more information, see https://www.github.com/anthropics/anthropic-sdk-python#accessing-raw-response-data-eg-headers
366 """
367 return AsyncWorkspacesWithRawResponse(self)
368
369 @cached_property
370 def with_streaming_response(self) -> AsyncWorkspacesWithStreamingResponse:
371 """
372 An alternative to `.with_raw_response` that doesn't eagerly read the response body.
373
374 For more information, see https://www.github.com/anthropics/anthropic-sdk-python#with_streaming_response
375 """
376 return AsyncWorkspacesWithStreamingResponse(self)
377
378 async def create(
379 self,
380 *,
381 name: str,
382 data_residency: Optional[BetaDataResidencyCreateConfigParam] | Omit = omit,
383 display_color: Optional[str] | Omit = omit,
384 external_key_id: Optional[str] | Omit = omit,
385 tags: Optional[Dict[str, str]] | Omit = omit,
386 betas: List[AnthropicBetaParam] | Omit = omit,
387 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
388 # The extra values given here take precedence over values defined on the client or passed to this method.
389 extra_headers: Headers | None = None,
390 extra_query: Query | None = None,
391 extra_body: Body | None = None,
392 timeout: float | httpx2.Timeout | None | NotGiven = not_given,
393 ) -> BetaWorkspace:
394 """
395 Create Workspace
396
397 Args:
398 name: Name of the Workspace.
399
400 data_residency: Data residency configuration for the workspace. If omitted, defaults to
401 `workspace_geo: "us"`, `allowed_inference_geos: "unrestricted"`, and
402 `default_inference_geo: "global"`.
403
404 display_color: Hex color code representing the Workspace in the Anthropic Console.
405
406 external_key_id: ID of the customer-managed encryption key (CMEK) configuration to use for this
407 Workspace. Setting this field requires CMEK to be enabled for your organization.
408 When set, data stored for this Workspace is encrypted with the referenced key.
409 Create key configurations with the External Keys API. On Claude Platform on AWS
410 the value is the AWS KMS key ARN, and the key must be a single-Region key in the
411 same AWS account and Region as the Workspace. On that platform the key is
412 validated against this Workspace when it is attached, so a key-policy problem is
413 reported as an error on this request. This field is write-once: once a key is
414 attached to a Workspace it cannot be detached or replaced. To rotate key
415 material, rotate the underlying key on your cloud KMS; the `external_key_id`
416 stays the same.
417
418 tags: User-defined tags as string key-value pairs. Keys may not begin with
419 `anthropic`.
420
421 betas: Optional header to specify the beta version(s) you want to use.
422
423 extra_headers: Send extra headers
424
425 extra_query: Add additional query parameters to the request
426
427 extra_body: Add additional JSON properties to the request
428
429 timeout: Override the client-level default timeout for this request, in seconds
430 """
431 extra_headers = {
432 **strip_not_given({"anthropic-beta": ",".join(str(e) for e in betas) if is_given(betas) else not_given}),
433 **(extra_headers or {}),
434 }
435 return await self._post(
436 "/v1/organizations/workspaces?beta=true",
437 body={
438 "name": name,
439 "data_residency": data_residency,
440 "display_color": display_color,
441 "external_key_id": external_key_id,
442 "tags": tags,
443 },
444 options=make_request_options(
445 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
446 ),
447 cast_to=BetaWorkspace,
448 )
449
450 async def retrieve(
451 self,
452 workspace_id: str,
453 *,
454 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
455 # The extra values given here take precedence over values defined on the client or passed to this method.
456 extra_headers: Headers | None = None,
457 extra_query: Query | None = None,
458 extra_body: Body | None = None,
459 timeout: float | httpx2.Timeout | None | NotGiven = not_given,
460 ) -> BetaWorkspace:
461 """
462 Get Workspace
463
464 Args:
465 workspace_id: ID of the Workspace.
466
467 extra_headers: Send extra headers
468
469 extra_query: Add additional query parameters to the request
470
471 extra_body: Add additional JSON properties to the request
472
473 timeout: Override the client-level default timeout for this request, in seconds
474 """
475 if not workspace_id:
476 raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}")
477 return await self._get(
478 path_template("/v1/organizations/workspaces/{workspace_id}?beta=true", workspace_id=workspace_id),
479 options=make_request_options(
480 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
481 ),
482 cast_to=BetaWorkspace,
483 )
484
485 async def update(
486 self,
487 workspace_id: str,
488 *,
489 data_residency: Optional[BetaDataResidencyUpdateConfigParam] | Omit = omit,
490 display_color: str | Omit = omit,
491 external_key_id: str | Omit = omit,
492 name: str | Omit = omit,
493 tags: Optional[Dict[str, Optional[str]]] | Omit = omit,
494 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
495 # The extra values given here take precedence over values defined on the client or passed to this method.
496 extra_headers: Headers | None = None,
497 extra_query: Query | None = None,
498 extra_body: Body | None = None,
499 timeout: float | httpx2.Timeout | None | NotGiven = not_given,
500 ) -> BetaWorkspace:
501 """
502 Update Workspace
503
504 Args:
505 data_residency: Data residency configuration for the workspace.
506
507 display_color: Hex color code representing the Workspace in the Anthropic Console.
508
509 external_key_id: ID of the customer-managed encryption key (CMEK) configuration to use for this
510 Workspace. Setting this field requires CMEK to be enabled for your organization.
511 When set, data stored for this Workspace is encrypted with the referenced key.
512 Create key configurations with the External Keys API. On Claude Platform on AWS
513 the value is the AWS KMS key ARN, and the key must be a single-Region key in the
514 same AWS account and Region as the Workspace. On that platform the key is
515 validated against this Workspace when it is attached, so a key-policy problem is
516 reported as an error on this request. This field is write-once: once a key is
517 attached to a Workspace it cannot be detached or replaced. To rotate key
518 material, rotate the underlying key on your cloud KMS; the `external_key_id`
519 stays the same.
520
521 name: Name of the Workspace.
522
523 tags: User-defined tags as string key-value pairs. Keys may not begin with
524 `anthropic`.
525
526 extra_headers: Send extra headers
527
528 extra_query: Add additional query parameters to the request
529
530 extra_body: Add additional JSON properties to the request
531
532 timeout: Override the client-level default timeout for this request, in seconds
533 """
534 if not workspace_id:
535 raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}")
536 return await self._post(
537 path_template("/v1/organizations/workspaces/{workspace_id}?beta=true", workspace_id=workspace_id),
538 body={
539 "data_residency": data_residency,
540 "display_color": display_color,
541 "external_key_id": external_key_id,
542 "name": name,
543 "tags": tags,
544 },
545 options=make_request_options(
546 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
547 ),
548 cast_to=BetaWorkspace,
549 )
550
551 def list(
552 self,
553 *,
554 after_id: str | Omit = omit,
555 before_id: str | Omit = omit,
556 include_archived: bool | Omit = omit,
557 limit: int | Omit = omit,
558 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
559 # The extra values given here take precedence over values defined on the client or passed to this method.
560 extra_headers: Headers | None = None,
561 extra_query: Query | None = None,
562 extra_body: Body | None = None,
563 timeout: float | httpx2.Timeout | None | NotGiven = not_given,
564 ) -> AsyncPaginator[BetaWorkspace, AsyncPage[BetaWorkspace]]:
565 """
566 List Workspaces
567
568 Args:
569 after_id: ID of the object to use as a cursor for pagination. When provided, returns the
570 page of results immediately after this object.
571
572 before_id: ID of the object to use as a cursor for pagination. When provided, returns the
573 page of results immediately before this object.
574
575 include_archived: Whether to include Workspaces that have been archived in the response
576
577 limit: Number of items to return per page.
578
579 Defaults to `20`. Ranges from `1` to `1000`.
580
581 extra_headers: Send extra headers
582
583 extra_query: Add additional query parameters to the request
584
585 extra_body: Add additional JSON properties to the request
586
587 timeout: Override the client-level default timeout for this request, in seconds
588 """
589 return self._get_api_list(
590 "/v1/organizations/workspaces?beta=true",
591 page=AsyncPage[BetaWorkspace],
592 options=make_request_options(
593 extra_headers=extra_headers,
594 extra_query=extra_query,
595 extra_body=extra_body,
596 timeout=timeout,
597 query={
598 "after_id": after_id,
599 "before_id": before_id,
600 "include_archived": include_archived,
601 "limit": limit,
602 },
603 ),
604 model=BetaWorkspace,
605 )
606
607 async def archive(
608 self,
609 workspace_id: str,
610 *,
611 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
612 # The extra values given here take precedence over values defined on the client or passed to this method.
613 extra_headers: Headers | None = None,
614 extra_query: Query | None = None,
615 extra_body: Body | None = None,
616 timeout: float | httpx2.Timeout | None | NotGiven = not_given,
617 ) -> BetaWorkspace:
618 """
619 Archive Workspace
620
621 Args:
622 extra_headers: Send extra headers
623
624 extra_query: Add additional query parameters to the request
625
626 extra_body: Add additional JSON properties to the request
627
628 timeout: Override the client-level default timeout for this request, in seconds
629 """
630 if not workspace_id:
631 raise ValueError(f"Expected a non-empty value for `workspace_id` but received {workspace_id!r}")
632 return await self._post(
633 path_template("/v1/organizations/workspaces/{workspace_id}/archive?beta=true", workspace_id=workspace_id),
634 options=make_request_options(
635 extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
636 ),
637 cast_to=BetaWorkspace,
638 )
639
640
641 class WorkspacesWithRawResponse:
642 def __init__(self, workspaces: Workspaces) -> None:
643 self._workspaces = workspaces
644
645 self.create = to_raw_response_wrapper(
646 workspaces.create,
647 )
648 self.retrieve = to_raw_response_wrapper(
649 workspaces.retrieve,
650 )
651 self.update = to_raw_response_wrapper(
652 workspaces.update,
653 )
654 self.list = to_raw_response_wrapper(
655 workspaces.list,
656 )
657 self.archive = to_raw_response_wrapper(
658 workspaces.archive,
659 )
660
661 @cached_property
662 def rate_limits(self) -> RateLimitsWithRawResponse:
663 return RateLimitsWithRawResponse(self._workspaces.rate_limits)
664
665 @cached_property
666 def members(self) -> MembersWithRawResponse:
667 return MembersWithRawResponse(self._workspaces.members)
668
669 @cached_property
670 def service_accounts(self) -> ServiceAccountsWithRawResponse:
671 return ServiceAccountsWithRawResponse(self._workspaces.service_accounts)
672
673
674 class AsyncWorkspacesWithRawResponse:
675 def __init__(self, workspaces: AsyncWorkspaces) -> None:
676 self._workspaces = workspaces
677
678 self.create = async_to_raw_response_wrapper(
679 workspaces.create,
680 )
681 self.retrieve = async_to_raw_response_wrapper(
682 workspaces.retrieve,
683 )
684 self.update = async_to_raw_response_wrapper(
685 workspaces.update,
686 )
687 self.list = async_to_raw_response_wrapper(
688 workspaces.list,
689 )
690 self.archive = async_to_raw_response_wrapper(
691 workspaces.archive,
692 )
693
694 @cached_property
695 def rate_limits(self) -> AsyncRateLimitsWithRawResponse:
696 return AsyncRateLimitsWithRawResponse(self._workspaces.rate_limits)
697
698 @cached_property
699 def members(self) -> AsyncMembersWithRawResponse:
700 return AsyncMembersWithRawResponse(self._workspaces.members)
701
702 @cached_property
703 def service_accounts(self) -> AsyncServiceAccountsWithRawResponse:
704 return AsyncServiceAccountsWithRawResponse(self._workspaces.service_accounts)
705
706
707 class WorkspacesWithStreamingResponse:
708 def __init__(self, workspaces: Workspaces) -> None:
709 self._workspaces = workspaces
710
711 self.create = to_streamed_response_wrapper(
712 workspaces.create,
713 )
714 self.retrieve = to_streamed_response_wrapper(
715 workspaces.retrieve,
716 )
717 self.update = to_streamed_response_wrapper(
718 workspaces.update,
719 )
720 self.list = to_streamed_response_wrapper(
721 workspaces.list,
722 )
723 self.archive = to_streamed_response_wrapper(
724 workspaces.archive,
725 )
726
727 @cached_property
728 def rate_limits(self) -> RateLimitsWithStreamingResponse:
729 return RateLimitsWithStreamingResponse(self._workspaces.rate_limits)
730
731 @cached_property
732 def members(self) -> MembersWithStreamingResponse:
733 return MembersWithStreamingResponse(self._workspaces.members)
734
735 @cached_property
736 def service_accounts(self) -> ServiceAccountsWithStreamingResponse:
737 return ServiceAccountsWithStreamingResponse(self._workspaces.service_accounts)
738
739
740 class AsyncWorkspacesWithStreamingResponse:
741 def __init__(self, workspaces: AsyncWorkspaces) -> None:
742 self._workspaces = workspaces
743
744 self.create = async_to_streamed_response_wrapper(
745 workspaces.create,
746 )
747 self.retrieve = async_to_streamed_response_wrapper(
748 workspaces.retrieve,
749 )
750 self.update = async_to_streamed_response_wrapper(
751 workspaces.update,
752 )
753 self.list = async_to_streamed_response_wrapper(
754 workspaces.list,
755 )
756 self.archive = async_to_streamed_response_wrapper(
757 workspaces.archive,
758 )
759
760 @cached_property
761 def rate_limits(self) -> AsyncRateLimitsWithStreamingResponse:
762 return AsyncRateLimitsWithStreamingResponse(self._workspaces.rate_limits)
763
764 @cached_property
765 def members(self) -> AsyncMembersWithStreamingResponse:
766 return AsyncMembersWithStreamingResponse(self._workspaces.members)
767
768 @cached_property
769 def service_accounts(self) -> AsyncServiceAccountsWithStreamingResponse:
770 return AsyncServiceAccountsWithStreamingResponse(self._workspaces.service_accounts)