from __future__ import annotations
import abc
import typing as t
from globus_sdk import utils
from globus_sdk._types import UUIDLike
from ._common import DatatypeCallback, ensure_datatype
[docs]
class POSIXStoragePolicies(StorageGatewayPolicies):
"""
Convenience class for constructing a POSIX Storage Policy document
to use as the ``policies`` parameter when creating a StorageGatewayDocument
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for
this class.
:param groups_allow: List of POSIX group IDs allowed to access this Storage
Gateway. Private.
:param groups_deny: List of POSIX group IDs denied access this Storage
Gateway. Private.
:param additional_fields: Additional data for inclusion in the policy document
"""
def __init__(
self,
DATA_TYPE: str = "posix_storage_policies#1.0.0",
groups_allow: t.Iterable[str] | None = None,
groups_deny: t.Iterable[str] | None = None,
additional_fields: dict[str, t.Any] | None = None,
) -> None:
super().__init__()
self._set_optstrs(DATA_TYPE=DATA_TYPE)
self._set_optstrlists(groups_allow=groups_allow, groups_deny=groups_deny)
if additional_fields is not None:
self.update(additional_fields)
[docs]
class POSIXStagingStoragePolicies(StorageGatewayPolicies):
"""
Convenience class for constructing a POSIX Staging Storage Policy document
to use as the ``policies`` parameter when creating a StorageGatewayDocument
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for
this class.
:param groups_allow: List of POSIX group IDs allowed to access this Storage
Gateway. Private.
:param groups_deny: List of POSIX group IDs denied access this Storage
Gateway. Private.
:param stage_app: Path to the stage app. Private.
:param environment: A mapping of variable names to values to set in the environment
when executing the ``stage_app``. Private.
:param additional_fields: Additional data for inclusion in the policy document
"""
def __init__(
self,
DATA_TYPE: str = "posix_staging_storage_policies#1.0.0",
groups_allow: t.Iterable[str] | None = None,
groups_deny: t.Iterable[str] | None = None,
stage_app: str | None = None,
environment: t.Iterable[dict[str, str]] | None = None,
additional_fields: dict[str, t.Any] | None = None,
) -> None:
super().__init__()
self._set_optstrs(DATA_TYPE=DATA_TYPE, stage_app=stage_app)
self._set_optstrlists(groups_allow=groups_allow, groups_deny=groups_deny)
self._set_value(
"environment",
environment,
callback=lambda env_iter: [{**e} for e in env_iter],
)
if additional_fields is not None:
self.update(additional_fields)
[docs]
class BlackPearlStoragePolicies(StorageGatewayPolicies):
"""
Convenience class for constructing a BlackPearl Storage Policy document
to use as the ``policies`` parameter when creating a StorageGatewayDocument.
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for
this class.
:param s3_endpoint: The URL of the S3 endpoint of the BlackPearl appliance to use to
access collections on this Storage Gateway.
:param bp_access_id_file: Path to the file which provides mappings from usernames
within the configured identity domain to the ID and secret associated with the
user's BlackPearl account
:param additional_fields: Additional data for inclusion in the policy document
"""
def __init__(
self,
DATA_TYPE: str = "blackpearl_storage_policies#1.0.0",
s3_endpoint: str | None = None,
bp_access_id_file: str | None = None,
additional_fields: dict[str, t.Any] | None = None,
) -> None:
super().__init__()
self._set_optstrs(
DATA_TYPE=DATA_TYPE,
s3_endpoint=s3_endpoint,
bp_access_id_file=bp_access_id_file,
)
if additional_fields is not None:
self.update(additional_fields)
[docs]
class BoxStoragePolicies(StorageGatewayPolicies):
"""
Convenience class for constructing a Box Storage Policy document
to use as the ``policies`` parameter when creating a StorageGatewayDocument
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for
this class.
:param enterpriseID: Identifies which Box Enterprise this Storage Gateway is
authorized to access. Private.
:param boxAppSettings: Values that the Storage Gateway uses to identify and
authenticate with the Box API. Private.
:param additional_fields: Additional data for inclusion in the policy document
"""
def __init__(
self,
DATA_TYPE: str = "box_storage_policies#1.0.0",
enterpriseID: str | None = None,
boxAppSettings: dict[str, t.Any] | None = None,
additional_fields: dict[str, t.Any] | None = None,
) -> None:
super().__init__()
self._set_optstrs(DATA_TYPE=DATA_TYPE, enterpriseID=enterpriseID)
self._set_value("boxAppSettings", boxAppSettings)
if additional_fields is not None:
self.update(additional_fields)
[docs]
class CephStoragePolicies(StorageGatewayPolicies):
"""
Convenience class for constructing a Ceph Storage Policy document
to use as the `policies` parameter when creating a StorageGatewayDocument
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for
this class.
:param s3_endpoint: URL of the S3 API endpoint
:param s3_buckets: List of buckets not owned by the collection owner that will be
shown in the root of collections created at the base of this Storage Gateway.
:param ceph_admin_key_id: Administrator key id used to authenticate with the ceph
admin service to obtain user credentials. Private.
:param ceph_admin_secret_key: Administrator secret key used to authenticate with the
ceph admin service to obtain user credentials. Private.
:param additional_fields: Additional data for inclusion in the policy document
"""
def __init__(
self,
DATA_TYPE: str = "ceph_storage_policies#1.0.0",
s3_endpoint: str | None = None,
s3_buckets: t.Iterable[str] | None = None,
ceph_admin_key_id: str | None = None,
ceph_admin_secret_key: str | None = None,
additional_fields: dict[str, t.Any] | None = None,
) -> None:
super().__init__()
self._set_optstrs(
DATA_TYPE=DATA_TYPE,
s3_endpoint=s3_endpoint,
ceph_admin_key_id=ceph_admin_key_id,
ceph_admin_secret_key=ceph_admin_secret_key,
)
self._set_optstrlists(s3_buckets=s3_buckets)
if additional_fields is not None:
self.update(additional_fields)
[docs]
class GoogleDriveStoragePolicies(StorageGatewayPolicies):
"""
Convenience class for constructing a Google Drive Storage Policy document
to use as the `policies` parameter when creating a StorageGatewayDocument
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for
this class.
:param client_id: Client ID registered with the Google Application console to access
Google Drive. Private.
:param secret: Secret created to access access Google Drive with the client_id in
this policy. Private.
:param user_api_rate_quota: User API Rate quota associated with this client ID.
:param additional_fields: Additional data for inclusion in the policy document
"""
def __init__(
self,
DATA_TYPE: str = "google_drive_storage_policies#1.0.0",
client_id: str | None = None,
secret: str | None = None,
user_api_rate_quota: int | None = None,
additional_fields: dict[str, t.Any] | None = None,
) -> None:
super().__init__()
self._set_optstrs(DATA_TYPE=DATA_TYPE, client_id=client_id, secret=secret)
self._set_optints(user_api_rate_quota=user_api_rate_quota)
if additional_fields is not None:
self.update(additional_fields)
[docs]
class GoogleCloudStoragePolicies(StorageGatewayPolicies):
"""
Convenience class for constructing a Google Cloud Storage Policy document
to use as the `policies` parameter when creating a StorageGatewayDocument
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for
this class.
:param client_id: Client ID registered with the Google Application console to
access Google Drive. Private.
:param secret: Secret created to access access Google Drive with the client_id in
this policy. Private.
:param service_account_key: Credentials for use with service account auth, read
from a Google-provided json file. Private.
:param buckets: The list of Google Cloud Storage buckets which the Storage
Gateway is allowed to access, as well as the list of buckets that will be
shown in root level directory listings. If this list is unset, bucket
access is unrestricted and all non public credential accessible buckets
will be shown in root level directory listings. The value is a list of
bucket names.
:param projects: The list of Google Cloud Storage projects which the
Storage Gateway is allowed to access. If this list is unset, project access
is unrestricted. The value is a list of project id strings.
:param additional_fields: Additional data for inclusion in the policy document
"""
def __init__(
self,
DATA_TYPE: str = "google_cloud_storage_policies#1.0.0",
client_id: str | None = None,
secret: str | None = None,
service_account_key: dict[str, t.Any] | None = None,
buckets: t.Iterable[str] | None = None,
projects: t.Iterable[str] | None = None,
additional_fields: dict[str, t.Any] | None = None,
) -> None:
super().__init__()
self._set_optstrs(DATA_TYPE=DATA_TYPE, client_id=client_id, secret=secret)
self._set_optstrlists(buckets=buckets, projects=projects)
self._set_value("service_account_key", service_account_key)
if additional_fields is not None:
self.update(additional_fields)
[docs]
class OneDriveStoragePolicies(StorageGatewayPolicies):
"""
Convenience class for constructing a OneDrive Storage Policy document
to use as the `policies` parameter when creating a StorageGatewayDocument
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for
this class.
:param client_id: Client ID registered with the MS Application console to
access OneDrive. Private.
:param secret: Secret created to access access MS with the client_id in
this policy. Private.
:param tenant: MS Tenant ID from which to allow user logins. Private.
:param user_api_rate_limit: User API Rate limit associated with this client ID.
:param additional_fields: Additional data for inclusion in the policy document
"""
def __init__(
self,
DATA_TYPE: str = "onedrive_storage_policies#1.0.0",
client_id: str | None = None,
secret: str | None = None,
tenant: str | None = None,
user_api_rate_limit: int | None = None,
additional_fields: dict[str, t.Any] | None = None,
) -> None:
super().__init__()
self._set_optstrs(
DATA_TYPE=DATA_TYPE, client_id=client_id, secret=secret, tenant=tenant
)
self._set_optints(user_api_rate_limit=user_api_rate_limit)
if additional_fields is not None:
self.update(additional_fields)
[docs]
class AzureBlobStoragePolicies(StorageGatewayPolicies):
"""
Convenience class for constructing a Azure Blob Storage Policy document
to use as the `policies` parameter when creating a StorageGatewayDocument
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for
this class.
:param client_id: Client ID registered with the MS Application console to
access Azure Blob Private.
:param secret: Secret created to access access MS with the client_id in
this policy. Private.
:param tenant: MS Tenant ID from which to allow user logins. Private.
:param account: Azure Storage account. Private.
:param auth_type: Auth type: user, service_principal or user_service_principal
:param adls: ADLS support enabled or not. Private.
:param additional_fields: Additional data for inclusion in the policy document
"""
def __init__(
self,
DATA_TYPE: str = "azure_blob_storage_policies#1.0.0",
client_id: str | None = None,
secret: str | None = None,
tenant: str | None = None,
account: str | None = None,
auth_type: str | None = None,
adls: bool | None = None,
additional_fields: dict[str, t.Any] | None = None,
) -> None:
super().__init__()
self._set_optstrs(
DATA_TYPE=DATA_TYPE,
client_id=client_id,
secret=secret,
tenant=tenant,
account=account,
auth_type=auth_type,
)
self._set_optbools(adls=adls)
if additional_fields is not None:
self.update(additional_fields)
[docs]
class S3StoragePolicies(StorageGatewayPolicies):
"""
Convenience class for constructing a Google Cloud Storage Policy document
to use as the `policies` parameter when creating a StorageGatewayDocument
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for
this class.
:param s3_endpoint: URL of the S3 API endpoint
:param s3_buckets: List of buckets not owned by the collection owner that
will be shown in the root of collections created at the base of this
Storage Gateway.
:param s3_user_credential_required: Flag indicating if a Globus User must
register a user credential in order to create a Guest Collection on this
Storage Gateway.
:param additional_fields: Additional data for inclusion in the policy document
"""
def __init__(
self,
DATA_TYPE: str = "s3_storage_policies#1.0.0",
s3_endpoint: str | None = None,
s3_buckets: t.Iterable[str] | None = None,
s3_user_credential_required: bool | None = None,
additional_fields: dict[str, t.Any] | None = None,
) -> None:
super().__init__()
self._set_optstrs(DATA_TYPE=DATA_TYPE, s3_endpoint=s3_endpoint)
self._set_optbools(s3_user_credential_required=s3_user_credential_required)
self._set_optstrlists(s3_buckets=s3_buckets)
if additional_fields is not None:
self.update(additional_fields)
[docs]
class ActiveScaleStoragePolicies(S3StoragePolicies):
"""
The ActiveScale Storage Policy is an alias for the S3 Storage Policy.
It even uses S3 policy DATA_TYPE.
"""
[docs]
class IrodsStoragePolicies(StorageGatewayPolicies):
"""
Convenience class for constructing an iRODS Storage Policy document
to use as the `policies` parameter when creating a StorageGatewayDocument
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for
this class.
:param irods_environment_file: Path to iRODS environment file on the endpoint
:param irods_authentication_file: Path to iRODS authentication file on the endpoint
:param additional_fields: Additional data for inclusion in the policy document
"""
def __init__(
self,
DATA_TYPE: str = "irods_storage_policies#1.0.0",
irods_environment_file: str | None = None,
irods_authentication_file: str | None = None,
additional_fields: dict[str, t.Any] | None = None,
) -> None:
super().__init__()
self._set_optstrs(
DATA_TYPE=DATA_TYPE,
irods_environment_file=irods_environment_file,
irods_authentication_file=irods_authentication_file,
)
if additional_fields is not None:
self.update(additional_fields)
[docs]
class HPSSStoragePolicies(StorageGatewayPolicies):
"""
Convenience class for constructing a HPSS Storage Policy document
to use as the `policies` parameter when creating a StorageGatewayDocument
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for
this class.
:param authentication_mech: Authentication mechanism to use with HPSS.
:param authenticator: Authentication credentials to use with HPSS.
:param uda_checksum_support: Flag indicating whether checksums should be
stored in metadata.
:param additional_fields: Additional data for inclusion in the policy document
"""
def __init__(
self,
DATA_TYPE: str = "hpss_storage_policies#1.0.0",
authentication_mech: str | None = None,
authenticator: str | None = None,
uda_checksum_support: bool | None = None,
additional_fields: dict[str, t.Any] | None = None,
) -> None:
super().__init__()
self._set_optstrs(
DATA_TYPE=DATA_TYPE,
authentication_mech=authentication_mech,
authenticator=authenticator,
)
self._set_optbools(uda_checksum_support=uda_checksum_support)
if additional_fields is not None:
self.update(additional_fields)