lightsailiface

package
v2.0.0-preview.3+incom... Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package lightsailiface provides an interface to enable mocking the Amazon Lightsail service client for testing your code.

It is important to note that this interface will have breaking changes when the service model is updated and adds new API operations, paginators, and waiters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LightsailAPI

type LightsailAPI interface {
	AllocateStaticIpRequest(*lightsail.AllocateStaticIpInput) lightsail.AllocateStaticIpRequest

	AttachDiskRequest(*lightsail.AttachDiskInput) lightsail.AttachDiskRequest

	AttachInstancesToLoadBalancerRequest(*lightsail.AttachInstancesToLoadBalancerInput) lightsail.AttachInstancesToLoadBalancerRequest

	AttachLoadBalancerTlsCertificateRequest(*lightsail.AttachLoadBalancerTlsCertificateInput) lightsail.AttachLoadBalancerTlsCertificateRequest

	AttachStaticIpRequest(*lightsail.AttachStaticIpInput) lightsail.AttachStaticIpRequest

	CloseInstancePublicPortsRequest(*lightsail.CloseInstancePublicPortsInput) lightsail.CloseInstancePublicPortsRequest

	CreateDiskRequest(*lightsail.CreateDiskInput) lightsail.CreateDiskRequest

	CreateDiskFromSnapshotRequest(*lightsail.CreateDiskFromSnapshotInput) lightsail.CreateDiskFromSnapshotRequest

	CreateDiskSnapshotRequest(*lightsail.CreateDiskSnapshotInput) lightsail.CreateDiskSnapshotRequest

	CreateDomainRequest(*lightsail.CreateDomainInput) lightsail.CreateDomainRequest

	CreateDomainEntryRequest(*lightsail.CreateDomainEntryInput) lightsail.CreateDomainEntryRequest

	CreateInstanceSnapshotRequest(*lightsail.CreateInstanceSnapshotInput) lightsail.CreateInstanceSnapshotRequest

	CreateInstancesRequest(*lightsail.CreateInstancesInput) lightsail.CreateInstancesRequest

	CreateInstancesFromSnapshotRequest(*lightsail.CreateInstancesFromSnapshotInput) lightsail.CreateInstancesFromSnapshotRequest

	CreateKeyPairRequest(*lightsail.CreateKeyPairInput) lightsail.CreateKeyPairRequest

	CreateLoadBalancerRequest(*lightsail.CreateLoadBalancerInput) lightsail.CreateLoadBalancerRequest

	CreateLoadBalancerTlsCertificateRequest(*lightsail.CreateLoadBalancerTlsCertificateInput) lightsail.CreateLoadBalancerTlsCertificateRequest

	DeleteDiskRequest(*lightsail.DeleteDiskInput) lightsail.DeleteDiskRequest

	DeleteDiskSnapshotRequest(*lightsail.DeleteDiskSnapshotInput) lightsail.DeleteDiskSnapshotRequest

	DeleteDomainRequest(*lightsail.DeleteDomainInput) lightsail.DeleteDomainRequest

	DeleteDomainEntryRequest(*lightsail.DeleteDomainEntryInput) lightsail.DeleteDomainEntryRequest

	DeleteInstanceRequest(*lightsail.DeleteInstanceInput) lightsail.DeleteInstanceRequest

	DeleteInstanceSnapshotRequest(*lightsail.DeleteInstanceSnapshotInput) lightsail.DeleteInstanceSnapshotRequest

	DeleteKeyPairRequest(*lightsail.DeleteKeyPairInput) lightsail.DeleteKeyPairRequest

	DeleteLoadBalancerRequest(*lightsail.DeleteLoadBalancerInput) lightsail.DeleteLoadBalancerRequest

	DeleteLoadBalancerTlsCertificateRequest(*lightsail.DeleteLoadBalancerTlsCertificateInput) lightsail.DeleteLoadBalancerTlsCertificateRequest

	DetachDiskRequest(*lightsail.DetachDiskInput) lightsail.DetachDiskRequest

	DetachInstancesFromLoadBalancerRequest(*lightsail.DetachInstancesFromLoadBalancerInput) lightsail.DetachInstancesFromLoadBalancerRequest

	DetachStaticIpRequest(*lightsail.DetachStaticIpInput) lightsail.DetachStaticIpRequest

	DownloadDefaultKeyPairRequest(*lightsail.DownloadDefaultKeyPairInput) lightsail.DownloadDefaultKeyPairRequest

	GetActiveNamesRequest(*lightsail.GetActiveNamesInput) lightsail.GetActiveNamesRequest

	GetBlueprintsRequest(*lightsail.GetBlueprintsInput) lightsail.GetBlueprintsRequest

	GetBundlesRequest(*lightsail.GetBundlesInput) lightsail.GetBundlesRequest

	GetDiskRequest(*lightsail.GetDiskInput) lightsail.GetDiskRequest

	GetDiskSnapshotRequest(*lightsail.GetDiskSnapshotInput) lightsail.GetDiskSnapshotRequest

	GetDiskSnapshotsRequest(*lightsail.GetDiskSnapshotsInput) lightsail.GetDiskSnapshotsRequest

	GetDisksRequest(*lightsail.GetDisksInput) lightsail.GetDisksRequest

	GetDomainRequest(*lightsail.GetDomainInput) lightsail.GetDomainRequest

	GetDomainsRequest(*lightsail.GetDomainsInput) lightsail.GetDomainsRequest

	GetInstanceRequest(*lightsail.GetInstanceInput) lightsail.GetInstanceRequest

	GetInstanceAccessDetailsRequest(*lightsail.GetInstanceAccessDetailsInput) lightsail.GetInstanceAccessDetailsRequest

	GetInstanceMetricDataRequest(*lightsail.GetInstanceMetricDataInput) lightsail.GetInstanceMetricDataRequest

	GetInstancePortStatesRequest(*lightsail.GetInstancePortStatesInput) lightsail.GetInstancePortStatesRequest

	GetInstanceSnapshotRequest(*lightsail.GetInstanceSnapshotInput) lightsail.GetInstanceSnapshotRequest

	GetInstanceSnapshotsRequest(*lightsail.GetInstanceSnapshotsInput) lightsail.GetInstanceSnapshotsRequest

	GetInstanceStateRequest(*lightsail.GetInstanceStateInput) lightsail.GetInstanceStateRequest

	GetInstancesRequest(*lightsail.GetInstancesInput) lightsail.GetInstancesRequest

	GetKeyPairRequest(*lightsail.GetKeyPairInput) lightsail.GetKeyPairRequest

	GetKeyPairsRequest(*lightsail.GetKeyPairsInput) lightsail.GetKeyPairsRequest

	GetLoadBalancerRequest(*lightsail.GetLoadBalancerInput) lightsail.GetLoadBalancerRequest

	GetLoadBalancerMetricDataRequest(*lightsail.GetLoadBalancerMetricDataInput) lightsail.GetLoadBalancerMetricDataRequest

	GetLoadBalancerTlsCertificatesRequest(*lightsail.GetLoadBalancerTlsCertificatesInput) lightsail.GetLoadBalancerTlsCertificatesRequest

	GetLoadBalancersRequest(*lightsail.GetLoadBalancersInput) lightsail.GetLoadBalancersRequest

	GetOperationRequest(*lightsail.GetOperationInput) lightsail.GetOperationRequest

	GetOperationsRequest(*lightsail.GetOperationsInput) lightsail.GetOperationsRequest

	GetOperationsForResourceRequest(*lightsail.GetOperationsForResourceInput) lightsail.GetOperationsForResourceRequest

	GetRegionsRequest(*lightsail.GetRegionsInput) lightsail.GetRegionsRequest

	GetStaticIpRequest(*lightsail.GetStaticIpInput) lightsail.GetStaticIpRequest

	GetStaticIpsRequest(*lightsail.GetStaticIpsInput) lightsail.GetStaticIpsRequest

	ImportKeyPairRequest(*lightsail.ImportKeyPairInput) lightsail.ImportKeyPairRequest

	IsVpcPeeredRequest(*lightsail.IsVpcPeeredInput) lightsail.IsVpcPeeredRequest

	OpenInstancePublicPortsRequest(*lightsail.OpenInstancePublicPortsInput) lightsail.OpenInstancePublicPortsRequest

	PeerVpcRequest(*lightsail.PeerVpcInput) lightsail.PeerVpcRequest

	PutInstancePublicPortsRequest(*lightsail.PutInstancePublicPortsInput) lightsail.PutInstancePublicPortsRequest

	RebootInstanceRequest(*lightsail.RebootInstanceInput) lightsail.RebootInstanceRequest

	ReleaseStaticIpRequest(*lightsail.ReleaseStaticIpInput) lightsail.ReleaseStaticIpRequest

	StartInstanceRequest(*lightsail.StartInstanceInput) lightsail.StartInstanceRequest

	StopInstanceRequest(*lightsail.StopInstanceInput) lightsail.StopInstanceRequest

	UnpeerVpcRequest(*lightsail.UnpeerVpcInput) lightsail.UnpeerVpcRequest

	UpdateDomainEntryRequest(*lightsail.UpdateDomainEntryInput) lightsail.UpdateDomainEntryRequest

	UpdateLoadBalancerAttributeRequest(*lightsail.UpdateLoadBalancerAttributeInput) lightsail.UpdateLoadBalancerAttributeRequest
}

