Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate global AWS config as first argument. #248

Open
peteristhegreat opened this issue Apr 19, 2022 · 0 comments
Open

Deprecate global AWS config as first argument. #248

peteristhegreat opened this issue Apr 19, 2022 · 0 comments

Comments

@peteristhegreat
Copy link

Most function arguments are of the form

function s3_xxx_xxx(::AbstractAWSConfig, a, b, c; kw1="foo", kw2="bar")
     # function body
end

s3_xxx_xxx(a...; b...) =  s3_xxx_xxx(global_aws_config(), a...; b...)

Whereas AWS.jl now passes the AbstractAWSConfig as a keyword argument.

Reverse this, so that the AbstractAWSConfig is not in the main version of each function, but only in the keyword version of each function.

Here is the new form:

function s3_xxx_xxx(a, b, c; aws_config::AbstractAWSConfig=global_aws_config(), kw1="foo", kw2="bar")
     # function body
end

s3_xxx_xxx(aws_config::AbstractAWSConfig, a...; b...) =  s3_xxx_xxx(a...; aws_config=aws_config, b...)

This in general is more consistent with AWS.jl and should remain backward compatible with existing uses of AWSS3

Here is an example in AWS.jl.
https://github.com/JuliaCloud/AWS.jl/blob/master/src/services/sts.jl#L711

function get_caller_identity(; aws_config::AbstractAWSConfig=global_aws_config())
    return sts("GetCallerIdentity"; aws_config=aws_config, feature_set=SERVICE_FEATURE_SET)
end
function get_caller_identity(
    params::AbstractDict{String}; aws_config::AbstractAWSConfig=global_aws_config()
)
    return sts(
        "GetCallerIdentity", params; aws_config=aws_config, feature_set=SERVICE_FEATURE_SET
    )
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant