def _make_container(self, folder_name: str) -> Container: """Convert a folder name to a Cloud Storage Container. :param folder_name: The folder name to convert. :type folder_name: str :return: A container instance. :rtype: :class:`.Container` :raises FileNotFoundError: If container does not exist. """ full_path = os.path.join(self.base_path, folder_name) if not self._check_path_accessible(full_path): raise NotFoundError(messages.CONTAINER_NOT_FOUND % folder_name) try: stat = os.stat(full_path) except FileNotFoundError: raise NotFoundError(messages.CONTAINER_NOT_FOUND % folder_name) created_at = datetime.fromtimestamp(stat.st_ctime, timezone.utc) return Container(name=folder_name, driver=self, meta_data=None, created_at=created_at)
def _make_container(self, bucket: definitions.Bucket) -> Container: """Convert Minio Bucket to Container. :param bucket: Minio bucket. :type bucket: :class:`minio.definitions.Bucket` :return: The container if it exists. :rtype: :class:`.Container` """ created_at = bucket.creation_date.astimezone(tz=None) return Container(name=bucket.name, driver=self, acl='', meta_data=None, created_at=created_at)
def _make_container(self, bucket: Bucket) -> Container: """Convert Google Storage Bucket to Cloud Storage Container. :param bucket: The bucket to convert. :type bucket: :class:`google.client.storage.bucket.Bucket` :return: A container instance. :rtype: :class:`.Container` """ acl = bucket.acl created_at = bucket.time_created.astimezone(tz=None) return Container(name=bucket.name, driver=self, acl=acl, meta_data=None, created_at=created_at)
def _make_container(self, container) -> Container: """Convert Rackspace Container to Cloud Storage Container. :param container: Openstack container to convert. :type container: :class:`openstack.object_store.v1.container.Container` :return: A container instance. :rtype: :class:`.Container` """ return Container(name=container.id, driver=self, acl=None, meta_data=container.metadata, created_at=None)
def _convert_azure_container(self, azure_container: AzureContainer) -> Container: """Convert Azure Storage container to Cloud Storage Container. :param azure_container: The container to convert. :type azure_container: :class:`azure.storage.blob.models.Container` :return: A container instance. :rtype: :class:`.Container` """ return Container(name=azure_container.name, driver=self, acl=azure_container.properties.public_access, meta_data=azure_container.metadata, created_at=azure_container.properties.last_modified)
def _make_container(self, bucket) -> Container: """Convert S3 Bucket to Container. :param bucket: S3 bucket object. :type bucket: :class:`boto3.s3.Bucket` :return: The container if it exists. :rtype: :class:`.Container` """ acl = bucket.Acl() created_at = bucket.creation_date.astimezone(tz=None) return Container(name=bucket.name, driver=self, acl=acl, meta_data=None, created_at=created_at)