diff --git a/docs/src/index.md b/docs/src/index.md index 7f3cf47..ae59b6d 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -12,7 +12,8 @@ Documentation for [GoAWS](https://github.com/ericphanson/GoAWS.jl). ## Configuration To configure the server, pass `config`. It is suggested to modify the default config, for example: -``` + +```julia config = GoAWS.default_config() config["Local"]["LogToFile"] = true server = Server(; config) diff --git a/src/aws_interop.jl b/src/aws_interop.jl index b598a47..4c74baa 100644 --- a/src/aws_interop.jl +++ b/src/aws_interop.jl @@ -1,3 +1,40 @@ +""" + GoAWSConfig <: AWS.AbstractAWSConfig + GoAWSConfig(; endpoint=GoAWS.DEFAULT_ADDRESS, region="us-east-2") + GoAWSConfig(s::Server) + +Constructs an `AbstractAWSConfig` for use with AWS.jl, to configure +SQS and SNS to use GoAWS. + +## Examples + +Here we demonstrate using the config with a local server we launch +as a subprocess. + +```julia +using GoAWS, AWS +@service SQS + +server = GoAWS.Server() +aws_config = GoAWSConfig(server) +run(server; wait=false) + +# ... now we can use the config: +SQS.create_queue("my_queue"; aws_config) + +kill(server) # when you are done +``` + +One can also use a `GoAWSConfig` with a GoAWS server launched outside +of the Julia process. Simply set the `endpoint` and `region` using the +keyword argument constructor: + +```julia +aws_config = GoAWSConfig(; endpoint="localhost:5203", region="us-east-1") +# ... now we can use the config: +SQS.create_queue("my_queue"; aws_config) +``` +""" struct GoAWSConfig <: AWS.AbstractAWSConfig endpoint::URI region::String