diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 16dc67dba..77620d02d 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -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' }} diff --git a/Project.toml b/Project.toml index d68d24229..f86212236 100644 --- a/Project.toml +++ b/Project.toml @@ -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" @@ -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" diff --git a/README.md b/README.md index 63960240a..88a0fb9dd 100644 --- a/README.md +++ b/README.md @@ -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 \ No newline at end of file diff --git a/src/AWS.jl b/src/AWS.jl index 246b7c037..13a138c9d 100644 --- a/src/AWS.jl +++ b/src/AWS.jl @@ -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 @@ -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}() """ @@ -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), ) @@ -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 @@ -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 diff --git a/src/AWSCredentials.jl b/src/AWSCredentials.jl index 033af0059..8d8177a68 100644 --- a/src/AWSCredentials.jl +++ b/src/AWSCredentials.jl @@ -1,7 +1,6 @@ using Dates using HTTP using IniFile -using JSON using Mocking using ..AWSExceptions @@ -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"], @@ -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')) diff --git a/src/AWSExceptions.jl b/src/AWSExceptions.jl index 5551226dc..3087bb0bf 100644 --- a/src/AWSExceptions.jl +++ b/src/AWSExceptions.jl @@ -1,7 +1,7 @@ module AWSExceptions using HTTP -using JSON +using JSON: JSON using XMLDict using XMLDict: XMLDictElement @@ -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 diff --git a/src/AWSMetadata.jl b/src/AWSMetadata.jl index 4878bbe22..c179fc758 100644 --- a/src/AWSMetadata.jl +++ b/src/AWSMetadata.jl @@ -4,7 +4,7 @@ using Base64 using ..AWSExceptions using GitHub using HTTP -using JSON +using JSON: JSON using Mocking using OrderedCollections: LittleDict, OrderedDict diff --git a/test/patch.jl b/test/patch.jl index 2e36d0406..1437c6246 100644 --- a/test/patch.jl +++ b/test/patch.jl @@ -4,7 +4,6 @@ using AWS using Dates using Downloads: Downloads using HTTP -using JSON using GitHub using Mocking using OrderedCollections: LittleDict diff --git a/test/resource/setup.jl b/test/resource/setup.jl index 479d6b315..37d4b66df 100755 --- a/test/resource/setup.jl +++ b/test/resource/setup.jl @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index 2b5172f36..ec223323b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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