Documentation
¶
Index ¶
Constants ¶
View Source
const ( ContentTypeXML = "text/xml" ContentTypeJSON = "application/json" ContentTypeText = "text/plain" )
View Source
const DefaultAccountId = "555555555555"
Variables ¶
View Source
var GlobalDebugMode = false
View Source
var ( MockStsGetCallerIdentityValid = &MockedEndpoint{ Request: &MockedRequest{ Service: "sts", Action: "GetCallerIdentity", }, Response: &MockedResponse{ StatusCode: http.StatusOK, Encoding: ResponseEncodingXML, Body: map[string]interface{}{ "Account": DefaultAccountId, "Arn": fmt.Sprintf("arn:aws:iam::%s:user/fakeuser", DefaultAccountId), "UserId": "AKIAI44QH8DHBEXAMPLE", }, }, } )
Functions ¶
func CACertPEM ¶
func CACertPEM() []byte
Exports the PEM Bytes of the CA Certificate (if you need to use it)
func StartMockServer ¶
func StartMockServer(options *MockerOptions) (func(), string, error)
Types ¶
type MockedEndpoint ¶
type MockedEndpoint struct {
Request *MockedRequest
Response *MockedResponse
}
func NewSimpleMockedEndpoint ¶
func NewSimpleMockedEndpoint(service, action string, responseObj interface{}) *MockedEndpoint
type MockedRequest ¶
type MockedResponse ¶
type MockedResponse struct {
// modify the status code. default is 200
StatusCode int
// force the content type. default will be determined by request content type
ContentType string
Encoding ResponseEncoding
// a string, struct or map that will be encoded as the response
Body interface{}
// Do not wrap the xml response in ACTIONResponse>ACTIONResult
DoNotWrap bool
RootTag string
// contains filtered or unexported fields
}
type MockerOptions ¶
type MockerOptions struct {
// used to get the TempDir value
T *testing.T
// provide a path to a temporary directory used to write the CA Bundle
TempDir string
// dump request/responses to the log
Verbose bool
// if true, then env vars for various aws credentials will not be set.
// This is dangerous, because if the proxy were to fail, then your requests may actually
// execute on AWS with real credentials.
//
DoNotOverrideCreds bool
// if this is true, then default mocks for GetCallerIdentity and role assumptions will not be provided
SkipDefaultMocks bool
// The mocks that will be responded to
Mocks []*MockedEndpoint
}
type ResponseEncoding ¶
type ResponseEncoding int
const ( // Default will try to determine encoding via the request headers ResponseEncodingDefault ResponseEncoding = iota ResponseEncodingJSON ResponseEncodingXML ResponseEncodingText )
Click to show internal directories.
Click to hide internal directories.