-
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
Make AWSConfig its own type #63
base: master
Are you sure you want to change the base?
Conversation
bors try |
tryBuild failed |
Oh no |
Sorry, my fault I'm moving credentials around: #62 |
Nah definitely my fault:
|
Aren't there APIs that don't require a region? I believe boto does not require you to set a region. We could have it as |
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
981f19e
to
6607543
Compare
bors try |
tryBuild succeeded |
Are there any APIs where you shouldn't have a region? Unless I'm misunderstanding the code here, I think in most cases currently on master, you'll end up with a region set. |
I was under the impression that the region was used as the endpoint to send API commands |
There are APIs which don't require the region to determine the endpoint, but since I can't find an example of one where you explicitly don't have to provide the region in any form, I guess we can just always assume a region must be set somewhere. |
Also note that since we allow any ol' |
There are other reasons for the type to be open-ended. In certain cases, other AWS* packages allow extra keys in the AWSConfig dictionary to pass along overrides. For example, |
IAM is a case in which the service itself is regionless. I'm not sure if there's anything bad that happens if you do have a region set, so an empty string is probably fine for situations like this. |
Please be careful with incompatible changes like these. There is a whole suite of other AWS* modules that may break because of this, not to mention production code. In particular, take a look at AWSS3.jl. It uses Before merging this, please at least verify that it doesn't break any of the other AWS* packages that depend on this one. |
That is really weird and should be changed. How it's currently defined, |
There may well be a better way to do it, but the current way, which was introduced here a0ff2b7, is still quite in use in production systems and across various AWS* modules. AWSLambda relies on it as well, and possibly others; I haven't done an exhausive search. I'm ok with changing it, but please let's do so in a way that's not suddenly going to break stuff, particularly other modules available to the public. :) |
Breaking things isn't my intention of course, so I appreciate you bringing up the other uses. I some ideas for fine-tuning the deprecations that should make it easier for users to adapt. |
Implementing the better approach in AWSS3 and elsewhere should probably be a first step, to eliminate reliance on AWSConfig being a dictionary. I'm concerned though, because I remember there being some deep use of the AWSConfig dictionary data that passes service-specific data across perhaps a dozen functions. I'll have to dig into my code to see if I can find it. In the meantime, @samoconnor tells me he'll be back in a few days. We should definitely get his input on this. Ultimately to make this change, something will have to break. I think it's a very good idea to tighten up AWSConfig. And I happen to be in a good place for a breaking change to the API as I move from 0.6 to 0.7 to 1.x, which I'm doing over the next couple of weeks. If AWSS3 and the other packages are tweaked first so they continue to work once this PR is merged, and any user code throws a clear error about what to do instead, then I'm pretty cool with whatever the final solution is. |
Not necessarily: One of the deprecations I'm working on is implementing the full |
Great! That works for me! |
This temporarily makes `AWSConfig` a subtype of `AbstractDict` and defines the corresponding methods to satisfy the interface. Each method emits a deprecation warning. This should hopefully be completely non-breaking for users and provide sufficient information for them to upgrade.
bors try |
tryBuild succeeded |
I tried running the AWSS3 tests with this branch of AWSCore and things were going okay, deprecation warnings were popping up as expected, but I got a 403 in the PUT tests, so I'm guessing the tests there require Sam's credentials. |
We should be able to do the same |
True, though it might be a little tricker; AWSCore appears only to have needed valid AWS credentials for the existing tests, whereas AWSS3 appears to require privileges of some kind. |
@ararslan, to run the S3 tests with your own AWS creds you will probably have to:
Also, you should run the tests both on your local dev box and on an EC2 box to check that automatic EC2 credentials discovery is working. |
I think there are two things that should be modelled here,
|
Rather than defining
AWSConfig
as aSymbolDict
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