This project aims to bring over as many Google Cloud Platform APIs as possible to server side swift projects built on top of Swift NIO.
Because the products and API's are so vast this will start slowly and over time add more API's as time goes on.
Before you begin note that this package only supports using Service accounts to authenticate to the various Google Cloud Platform APIs using OAuth2.
- Select or create a Cloud Platform project.
- Enable billing for your project.
[Enable billing](https://raw.github.com/vapor-community/google-cloud-kit/blob/master/ https://support.google.com/cloud/answer/6293499#enable-billing)
- Enable the Google Cloud Storage API.
- Set up authentication with a service account so you can access the API from your local workstation.
To begin using GogleCloudKit in your project you'll need to setup the initial configuration.
Package.swift file, add the following
.package(url: "https://github.com/vapor-community/GoogleCloudKit.git", from: "1.0.0-alpha.1")
Now setup the configuration.
import GoogleCloudKit let credentialsConfig = GoogleCloudCredentialsConfiguration(project: "myprojectid-12345", credentialsFile: "~/path/to/service-account.json")
Optionally, you can register an empty
GoogleCloudCredentialsConfiguration() and configure the following environment variables:
export PROJECT_ID=myprojectid-12345 export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/service-account.json
Additionally, you can copy and paste the contents of your Service Account JSON file as the value for the
GOOGLE_APPLICATION_CREDENTIALS environment variable:
export GOOGLE_APPLICATION_CREDENTIALS=[Valid Pasted JSON]
Currently the following API's are implemented and you can follow the setup guides for each specific API to integrate with your project.
- [x] Cloud Storage Setup guide
You may find interesting
GoogleCloudKit 1.0.0 Alpha 11 - 2020-03-13 15:04:09
This release removes the
exact requirement for using
async-http-client. We're generally trust worthy of the NIO developers to follow semversion.
GoogleCloudKit 1.0.0 Alpha 10 - 2020-03-13 12:07:54
GoogleCloudKit 1.0.0 Alpha 9 - 2020-03-13 01:17:50
This release updates the library to require swift 5.2.
hopped eventloop helper for
GoogleCloudKit Alpha 8 - 2020-01-22 01:27:05
This release adds the
subscription field to the
This allows specific configuration for APIs to accept a
subscription when creating JWT tokens if they need to do so.
GoogleCloudKit Alpha 7 - 2019-12-14 01:10:46
This release updates the
GoogleCloudCredentialsConfiguration to perform the work of reading the service account from disk rather than having
GoogleCloudStorageClient do it.
This approach has the benefit of reducing overhead by not having to block and read from disk if a user initializes a
GoogleCloudStorageClient in a computed property for example. Setting up the configuration to perform that work steers a user to do that operation once and in a manner where a system is still initializing and it's ok to take that overhead.
GoogleCloudKit Alpha 6 - 2019-12-13 00:43:29
This version has breaking changes.
It's now required when initializing a new APIClient
GoogleCloudStorageClient for example,
to provide an
HTTPClient and an event loop you want to be notified on when a promise resolves.
let credentialsConfiguration = GoogleCloudCredentialsConfiguration() let cloudStorageConfiguration: GoogleCloudStorageConfiguration = .default() let elg = MultiThreadedEventLoopGroup(numberOfThreads: 1) let client = HTTPClient(eventLoopGroupProvider: .shared(elg), configuration: .init(ignoreUncleanSSLShutdown: true)) let gcs = try GoogleCloudStorageClient(credentials: credentialsConfiguration, storageConfig: cloudStorageConfiguration, httpClient: client, eventLoop: elg.next())
GoogleCloudKit 1.0.0 Alpha 5 - 2019-12-09 23:06:49
GoogleCloudKit Alpha 4.0.0 - 2019-12-09 02:55:59
This release updates the JWT package to the latest implementation from JWTKit
GoogleCloudKit Alpha 3.0.1 - 2019-11-03 02:59:45
Fixed a bug with shutting down the http client when no project id is set.
GoogleCloudKit Alpha 3 - 2019-11-02 17:11:40
This release makes the library modular and sets up the package to be flexible in which APIs you use.
for example instead of just importing
GoogleCloudKit and having to compile every API that's implemented, you can specifically import the API you're looking to use
import GoogleCloudKit // Compiles CloudStorage library, PubSub library, etc... import Storage // Only compiles CloudStorage
GoogleCloudKit Alpha 2.1.1 - 2019-10-06 18:55:54
Fixes an issue where we weren't shutting down the
GoogleCloudKit Alpha 2.1 - 2019-10-01 22:09:55
Added a fix for an empty 404 response that may be returned by google.
GoogleCloudKit Alpha 2 - 2019-08-23 16:46:46
Updated to use latest version of AsyncHTTPClient Made StorageClient initializer take an eventloop Fixed storage upload URL Updated README
GoogleCloudKit Alpha 1.2 - 2019-08-13 17:00:38
GoogleCloudStorageClient's initializer is now public.
GoogleCloudKit Alpha 1.1 - 2019-08-12 22:53:39
Finished the object API implementation
GoogleCloudKit 1.0.0 Alpha 1 - 2019-08-11 22:50:36
Not completely finished just yet. Still have to implement a few more APIs in the Storage Object API. Only Cloud Storage is supported right now.