-
Notifications
You must be signed in to change notification settings - Fork 65
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
Feature aws s3 #968
base: master
Are you sure you want to change the base?
Feature aws s3 #968
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Glad to see a PR from you @kaffein 😃welcome back. Left a few thoughts.
src/yetibot/commands/aws.clj
Outdated
"aws s3 mb s3://<bucket-name> # Creates a new s3 bucket" | ||
{:yb/cat #{:util :info}} | ||
[{[_ bucket-name] :match}] | ||
(-> (aws/s3-create-bucket bucket-name {:LocationConstraint "eu-west-1"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make Availability Zones configurable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will include it in the configuration 👍
(defmethod format-s3-response ::S3BucketListed | ||
[{:keys [Buckets]}] | ||
{:result/data {:buckets Buckets} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same - more data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the bucket list, we have more infos related to the buckets. I will paste the response format here and we will decide which data we will include in the formatted response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have the following spec for the :ListBuckets
API call :
:ListBuckets {:name "ListBuckets",
:documentation "<p>Returns a list of all buckets owned by the authenticated sender of the request.</p>",
:documentationUrl "http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTServiceGET.html",
:request nil,
:required nil,
:response {:Buckets [:seq-of {:Name string, :CreationDate timestamp}],
:Owner {:DisplayName string, :ID string}}},
Apart from the Buckets list, we have an additional :Owner
field included.
Do you want it to be included within the response @devth ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Can't hurt to have extra data behind the pipe :)
(defmethod format-s3-response ::S3ObjectsListed | ||
[{:keys [Contents]}] | ||
{:result/data {:contents Contents} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same - more data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for the objects listing, we have more infos returned by the API. I will paste the format here later and we will decide which infos we will keep in the formatted response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the :ListObjectsV2
API call, we have the following spec :
:ListObjectsV2 {:name "ListObjectsV2",
:documentation "<p>Returns some or all (up to 1000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket. Note: ListObjectsV2 is the revised List Objects API and we recommend you use this revised API for new application development.</p>",
:request {:Prefix string,
:StartAfter string,
:Bucket string,
:EncodingType string,
:Delimiter string,
:FetchOwner boolean,
:RequestPayer string,
:ContinuationToken string,
:MaxKeys integer},
:required [:Bucket],
:response {:Prefix string,
:StartAfter string,
:EncodingType string,
:Delimiter string,
:NextContinuationToken string,
:CommonPrefixes [:seq-of {:Prefix string}],
:ContinuationToken string,
:Contents [:seq-of
{:Key string,
:LastModified timestamp,
:ETag string,
:Size integer,
:StorageClass string,
:Owner {:DisplayName string, :ID string}}],
:MaxKeys integer,
:IsTruncated boolean,
:Name string,
:KeyCount integer}},
I only took the :Contents
but the :response
key is assoc-ed to much more information, mostly meta-data such as pagination-related stuff (I will also have to think about how to manage it too by the way ^^).
Which other keys do you think we should include in the response for this one ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think everything. I'm aiming to make data behind pipes super powerful. I'd prob only omit something if it was massive, unrelated, or a security issue.
be4a54a
to
f058d97
Compare
hey guys, Sorry for the delay on this PR, I was a little bit busy the last few months ^^ but I think we are ready this time. So this PR emulates a few
There were a few interesting commands in the official I can make another round of testing to make sure we do not have regressions and I will include the screenshots here if you want @devth. It will probably ease your job but of course feel free to play with the PR to see if there are things that need to be fixed. thanks in advance |
Yo, just to give a quick update on the last round of tests for the
can you PTAL @devth thanks in advance ^^ |
@kaffein looks awesome! I will try to find some time to review this tomorrow if that's ok. |
Take your time ... we're not in a hurry 😉😊 Thanks 🙏 |
6443e0e
to
66b9b2a
Compare
Playing with this now! |
Enjoy and take your time!! it's a big chunk haha |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! I setup an AWS account and played with it. I didn't test every command yet. Found a couple things and left some comments.
Thanks! ☁️ ☁️ ☁️
8a770e3
to
9ab4e07
Compare
…pi result parsing
The reason being that AWS sends back an empty response when a bucket is successfully deleted (http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketDELETE.html)
9ab4e07
to
ca3351d
Compare
I might want to refactor the whole |
@kaffein code gen sounds cool and makes sense for such a large set of commands. |
hey guys,
I just wanted to let you know that I have (at last) made some progress on the
aws s3 command
. Sorry for the little delay, I have been on another planet lately :).I have made a minor modification to the early
aws-invoke
function for callingaws
service APIs by adding anaws-client
parameter. This parameter should allow anyaws service clients
(iam, s3 etc.) to be plugged in and should ease any upcoming integration.At the moment, it covers (almost) all the features we had in the previous version of the
s3
command. This is still a work in progress as I intend to add some (of the most useful) commands to it but feel free to let me know if there is anything that you would like me to put in.I will keep you in the loop ;-)
thanks in advance