aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/minio/minio-go/v7/core.go
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2024-01-02 18:56:31 +0100
committerLibravatar Rutger Broekhoff2024-01-02 18:56:31 +0100
commit8db41da676ac8368ef7c2549d56239a5ff5eedde (patch)
tree09c427fd66de2ec1ebffc8342f5fdbb84b0701b5 /vendor/github.com/minio/minio-go/v7/core.go
parentd4f75fb6db22e57577867445a022227e70958931 (diff)
downloadgitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.tar.gz
gitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.zip
Delete vendor directory
Diffstat (limited to 'vendor/github.com/minio/minio-go/v7/core.go')
-rw-r--r--vendor/github.com/minio/minio-go/v7/core.go150
1 files changed, 0 insertions, 150 deletions
diff --git a/vendor/github.com/minio/minio-go/v7/core.go b/vendor/github.com/minio/minio-go/v7/core.go
deleted file mode 100644
index 132ea70..0000000
--- a/vendor/github.com/minio/minio-go/v7/core.go
+++ /dev/null
@@ -1,150 +0,0 @@
1/*
2 * MinIO Go Library for Amazon S3 Compatible Cloud Storage
3 * Copyright 2015-2017 MinIO, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package minio
19
20import (
21 "context"
22 "io"
23 "net/http"
24
25 "github.com/minio/minio-go/v7/pkg/encrypt"
26)
27
28// Core - Inherits Client and adds new methods to expose the low level S3 APIs.
29type Core struct {
30 *Client
31}
32
33// NewCore - Returns new initialized a Core client, this CoreClient should be
34// only used under special conditions such as need to access lower primitives
35// and being able to use them to write your own wrappers.
36func NewCore(endpoint string, opts *Options) (*Core, error) {
37 var s3Client Core
38 client, err := New(endpoint, opts)
39 if err != nil {
40 return nil, err
41 }
42 s3Client.Client = client
43 return &s3Client, nil
44}
45
46// ListObjects - List all the objects at a prefix, optionally with marker and delimiter
47// you can further filter the results.
48func (c Core) ListObjects(bucket, prefix, marker, delimiter string, maxKeys int) (result ListBucketResult, err error) {
49 return c.listObjectsQuery(context.Background(), bucket, prefix, marker, delimiter, maxKeys, nil)
50}
51
52// ListObjectsV2 - Lists all the objects at a prefix, similar to ListObjects() but uses
53// continuationToken instead of marker to support iteration over the results.
54func (c Core) ListObjectsV2(bucketName, objectPrefix, startAfter, continuationToken, delimiter string, maxkeys int) (ListBucketV2Result, error) {
55 return c.listObjectsV2Query(context.Background(), bucketName, objectPrefix, continuationToken, true, false, delimiter, startAfter, maxkeys, nil)
56}
57
58// CopyObject - copies an object from source object to destination object on server side.
59func (c Core) CopyObject(ctx context.Context, sourceBucket, sourceObject, destBucket, destObject string, metadata map[string]string, srcOpts CopySrcOptions, dstOpts PutObjectOptions) (ObjectInfo, error) {
60 return c.copyObjectDo(ctx, sourceBucket, sourceObject, destBucket, destObject, metadata, srcOpts, dstOpts)
61}
62
63// CopyObjectPart - creates a part in a multipart upload by copying (a
64// part of) an existing object.
65func (c Core) CopyObjectPart(ctx context.Context, srcBucket, srcObject, destBucket, destObject, uploadID string,
66 partID int, startOffset, length int64, metadata map[string]string,
67) (p CompletePart, err error) {
68 return c.copyObjectPartDo(ctx, srcBucket, srcObject, destBucket, destObject, uploadID,
69 partID, startOffset, length, metadata)
70}
71
72// PutObject - Upload object. Uploads using single PUT call.
73func (c Core) PutObject(ctx context.Context, bucket, object string, data io.Reader, size int64, md5Base64, sha256Hex string, opts PutObjectOptions) (UploadInfo, error) {
74 hookReader := newHook(data, opts.Progress)
75 return c.putObjectDo(ctx, bucket, object, hookReader, md5Base64, sha256Hex, size, opts)
76}
77
78// NewMultipartUpload - Initiates new multipart upload and returns the new uploadID.
79func (c Core) NewMultipartUpload(ctx context.Context, bucket, object string, opts PutObjectOptions) (uploadID string, err error) {
80 result, err := c.initiateMultipartUpload(ctx, bucket, object, opts)
81 return result.UploadID, err
82}
83
84// ListMultipartUploads - List incomplete uploads.
85func (c Core) ListMultipartUploads(ctx context.Context, bucket, prefix, keyMarker, uploadIDMarker, delimiter string, maxUploads int) (result ListMultipartUploadsResult, err error) {
86 return c.listMultipartUploadsQuery(ctx, bucket, keyMarker, uploadIDMarker, prefix, delimiter, maxUploads)
87}
88
89// PutObjectPartOptions contains options for PutObjectPart API
90type PutObjectPartOptions struct {
91 Md5Base64, Sha256Hex string
92 SSE encrypt.ServerSide
93 CustomHeader, Trailer http.Header
94}
95
96// PutObjectPart - Upload an object part.
97func (c Core) PutObjectPart(ctx context.Context, bucket, object, uploadID string, partID int,
98 data io.Reader, size int64, opts PutObjectPartOptions,
99) (ObjectPart, error) {
100 p := uploadPartParams{
101 bucketName: bucket,
102 objectName: object,
103 uploadID: uploadID,
104 reader: data,
105 partNumber: partID,
106 md5Base64: opts.Md5Base64,
107 sha256Hex: opts.Sha256Hex,
108 size: size,
109 sse: opts.SSE,
110 streamSha256: true,
111 customHeader: opts.CustomHeader,
112 trailer: opts.Trailer,
113 }
114 return c.uploadPart(ctx, p)
115}
116
117// ListObjectParts - List uploaded parts of an incomplete upload.x
118func (c Core) ListObjectParts(ctx context.Context, bucket, object, uploadID string, partNumberMarker, maxParts int) (result ListObjectPartsResult, err error) {
119 return c.listObjectPartsQuery(ctx, bucket, object, uploadID, partNumberMarker, maxParts)
120}
121
122// CompleteMultipartUpload - Concatenate uploaded parts and commit to an object.
123func (c Core) CompleteMultipartUpload(ctx context.Context, bucket, object, uploadID string, parts []CompletePart, opts PutObjectOptions) (UploadInfo, error) {
124 res, err := c.completeMultipartUpload(ctx, bucket, object, uploadID, completeMultipartUpload{
125 Parts: parts,
126 }, opts)
127 return res, err
128}
129
130// AbortMultipartUpload - Abort an incomplete upload.
131func (c Core) AbortMultipartUpload(ctx context.Context, bucket, object, uploadID string) error {
132 return c.abortMultipartUpload(ctx, bucket, object, uploadID)
133}
134
135// GetBucketPolicy - fetches bucket access policy for a given bucket.
136func (c Core) GetBucketPolicy(ctx context.Context, bucket string) (string, error) {
137 return c.getBucketPolicy(ctx, bucket)
138}
139
140// PutBucketPolicy - applies a new bucket access policy for a given bucket.
141func (c Core) PutBucketPolicy(ctx context.Context, bucket, bucketPolicy string) error {
142 return c.putBucketPolicy(ctx, bucket, bucketPolicy)
143}
144
145// GetObject is a lower level API implemented to support reading
146// partial objects and also downloading objects with special conditions
147// matching etag, modtime etc.
148func (c Core) GetObject(ctx context.Context, bucketName, objectName string, opts GetObjectOptions) (io.ReadCloser, ObjectInfo, http.Header, error) {
149 return c.getObject(ctx, bucketName, objectName, opts)
150}