Issue 1 : I have a binary file stored in another table, that I want to send to Minio. The method only allows for a filePath that I don't have. How to send a binary?
I'm trying to implement using the details from here : .html#running-minio-client-examples
Issue 2 After uploading the file, I need to generate a presigned url and send to a 3rd party app, so that app can pull the file and process it The sdk only has a bucketId , and I don't know how to get it
For issue 1 :
private async static Task Run(IMinioClient minio, string ssBucketName, string ssLocation, string ssObjectName, string ssFilePath, string ssContentType)
{
var bucketName = ssBucketName;
var location = ssLocation;
var objectName = ssObjectName;
var filePath = ssFilePath;
var contentType = ssContentType;
try
{
var putObjectArgs = new PutObjectArgs()
.WithBucket(bucketName)
.WithObject(objectName)
.WithFileName(filePath) //how do I replace this with a binary?
.WithContentType(contentType);
await minio.PutObjectAsync(putObjectArgs).ConfigureAwait(false);
}
catch (MinioException e)
{
}
For issue 2 :
private async static Task<string> GetUrl(IMinioClient minio, string bucketId)
{
var presignedArgs = new PresignedGetObjectArgs()
.WithBucket(bucketId)
.WithExpiry(3600);
var url = await minio.PresignedGetObjectAsync(presignedArgs).ConfigureAwait(false);
return url;
}
I have an aditional issue here: the action that calls GetUrl is like this :
var endpoint = ssEndPoint;
var accessKey = ssAccessKey;
var secretKey = ssSecretKey;
try
{
var minio = new MinioClient()
.WithEndpoint(endpoint)
.WithCredentials(accessKey, secretKey)
.WithSSL()
.Build();
GetUrl(minio, ssBucketId).Wait();
}
catch (Exception ex)
{
}
How do I assing the return of GetUrl call to a string variable?
If I use var url = GetUrl(minio, ssBucketId).Wait();
I get error "Cannot assign error to an implicitly-typed variable" which I kind of understand the reason, but don't know how to fix it.