Documentation
¶
Index ¶
- func RunGetStartedScenario(ctx context.Context, sdkConfig aws.Config, questioner demotools.IQuestioner)
- func RunLargeObjectScenario(ctx context.Context, sdkConfig aws.Config, questioner demotools.IQuestioner)
- func RunPresigningScenario(ctx context.Context, sdkConfig aws.Config, questioner demotools.IQuestioner, ...)
- type HttpRequester
- func (httpReq HttpRequester) Delete(url string) (resp *http.Response, err error)
- func (httpReq HttpRequester) Get(url string) (resp *http.Response, err error)
- func (httpReq HttpRequester) Post(url, contentType string, body io.Reader) (resp *http.Response, err error)
- func (httpReq HttpRequester) Put(url string, contentLength int64, body io.Reader) (resp *http.Response, err error)
- type IHttpRequester
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunGetStartedScenario ¶
func RunGetStartedScenario(ctx context.Context, sdkConfig aws.Config, questioner demotools.IQuestioner)
RunGetStartedScenario is an interactive example that shows you how to use Amazon Simple Storage Service (Amazon S3) to create an S3 bucket and use it to store objects.
1. Create a bucket. 2. Upload a local file to the bucket. 3. Download an object to a local file. 4. Copy an object to a different folder in the bucket. 5. List objects in the bucket. 6. Delete all objects in the bucket. 7. Delete the bucket.
This example creates an Amazon S3 service client from the specified sdkConfig so that you can replace it with a mocked or stubbed config for unit testing.
It uses a questioner from the `demotools` package to get input during the example. This package can be found in the ..\..\demotools folder of this repo.
func RunLargeObjectScenario ¶
func RunLargeObjectScenario(ctx context.Context, sdkConfig aws.Config, questioner demotools.IQuestioner)
RunLargeObjectScenario is an interactive example that shows you how to use Amazon Simple Storage Service (Amazon S3) to upload and download large objects.
1. Create a bucket. 3. Upload a large object to the bucket by using an upload manager. 5. Download a large object by using a download manager. 8. Delete all objects in the bucket. 9. Delete the bucket.
This example creates an Amazon S3 service client from the specified sdkConfig so that you can replace it with a mocked or stubbed config for unit testing.
It uses a questioner from the `demotools` package to get input during the example. This package can be found in the ..\..\demotools folder of this repo.
func RunPresigningScenario ¶
func RunPresigningScenario(ctx context.Context, sdkConfig aws.Config, questioner demotools.IQuestioner, httpRequester IHttpRequester)
RunPresigningScenario is an interactive example that shows you how to get presigned HTTP requests that you can use to move data into and out of Amazon Simple Storage Service (Amazon S3). The presigned requests contain temporary credentials and can be used by an HTTP client.
1. Get a presigned request to put an object in a bucket. 2. Use the net/http package to use the presigned request to upload a local file to the bucket. 3. Get a presigned request to get an object from a bucket. 4. Use the net/http package to use the presigned request to download the object to a local file. 5. Get a presigned request to delete an object from a bucket. 6. Use the net/http package to use the presigned request to delete the object.
This example creates an Amazon S3 presign client from the specified sdkConfig so that you can replace it with a mocked or stubbed config for unit testing.
It uses a questioner from the `demotools` package to get input during the example. This package can be found in the ..\..\demotools folder of this repo.
It uses an IHttpRequester interface to abstract HTTP requests so they can be mocked during testing.
Types ¶
type HttpRequester ¶
type HttpRequester struct{}
HttpRequester uses the net/http package to make HTTP requests during the scenario.
func (HttpRequester) Delete ¶
func (httpReq HttpRequester) Delete(url string) (resp *http.Response, err error)
func (HttpRequester) Get ¶
func (httpReq HttpRequester) Get(url string) (resp *http.Response, err error)
type IHttpRequester ¶
type IHttpRequester interface { Get(url string) (resp *http.Response, err error) Post(url, contentType string, body io.Reader) (resp *http.Response, err error) Put(url string, contentLength int64, body io.Reader) (resp *http.Response, err error) Delete(url string) (resp *http.Response, err error) }
IHttpRequester abstracts HTTP requests into an interface so it can be mocked during unit testing.