Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,9 @@ jobs:
- uses: actions/checkout@v5
- name: Debug OIDC Claims
if: ${{ env.RUN_INTEGRATION_TESTS == 'true' }}
# TODO: Switch to `steve-todorov/oidc-debugger-action@v1` once it's working
run: |
TOKEN_JSON="$(curl -fsSL -H "Authorization: bearer ${ACTIONS_ID_TOKEN_REQUEST_TOKEN:?}" "${ACTIONS_ID_TOKEN_REQUEST_URL:?}&audience=${audience:?}")"
ID_TOKEN="$(echo "${TOKEN_JSON:?}" | jq -r .value)"
echo "${ID_TOKEN:?}" | awk -F. '{print $2}' | base64 -d 2>/dev/null | jq -r
env:
continue-on-error: true
uses: steve-todorov/oidc-debugger-action@v1
with:
audience: sts.amazonaws.com
- name: Assume AWS role
if: ${{ env.RUN_INTEGRATION_TESTS == 'true' }}
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AWS"
uuid = "fbe9abb3-538b-5e4e-ba9e-bc94f4f92ebc"
license = "MIT"
version = "1.97.0"
version = "1.97.1"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down Expand Up @@ -29,7 +29,7 @@ Compat = "4.11"
GitHub = "5"
HTTP = "1"
IniFile = "0.5"
JSON = "0.18, 0.19, 0.20, 0.21"
JSON = "0.18, 0.19, 0.20, 0.21, 1"
MbedTLS = "0.6, 0.7, 1"
Mocking = "0.7, 0.8"
OrderedCollections = "1.3"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,4 @@ As well as some hand-written packages for specific AWS services:
* [AWSEC2.jl](https://github.com/samoconnor/AWSEC2.jl) - Julia 0.6
* [AWSLambda.jl](https://github.com/samoconnor/AWSLambda.jl) - Julia 0.6
* [AWSSES.jl](https://github.com/samoconnor/AWSSES.jl) - Julia 0.6
* [AWSSDB.jl](https://github.com/samoconnor/AWSSDB.jl) - Julia 0.6
* [AWSSDB.jl](https://github.com/samoconnor/AWSSDB.jl) - Julia 0.6
11 changes: 8 additions & 3 deletions src/AWS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ using Base64
using Dates
using Downloads: Downloads, Downloader, Curl
using HTTP
using JSON: JSON
using MbedTLS
using Mocking
using OrderedCollections: LittleDict, OrderedDict
Expand Down Expand Up @@ -46,7 +47,7 @@ include("deprecated.jl")
using ..AWSExceptions
using ..AWSExceptions: AWSException

const user_agent = Ref{String}("AWS.jl/$(pkgversion(@__MODULE__()))")
const user_agent = Ref{String}()
const aws_config = Ref{AbstractAWSConfig}()

"""
Expand Down Expand Up @@ -401,7 +402,7 @@ function (service::JSONService)(
use_response_type=feature_set.use_response_type,
resource=POST_RESOURCE,
request_method="POST",
content=json(args),
content=JSON.json(args),
url=generate_service_url(aws_config, service.endpoint_prefix, POST_RESOURCE),
)

Expand Down Expand Up @@ -458,7 +459,7 @@ function (service::RestJSONService)(
end

request.headers["Content-Type"] = "application/json"
request.content = json(args)
request.content = JSON.json(args)

return submit_request(aws_config, request; return_headers=return_headers)
end
Expand All @@ -469,6 +470,10 @@ function (service::ServiceWrapper)(args...; feature_set=nothing, kwargs...)
end

function __init__()
pkg_module = @__MODULE__()
pkg_version = pkgversion(pkg_module)
user_agent[] = "$(nameof(pkg_module)).jl/$(pkg_version)"

DEFAULT_BACKEND[] = HTTPBackend()
return nothing
end
Expand Down
7 changes: 3 additions & 4 deletions src/AWSCredentials.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Dates
using HTTP
using IniFile
using JSON
using Mocking

using ..AWSExceptions
Expand Down Expand Up @@ -232,12 +231,12 @@ function ec2_instance_credentials(profile::AbstractString)

info = IMDS.get("/latest/meta-data/iam/info")
info === nothing && return nothing
info = JSON.parse(info)
info = JSON.parse(info; dicttype=Dict)

# Get credentials for the role associated to the instance via instance profile.
name = IMDS.get("/latest/meta-data/iam/security-credentials/")
creds = IMDS.get("/latest/meta-data/iam/security-credentials/$name")
parsed = JSON.parse(creds)
parsed = JSON.parse(creds; dicttype=Dict)
instance_profile_creds = AWSCredentials(
parsed["AccessKeyId"],
parsed["SecretAccessKey"],
Expand Down Expand Up @@ -332,7 +331,7 @@ function ecs_instance_credentials()
rethrow()
end
new_creds = String(response.body)
new_creds = JSON.parse(new_creds)
new_creds = JSON.parse(new_creds; dicttype=Dict)

expiry = DateTime(rstrip(new_creds["Expiration"], 'Z'))

Expand Down
6 changes: 3 additions & 3 deletions src/AWSExceptions.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module AWSExceptions

using HTTP
using JSON
using JSON: JSON
using XMLDict
using XMLDict: XMLDictElement

Expand Down Expand Up @@ -87,12 +87,12 @@ function AWSException(e::HTTP.StatusError, body::AbstractString)
if !isempty(body)
# Extract API error code from Lambda-style JSON error message...
if endswith(content_type, "json")
info = JSON.parse(body)
info = JSON.parse(body; dicttype=Dict)
end

# Extract API error code from JSON error message...
if occursin(r"^application/x-amz-json-1\.[01]$", content_type)
info = JSON.parse(body)
info = JSON.parse(body; dicttype=Dict)
if haskey(info, "__type")
code = rsplit(info["__type"], '#'; limit=2)[end]
end
Expand Down
2 changes: 1 addition & 1 deletion src/AWSMetadata.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using Base64
using ..AWSExceptions
using GitHub
using HTTP
using JSON
using JSON: JSON
using Mocking
using OrderedCollections: LittleDict, OrderedDict

Expand Down
1 change: 0 additions & 1 deletion test/patch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ using AWS
using Dates
using Downloads: Downloads
using HTTP
using JSON
using GitHub
using Mocking
using OrderedCollections: LittleDict
Expand Down
2 changes: 1 addition & 1 deletion test/resource/setup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using AWS
using AWS: AWSException
using JSON
using JSON: JSON

@service CloudFormation use_response_type = true
@service IAM use_response_type = true
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ using Downloads
using GitHub
using HTTP
using IniFile: Inifile, sections
using JSON
using JSON: JSON
using OrderedCollections: LittleDict, OrderedDict
using MbedTLS: digest, MD_SHA256, MD_MD5
using Mocking
Expand Down
Loading