| 1 |
from __future__ import annotations |
| 2 |
|
| 3 |
import copy |
| 4 |
import typing as t |
| 5 |
import uuid |
| 6 |
|
| 7 |
from globus_sdk._internal.remarshal import list_map, listify, strseq_listify |
| 8 |
from globus_sdk._missing import MISSING, MissingType |
| 9 |
from globus_sdk._payload import AbstractGlobusPayload, GlobusPayload |
| 10 |
|
| 11 |
from ._common import DatatypeCallback, ensure_datatype |
| 12 |
|
| 13 |
|
| 14 |
class StorageGatewayDocument(GlobusPayload): |
| 15 |
""" |
| 16 |
Convenience class for constructing a Storage Gateway document |
| 17 |
to use as the `data` parameter to ``create_storage_gateway`` or |
| 18 |
``update_storage_gateway`` |
| 19 |
|
| 20 |
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for |
| 21 |
this class. |
| 22 |
:param display_name: Name of the Storage Gateway |
| 23 |
:param connector_id: UUID of the connector type that this Storage Gateway interacts |
| 24 |
with. |
| 25 |
:param identity_mappings: A list of IdentityMapping objects which are applied to |
| 26 |
user identities to attempt to determine what accounts are available for access. |
| 27 |
:param policies: Connector specific storage policies. It is recommended that |
| 28 |
you use one of the policy helper classes (e.g. `POSIXStoragePolicies` |
| 29 |
if you are using the POSIX connector) to create these. |
| 30 |
:param allowed_domains: List of allowed domains. Users creating credentials or |
| 31 |
collections on this Storage Gateway must have an identity in one of these |
| 32 |
domains. |
| 33 |
:param restrict_paths: Path restrictions within this Storage Gateway. Private. |
| 34 |
:param high_assurance: Flag indicating if the Storage Gateway requires high |
| 35 |
assurance features. |
| 36 |
:param authentication_timeout_mins: Timeout (in minutes) during which a user is |
| 37 |
required to have authenticated in a session to access this storage gateway. |
| 38 |
:param users_allow: List of connector-specific usernames allowed to access this |
| 39 |
Storage Gateway. Private. |
| 40 |
:param users_deny: List of connector-specific usernames denied access to this |
| 41 |
Storage Gateway. Private. |
| 42 |
:param process_user: Local POSIX user the GridFTP server should run as when |
| 43 |
accessing this Storage Gateway. |
| 44 |
:param load_dsi_module: Name of the DSI module to load by the GridFTP server when |
| 45 |
accessing this Storage Gateway. |
| 46 |
:param require_mfa: Flag indicating that the Storage Gateway requires multi-factor |
| 47 |
authentication. Only usable on high assurance Storage Gateways. |
| 48 |
|
| 49 |
:param additional_fields: Additional data for inclusion in the Storage Gateway |
| 50 |
document |
| 51 |
""" |
| 52 |
|
| 53 |
DATATYPE_BASE: str = "storage_gateway" |
| 54 |
DATATYPE_VERSION_IMPLICATIONS: dict[str, tuple[int, int, int]] = { |
| 55 |
"require_mfa": (1, 1, 0), |
| 56 |
} |
| 57 |
DATATYPE_VERSION_CALLBACKS: tuple[DatatypeCallback, ...] = () |
| 58 |
|
| 59 |
def __init__( |
| 60 |
self, |
| 61 |
DATA_TYPE: str | MissingType = MISSING, |
| 62 |
display_name: str | MissingType = MISSING, |
| 63 |
connector_id: uuid.UUID | str | MissingType = MISSING, |
| 64 |
root: str | MissingType = MISSING, |
| 65 |
identity_mappings: t.Iterable[dict[str, t.Any]] | MissingType = MISSING, |
| 66 |
policies: StorageGatewayPolicies | dict[str, t.Any] | MissingType = MISSING, |
| 67 |
allowed_domains: t.Iterable[str] | MissingType = MISSING, |
| 68 |
high_assurance: bool | MissingType = MISSING, |
| 69 |
require_mfa: bool | MissingType = MISSING, |
| 70 |
authentication_timeout_mins: int | MissingType = MISSING, |
| 71 |
users_allow: t.Iterable[str] | MissingType = MISSING, |
| 72 |
users_deny: t.Iterable[str] | MissingType = MISSING, |
| 73 |
additional_fields: dict[str, t.Any] | None = None, |
| 74 |
) -> None: |
| 75 |
super().__init__() |
| 76 |
self["DATA_TYPE"] = DATA_TYPE |
| 77 |
self["display_name"] = display_name |
| 78 |
self["connector_id"] = connector_id |
| 79 |
self["root"] = root |
| 80 |
self["allowed_domains"] = strseq_listify(allowed_domains) |
| 81 |
self["users_allow"] = strseq_listify(users_allow) |
| 82 |
self["users_deny"] = strseq_listify(users_deny) |
| 83 |
self["high_assurance"] = high_assurance |
| 84 |
self["require_mfa"] = require_mfa |
| 85 |
self["authentication_timeout_mins"] = authentication_timeout_mins |
| 86 |
self["identity_mappings"] = listify(identity_mappings) |
| 87 |
self["policies"] = policies |
| 88 |
self.update(additional_fields or {}) |
| 89 |
ensure_datatype(self) |
| 90 |
|
| 91 |
|
| 92 |
class StorageGatewayPolicies(AbstractGlobusPayload): |
| 93 |
""" |
| 94 |
This is the abstract base type for Storage Policies documents to use as the |
| 95 |
``policies`` parameter when creating a StorageGatewayDocument. |
| 96 |
|
| 97 |
Several fields on policy documents are marked as ``Private``. This means that they |
| 98 |
are not visible except to admins and owners of the storage gateway. |
| 99 |
""" |
| 100 |
|
| 101 |
|
| 102 |
class POSIXStoragePolicies(StorageGatewayPolicies): |
| 103 |
""" |
| 104 |
Convenience class for constructing a POSIX Storage Policy document |
| 105 |
to use as the ``policies`` parameter when creating a StorageGatewayDocument |
| 106 |
|
| 107 |
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for |
| 108 |
this class. |
| 109 |
:param groups_allow: List of POSIX group IDs allowed to access this Storage |
| 110 |
Gateway. Private. |
| 111 |
:param groups_deny: List of POSIX group IDs denied access this Storage |
| 112 |
Gateway. Private. |
| 113 |
:param additional_fields: Additional data for inclusion in the policy document |
| 114 |
""" |
| 115 |
|
| 116 |
def __init__( |
| 117 |
self, |
| 118 |
DATA_TYPE: str = "posix_storage_policies#1.0.0", |
| 119 |
groups_allow: t.Iterable[str] | MissingType = MISSING, |
| 120 |
groups_deny: t.Iterable[str] | MissingType = MISSING, |
| 121 |
additional_fields: dict[str, t.Any] | None = None, |
| 122 |
) -> None: |
| 123 |
super().__init__() |
| 124 |
self["DATA_TYPE"] = DATA_TYPE |
| 125 |
self["groups_allow"] = strseq_listify(groups_allow) |
| 126 |
self["groups_deny"] = strseq_listify(groups_deny) |
| 127 |
self.update(additional_fields or {}) |
| 128 |
|
| 129 |
|
| 130 |
class POSIXStagingStoragePolicies(StorageGatewayPolicies): |
| 131 |
""" |
| 132 |
Convenience class for constructing a POSIX Staging Storage Policy document |
| 133 |
to use as the ``policies`` parameter when creating a StorageGatewayDocument |
| 134 |
|
| 135 |
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for |
| 136 |
this class. |
| 137 |
:param groups_allow: List of POSIX group IDs allowed to access this Storage |
| 138 |
Gateway. Private. |
| 139 |
:param groups_deny: List of POSIX group IDs denied access this Storage |
| 140 |
Gateway. Private. |
| 141 |
:param stage_app: Path to the stage app. Private. |
| 142 |
:param environment: A mapping of variable names to values to set in the environment |
| 143 |
when executing the ``stage_app``. Private. |
| 144 |
:param additional_fields: Additional data for inclusion in the policy document |
| 145 |
""" |
| 146 |
|
| 147 |
def __init__( |
| 148 |
self, |
| 149 |
DATA_TYPE: str = "posix_staging_storage_policies#1.0.0", |
| 150 |
groups_allow: t.Iterable[str] | MissingType = MISSING, |
| 151 |
groups_deny: t.Iterable[str] | MissingType = MISSING, |
| 152 |
stage_app: str | MissingType = MISSING, |
| 153 |
environment: t.Iterable[dict[str, str]] | MissingType = MISSING, |
| 154 |
additional_fields: dict[str, t.Any] | None = None, |
| 155 |
) -> None: |
| 156 |
super().__init__() |
| 157 |
self["DATA_TYPE"] = DATA_TYPE |
| 158 |
self["stage_app"] = stage_app |
| 159 |
self["groups_allow"] = strseq_listify(groups_allow) |
| 160 |
self["groups_deny"] = strseq_listify(groups_deny) |
| 161 |
# make shallow copies of all the dicts passed |
| 162 |
self["environment"] = list_map(environment, copy.copy) |
| 163 |
self.update(additional_fields or {}) |
| 164 |
|
| 165 |
|
| 166 |
class BlackPearlStoragePolicies(StorageGatewayPolicies): |
| 167 |
""" |
| 168 |
Convenience class for constructing a BlackPearl Storage Policy document |
| 169 |
to use as the ``policies`` parameter when creating a StorageGatewayDocument. |
| 170 |
|
| 171 |
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for |
| 172 |
this class. |
| 173 |
:param s3_endpoint: The URL of the S3 endpoint of the BlackPearl appliance to use to |
| 174 |
access collections on this Storage Gateway. |
| 175 |
:param bp_access_id_file: Path to the file which provides mappings from usernames |
| 176 |
within the configured identity domain to the ID and secret associated with the |
| 177 |
user's BlackPearl account |
| 178 |
:param additional_fields: Additional data for inclusion in the policy document |
| 179 |
""" |
| 180 |
|
| 181 |
def __init__( |
| 182 |
self, |
| 183 |
DATA_TYPE: str = "blackpearl_storage_policies#1.0.0", |
| 184 |
s3_endpoint: str | MissingType = MISSING, |
| 185 |
bp_access_id_file: str | MissingType = MISSING, |
| 186 |
additional_fields: dict[str, t.Any] | None = None, |
| 187 |
) -> None: |
| 188 |
super().__init__() |
| 189 |
self["DATA_TYPE"] = DATA_TYPE |
| 190 |
self["s3_endpoint"] = s3_endpoint |
| 191 |
self["bp_access_id_file"] = bp_access_id_file |
| 192 |
self.update(additional_fields or {}) |
| 193 |
|
| 194 |
|
| 195 |
class BoxStoragePolicies(StorageGatewayPolicies): |
| 196 |
""" |
| 197 |
Convenience class for constructing a Box Storage Policy document |
| 198 |
to use as the ``policies`` parameter when creating a StorageGatewayDocument |
| 199 |
|
| 200 |
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for |
| 201 |
this class. |
| 202 |
:param enterpriseID: Identifies which Box Enterprise this Storage Gateway is |
| 203 |
authorized to access. Private. |
| 204 |
:param boxAppSettings: Values that the Storage Gateway uses to identify and |
| 205 |
authenticate with the Box API. Private. |
| 206 |
:param additional_fields: Additional data for inclusion in the policy document |
| 207 |
""" |
| 208 |
|
| 209 |
def __init__( |
| 210 |
self, |
| 211 |
DATA_TYPE: str = "box_storage_policies#1.0.0", |
| 212 |
enterpriseID: str | MissingType = MISSING, |
| 213 |
boxAppSettings: dict[str, t.Any] | MissingType = MISSING, |
| 214 |
additional_fields: dict[str, t.Any] | None = None, |
| 215 |
) -> None: |
| 216 |
super().__init__() |
| 217 |
self["DATA_TYPE"] = DATA_TYPE |
| 218 |
self["enterpriseID"] = enterpriseID |
| 219 |
self["boxAppSettings"] = boxAppSettings |
| 220 |
self.update(additional_fields or {}) |
| 221 |
|
| 222 |
|
| 223 |
class CephStoragePolicies(StorageGatewayPolicies): |
| 224 |
""" |
| 225 |
Convenience class for constructing a Ceph Storage Policy document |
| 226 |
to use as the `policies` parameter when creating a StorageGatewayDocument |
| 227 |
|
| 228 |
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for |
| 229 |
this class. |
| 230 |
:param s3_endpoint: URL of the S3 API endpoint |
| 231 |
:param s3_buckets: List of buckets not owned by the collection owner that will be |
| 232 |
shown in the root of collections created at the base of this Storage Gateway. |
| 233 |
:param ceph_admin_key_id: Administrator key id used to authenticate with the ceph |
| 234 |
admin service to obtain user credentials. Private. |
| 235 |
:param ceph_admin_secret_key: Administrator secret key used to authenticate with the |
| 236 |
ceph admin service to obtain user credentials. Private. |
| 237 |
:param additional_fields: Additional data for inclusion in the policy document |
| 238 |
""" |
| 239 |
|
| 240 |
def __init__( |
| 241 |
self, |
| 242 |
DATA_TYPE: str = "ceph_storage_policies#1.0.0", |
| 243 |
s3_endpoint: str | MissingType = MISSING, |
| 244 |
s3_buckets: t.Iterable[str] | MissingType = MISSING, |
| 245 |
ceph_admin_key_id: str | MissingType = MISSING, |
| 246 |
ceph_admin_secret_key: str | MissingType = MISSING, |
| 247 |
additional_fields: dict[str, t.Any] | None = None, |
| 248 |
) -> None: |
| 249 |
super().__init__() |
| 250 |
self["DATA_TYPE"] = DATA_TYPE |
| 251 |
self["s3_endpoint"] = s3_endpoint |
| 252 |
self["ceph_admin_key_id"] = ceph_admin_key_id |
| 253 |
self["ceph_admin_secret_key"] = ceph_admin_secret_key |
| 254 |
self["s3_buckets"] = strseq_listify(s3_buckets) |
| 255 |
self.update(additional_fields or {}) |
| 256 |
|
| 257 |
|
| 258 |
class GoogleDriveStoragePolicies(StorageGatewayPolicies): |
| 259 |
""" |
| 260 |
Convenience class for constructing a Google Drive Storage Policy document |
| 261 |
to use as the `policies` parameter when creating a StorageGatewayDocument |
| 262 |
|
| 263 |
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for |
| 264 |
this class. |
| 265 |
:param client_id: Client ID registered with the Google Application console to access |
| 266 |
Google Drive. Private. |
| 267 |
:param secret: Secret created to access access Google Drive with the client_id in |
| 268 |
this policy. Private. |
| 269 |
:param user_api_rate_quota: User API Rate quota associated with this client ID. |
| 270 |
:param additional_fields: Additional data for inclusion in the policy document |
| 271 |
""" |
| 272 |
|
| 273 |
def __init__( |
| 274 |
self, |
| 275 |
DATA_TYPE: str = "google_drive_storage_policies#1.0.0", |
| 276 |
client_id: str | MissingType = MISSING, |
| 277 |
secret: str | MissingType = MISSING, |
| 278 |
user_api_rate_quota: int | MissingType = MISSING, |
| 279 |
additional_fields: dict[str, t.Any] | None = None, |
| 280 |
) -> None: |
| 281 |
super().__init__() |
| 282 |
self["DATA_TYPE"] = DATA_TYPE |
| 283 |
self["client_id"] = client_id |
| 284 |
self["secret"] = secret |
| 285 |
self["user_api_rate_quota"] = user_api_rate_quota |
| 286 |
self.update(additional_fields or {}) |
| 287 |
|
| 288 |
|
| 289 |
class GoogleCloudStoragePolicies(StorageGatewayPolicies): |
| 290 |
""" |
| 291 |
Convenience class for constructing a Google Cloud Storage Policy document |
| 292 |
to use as the `policies` parameter when creating a StorageGatewayDocument |
| 293 |
|
| 294 |
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for |
| 295 |
this class. |
| 296 |
:param client_id: Client ID registered with the Google Application console to |
| 297 |
access Google Drive. Private. |
| 298 |
:param secret: Secret created to access access Google Drive with the client_id in |
| 299 |
this policy. Private. |
| 300 |
:param service_account_key: Credentials for use with service account auth, read |
| 301 |
from a Google-provided json file. Private. |
| 302 |
:param buckets: The list of Google Cloud Storage buckets which the Storage |
| 303 |
Gateway is allowed to access, as well as the list of buckets that will be |
| 304 |
shown in root level directory listings. If this list is unset, bucket |
| 305 |
access is unrestricted and all non public credential accessible buckets |
| 306 |
will be shown in root level directory listings. The value is a list of |
| 307 |
bucket names. |
| 308 |
:param projects: The list of Google Cloud Storage projects which the |
| 309 |
Storage Gateway is allowed to access. If this list is unset, project access |
| 310 |
is unrestricted. The value is a list of project id strings. |
| 311 |
:param additional_fields: Additional data for inclusion in the policy document |
| 312 |
""" |
| 313 |
|
| 314 |
def __init__( |
| 315 |
self, |
| 316 |
DATA_TYPE: str = "google_cloud_storage_policies#1.0.0", |
| 317 |
client_id: str | MissingType = MISSING, |
| 318 |
secret: str | MissingType = MISSING, |
| 319 |
service_account_key: dict[str, t.Any] | MissingType = MISSING, |
| 320 |
buckets: t.Iterable[str] | MissingType = MISSING, |
| 321 |
projects: t.Iterable[str] | MissingType = MISSING, |
| 322 |
additional_fields: dict[str, t.Any] | None = None, |
| 323 |
) -> None: |
| 324 |
super().__init__() |
| 325 |
self["DATA_TYPE"] = DATA_TYPE |
| 326 |
self["client_id"] = client_id |
| 327 |
self["secret"] = secret |
| 328 |
self["buckets"] = strseq_listify(buckets) |
| 329 |
self["projects"] = strseq_listify(projects) |
| 330 |
self["service_account_key"] = service_account_key |
| 331 |
self.update(additional_fields or {}) |
| 332 |
|
| 333 |
|
| 334 |
class OneDriveStoragePolicies(StorageGatewayPolicies): |
| 335 |
""" |
| 336 |
Convenience class for constructing a OneDrive Storage Policy document |
| 337 |
to use as the `policies` parameter when creating a StorageGatewayDocument |
| 338 |
|
| 339 |
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for |
| 340 |
this class. |
| 341 |
:param client_id: Client ID registered with the MS Application console to |
| 342 |
access OneDrive. Private. |
| 343 |
:param secret: Secret created to access access MS with the client_id in |
| 344 |
this policy. Private. |
| 345 |
:param tenant: MS Tenant ID from which to allow user logins. Private. |
| 346 |
:param user_api_rate_limit: User API Rate limit associated with this client ID. |
| 347 |
:param additional_fields: Additional data for inclusion in the policy document |
| 348 |
""" |
| 349 |
|
| 350 |
def __init__( |
| 351 |
self, |
| 352 |
DATA_TYPE: str = "onedrive_storage_policies#1.0.0", |
| 353 |
client_id: str | MissingType = MISSING, |
| 354 |
secret: str | MissingType = MISSING, |
| 355 |
tenant: str | MissingType = MISSING, |
| 356 |
user_api_rate_limit: int | MissingType = MISSING, |
| 357 |
additional_fields: dict[str, t.Any] | None = None, |
| 358 |
) -> None: |
| 359 |
super().__init__() |
| 360 |
self["DATA_TYPE"] = DATA_TYPE |
| 361 |
self["client_id"] = client_id |
| 362 |
self["secret"] = secret |
| 363 |
self["tenant"] = tenant |
| 364 |
self["user_api_rate_limit"] = user_api_rate_limit |
| 365 |
self.update(additional_fields or {}) |
| 366 |
|
| 367 |
|
| 368 |
class AzureBlobStoragePolicies(StorageGatewayPolicies): |
| 369 |
""" |
| 370 |
Convenience class for constructing a Azure Blob Storage Policy document |
| 371 |
to use as the `policies` parameter when creating a StorageGatewayDocument |
| 372 |
|
| 373 |
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for |
| 374 |
this class. |
| 375 |
:param client_id: Client ID registered with the MS Application console to |
| 376 |
access Azure Blob Private. |
| 377 |
:param secret: Secret created to access access MS with the client_id in |
| 378 |
this policy. Private. |
| 379 |
:param tenant: MS Tenant ID from which to allow user logins. Private. |
| 380 |
:param account: Azure Storage account. Private. |
| 381 |
:param auth_type: Auth type: user, service_principal or user_service_principal |
| 382 |
:param adls: ADLS support enabled or not. Private. |
| 383 |
:param additional_fields: Additional data for inclusion in the policy document |
| 384 |
""" |
| 385 |
|
| 386 |
def __init__( |
| 387 |
self, |
| 388 |
DATA_TYPE: str = "azure_blob_storage_policies#1.0.0", |
| 389 |
client_id: str | MissingType = MISSING, |
| 390 |
secret: str | MissingType = MISSING, |
| 391 |
tenant: str | MissingType = MISSING, |
| 392 |
account: str | MissingType = MISSING, |
| 393 |
auth_type: str | MissingType = MISSING, |
| 394 |
adls: bool | MissingType = MISSING, |
| 395 |
additional_fields: dict[str, t.Any] | None = None, |
| 396 |
) -> None: |
| 397 |
super().__init__() |
| 398 |
self["DATA_TYPE"] = DATA_TYPE |
| 399 |
self["client_id"] = client_id |
| 400 |
self["secret"] = secret |
| 401 |
self["tenant"] = tenant |
| 402 |
self["account"] = account |
| 403 |
self["auth_type"] = auth_type |
| 404 |
self["adls"] = adls |
| 405 |
self.update(additional_fields or {}) |
| 406 |
|
| 407 |
|
| 408 |
class S3StoragePolicies(StorageGatewayPolicies): |
| 409 |
""" |
| 410 |
Convenience class for constructing a Google Cloud Storage Policy document |
| 411 |
to use as the `policies` parameter when creating a StorageGatewayDocument |
| 412 |
|
| 413 |
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for |
| 414 |
this class. |
| 415 |
:param s3_endpoint: URL of the S3 API endpoint |
| 416 |
:param s3_buckets: List of buckets not owned by the collection owner that |
| 417 |
will be shown in the root of collections created at the base of this |
| 418 |
Storage Gateway. |
| 419 |
:param s3_user_credential_required: Flag indicating if a Globus User must |
| 420 |
register a user credential in order to create a Guest Collection on this |
| 421 |
Storage Gateway. |
| 422 |
:param additional_fields: Additional data for inclusion in the policy document |
| 423 |
""" |
| 424 |
|
| 425 |
def __init__( |
| 426 |
self, |
| 427 |
DATA_TYPE: str = "s3_storage_policies#1.0.0", |
| 428 |
s3_endpoint: str | MissingType = MISSING, |
| 429 |
s3_buckets: t.Iterable[str] | MissingType = MISSING, |
| 430 |
s3_user_credential_required: bool | MissingType = MISSING, |
| 431 |
additional_fields: dict[str, t.Any] | None = None, |
| 432 |
) -> None: |
| 433 |
super().__init__() |
| 434 |
self["DATA_TYPE"] = DATA_TYPE |
| 435 |
self["s3_endpoint"] = s3_endpoint |
| 436 |
self["s3_user_credential_required"] = s3_user_credential_required |
| 437 |
self["s3_buckets"] = strseq_listify(s3_buckets) |
| 438 |
self.update(additional_fields or {}) |
| 439 |
|
| 440 |
|
| 441 |
class ActiveScaleStoragePolicies(S3StoragePolicies): |
| 442 |
""" |
| 443 |
The ActiveScale Storage Policy is an alias for the S3 Storage Policy. |
| 444 |
It even uses S3 policy DATA_TYPE. |
| 445 |
""" |
| 446 |
|
| 447 |
|
| 448 |
class IrodsStoragePolicies(StorageGatewayPolicies): |
| 449 |
""" |
| 450 |
Convenience class for constructing an iRODS Storage Policy document |
| 451 |
to use as the `policies` parameter when creating a StorageGatewayDocument |
| 452 |
|
| 453 |
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for |
| 454 |
this class. |
| 455 |
:param irods_environment_file: Path to iRODS environment file on the endpoint |
| 456 |
:param irods_authentication_file: Path to iRODS authentication file on the endpoint |
| 457 |
:param additional_fields: Additional data for inclusion in the policy document |
| 458 |
""" |
| 459 |
|
| 460 |
def __init__( |
| 461 |
self, |
| 462 |
DATA_TYPE: str = "irods_storage_policies#1.0.0", |
| 463 |
irods_environment_file: str | MissingType = MISSING, |
| 464 |
irods_authentication_file: str | MissingType = MISSING, |
| 465 |
additional_fields: dict[str, t.Any] | None = None, |
| 466 |
) -> None: |
| 467 |
super().__init__() |
| 468 |
self["DATA_TYPE"] = DATA_TYPE |
| 469 |
self["irods_environment_file"] = irods_environment_file |
| 470 |
self["irods_authentication_file"] = irods_authentication_file |
| 471 |
self.update(additional_fields or {}) |
| 472 |
|
| 473 |
|
| 474 |
class HPSSStoragePolicies(StorageGatewayPolicies): |
| 475 |
""" |
| 476 |
Convenience class for constructing a HPSS Storage Policy document |
| 477 |
to use as the `policies` parameter when creating a StorageGatewayDocument |
| 478 |
|
| 479 |
:param DATA_TYPE: Versioned document type. Defaults to the appropriate type for |
| 480 |
this class. |
| 481 |
:param authentication_mech: Authentication mechanism to use with HPSS. |
| 482 |
:param authenticator: Authentication credentials to use with HPSS. |
| 483 |
:param uda_checksum_support: Flag indicating whether checksums should be |
| 484 |
stored in metadata. |
| 485 |
:param additional_fields: Additional data for inclusion in the policy document |
| 486 |
""" |
| 487 |
|
| 488 |
def __init__( |
| 489 |
self, |
| 490 |
DATA_TYPE: str = "hpss_storage_policies#1.0.0", |
| 491 |
authentication_mech: str | MissingType = MISSING, |
| 492 |
authenticator: str | MissingType = MISSING, |
| 493 |
uda_checksum_support: bool | MissingType = MISSING, |
| 494 |
additional_fields: dict[str, t.Any] | None = None, |
| 495 |
) -> None: |
| 496 |
super().__init__() |
| 497 |
self["DATA_TYPE"] = DATA_TYPE |
| 498 |
self["authentication_mech"] = authentication_mech |
| 499 |
self["authenticator"] = authenticator |
| 500 |
self["uda_checksum_support"] = uda_checksum_support |
| 501 |
self.update(additional_fields or {}) |