aws_go

package module
v0.0.0-...-cdcf30c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

README

aws-go

A Golang httpclient for interfacing with AWS.

custom http client based on official aws guide for setting up httpclient

How to use this module

Create a golang file with the following configuration in order to take advantage of the functions in this module.


package main

import (
    "github.com/GaryLouisStewart/aws_go"
    "github.com/aws/aws-sdk-go/aws/session"
    "github.com/aws/aws-sdk-go/service/iam"
    "github.com/aws/aws-sdk-go/aws"
)


 httpClient, err := aws_go.NewHTTPClientWithSettings(aws_go.HTTPClientSettings{
    Connect:           5 * time.Second,
    ExpectContinue:    1 * time.Second,
    IdleConn:          60 * time.Second,
    ConnKeepAlive:     20 * time.Second,
    MaxAllIdleConns:   75,
    MaxHostIdleConns:  10,
    ResponseHeader:    5 * time.Second,
    TLSHandshake:      5 * time.Second,
 })

if err, != nil {
    fmt.Println("Got an error creating custom HTTP client:")
    fmt.Println(err)
    return
}

sess := session.Must(session.NewSession(&aws.Config{
    HTTPClient: httpClient,
    Region: aws.String("eu-west-2")
}))

svc := iam.New(sess)

// futher operations with the iam session or other aws sessions below.....

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPClientWithSettings

func NewHTTPClientWithSettings(httpSettings HTTPClientSettings) (*http.Client, error)

Types

type HTTPClientSettings

type HTTPClientSettings struct {
	Connect          time.Duration
	ConnKeepAlive    time.Duration
	ExpectContinue   time.Duration
	IdleConn         time.Duration
	MaxAllIdleConns  int
	MaxHostIdleConns int
	ResponseHeader   time.Duration
	TLSHandshake     time.Duration
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL