| 1 |
from functools import cached_property |
| 2 |
|
| 3 |
from ..collection import DynamicScopeCollection, _url_scope, _urn_scope |
| 4 |
from ..representation import Scope |
| 5 |
|
| 6 |
|
| 7 |
class GCSEndpointScopes(DynamicScopeCollection): |
| 8 |
""" |
| 9 |
A dynamic ScopeCollection with a named property for the GCS |
| 10 |
manage_collections scope. "manage_collections" is a scope on GCS Endpoints. |
| 11 |
The resource_server string should be the GCS Endpoint ID. |
| 12 |
|
| 13 |
**Examples** |
| 14 |
|
| 15 |
>>> sc = GCSEndpointScopes("xyz") |
| 16 |
>>> mc_scope = sb.manage_collections |
| 17 |
""" |
| 18 |
|
| 19 |
_scope_names = ("manage_collections",) |
| 20 |
|
| 21 |
@cached_property |
| 22 |
def manage_collections(self) -> Scope: |
| 23 |
return _urn_scope(self.resource_server, "manage_collections") |
| 24 |
|
| 25 |
|
| 26 |
class GCSCollectionScopes(DynamicScopeCollection): |
| 27 |
""" |
| 28 |
A dynamic ScopeCollection with a named property for the GCS data_access scope. |
| 29 |
"data_access" is a scope on GCS Collections. The resource_server string should |
| 30 |
be the GCS Collection ID. |
| 31 |
|
| 32 |
**Examples** |
| 33 |
|
| 34 |
>>> sc = GCSCollectionScopes("xyz") |
| 35 |
>>> da_scope = sc.data_access |
| 36 |
>>> https_scope = sc.https |
| 37 |
""" |
| 38 |
|
| 39 |
_scope_names = ("data_access", "https") |
| 40 |
|
| 41 |
@cached_property |
| 42 |
def data_access(self) -> Scope: |
| 43 |
return _url_scope(self.resource_server, "data_access") |
| 44 |
|
| 45 |
@cached_property |
| 46 |
def https(self) -> Scope: |
| 47 |
return _url_scope(self.resource_server, "https") |