Skip to content

Commit 02810b1

Browse files
committed
Fixed GCS breaks due to APIs changes
1 parent e783857 commit 02810b1

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

environment-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
- blosc
1515
- gdal
1616
- nlohmann_json
17-
- google-cloud-cpp
17+
- google-cloud-cpp >=3.0,<4
1818
- aws-sdk-cpp
1919
- xtensor=0.25.0
2020
- cpp-filesystem

include/xtensor-io/xio_gcs_handler.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <xtensor/xarray.hpp>
55
#include <xtensor/xexpression.hpp>
66
#include <google/cloud/storage/client.h>
7+
#include <google/cloud/credentials.h>
78
#include "xfile_array.hpp"
89
#include "xio_stream_wrapper.hpp"
910

@@ -43,7 +44,7 @@ namespace xt
4344

4445
template <class C>
4546
xio_gcs_handler<C>::xio_gcs_handler()
46-
: m_client(gcs::ClientOptions((gcs::oauth2::CreateAnonymousCredentials())))
47+
: m_client(google::cloud::Options{}.set<google::cloud::UnifiedCredentialsOption>(google::cloud::MakeInsecureCredentials()))
4748
{
4849
}
4950

test/test_xio_gcs_handler.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <exception>
1313

1414
#include "gtest/gtest.h"
15+
#include <google/cloud/credentials.h>
1516
#include "xtensor-io/xio_gzip.hpp"
1617
#include "xtensor-io/xio_gcs_handler.hpp"
1718

@@ -20,7 +21,10 @@ namespace xt
2021
TEST(xio_gcs_handler, read)
2122
{
2223
xio_gcs_handler<xio_gzip_config> h;
23-
xio_gcs_config c = {gcs::Client((gcs::ClientOptions(gcs::oauth2::CreateAnonymousCredentials()))), "zarr-demo"};
24+
xio_gcs_config c = {gcs::Client(google::cloud::Options{}.set<google::cloud::UnifiedCredentialsOption>(
25+
google::cloud::MakeInsecureCredentials())),
26+
"zarr-demo"};
27+
2428
h.configure_io(c);
2529
xarray<int32_t> a0;
2630
h.read(a0, "v3/test.zr3/data/root/arthur/dent/c0/0");

0 commit comments

Comments
 (0)