/*
* MinIO .NET Library for Amazon S3 Compatible Cloud Storage,
* (C) 2017-2021 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using Minio.DataModel;
using Minio.DataModel.Args;
using Minio.DataModel.ObjectLock;
using Minio.DataModel.Response;
using Minio.DataModel.Select;
using Minio.DataModel.Tags;
using Minio.Exceptions;
namespace Minio.ApiEndpoints;
public interface IObjectOperations
{
///
/// Get the configuration object for Legal Hold Status
///
///
/// GetObjectLegalHoldArgs Arguments Object which has object identifier information - bucket name,
/// object name, version ID
///
/// Optional cancellation token to cancel the operation
/// True if Legal Hold is ON, false otherwise
/// When access or secret key is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When object is not found
/// When object lock configuration on bucket is not set
/// When a functionality or extension is not implemented
/// When configuration XML provided is invalid
Task GetObjectLegalHoldAsync(GetObjectLegalHoldArgs args, CancellationToken cancellationToken = default);
///
/// Set the configuration for Legal Hold Status
///
///
/// SetObjectLegalHoldArgs Arguments Object which has object identifier information - bucket name,
/// object name, version ID and the status (ON/OFF) of legal-hold
///
/// Optional cancellation token to cancel the operation
/// Task
/// When access or secret key is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When object is not found
/// When object lock configuration on bucket is not set
/// When a functionality or extension is not implemented
/// When configuration XML provided is invalid
Task SetObjectLegalHoldAsync(SetObjectLegalHoldArgs args, CancellationToken cancellationToken = default);
///
/// Set the Retention using the configuration object
///
///
/// SetObjectRetentionArgs Arguments Object which has object identifier information - bucket name,
/// object name, version ID
///
/// Optional cancellation token to cancel the operation
/// Task
/// When access or secret key provided is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When object is not found
/// When object lock configuration on bucket is not set
/// When a functionality or extension is not implemented
/// When configuration XML provided is invalid
Task SetObjectRetentionAsync(SetObjectRetentionArgs args, CancellationToken cancellationToken = default);
///
/// Get the Retention configuration for the object
///
///
/// GetObjectRetentionArgs Arguments Object which has object identifier information - bucket name,
/// object name, version ID
///
/// Optional cancellation token to cancel the operation
/// ObjectRetentionConfiguration object which contains the Retention configuration
/// When access or secret key provided is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When object is not found
/// When a functionality or extension is not implemented
/// When object lock configuration on bucket is not set
Task GetObjectRetentionAsync(GetObjectRetentionArgs args,
CancellationToken cancellationToken = default);
///
/// Clears the Retention configuration for the object
///
///
/// ClearObjectRetentionArgs Arguments Object which has object identifier information - bucket name,
/// object name, version ID
///
/// Optional cancellation token to cancel the operation
/// Task
/// When access or secret key provided is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When object is not found
/// When object lock configuration on bucket is not set
/// When a functionality or extension is not implemented
/// When configuration XML provided is invalid
Task ClearObjectRetentionAsync(ClearObjectRetentionArgs args, CancellationToken cancellationToken = default);
///
/// Removes an object with given name in specific bucket
///
///
/// RemoveObjectArgs Arguments Object encapsulates information like - bucket name, object name, whether
/// delete all versions
///
/// Optional cancellation token to cancel the operation
///
/// When access or secret key provided is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
Task RemoveObjectAsync(RemoveObjectArgs args, CancellationToken cancellationToken = default);
///
/// Removes list of objects from bucket
///
///
/// RemoveObjectsArgs Arguments Object encapsulates information like - bucket name, List of objects,
/// optional list of versions (for each object) to be deleted
///
/// Optional cancellation token to cancel the operation
/// Observable that returns delete error while deleting objects if any
/// When access or secret key provided is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When a functionality or extension is not implemented
Task> RemoveObjectsAsync(RemoveObjectsArgs args,
CancellationToken cancellationToken = default);
///
/// Copy a source object into a new destination object.
///
///
/// CopyObjectArgs Arguments Object which encapsulates bucket name, object name, destination bucket,
/// destination object names, Copy conditions object, metadata, SSE source, destination objects
///
/// Optional cancellation token to cancel the operation
///
/// When access or secret key is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When object is not found
/// For encrypted copy operation, Access is denied if the key is wrong
Task CopyObjectAsync(CopyObjectArgs args, CancellationToken cancellationToken = default);
///
/// Get an object. The object will be streamed to the callback given by the user.
///
///
/// GetObjectArgs Arguments Object encapsulates information like - bucket name, object name, server-side
/// encryption object, action stream, length, offset
///
/// Optional cancellation token to cancel the operation
/// When access or secret key is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When object is not found
/// If the directory to copy to is not found
Task GetObjectAsync(GetObjectArgs args, CancellationToken cancellationToken = default);
///
/// Creates object in a bucket fom input stream or filename.
///
///
/// PutObjectArgs Arguments object encapsulating bucket name, object name, file name, object data
/// stream, object size, content type.
///
/// Optional cancellation token to cancel the operation
/// When access or secret key is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// If the file to copy from not found
/// The file stream has been disposed
/// The file stream cannot be read from
/// The file stream is currently in a read operation
/// For encrypted PUT operation, Access is denied if the key is wrong
Task PutObjectAsync(PutObjectArgs args, CancellationToken cancellationToken = default);
///
/// Select an object's content. The object will be streamed to the callback given by the user.
///
///
/// SelectObjectContentArgs Arguments Object which encapsulates bucket name, object name, Select Object
/// Options
///
/// Optional cancellation token to cancel the operation
/// When access or secret key provided is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When object is not found
Task SelectObjectContentAsync(SelectObjectContentArgs args,
CancellationToken cancellationToken = default);
///
/// Lists all incomplete uploads in a given bucket and prefix recursively
///
/// ListIncompleteUploadsArgs Arguments Object which encapsulates bucket name, prefix, recursive
/// Optional cancellation token to cancel the operation
/// A lazily populated list of incomplete uploads
/// When access or secret key provided is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When object is not found
IObservable ListIncompleteUploads(ListIncompleteUploadsArgs args,
CancellationToken cancellationToken = default);
///
/// Remove incomplete uploads from a given bucket and objectName
///
/// RemoveIncompleteUploadArgs Arguments Object which encapsulates bucket, object names
/// Optional cancellation token to cancel the operation
///
/// When access or secret key is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When object is not found
/// When configuration XML provided is invalid
Task RemoveIncompleteUploadAsync(RemoveIncompleteUploadArgs args, CancellationToken cancellationToken = default);
///
/// Presigned get url - returns a presigned url to access an object's data without credentials.URL can have a maximum
/// expiry of
/// up to 7 days or a minimum of 1 second.Additionally, you can override a set of response headers using reqParams.
///
///
/// PresignedGetObjectArgs Arguments object encapsulating bucket and object names, expiry time, response
/// headers, request date
///
///
/// When access or secret key is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When object is not found
Task PresignedGetObjectAsync(PresignedGetObjectArgs args);
///
/// Presigned post policy
///
/// PresignedPostPolicyArgs Arguments object encapsulating Policy, Expiry, Region,
/// Tuple of URI and Policy Form data
/// When access or secret key is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When object is not found
/// When configuration XML provided is invalid
Task<(Uri, IDictionary)> PresignedPostPolicyAsync(PresignedPostPolicyArgs args);
///
/// Presigned Put url -returns a presigned url to upload an object without credentials.URL can have a maximum expiry of
/// upto 7 days or a minimum of 1 second.
///
/// PresignedPutObjectArgs Arguments Object which encapsulates bucket, object names, expiry
///
/// When access or secret key is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When object is not found
/// When configuration XML provided is invalid
Task PresignedPutObjectAsync(PresignedPutObjectArgs args);
///
/// Tests the object's existence and returns metadata about existing objects.
///
///
/// StatObjectArgs Arguments Object encapsulates information like - bucket name, object name,
/// server-side encryption object
///
/// Optional cancellation token to cancel the operation
/// Facts about the object
Task StatObjectAsync(StatObjectArgs args, CancellationToken cancellationToken = default);
///
/// Presigned post policy
///
///
///
Task<(Uri, IDictionary)> PresignedPostPolicyAsync(PostPolicy policy);
///
/// Gets Tagging values set for this object
///
/// GetObjectTagsArgs Arguments Object with information like Bucket, Object name, (optional)version Id
/// Optional cancellation token to cancel the operation
/// Tagging Object with key-value tag pairs
/// When access or secret key is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When a functionality or extension is not implemented
/// When object is not found
Task GetObjectTagsAsync(GetObjectTagsArgs args, CancellationToken cancellationToken = default);
///
/// Sets the Tagging values for this object
///
///
/// SetObjectTagsArgs Arguments Object with information like Bucket name,Object name, (optional)version
/// Id, tag key-value pairs
///
/// Optional cancellation token to cancel the operation
///
/// When access or secret key is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When object is not found
/// When a functionality or extension is not implemented
/// When configuration XML provided is invalid
Task SetObjectTagsAsync(SetObjectTagsArgs args, CancellationToken cancellationToken = default);
///
/// Removes Tagging values stored for the object
///
/// RemoveObjectTagsArgs Arguments Object with information like Bucket name
/// Optional cancellation token to cancel the operation
///
/// When access or secret key is invalid
/// When bucket name is invalid
/// When object name is invalid
/// When bucket is not found
/// When a functionality or extension is not implemented
/// When object is not found
/// When configuration XML provided is invalid
Task RemoveObjectTagsAsync(RemoveObjectTagsArgs args, CancellationToken cancellationToken = default);
}