From 238f465f0a43a8152e69a819dc73927e2cf370d1 Mon Sep 17 00:00:00 2001 From: Petr Kobalicek Date: Tue, 26 Mar 2024 17:21:12 +0100 Subject: [PATCH] Moved C++ headers to miniocpp subdirectory (#123) * Use #include to include minio-cpp now * Header files have consistent guards that don't start with _ * Added a SPDX license identifier to each source and header file * Use clang-format-18 to format the source code Co-authored-by: Petr Kobalicek --- .github/workflows/ci.yml | 91 ++++++++++++++++------------ CMakeLists.txt | 33 +++++----- README.md | 11 ++-- check-style.sh | 14 +++-- examples/BucketExists.cc | 6 +- examples/ComposeObject.cc | 6 +- examples/CopyObject.cc | 6 +- examples/DeleteBucketEncryption.cc | 6 +- examples/DeleteBucketLifecycle.cc | 6 +- examples/DeleteBucketNotification.cc | 6 +- examples/DeleteBucketPolicy.cc | 6 +- examples/DeleteBucketReplication.cc | 6 +- examples/DeleteBucketTags.cc | 6 +- examples/DeleteObjectLockConfig.cc | 6 +- examples/DeleteObjectTags.cc | 6 +- examples/DisableObjectLegalHold.cc | 6 +- examples/DownloadObject.cc | 6 +- examples/EnableObjectLegalHold.cc | 6 +- examples/GetBucketEncryption.cc | 6 +- examples/GetBucketLifecycle.cc | 6 +- examples/GetBucketNotification.cc | 6 +- examples/GetBucketPolicy.cc | 6 +- examples/GetBucketReplication.cc | 6 +- examples/GetBucketTags.cc | 9 +-- examples/GetBucketVersioning.cc | 6 +- examples/GetObject.cc | 6 +- examples/GetObjectLockConfig.cc | 6 +- examples/GetObjectProgress.cc | 4 +- examples/GetObjectRetention.cc | 6 +- examples/GetObjectTags.cc | 9 +-- examples/GetPresignedObjectUrl.cc | 6 +- examples/GetPresignedPostFormData.cc | 6 +- examples/IsObjectLegalHoldEnabled.cc | 6 +- examples/ListBuckets.cc | 6 +- examples/ListObjects.cc | 6 +- examples/ListenBucketNotification.cc | 6 +- examples/MakeBucket.cc | 6 +- examples/PutObject.cc | 16 ++--- examples/PutObjectProgress.cc | 15 ++--- examples/RemoveBucket.cc | 6 +- examples/RemoveObject.cc | 6 +- examples/RemoveObjects.cc | 6 +- examples/SelectObjectContent.cc | 8 ++- examples/SetBucketEncryption.cc | 6 +- examples/SetBucketLifecycle.cc | 6 +- examples/SetBucketNotification.cc | 6 +- examples/SetBucketPolicy.cc | 6 +- examples/SetBucketReplication.cc | 6 +- examples/SetBucketTags.cc | 6 +- examples/SetBucketVersioning.cc | 6 +- examples/SetObjectLockConfig.cc | 6 +- examples/SetObjectRetention.cc | 6 +- examples/SetObjectTags.cc | 6 +- examples/StatObject.cc | 6 +- examples/UploadObject.cc | 6 +- include/{ => miniocpp}/args.h | 12 ++-- include/{ => miniocpp}/baseclient.h | 11 ++-- include/{ => miniocpp}/client.h | 13 ++-- include/{ => miniocpp}/config.h | 4 +- include/{ => miniocpp}/credentials.h | 12 ++-- include/{ => miniocpp}/error.h | 12 ++-- include/{ => miniocpp}/http.h | 13 ++-- include/{ => miniocpp}/providers.h | 12 ++-- include/{ => miniocpp}/request.h | 13 ++-- include/{ => miniocpp}/response.h | 12 ++-- include/{ => miniocpp}/select.h | 10 +-- include/{ => miniocpp}/signer.h | 12 ++-- include/{ => miniocpp}/sse.h | 10 +-- include/{ => miniocpp}/types.h | 13 ++-- include/{ => miniocpp}/utils.h | 12 ++-- src/args.cc | 16 ++--- src/baseclient.cc | 62 +++++++++---------- src/client.cc | 26 ++++---- src/credentials.cc | 10 +-- src/http.cc | 13 ++-- src/providers.cc | 19 +++--- src/request.cc | 18 +++--- src/response.cc | 12 ++-- src/select.cc | 14 +++-- src/signer.cc | 10 +-- src/sse.cc | 8 ++- src/types.cc | 32 ++++------ src/utils.cc | 17 +++--- tests/tests.cc | 22 ++++--- 84 files changed, 558 insertions(+), 372 deletions(-) rename include/{ => miniocpp}/args.h (98%) rename include/{ => miniocpp}/baseclient.h (97%) rename include/{ => miniocpp}/client.h (95%) rename include/{ => miniocpp}/config.h (97%) rename include/{ => miniocpp}/credentials.h (92%) rename include/{ => miniocpp}/error.h (88%) rename include/{ => miniocpp}/http.h (96%) rename include/{ => miniocpp}/providers.h (97%) rename include/{ => miniocpp}/request.h (95%) rename include/{ => miniocpp}/response.h (98%) rename include/{ => miniocpp}/select.h (90%) rename include/{ => miniocpp}/signer.h (95%) rename include/{ => miniocpp}/sse.h (89%) rename include/{ => miniocpp}/types.h (99%) rename include/{ => miniocpp}/utils.h (97%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f654a5d..229fd1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,16 +16,34 @@ permissions: contents: read jobs: + coding-style: + name: "Coding Style Check" + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies if Ubuntu + run: | + wget --quiet -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-18 main' | sudo tee -a /etc/apt/sources.list + sudo apt-get -qy update + sudo apt-get -qy install clang-format-18 + clang-format-18 --version + + - name: Coding Style Check + shell: bash + run: | + CLANG_FORMAT=clang-format-18 ./check-style.sh + build: - name: ${{ matrix.config.name }} - runs-on: ${{ matrix.config.os }} strategy: fail-fast: false matrix: config: - { name: "Ubuntu_Latest_GCC", - os: Ubuntu-latest, + os: ubuntu-latest, build_type: "Release", cc: "gcc", cxx: "g++" @@ -45,8 +63,20 @@ jobs: cxx: "cl" } + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + steps: - - uses: actions/checkout@v2 + - name: Checkout minio-cpp + uses: actions/checkout@v4 + with: + path: "minio-cpp" + + - name: Checkout vcpkg + uses: actions/checkout@v4 + with: + repository: microsoft/vcpkg + path: "vcpkg" - name: Print env run: | @@ -57,22 +87,20 @@ jobs: if: startsWith(matrix.config.name, 'Ubuntu_Latest_GCC') run: | wget --quiet -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main' | sudo tee -a /etc/apt/sources.list + echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-18 main' | sudo tee -a /etc/apt/sources.list sudo apt-get -qy update - sudo apt-get -qy install cmake clang-format-14 + sudo apt-get -qy install cmake wget --quiet https://dl.min.io/server/minio/release/linux-amd64/minio chmod +x minio cmake --version - clang-format --version ./minio --version - name: Install dependencies if macOS if: startsWith(matrix.config.os, 'macos') run: | - brew install pkg-config cmake clang-format minio/stable/minio + brew install pkg-config cmake minio/stable/minio cmake --version minio --version - clang-format --version - name: Install dependencies if Windows shell: bash @@ -83,35 +111,21 @@ jobs: chmod +x minio.exe cmake --version - - name: Install vcpkg - shell: bash - run: | - mkdir -p ~/.vcpkg - touch ~/.vcpkg/vcpkg.path.txt - wget --quiet -O vcpkg-master.zip https://github.com/microsoft/vcpkg/archive/refs/heads/master.zip - unzip -qq vcpkg-master.zip - ./vcpkg-master/bootstrap-vcpkg.sh - ./vcpkg-master/vcpkg integrate install - ./vcpkg-master/vcpkg install - - - name: C++ Style check if not Windows - if: ${{ !startsWith(matrix.config.os, 'windows') }} - shell: bash - run: | - ./check-style.sh - - name: Configure and Build shell: bash run: | - cmake -B ./build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DCMAKE_TOOLCHAIN_FILE=./vcpkg-master/scripts/buildsystems/vcpkg.cmake -DMINIO_CPP_TEST:BOOL=ON - cmake --build ./build --config ${{ matrix.config.build_type }} -j 4 + ./vcpkg/bootstrap-vcpkg.sh + cd minio-cpp + ../vcpkg/vcpkg install + cmake . -B ./build -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake -DMINIO_CPP_TEST:BOOL=ON + cmake --build ./build --config ${{matrix.config.build_type}} -j 4 - name: Start MinIO server if Ubuntu if: startsWith(matrix.config.name, 'Ubuntu_Latest_GCC') run: | mkdir -p ~/.minio/certs - cp ./tests/public.crt ./tests/private.key ~/.minio/certs/ - sudo cp ./tests/public.crt /usr/local/share/ca-certificates/ + cp ./minio-cpp/tests/public.crt ./minio-cpp/tests/private.key ~/.minio/certs/ + sudo cp ./minio-cpp/tests/public.crt /usr/local/share/ca-certificates/ sudo update-ca-certificates MINIO_CI_CD=true ./minio server /tmp/test-xl/{1...4}/ & sleep 10 @@ -127,29 +141,28 @@ jobs: shell: bash run: | mkdir -p ~/.minio/certs - cp ./tests/public.crt ./tests/private.key ~/.minio/certs/ - certutil -addstore -f "ROOT" ./tests/public.crt + cp ./minio-cpp/tests/public.crt ./minio-cpp/tests/private.key ~/.minio/certs/ + certutil -addstore -f "ROOT" ./minio-cpp/tests/public.crt MINIO_CI_CD=true ./minio.exe server test-xl/{1...4}/ & sleep 10 - name: Run tests if Ubuntu if: startsWith(matrix.config.name, 'Ubuntu_Latest_GCC') run: | - SERVER_ENDPOINT=localhost:9000 ACCESS_KEY=minioadmin SECRET_KEY=minioadmin ENABLE_HTTPS=1 ./build/tests + SERVER_ENDPOINT=localhost:9000 ACCESS_KEY=minioadmin SECRET_KEY=minioadmin ENABLE_HTTPS=1 ./minio-cpp/build/tests - name: Run tests if macOS if: startsWith(matrix.config.name, 'macos') run: | - SERVER_ENDPOINT=localhost:9000 ACCESS_KEY=minioadmin SECRET_KEY=minioadmin ./build/tests + SERVER_ENDPOINT=localhost:9000 ACCESS_KEY=minioadmin SECRET_KEY=minioadmin ./minio-cpp/build/tests - name: Run tests if Windows shell: bash if: startsWith(matrix.config.os, 'windows') run: | - SERVER_ENDPOINT=localhost:9000 ACCESS_KEY=minioadmin SECRET_KEY=minioadmin ENABLE_HTTPS=1 ./build/Release/tests.exe + SERVER_ENDPOINT=localhost:9000 ACCESS_KEY=minioadmin SECRET_KEY=minioadmin ENABLE_HTTPS=1 ./minio-cpp/build/Release/tests.exe - name: Run CMake test - working-directory: ${{github.workspace}}/build - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest -C ${{ matrix.config.build_type }} + run: | + cd minio-cpp/build + ctest -C ${{ matrix.config.build_type }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 87a9304..2c05f95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,9 @@ # 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. +# +# SPDX-License-Identifier: Apache-2.0 + cmake_minimum_required(VERSION 3.10) cmake_policy(SET CMP0091 NEW) @@ -97,21 +100,21 @@ set(MINIO_CPP_SOURCES ) set(MINIO_CPP_HEADERS - include/args.h - include/baseclient.h - include/client.h - include/config.h - include/credentials.h - include/error.h - include/http.h - include/providers.h - include/request.h - include/response.h - include/select.h - include/signer.h - include/sse.h - include/types.h - include/utils.h + include/miniocpp/args.h + include/miniocpp/baseclient.h + include/miniocpp/client.h + include/miniocpp/config.h + include/miniocpp/credentials.h + include/miniocpp/error.h + include/miniocpp/http.h + include/miniocpp/providers.h + include/miniocpp/request.h + include/miniocpp/response.h + include/miniocpp/select.h + include/miniocpp/signer.h + include/miniocpp/sse.h + include/miniocpp/types.h + include/miniocpp/utils.h ) add_library(miniocpp STATIC ${MINIO_CPP_SOURCES} ${MINIO_CPP_HEADERS}) diff --git a/README.md b/README.md index 853f492..1e4b9d5 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Typically `minio-cpp` will be part of dependencies specified in `vcpkg.json` fil ## Hacking minio-cpp -In order to run minio-cpp tests and examples, you can do the following assuming `VCPKG_ROOT` points to a `vcpkg` installation: +In order to run minio-cpp tests and examples, you can do the following assuming `VCPKG_ROOT` points to a valid `vcpkg` installation: ```bash $ git clone https://github.com/minio/minio-cpp @@ -58,11 +58,10 @@ The examples above assumed that you have `vcpkg` already installed and you have ```bash $ git clone https://github.com/minio/minio-cpp $ cd minio-cpp -$ wget --quiet -O vcpkg-master.zip https://github.com/microsoft/vcpkg/archive/refs/heads/master.zip -$ unzip -qq vcpkg-master.zip -$ ./vcpkg-master/bootstrap-vcpkg.sh -$ ./vcpkg-master/vcpkg integrate install -$ cmake . -B ./build/Debug -DCMAKE_BUILD_TYPE=Debug -DMINIO_CPP_TEST=ON -DCMAKE_TOOLCHAIN_FILE=./vcpkg-master/scripts/buildsystems/vcpkg.cmake +$ git clone https://github.com/microsoft/vcpkg.git +$ ./vcpkg/bootstrap-vcpkg.sh +$ ./vcpkg/vcpkg install +$ cmake . -B ./build/Debug -DCMAKE_BUILD_TYPE=Debug -DMINIO_CPP_TEST=ON -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake $ cmake --build ./build/Debug ``` diff --git a/check-style.sh b/check-style.sh index 6813dae..5db19fc 100755 --- a/check-style.sh +++ b/check-style.sh @@ -1,11 +1,15 @@ #!/bin/bash -function clang_format() { - echo "verifying 'clang-format --output-replacements-xml --style=Google $@'" - if clang-format --output-replacements-xml --style=Google "$@" | grep -q ' "$tmpfile" ec=0 while read -r file; do - if ! clang_format "$file"; then + if ! do_clang_format "$file"; then ec=255 fi done < "$tmpfile" diff --git a/examples/BucketExists.cc b/examples/BucketExists.cc index 16fb2db..991d658 100644 --- a/examples/BucketExists.cc +++ b/examples/BucketExists.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/ComposeObject.cc b/examples/ComposeObject.cc index 2139fe6..5461057 100644 --- a/examples/ComposeObject.cc +++ b/examples/ComposeObject.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Composeright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/CopyObject.cc b/examples/CopyObject.cc index d978a1f..99780ed 100644 --- a/examples/CopyObject.cc +++ b/examples/CopyObject.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/DeleteBucketEncryption.cc b/examples/DeleteBucketEncryption.cc index 851a0dd..e782205 100644 --- a/examples/DeleteBucketEncryption.cc +++ b/examples/DeleteBucketEncryption.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/DeleteBucketLifecycle.cc b/examples/DeleteBucketLifecycle.cc index 51e8642..573a45a 100644 --- a/examples/DeleteBucketLifecycle.cc +++ b/examples/DeleteBucketLifecycle.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/DeleteBucketNotification.cc b/examples/DeleteBucketNotification.cc index c296b05..cbb3b3a 100644 --- a/examples/DeleteBucketNotification.cc +++ b/examples/DeleteBucketNotification.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/DeleteBucketPolicy.cc b/examples/DeleteBucketPolicy.cc index d459022..ed7b541 100644 --- a/examples/DeleteBucketPolicy.cc +++ b/examples/DeleteBucketPolicy.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/DeleteBucketReplication.cc b/examples/DeleteBucketReplication.cc index 851a0dd..e782205 100644 --- a/examples/DeleteBucketReplication.cc +++ b/examples/DeleteBucketReplication.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/DeleteBucketTags.cc b/examples/DeleteBucketTags.cc index 3db668f..1cc21b6 100644 --- a/examples/DeleteBucketTags.cc +++ b/examples/DeleteBucketTags.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/DeleteObjectLockConfig.cc b/examples/DeleteObjectLockConfig.cc index 4774755..4ac9c85 100644 --- a/examples/DeleteObjectLockConfig.cc +++ b/examples/DeleteObjectLockConfig.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/DeleteObjectTags.cc b/examples/DeleteObjectTags.cc index 669bc4e..27f506a 100644 --- a/examples/DeleteObjectTags.cc +++ b/examples/DeleteObjectTags.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/DisableObjectLegalHold.cc b/examples/DisableObjectLegalHold.cc index 648314f..f9e9e5c 100644 --- a/examples/DisableObjectLegalHold.cc +++ b/examples/DisableObjectLegalHold.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/DownloadObject.cc b/examples/DownloadObject.cc index e1941b0..8a28375 100644 --- a/examples/DownloadObject.cc +++ b/examples/DownloadObject.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/EnableObjectLegalHold.cc b/examples/EnableObjectLegalHold.cc index 5d6e09b..d7b7a98 100644 --- a/examples/EnableObjectLegalHold.cc +++ b/examples/EnableObjectLegalHold.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/GetBucketEncryption.cc b/examples/GetBucketEncryption.cc index f8987d2..391ad92 100644 --- a/examples/GetBucketEncryption.cc +++ b/examples/GetBucketEncryption.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/GetBucketLifecycle.cc b/examples/GetBucketLifecycle.cc index bc6f28e..eaa800b 100644 --- a/examples/GetBucketLifecycle.cc +++ b/examples/GetBucketLifecycle.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/GetBucketNotification.cc b/examples/GetBucketNotification.cc index 4732e8d..8aac6c9 100644 --- a/examples/GetBucketNotification.cc +++ b/examples/GetBucketNotification.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/GetBucketPolicy.cc b/examples/GetBucketPolicy.cc index 138aa8c..9283c94 100644 --- a/examples/GetBucketPolicy.cc +++ b/examples/GetBucketPolicy.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/GetBucketReplication.cc b/examples/GetBucketReplication.cc index f8987d2..391ad92 100644 --- a/examples/GetBucketReplication.cc +++ b/examples/GetBucketReplication.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/GetBucketTags.cc b/examples/GetBucketTags.cc index 81bd8b3..552fd2e 100644 --- a/examples/GetBucketTags.cc +++ b/examples/GetBucketTags.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. @@ -37,8 +39,7 @@ int main() { if (resp) { std::cout << "Bucket tags: " << std::endl; for (auto& [key, value] : resp.tags) { - std::cout << "Key: " << key << ", " - << "Value: " << value << std::endl; + std::cout << "Key: " << key << ", " << "Value: " << value << std::endl; } } else { std::cout << "unable to get bucket tags; " << resp.Error().String() diff --git a/examples/GetBucketVersioning.cc b/examples/GetBucketVersioning.cc index 58aa543..ee9801b 100644 --- a/examples/GetBucketVersioning.cc +++ b/examples/GetBucketVersioning.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/GetObject.cc b/examples/GetObject.cc index fbd311e..ddced56 100644 --- a/examples/GetObject.cc +++ b/examples/GetObject.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/GetObjectLockConfig.cc b/examples/GetObjectLockConfig.cc index 4249d25..9d2782e 100644 --- a/examples/GetObjectLockConfig.cc +++ b/examples/GetObjectLockConfig.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/GetObjectProgress.cc b/examples/GetObjectProgress.cc index be65bbf..729787e 100644 --- a/examples/GetObjectProgress.cc +++ b/examples/GetObjectProgress.cc @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/GetObjectRetention.cc b/examples/GetObjectRetention.cc index 40587a3..4a9be0d 100644 --- a/examples/GetObjectRetention.cc +++ b/examples/GetObjectRetention.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/GetObjectTags.cc b/examples/GetObjectTags.cc index e862a7c..909b1c0 100644 --- a/examples/GetObjectTags.cc +++ b/examples/GetObjectTags.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. @@ -38,8 +40,7 @@ int main() { if (resp) { std::cout << "Object tags: " << std::endl; for (auto& [key, value] : resp.tags) { - std::cout << "Key: " << key << ", " - << "Value: " << value << std::endl; + std::cout << "Key: " << key << ", " << "Value: " << value << std::endl; } } else { std::cout << "unable to get object tags; " << resp.Error().String() diff --git a/examples/GetPresignedObjectUrl.cc b/examples/GetPresignedObjectUrl.cc index 8590645..1a80dc5 100644 --- a/examples/GetPresignedObjectUrl.cc +++ b/examples/GetPresignedObjectUrl.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/GetPresignedPostFormData.cc b/examples/GetPresignedPostFormData.cc index c526b43..c084d8d 100644 --- a/examples/GetPresignedPostFormData.cc +++ b/examples/GetPresignedPostFormData.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/IsObjectLegalHoldEnabled.cc b/examples/IsObjectLegalHoldEnabled.cc index 781bbf0..10f59ec 100644 --- a/examples/IsObjectLegalHoldEnabled.cc +++ b/examples/IsObjectLegalHoldEnabled.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/ListBuckets.cc b/examples/ListBuckets.cc index 39a095e..20a2463 100644 --- a/examples/ListBuckets.cc +++ b/examples/ListBuckets.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/ListObjects.cc b/examples/ListObjects.cc index 3bc3595..e99b8b9 100644 --- a/examples/ListObjects.cc +++ b/examples/ListObjects.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/ListenBucketNotification.cc b/examples/ListenBucketNotification.cc index 2f8ede4..7d56785 100644 --- a/examples/ListenBucketNotification.cc +++ b/examples/ListenBucketNotification.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/MakeBucket.cc b/examples/MakeBucket.cc index 44837bc..4013dbd 100644 --- a/examples/MakeBucket.cc +++ b/examples/MakeBucket.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/PutObject.cc b/examples/PutObject.cc index 0857b2a..d6bd0f8 100644 --- a/examples/PutObject.cc +++ b/examples/PutObject.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,18 +12,20 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 + +#include +#include +#include +#include +#include #include #include #include #include -#include "args.h" -#include "client.h" -#include "providers.h" -#include "request.h" -#include "response.h" - int main() { // Create S3 base URL. minio::s3::BaseUrl base_url("play.min.io"); diff --git a/examples/PutObjectProgress.cc b/examples/PutObjectProgress.cc index 48c99f1..db107ad 100644 --- a/examples/PutObjectProgress.cc +++ b/examples/PutObjectProgress.cc @@ -12,19 +12,20 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 + +#include +#include +#include +#include +#include #include #include #include #include -#include "args.h" -#include "client.h" -#include "http.h" -#include "providers.h" -#include "request.h" -#include "response.h" - int main() { // Create S3 base URL. minio::s3::BaseUrl base_url("play.min.io"); diff --git a/examples/RemoveBucket.cc b/examples/RemoveBucket.cc index 0045e0f..302df27 100644 --- a/examples/RemoveBucket.cc +++ b/examples/RemoveBucket.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/RemoveObject.cc b/examples/RemoveObject.cc index 8525728..676a64f 100644 --- a/examples/RemoveObject.cc +++ b/examples/RemoveObject.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/RemoveObjects.cc b/examples/RemoveObjects.cc index 35b1436..cfe650b 100644 --- a/examples/RemoveObjects.cc +++ b/examples/RemoveObjects.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/SelectObjectContent.cc b/examples/SelectObjectContent.cc index 7538a77..78731b2 100644 --- a/examples/SelectObjectContent.cc +++ b/examples/SelectObjectContent.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,9 +12,11 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" -#include "select.h" +#include +#include int main() { // Create S3 base URL. diff --git a/examples/SetBucketEncryption.cc b/examples/SetBucketEncryption.cc index e249411..f979642 100644 --- a/examples/SetBucketEncryption.cc +++ b/examples/SetBucketEncryption.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/SetBucketLifecycle.cc b/examples/SetBucketLifecycle.cc index c358f23..7567e6b 100644 --- a/examples/SetBucketLifecycle.cc +++ b/examples/SetBucketLifecycle.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/SetBucketNotification.cc b/examples/SetBucketNotification.cc index dddbb86..aefd5ff 100644 --- a/examples/SetBucketNotification.cc +++ b/examples/SetBucketNotification.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/SetBucketPolicy.cc b/examples/SetBucketPolicy.cc index 0a25c18..dc3df74 100644 --- a/examples/SetBucketPolicy.cc +++ b/examples/SetBucketPolicy.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/SetBucketReplication.cc b/examples/SetBucketReplication.cc index e9758f2..198b055 100644 --- a/examples/SetBucketReplication.cc +++ b/examples/SetBucketReplication.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/SetBucketTags.cc b/examples/SetBucketTags.cc index b0be1da..b89aabb 100644 --- a/examples/SetBucketTags.cc +++ b/examples/SetBucketTags.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/SetBucketVersioning.cc b/examples/SetBucketVersioning.cc index 26627df..982313c 100644 --- a/examples/SetBucketVersioning.cc +++ b/examples/SetBucketVersioning.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/SetObjectLockConfig.cc b/examples/SetObjectLockConfig.cc index 77236da..c60db66 100644 --- a/examples/SetObjectLockConfig.cc +++ b/examples/SetObjectLockConfig.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/SetObjectRetention.cc b/examples/SetObjectRetention.cc index 36b503e..57ab6f4 100644 --- a/examples/SetObjectRetention.cc +++ b/examples/SetObjectRetention.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/SetObjectTags.cc b/examples/SetObjectTags.cc index fa67550..82914e2 100644 --- a/examples/SetObjectTags.cc +++ b/examples/SetObjectTags.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/StatObject.cc b/examples/StatObject.cc index ac367b2..606a41b 100644 --- a/examples/StatObject.cc +++ b/examples/StatObject.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/examples/UploadObject.cc b/examples/UploadObject.cc index 364bbc1..629f9f0 100644 --- a/examples/UploadObject.cc +++ b/examples/UploadObject.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include int main() { // Create S3 base URL. diff --git a/include/args.h b/include/miniocpp/args.h similarity index 98% rename from include/args.h rename to include/miniocpp/args.h index a0cda2f..c22503f 100644 --- a/include/args.h +++ b/include/miniocpp/args.h @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,9 +12,11 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#ifndef _MINIO_S3_ARGS_H -#define _MINIO_S3_ARGS_H +#ifndef MINIO_CPP_ARGS_H_INCLUDED +#define MINIO_CPP_ARGS_H_INCLUDED #include #include @@ -30,6 +32,7 @@ namespace minio { namespace s3 { + struct BaseArgs { utils::Multimap extra_headers; utils::Multimap extra_query_params; @@ -600,4 +603,5 @@ struct PostPolicy { }; // struct PostPolicy } // namespace s3 } // namespace minio -#endif // #ifndef __MINIO_S3_ARGS_H + +#endif // _MINIO_CPP_ARGS_H_INCLUDED diff --git a/include/baseclient.h b/include/miniocpp/baseclient.h similarity index 97% rename from include/baseclient.h rename to include/miniocpp/baseclient.h index fcf4cc4..2d7860e 100644 --- a/include/baseclient.h +++ b/include/miniocpp/baseclient.h @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,9 +12,11 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#ifndef _MINIO_S3_BASE_CLIENT_H -#define _MINIO_S3_BASE_CLIENT_H +#ifndef MINIO_CPP_BASECLIENT_H_INCLUDED +#define MINIO_CPP_BASECLIENT_H_INCLUDED #include #include @@ -151,4 +153,5 @@ class BaseClient { }; // class BaseClient } // namespace s3 } // namespace minio -#endif // #ifndef __MINIO_S3_BASE_CLIENT_H + +#endif // MINIO_CPP_BASECLIENT_H_INCLUDED diff --git a/include/client.h b/include/miniocpp/client.h similarity index 95% rename from include/client.h rename to include/miniocpp/client.h index e5d40dd..5e8a37b 100644 --- a/include/client.h +++ b/include/miniocpp/client.h @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,9 +12,11 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#ifndef _MINIO_S3_CLIENT_H -#define _MINIO_S3_CLIENT_H +#ifndef MINIO_CPP_CLIENT_H_INCLUDED +#define MINIO_CPP_CLIENT_H_INCLUDED #include #include @@ -28,6 +30,7 @@ namespace minio { namespace s3 { + class Client; class ListObjectsResult { @@ -121,6 +124,8 @@ class Client : public BaseClient { UploadObjectResponse UploadObject(UploadObjectArgs args); RemoveObjectsResult RemoveObjects(RemoveObjectsArgs args); }; // class Client + } // namespace s3 } // namespace minio -#endif // #ifndef __MINIO_S3_CLIENT_H + +#endif // MINIO_CPP_CLIENT_H_INCLUDED diff --git a/include/config.h b/include/miniocpp/config.h similarity index 97% rename from include/config.h rename to include/miniocpp/config.h index 46665a6..6458f94 100644 --- a/include/config.h +++ b/include/miniocpp/config.h @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,6 +12,8 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 #ifndef MINIO_CPP_CONFIG_H_INCLUDED #define MINIO_CPP_CONFIG_H_INCLUDED diff --git a/include/credentials.h b/include/miniocpp/credentials.h similarity index 92% rename from include/credentials.h rename to include/miniocpp/credentials.h index 039f860..c986244 100644 --- a/include/credentials.h +++ b/include/miniocpp/credentials.h @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,9 +12,11 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#ifndef _MINIO_CREDS_CREDENTIALS_H -#define _MINIO_CREDS_CREDENTIALS_H +#ifndef MINIO_CPP_CREDENTIALS_H_INCLUDED +#define MINIO_CPP_CREDENTIALS_H_INCLUDED #include #include @@ -24,6 +26,7 @@ namespace minio { namespace creds { + bool expired(const utils::UtcTime& expiration); /** @@ -72,7 +75,8 @@ struct Credentials { static Credentials ParseXML(std::string_view data, const std::string& root); }; // class Credentials + } // namespace creds } // namespace minio -#endif // #ifndef _MINIO_CREDS_CREDENTIALS_H +#endif // MINIO_CPP_CREDENTIALS_H_INCLUDED diff --git a/include/error.h b/include/miniocpp/error.h similarity index 88% rename from include/error.h rename to include/miniocpp/error.h index 64eed1f..6b07f24 100644 --- a/include/error.h +++ b/include/miniocpp/error.h @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,9 +12,11 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#ifndef _MINIO_ERROR_H -#define _MINIO_ERROR_H +#ifndef MINIO_CPP_ERROR_H_INCLUDED +#define MINIO_CPP_ERROR_H_INCLUDED #include #include @@ -22,6 +24,7 @@ namespace minio { namespace error { + class Error { private: std::string msg_; @@ -52,7 +55,8 @@ template inline T_RESULT make(TA&&... args) { return T_RESULT{Error(std::forward(args)...)}; } + } // namespace error } // namespace minio -#endif // #ifndef _MINIO_ERROR_H +#endif // MINIO_CPP_ERROR_H_INCLUDED diff --git a/include/http.h b/include/miniocpp/http.h similarity index 96% rename from include/http.h rename to include/miniocpp/http.h index 441f6d4..322f4ee 100644 --- a/include/http.h +++ b/include/miniocpp/http.h @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,9 +12,11 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#ifndef _MINIO_HTTP_H -#define _MINIO_HTTP_H +#ifndef MINIO_CPP_HTTP_H_INCLUDED +#define MINIO_CPP_HTTP_H_INCLUDED #include #include @@ -29,6 +31,7 @@ namespace minio { namespace http { + enum class Method { kGet, kHead, kPost, kPut, kDelete }; // MethodToString converts http Method enum to string. @@ -182,6 +185,8 @@ struct Response { error::Error ReadStatusCode(); error::Error ReadHeaders(); }; // struct Response + } // namespace http } // namespace minio -#endif // #ifndef _MINIO_HTTP_H + +#endif // MINIO_CPP_HTTP_H_INCLUDED diff --git a/include/providers.h b/include/miniocpp/providers.h similarity index 97% rename from include/providers.h rename to include/miniocpp/providers.h index 949b608..c77ee25 100644 --- a/include/providers.h +++ b/include/miniocpp/providers.h @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,9 +12,11 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#ifndef _MINIO_CREDS_PROVIDERS_H -#define _MINIO_CREDS_PROVIDERS_H +#ifndef MINIO_CPP_PROVIDERS_H_INCLUDED +#define MINIO_CPP_PROVIDERS_H_INCLUDED #include #include @@ -31,6 +33,7 @@ namespace minio { namespace creds { + struct Jwt { std::string token; unsigned int expiry = 0; @@ -246,7 +249,8 @@ struct CertificateIdentityProvider : public Provider { virtual Credentials Fetch() override; }; // struct CertificateIdentityProvider + } // namespace creds } // namespace minio -#endif // #ifndef _MINIO_CREDS_PROVIDERS_H +#endif // MINIO_CPP_PROVIDERS_H_INCLUDED diff --git a/include/request.h b/include/miniocpp/request.h similarity index 95% rename from include/request.h rename to include/miniocpp/request.h index 67597a1..84527d8 100644 --- a/include/request.h +++ b/include/miniocpp/request.h @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,9 +12,11 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#ifndef _MINIO_REQUEST_H -#define _MINIO_REQUEST_H +#ifndef MINIO_CPP_REQUEST_H_INCLUDED +#define MINIO_CPP_REQUEST_H_INCLUDED #include #include @@ -26,6 +28,7 @@ namespace minio { namespace s3 { + const std::string AWS_S3_PREFIX = "^(((bucket\\.|accesspoint\\.)" "vpce(-(?!_)[a-z_\\d]+)+\\.s3\\.)|" @@ -136,6 +139,8 @@ struct Request { private: void BuildHeaders(http::Url& url, creds::Provider* const provider); }; // struct Request + } // namespace s3 } // namespace minio -#endif // #ifndef __MINIO_REQUEST_H + +#endif // MINIO_CPP_REQUEST_H_INCLUDED diff --git a/include/response.h b/include/miniocpp/response.h similarity index 98% rename from include/response.h rename to include/miniocpp/response.h index bc43bce..b76e1c6 100644 --- a/include/response.h +++ b/include/miniocpp/response.h @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,9 +12,11 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#ifndef _MINIO_S3_RESPONSE_H -#define _MINIO_S3_RESPONSE_H +#ifndef MINIO_CPP_RESPONSE_H_INCLUDED +#define MINIO_CPP_RESPONSE_H_INCLUDED #include #include @@ -27,6 +29,7 @@ namespace minio { namespace s3 { + struct Response { int status_code = 0; utils::Multimap headers; @@ -565,7 +568,8 @@ struct GetPresignedPostFormDataResponse : public Response { #undef MINIO_S3_DERIVE_FROM_PUT_OBJECT_RESPONSE #undef MINIO_S3_DERIVE_FROM_RESPONSE + } // namespace s3 } // namespace minio -#endif // #ifndef _MINIO_S3_RESPONSE_H +#endif // MINIO_CPP_RESPONSE_H_INCLUDED diff --git a/include/select.h b/include/miniocpp/select.h similarity index 90% rename from include/select.h rename to include/miniocpp/select.h index de2e3f4..798b359 100644 --- a/include/select.h +++ b/include/miniocpp/select.h @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,9 +12,11 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#ifndef _MINIO_S3_SELECT_H -#define _MINIO_S3_SELECT_H +#ifndef MINIO_CPP_SELECT_H_INCLUDED +#define MINIO_CPP_SELECT_H_INCLUDED #include #include @@ -67,4 +69,4 @@ class SelectHandler { } // namespace s3 } // namespace minio -#endif // #ifndef _MINIO_S3_SELECT_H +#endif // MINIO_CPP_SELECT_H_INCLUDED diff --git a/include/signer.h b/include/miniocpp/signer.h similarity index 95% rename from include/signer.h rename to include/miniocpp/signer.h index 836c4d0..f6ae278 100644 --- a/include/signer.h +++ b/include/miniocpp/signer.h @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,9 +12,11 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#ifndef _MINIO_SIGNER_H -#define _MINIO_SIGNER_H +#ifndef MINIO_CPP_SIGNER_H_INCLUDED +#define MINIO_CPP_SIGNER_H_INCLUDED #include @@ -23,6 +25,7 @@ namespace minio { namespace signer { + std::string GetScope(const utils::UtcTime& time, const std::string& region, const std::string& service_name); std::string GetCanonicalRequestHash(const std::string& method, @@ -77,4 +80,5 @@ std::string PostPresignV4(const std::string& data, const std::string& region); } // namespace signer } // namespace minio -#endif // #ifndef __MINIO_SIGNER_H + +#endif // MINIO_CPP_SIGNER_H_INCLUDED diff --git a/include/sse.h b/include/miniocpp/sse.h similarity index 89% rename from include/sse.h rename to include/miniocpp/sse.h index 9a1af48..992fbde 100644 --- a/include/sse.h +++ b/include/miniocpp/sse.h @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,9 +12,11 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#ifndef _MINIO_S3_SSE_H -#define _MINIO_S3_SSE_H +#ifndef MINIO_CPP_SSE_H_INCLUDED +#define MINIO_CPP_SSE_H_INCLUDED #include @@ -63,4 +65,4 @@ class SseS3 : public Sse { } // namespace s3 } // namespace minio -#endif // #ifndef __MINIO_S3_SSE_H +#endif // MINIO_CPP_SSE_H_INCLUDED diff --git a/include/types.h b/include/miniocpp/types.h similarity index 99% rename from include/types.h rename to include/miniocpp/types.h index 9c1f342..dafda65 100644 --- a/include/types.h +++ b/include/miniocpp/types.h @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,9 +12,11 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#ifndef _MINIO_S3_TYPES_H -#define _MINIO_S3_TYPES_H +#ifndef MINIO_CPP_TYPES_H_INCLUDED +#define MINIO_CPP_TYPES_H_INCLUDED #include #include @@ -31,6 +33,7 @@ namespace minio { namespace s3 { + enum class RetentionMode { kGovernance, kCompliance }; // StringToRetentionMode converts string to retention mode enum. @@ -763,6 +766,8 @@ struct ObjectLockConfig { error::Error Validate() const; }; // struct ObjectLockConfig + } // namespace s3 } // namespace minio -#endif // #ifndef __MINIO_S3_TYPES_H + +#endif // MINIO_CPP_TYPES_H_INCLUDED diff --git a/include/utils.h b/include/miniocpp/utils.h similarity index 97% rename from include/utils.h rename to include/miniocpp/utils.h index 8453a5c..bef06a5 100644 --- a/include/utils.h +++ b/include/miniocpp/utils.h @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,9 +12,11 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#ifndef _MINIO_UTILS_H -#define _MINIO_UTILS_H +#ifndef MINIO_CPP_UTILS_H_INCLUDED +#define MINIO_CPP_UTILS_H_INCLUDED #ifndef _WIN32 #include @@ -33,6 +35,7 @@ namespace minio { namespace utils { + inline constexpr unsigned int kMaxMultipartCount = 10000; // 10000 parts inline constexpr uint64_t kMaxObjectSize = 5'497'558'138'880; // 5TiB inline constexpr uint64_t kMaxPartSize = 5'368'709'120; // 5GiB @@ -223,7 +226,8 @@ struct CharBuffer : std::streambuf { off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in) override; }; // struct CharBuffer + } // namespace utils } // namespace minio -#endif // #ifndef _MINIO_UTILS_H +#endif // MINIO_CPP_UTILS_H_INCLUDED diff --git a/src/args.cc b/src/args.cc index 07a00b4..7d07338 100644 --- a/src/args.cc +++ b/src/args.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "args.h" +#include "miniocpp/args.h" #include #include @@ -25,11 +27,11 @@ #include #include -#include "error.h" -#include "http.h" -#include "signer.h" -#include "types.h" -#include "utils.h" +#include "miniocpp/error.h" +#include "miniocpp/http.h" +#include "miniocpp/signer.h" +#include "miniocpp/types.h" +#include "miniocpp/utils.h" minio::error::Error minio::s3::BucketArgs::Validate() const { return utils::CheckBucketName(bucket); diff --git a/src/baseclient.cc b/src/baseclient.cc index 792261e..253962c 100644 --- a/src/baseclient.cc +++ b/src/baseclient.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "baseclient.h" +#include "miniocpp/baseclient.h" #include #include @@ -28,18 +30,18 @@ #include #include -#include "args.h" -#include "config.h" -#include "credentials.h" -#include "error.h" -#include "http.h" -#include "providers.h" -#include "request.h" -#include "response.h" -#include "select.h" -#include "signer.h" -#include "types.h" -#include "utils.h" +#include "miniocpp/args.h" +#include "miniocpp/config.h" +#include "miniocpp/credentials.h" +#include "miniocpp/error.h" +#include "miniocpp/http.h" +#include "miniocpp/providers.h" +#include "miniocpp/request.h" +#include "miniocpp/response.h" +#include "miniocpp/select.h" +#include "miniocpp/signer.h" +#include "miniocpp/types.h" +#include "miniocpp/utils.h" minio::utils::Multimap minio::s3::GetCommonListObjectsQueryParams( const std::string& delimiter, const std::string& encoding_type, @@ -361,12 +363,8 @@ minio::s3::BaseClient::CompleteMultipartUpload( std::stringstream ss; ss << ""; for (auto& part : args.parts) { - ss << "" - << "" << part.number << "" - << "" - << "\"" << part.etag << "\"" - << "" - << ""; + ss << "" << "" << part.number << "" + << "" << "\"" << part.etag << "\"" << "" << ""; } ss << ""; std::string body = ss.str(); @@ -1348,9 +1346,8 @@ minio::s3::MakeBucketResponse minio::s3::BaseClient::MakeBucket( std::string body; if (region != "us-east-1") { std::stringstream ss; - ss << "" - << "" << region << "" - << ""; + ss << "" << "" << region + << "" << ""; body = ss.str(); req.body = body; } @@ -1671,10 +1668,8 @@ minio::s3::SetBucketTagsResponse minio::s3::BaseClient::SetBucketTags( if (!args.tags.empty()) { ss << ""; for (auto& [key, value] : args.tags) { - ss << "" - << "" << key << "" - << "" << value << "" - << ""; + ss << "" << "" << key << "" << "" << value + << "" << ""; } ss << ""; } @@ -1788,10 +1783,9 @@ minio::s3::SetObjectRetentionResponse minio::s3::BaseClient::SetObjectRetention( } std::stringstream ss; - ss << "" - << "" << RetentionModeToString(args.retention_mode) << "" - << "" << args.retain_until_date.ToISO8601UTC() - << "" + ss << "" << "" << RetentionModeToString(args.retention_mode) + << "" << "" + << args.retain_until_date.ToISO8601UTC() << "" << ""; std::string body = ss.str(); @@ -1828,10 +1822,8 @@ minio::s3::SetObjectTagsResponse minio::s3::BaseClient::SetObjectTags( if (!args.tags.empty()) { ss << ""; for (auto& [key, value] : args.tags) { - ss << "" - << "" << key << "" - << "" << value << "" - << ""; + ss << "" << "" << key << "" << "" << value + << "" << ""; } ss << ""; } diff --git a/src/client.cc b/src/client.cc index 7444b53..3894476 100644 --- a/src/client.cc +++ b/src/client.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "client.h" +#include "miniocpp/client.h" #include #include @@ -24,16 +26,16 @@ #include #include -#include "args.h" -#include "baseclient.h" -#include "error.h" -#include "http.h" -#include "providers.h" -#include "request.h" -#include "response.h" -#include "sse.h" -#include "types.h" -#include "utils.h" +#include "miniocpp/args.h" +#include "miniocpp/baseclient.h" +#include "miniocpp/error.h" +#include "miniocpp/http.h" +#include "miniocpp/providers.h" +#include "miniocpp/request.h" +#include "miniocpp/response.h" +#include "miniocpp/sse.h" +#include "miniocpp/types.h" +#include "miniocpp/utils.h" minio::s3::ListObjectsResult::ListObjectsResult(error::Error err) : failed_(true) { diff --git a/src/credentials.cc b/src/credentials.cc index 171544a..ac83bb1 100644 --- a/src/credentials.cc +++ b/src/credentials.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,15 +12,17 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "credentials.h" +#include "miniocpp/credentials.h" #include #include #include -#include "error.h" -#include "utils.h" +#include "miniocpp/error.h" +#include "miniocpp/utils.h" bool minio::creds::expired(const utils::UtcTime& expiration) { if (!expiration) return false; diff --git a/src/http.cc b/src/http.cc index f229442..64e6b6d 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,6 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 + +#include "miniocpp/http.h" #include @@ -32,6 +36,9 @@ #include #include +#include "miniocpp/error.h" +#include "miniocpp/utils.h" + #ifdef _WIN32 #include #include // NOTE needed for AF_INET6 @@ -41,10 +48,6 @@ #include #endif -#include "error.h" -#include "http.h" -#include "utils.h" - std::string minio::http::Url::String() const { if (host.empty()) return {}; diff --git a/src/providers.cc b/src/providers.cc index b78f24b..cb0c3e2 100644 --- a/src/providers.cc +++ b/src/providers.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,11 +12,15 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 #ifdef _WIN32 #define _WINSOCK_DEPRECATED_NO_WARNINGS #endif +#include "miniocpp/providers.h" + #include #include @@ -26,6 +30,12 @@ #include #include +#include "miniocpp/credentials.h" +#include "miniocpp/error.h" +#include "miniocpp/http.h" +#include "miniocpp/signer.h" +#include "miniocpp/utils.h" + #ifdef _WIN32 #include #include @@ -36,13 +46,6 @@ #include #endif -#include "credentials.h" -#include "error.h" -#include "http.h" -#include "providers.h" -#include "signer.h" -#include "utils.h" - minio::error::Error minio::creds::checkLoopbackHost(const std::string& host) { struct addrinfo hints = {}; hints.ai_family = AF_INET; diff --git a/src/request.cc b/src/request.cc index 30ead66..8179972 100644 --- a/src/request.cc +++ b/src/request.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "request.h" +#include "miniocpp/request.h" #include #include @@ -25,12 +27,12 @@ #include #include -#include "credentials.h" -#include "error.h" -#include "http.h" -#include "providers.h" -#include "signer.h" -#include "utils.h" +#include "miniocpp/credentials.h" +#include "miniocpp/error.h" +#include "miniocpp/http.h" +#include "miniocpp/providers.h" +#include "miniocpp/signer.h" +#include "miniocpp/utils.h" #define EMPTY_SHA256 \ "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" diff --git a/src/response.cc b/src/response.cc index eca167b..56f34fd 100644 --- a/src/response.cc +++ b/src/response.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "response.h" +#include "miniocpp/response.h" #include #include @@ -23,9 +25,9 @@ #include #include -#include "error.h" -#include "types.h" -#include "utils.h" +#include "miniocpp/error.h" +#include "miniocpp/types.h" +#include "miniocpp/utils.h" minio::s3::Response::Response() {} diff --git a/src/select.cc b/src/select.cc index 1fa3441..d705de8 100644 --- a/src/select.cc +++ b/src/select.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,17 +12,19 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "select.h" +#include "miniocpp/select.h" #include #include #include -#include "error.h" -#include "http.h" -#include "types.h" -#include "utils.h" +#include "miniocpp/error.h" +#include "miniocpp/http.h" +#include "miniocpp/types.h" +#include "miniocpp/utils.h" void minio::s3::SelectHandler::Reset() { prelude_.clear(); diff --git a/src/signer.cc b/src/signer.cc index 227554d..a2f6b94 100644 --- a/src/signer.cc +++ b/src/signer.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "signer.h" +#include "miniocpp/signer.h" #include #include @@ -23,8 +25,8 @@ #include #include -#include "http.h" -#include "utils.h" +#include "miniocpp/http.h" +#include "miniocpp/utils.h" const char* SIGN_V4_ALGORITHM = "AWS4-HMAC-SHA256"; diff --git a/src/sse.cc b/src/sse.cc index b3e0728..132e3ca 100644 --- a/src/sse.cc +++ b/src/sse.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,12 +12,14 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "sse.h" +#include "miniocpp/sse.h" #include -#include "utils.h" +#include "miniocpp/utils.h" minio::s3::Sse::Sse() {} diff --git a/src/types.cc b/src/types.cc index 9346c41..51578b3 100644 --- a/src/types.cc +++ b/src/types.cc @@ -1,5 +1,5 @@ // MinIO C++ Library for Amazon S3 Compatible Cloud Storage -// Copyright 2022 MinIO, Inc. +// Copyright 2022-2024 MinIO, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,8 +12,10 @@ // 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. +// +// SPDX-License-Identifier: Apache-2.0 -#include "types.h" +#include "miniocpp/types.h" #include #include @@ -23,7 +25,7 @@ #include #include -#include "error.h" +#include "miniocpp/error.h" minio::s3::RetentionMode minio::s3::StringToRetentionMode( std::string_view str) noexcept { @@ -340,10 +342,8 @@ std::string minio::s3::ReplicationConfig::ToXML() const { auto tag_xml = [](std::string key, std::string value) -> std::string { std::stringstream ss; - ss << "" - << "" << key << "" - << "" << value << "" - << ""; + ss << "" << "" << key << "" << "" << value + << "" << ""; return ss.str(); }; @@ -373,8 +373,7 @@ std::string minio::s3::ReplicationConfig::ToXML() const { ss << ""; } if (rule.destination.metrics) { - ss << "" - << ""; + ss << "" << ""; if (rule.destination.metrics.event_threshold_minutes > 0) { ss << minutes_xml(rule.destination.metrics.event_threshold_minutes); } @@ -382,8 +381,7 @@ std::string minio::s3::ReplicationConfig::ToXML() const { << ""; } if (rule.destination.replication_time) { - ss << "" - << "