LightsailAPI provides an interface to enable mocking the lightsail.Lightsail service client's API operation, paginators, and waiters. This make unit testing your code that calls out to the SDK's service client's calls easier.

The best way to use this interface is so the SDK's service client's calls can be stubbed out for unit testing your code with the SDK without needing to inject custom request handlers into the SDK's request pipeline.

// myFunc uses an SDK service client to make a request to
// Amazon Lightsail.
func myFunc(svc lightsailiface.LightsailAPI) bool {
    // Make svc.AllocateStaticIp request
}

func main() {
    cfg, err := external.LoadDefaultAWSConfig()
    if err != nil {
        panic("failed to load config, " + err.Error())
    }

    svc := lightsail.New(cfg)

    myFunc(svc)
}

In your _test.go file:

// Define a mock struct to be used in your unit tests of myFunc.
type mockLightsailClient struct {
    lightsailiface.LightsailAPI
}
func (m *mockLightsailClient) AllocateStaticIp(input *lightsail.AllocateStaticIpInput) (*lightsail.AllocateStaticIpOutput, error) {
    // mock response/functionality
}

func TestMyFunc(t *testing.T) {
    // Setup Test
    mockSvc := &mockLightsailClient{}

    myfunc(mockSvc)

    // Verify myFunc's functionality
}

It is important to note that this interface will have breaking changes when the service model is updated and adds new API operations, paginators, and waiters. Its suggested to use the pattern above for testing, or using tooling to generate mocks to satisfy the interfaces.

Jump to

Keyboard shortcuts

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