Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPClient ¶
HTTPClient returns an *http.Client, URL, and cleanup function. The http.Client is configured to connect to test SSL Server at the returned URL. This server will respond to HTTP requests defined, or return a 5xx server error for unexpected ones. The cleanup function will close the server, and return an error if any expected calls weren't received.
func StartServerProxy ¶
func StartServerProxy(t *testing.T, inst FakeAlloyDBInstance) func()
StartServerProxy starts a fake server proxy and listens on the provided port on all interfaces, configured with TLS as specified by the FakeAlloyDBInstance. Callers should invoke the returned function to clean up all resources.
Types ¶
type FakeAlloyDBInstance ¶
type FakeAlloyDBInstance struct {
// contains filtered or unexported fields
}
FakeAlloyDBInstance represents the server side proxy.
func NewFakeInstance ¶
func NewFakeInstance(proj, reg, clust, name string, opts ...Option) FakeAlloyDBInstance
NewFakeInstance creates a Fake AlloyDB instance.
func (*FakeAlloyDBInstance) GeneratePEMCertificateChain ¶ added in v1.10.0
func (f *FakeAlloyDBInstance) GeneratePEMCertificateChain( pub *rsa.PublicKey, ) ([]string, error)
GeneratePEMCertificateChain produces the certificate chain including an ephemeral client certificate.
func (FakeAlloyDBInstance) String ¶ added in v1.10.0
func (f FakeAlloyDBInstance) String() string
String returns the URI of the instance.
type Option ¶
type Option func(*FakeAlloyDBInstance)
Option configures a FakeAlloyDBInstance
func WithCertExpiry ¶
WithCertExpiry sets the expiration time of the fake instance
func WithPrivateIP ¶ added in v1.6.0
WithPrivateIP sets the private IP address to addr.
func WithPublicIP ¶ added in v1.6.0
WithPublicIP sets the public IP address to addr.
func WithServerName ¶ added in v0.2.0
WithServerName sets the name that server uses to identify itself in the TLS handshake.
type Request ¶
Request represents a HTTP request for a test Server to mock responses for.
Use NewRequest to initialize new Requests.
func CreateEphemeralSuccess ¶
func CreateEphemeralSuccess(i FakeAlloyDBInstance, ct int) *Request
CreateEphemeralSuccess returns a Request that responds to the `generateClientCertificate` AlloyDB Admin API endpoint.
func InstanceGetSuccess ¶
func InstanceGetSuccess(i FakeAlloyDBInstance, ct int) *Request
InstanceGetSuccess returns a Request that responds to the `instance.get` AlloyDB Admin API endpoint.