/// <summary> /// Gets object URL for downloading from storage (Temporary URL support varies by implementation) /// </summary> /// <param name="objectId">Object Id</param> /// <param name="expiresInSeconds">Temporary link expiration time in seconds. Defaults to 12 hours</param> /// <param name="bucketName">Bucket name - Optional if passed throuhg constructor</param> /// <returns>Returns temporary URL of object for download</returns> /// <exception cref="EndpointUnreachableException">Thrown when S3 endpoint is unreachable.</exception> /// <exception cref="ObjectNotFoundException">Thrown when object is not found.</exception> /// <exception cref="S3BaseException">Thrown when exception is not handled.</exception> public async Task <string> GetObjectURL(string objectId, int expiresInSeconds = 600) { var s3Obj = BucketHelper.ExtractObjectInfo(objectId); var bucket = s3Obj.bucketName?.ToLower() ?? _bucketName; var objectName = s3Obj.objectName; string result = null; try { result = await _requestRetryPolicy.ExecuteAsync(async() => { return(await _objectOperationsClient.PresignedGetObjectAsync(bucket, objectName, expiresInSeconds)); }); if (result == null) { throw new Exceptions.ObjectNotFoundException(objectId, bucket); } } catch (MinioException ex) when(ex is ConnectionException || ex is InternalServerException || ex is InternalClientException || ex is InvalidEndpointException ) { throw new EndpointUnreachableException(_endpoint, ex.ToString()); } catch (S3BaseException) { throw; } catch (Exception ex) { throw new S3BaseException(ex.Message, ex.ToString()); } return(result); }