From 16e22078f7c26058dea7be82cb7da4baca19df1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 16 Nov 2023 16:28:57 +0100 Subject: [PATCH] Rename session_token to token to mirror FSS --- lib/livebook/file_system/s3.ex | 12 ++++-------- lib/livebook/file_system/s3/client.ex | 6 +++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/livebook/file_system/s3.ex b/lib/livebook/file_system/s3.ex index 36e140207..7b7ede313 100644 --- a/lib/livebook/file_system/s3.ex +++ b/lib/livebook/file_system/s3.ex @@ -17,7 +17,7 @@ defmodule Livebook.FileSystem.S3 do @type credentials :: %{ access_key_id: String.t() | nil, secret_access_key: String.t() | nil, - session_token: String.t() | nil + token: String.t() | nil } embedded_schema do @@ -136,21 +136,17 @@ defmodule Livebook.FileSystem.S3 do {nil, nil} -> case get_credentials() do :undefined -> - %{access_key_id: nil, secret_access_key: nil, session_token: nil} + %{access_key_id: nil, secret_access_key: nil, token: nil} credentials -> - %{ - access_key_id: credentials[:access_key_id], - secret_access_key: credentials[:secret_access_key], - session_token: credentials[:token] - } + Map.take(credentials, [:access_key_id, :secret_access_key, :token]) end _ -> %{ access_key_id: file_system.access_key_id, secret_access_key: file_system.secret_access_key, - session_token: nil + token: nil } end end diff --git a/lib/livebook/file_system/s3/client.ex b/lib/livebook/file_system/s3/client.ex index 09d2efcd9..8c39977c4 100644 --- a/lib/livebook/file_system/s3/client.ex +++ b/lib/livebook/file_system/s3/client.ex @@ -265,8 +265,8 @@ defmodule Livebook.FileSystem.S3.Client do headers = [{"Host", host} | headers] headers = - if credentials.session_token, - do: [{"X-Amz-Security-Token", credentials.session_token} | headers], + if credentials.token, + do: [{"X-Amz-Security-Token", credentials.token} | headers], else: headers :aws_signature.sign_v4( @@ -280,7 +280,7 @@ defmodule Livebook.FileSystem.S3.Client do headers, body || "", uri_encode_path: false, - session_token: credentials.session_token + session_token: credentials.token ) end