Skip to content

Commit

Permalink
api: remove openssl dep. split publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
andrusha committed Sep 8, 2023
1 parent a05c168 commit 0fcf8b8
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 56 deletions.
45 changes: 0 additions & 45 deletions .github/workflows/publish.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/publish_api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
workflow_dispatch:

name: Publish API

jobs:

publish-api:
name: Publish Snowflake API
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2

- name: stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- run: cargo publish -p snowflake-api
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
24 changes: 24 additions & 0 deletions .github/workflows/publish_jwt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
workflow_dispatch:

name: Publish JWT

jobs:

publish-jwt:
name: Publish Snowflake JWT
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2

- name: stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- run: cargo publish -p snowflake-jwt
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
2 changes: 1 addition & 1 deletion jwt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "snowflake-jwt"
version = "0.1.1"
version = "0.3.0"
edition = "2021"
description = "Snowflake JWT token generator"
authors = ["Andrew Korzhuev <korzhuev@andrusha.me>", "Artem Semenov <hi@artps.org>"]
Expand Down
8 changes: 4 additions & 4 deletions snowflake-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "snowflake-api"
version = "0.2.0"
version = "0.3.0"
edition = "2021"
description = "Snowflake API bindings"
authors = ["Andrew Korzhuev <korzhuev@andrusha.me>"]
Expand All @@ -13,8 +13,8 @@ license = "Apache-2.0"

[dependencies]
thiserror = "1"
snowflake-jwt = "0.1.1"
reqwest = { version = "0.11", features = ["json"] }
snowflake-jwt = "0.3.0"
reqwest = { version = "0.11", default-features = false, features = ["rustls-tls", "json"] }
reqwest-middleware = "0.2"
reqwest-retry = "0.2"
log = "0.4"
Expand All @@ -33,4 +33,4 @@ anyhow = "1"
pretty_env_logger = "0.5.0"
clap = { version = "4", features = ["derive"] }
arrow = { version = "42", features = ["prettyprint"] }
tokio = { version = "1", features=["macros", "rt-multi-thread"] }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
2 changes: 1 addition & 1 deletion snowflake-api/examples/filetransfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async fn main() -> Result<()> {

let mut api = match (&args.private_key, &args.password) {
(Some(pkey), None) => {
let pem = fs::read(pkey)?;
let pem = fs::read_to_string(pkey)?;
SnowflakeApi::with_certificate_auth(
&args.account_identifier,
&args.warehouse,
Expand Down
2 changes: 1 addition & 1 deletion snowflake-api/examples/run_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async fn main() -> Result<()> {

let mut api = match (&args.private_key, &args.password) {
(Some(pkey), None) => {
let pem = fs::read(pkey)?;
let pem = fs::read_to_string(pkey)?;
SnowflakeApi::with_certificate_auth(
&args.account_identifier,
&args.warehouse,
Expand Down
2 changes: 1 addition & 1 deletion snowflake-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl SnowflakeApi {
schema: Option<&str>,
username: &str,
role: Option<&str>,
private_key_pem: &[u8],
private_key_pem: &str,
) -> Result<Self, SnowflakeApiError> {
let connection = Arc::new(Connection::new()?);

Expand Down
6 changes: 3 additions & 3 deletions snowflake-api/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub struct Session {

username: String,
role: Option<String>,
private_key_pem: Option<Vec<u8>>,
private_key_pem: Option<String>,
password: Option<String>,
}

Expand All @@ -120,7 +120,7 @@ impl Session {
schema: Option<&str>,
username: &str,
role: Option<&str>,
private_key_pem: &[u8],
private_key_pem: &str,
) -> Self {
// uppercase everything as this is the convention
let account_identifier = account_identifier.to_uppercase();
Expand All @@ -131,7 +131,7 @@ impl Session {

let username = username.to_uppercase();
let role = role.map(str::to_uppercase);
let private_key_pem = Some(private_key_pem.to_vec());
let private_key_pem = Some(private_key_pem.to_string());

Session {
connection,
Expand Down

0 comments on commit 0fcf8b8

Please sign in to comment.