-
Notifications
You must be signed in to change notification settings - Fork 26
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
Define AWSConfig as a struct? #53
Comments
Rather than defining `AWSConfig` as a `SymbolDict` with no restrictions on the contents, we can make it its own type, which gives more control over how things are stored and accessed. Fixes #53
Rather than defining `AWSConfig` as a `SymbolDict` with no restrictions on the contents, we can make it its own type, which gives more control over how things are stored and accessed. Fixes #53
Hi @morris25, it has always been my intention to eventually replace the Note that while the Over time, some stuff has been pushed into the Just now my laptop is saying 2% batt. |
I agree it makes sense to have a type for |
AWSS3 is different enough that I think service-specific stuff could go in its own type there. We could also have an const cloudformation = AWSService(service_query, "cloudformation", "2010-05-15") and then a generic call method defined on instances of |
I would very much like to retain the current scheme where there is a function for each service in ec2(operation, args=[]) =
ec2(default_aws_config(), operation, args) This supports code like this where use of the default config is completely hidden (this pattern is very common in scripts that run on EC2 or lambda, where the config and credentials are inherited from the hosting container.
Another common pattern is to have two different us = aws_config()
them = JSON.parse(3rd_party_aws_config)
for x in 3rd_party_stuff_to_import
bar = dynamodb(them, ... look up info in x ...)
foo = s3(them, "GET", bar)
s3(us, "PUT", x, foo)
sqs(us, "SendMessage", ...)
end This makes things simpler than having to create a seperate service objects for |
Right, what I was suggesting would not change the user interface at all. I'll give a detailed example. module AWSCore
# ...
abstract type AWSService end
mutable struct QueryService
service::String
version::String
extra_data_maybe::Dict
end
QueryService(service, version) = QueryService(service, version, Dict())
function (qs::QueryService)(aws::AWSConfig, operation, args=[])
service_query(
aws;
service=qs.service,
version=qs.version,
operation=operation,
args=args,
)
end
(qs::QueryService)(operation, args=[]) = qs(default_aws_config(), operation, args)
(qs::QueryService)(a...; b...) = qs(a..., b)
module Services
using ..AWSCore
const cloudformation = AWSCore.QueryService("cloudformation", "2010-05-15")
# ...
end
end and user code would look the same: using AWSCore.Services: cloudformation
cloudformation("DescribeStackOutput", StackName="MyStack")
cloudformation(aws_config(profile="other"), "SomeOperation", some_args) |
Considering the existence of
aws_config()
, it seems to me that it would make more sense to defineAWSConfig
as a struct rather than aSymbolDict
.I'm curious as to why this design decision was made and whether people think this change may or may not be a good idea.
The text was updated successfully, but these errors were encountered: