applicationinsightsiface

package
v0.0.0-...-c570f4e Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package applicationinsightsiface provides an interface to enable mocking the Amazon CloudWatch Application Insights 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 ApplicationInsightsAPI

type ApplicationInsightsAPI interface {
	AddWorkload(*applicationinsights.AddWorkloadInput) (*applicationinsights.AddWorkloadOutput, error)
	AddWorkloadWithContext(aws.Context, *applicationinsights.AddWorkloadInput, ...request.Option) (*applicationinsights.AddWorkloadOutput, error)
	AddWorkloadRequest(*applicationinsights.AddWorkloadInput) (*request.Request, *applicationinsights.AddWorkloadOutput)

	CreateApplication(*applicationinsights.CreateApplicationInput) (*applicationinsights.CreateApplicationOutput, error)
	CreateApplicationWithContext(aws.Context, *applicationinsights.CreateApplicationInput, ...request.Option) (*applicationinsights.CreateApplicationOutput, error)
	CreateApplicationRequest(*applicationinsights.CreateApplicationInput) (*request.Request, *applicationinsights.CreateApplicationOutput)

	CreateComponent(*applicationinsights.CreateComponentInput) (*applicationinsights.CreateComponentOutput, error)
	CreateComponentWithContext(aws.Context, *applicationinsights.CreateComponentInput, ...request.Option) (*applicationinsights.CreateComponentOutput, error)
	CreateComponentRequest(*applicationinsights.CreateComponentInput) (*request.Request, *applicationinsights.CreateComponentOutput)

	CreateLogPattern(*applicationinsights.CreateLogPatternInput) (*applicationinsights.CreateLogPatternOutput, error)
	CreateLogPatternWithContext(aws.Context, *applicationinsights.CreateLogPatternInput, ...request.Option) (*applicationinsights.CreateLogPatternOutput, error)
	CreateLogPatternRequest(*applicationinsights.CreateLogPatternInput) (*request.Request, *applicationinsights.CreateLogPatternOutput)

	DeleteApplication(*applicationinsights.DeleteApplicationInput) (*applicationinsights.DeleteApplicationOutput, error)
	DeleteApplicationWithContext(aws.Context, *applicationinsights.DeleteApplicationInput, ...request.Option) (*applicationinsights.DeleteApplicationOutput, error)
	DeleteApplicationRequest(*applicationinsights.DeleteApplicationInput) (*request.Request, *applicationinsights.DeleteApplicationOutput)

	DeleteComponent(*applicationinsights.DeleteComponentInput) (*applicationinsights.DeleteComponentOutput, error)
	DeleteComponentWithContext(aws.Context, *applicationinsights.DeleteComponentInput, ...request.Option) (*applicationinsights.DeleteComponentOutput, error)
	DeleteComponentRequest(*applicationinsights.DeleteComponentInput) (*request.Request, *applicationinsights.DeleteComponentOutput)

	DeleteLogPattern(*applicationinsights.DeleteLogPatternInput) (*applicationinsights.DeleteLogPatternOutput, error)
	DeleteLogPatternWithContext(aws.Context, *applicationinsights.DeleteLogPatternInput, ...request.Option) (*applicationinsights.DeleteLogPatternOutput, error)
	DeleteLogPatternRequest(*applicationinsights.DeleteLogPatternInput) (*request.Request, *applicationinsights.DeleteLogPatternOutput)

	DescribeApplication(*applicationinsights.DescribeApplicationInput) (*applicationinsights.DescribeApplicationOutput, error)
	DescribeApplicationWithContext(aws.Context, *applicationinsights.DescribeApplicationInput, ...request.Option) (*applicationinsights.DescribeApplicationOutput, error)
	DescribeApplicationRequest(*applicationinsights.DescribeApplicationInput) (*request.Request, *applicationinsights.DescribeApplicationOutput)

	DescribeComponent(*applicationinsights.DescribeComponentInput) (*applicationinsights.DescribeComponentOutput, error)
	DescribeComponentWithContext(aws.Context, *applicationinsights.DescribeComponentInput, ...request.Option) (*applicationinsights.DescribeComponentOutput, error)
	DescribeComponentRequest(*applicationinsights.DescribeComponentInput) (*request.Request, *applicationinsights.DescribeComponentOutput)

	DescribeComponentConfiguration(*applicationinsights.DescribeComponentConfigurationInput) (*applicationinsights.DescribeComponentConfigurationOutput, error)
	DescribeComponentConfigurationWithContext(aws.Context, *applicationinsights.DescribeComponentConfigurationInput, ...request.Option) (*applicationinsights.DescribeComponentConfigurationOutput, error)
	DescribeComponentConfigurationRequest(*applicationinsights.DescribeComponentConfigurationInput) (*request.Request, *applicationinsights.DescribeComponentConfigurationOutput)

	DescribeComponentConfigurationRecommendation(*applicationinsights.DescribeComponentConfigurationRecommendationInput) (*applicationinsights.DescribeComponentConfigurationRecommendationOutput, error)
	DescribeComponentConfigurationRecommendationWithContext(aws.Context, *applicationinsights.DescribeComponentConfigurationRecommendationInput, ...request.Option) (*applicationinsights.DescribeComponentConfigurationRecommendationOutput, error)
	DescribeComponentConfigurationRecommendationRequest(*applicationinsights.DescribeComponentConfigurationRecommendationInput) (*request.Request, *applicationinsights.DescribeComponentConfigurationRecommendationOutput)

	DescribeLogPattern(*applicationinsights.DescribeLogPatternInput) (*applicationinsights.DescribeLogPatternOutput, error)
	DescribeLogPatternWithContext(aws.Context, *applicationinsights.DescribeLogPatternInput, ...request.Option) (*applicationinsights.DescribeLogPatternOutput, error)
	DescribeLogPatternRequest(*applicationinsights.DescribeLogPatternInput) (*request.Request, *applicationinsights.DescribeLogPatternOutput)

	DescribeObservation(*applicationinsights.DescribeObservationInput) (*applicationinsights.DescribeObservationOutput, error)
	DescribeObservationWithContext(aws.Context, *applicationinsights.DescribeObservationInput, ...request.Option) (*applicationinsights.DescribeObservationOutput, error)
	DescribeObservationRequest(*applicationinsights.DescribeObservationInput) (*request.Request, *applicationinsights.DescribeObservationOutput)

	DescribeProblem(*applicationinsights.DescribeProblemInput) (*applicationinsights.DescribeProblemOutput, error)
	DescribeProblemWithContext(aws.Context, *applicationinsights.DescribeProblemInput, ...request.Option) (*applicationinsights.DescribeProblemOutput, error)
	DescribeProblemRequest(*applicationinsights.DescribeProblemInput) (*request.Request, *applicationinsights.DescribeProblemOutput)

	DescribeProblemObservations(*applicationinsights.DescribeProblemObservationsInput) (*applicationinsights.DescribeProblemObservationsOutput, error)
	DescribeProblemObservationsWithContext(aws.Context, *applicationinsights.DescribeProblemObservationsInput, ...request.Option) (*applicationinsights.DescribeProblemObservationsOutput, error)
	DescribeProblemObservationsRequest(*applicationinsights.DescribeProblemObservationsInput) (*request.Request, *applicationinsights.DescribeProblemObservationsOutput)

	DescribeWorkload(*applicationinsights.DescribeWorkloadInput) (*applicationinsights.DescribeWorkloadOutput, error)
	DescribeWorkloadWithContext(aws.Context, *applicationinsights.DescribeWorkloadInput, ...request.Option) (*applicationinsights.DescribeWorkloadOutput, error)
	DescribeWorkloadRequest(*applicationinsights.DescribeWorkloadInput) (*request.Request, *applicationinsights.DescribeWorkloadOutput)

	ListApplications(*applicationinsights.ListApplicationsInput) (*applicationinsights.ListApplicationsOutput, error)
	ListApplicationsWithContext(aws.Context, *applicationinsights.ListApplicationsInput, ...request.Option) (*applicationinsights.ListApplicationsOutput, error)
	ListApplicationsRequest(*applicationinsights.ListApplicationsInput) (*request.Request, *applicationinsights.ListApplicationsOutput)

	ListApplicationsPages(*applicationinsights.ListApplicationsInput, func(*applicationinsights.ListApplicationsOutput, bool) bool) error
	ListApplicationsPagesWithContext(aws.Context, *applicationinsights.ListApplicationsInput, func(*applicationinsights.ListApplicationsOutput, bool) bool, ...request.Option) error

	ListComponents(*applicationinsights.ListComponentsInput) (*applicationinsights.ListComponentsOutput, error)
	ListComponentsWithContext(aws.Context, *applicationinsights.ListComponentsInput, ...request.Option) (*applicationinsights.ListComponentsOutput, error)
	ListComponentsRequest(*applicationinsights.ListComponentsInput) (*request.Request, *applicationinsights.ListComponentsOutput)

	ListComponentsPages(*applicationinsights.ListComponentsInput, func(*applicationinsights.ListComponentsOutput, bool) bool) error
	ListComponentsPagesWithContext(aws.Context, *applicationinsights.ListComponentsInput, func(*applicationinsights.ListComponentsOutput, bool) bool, ...request.Option) error

	ListConfigurationHistory(*applicationinsights.ListConfigurationHistoryInput) (*applicationinsights.ListConfigurationHistoryOutput, error)
	ListConfigurationHistoryWithContext(aws.Context, *applicationinsights.ListConfigurationHistoryInput, ...request.Option) (*applicationinsights.ListConfigurationHistoryOutput, error)
	ListConfigurationHistoryRequest(*applicationinsights.ListConfigurationHistoryInput) (*request.Request, *applicationinsights.ListConfigurationHistoryOutput)

	ListConfigurationHistoryPages(*applicationinsights.ListConfigurationHistoryInput, func(*applicationinsights.ListConfigurationHistoryOutput, bool) bool) error
	ListConfigurationHistoryPagesWithContext(aws.Context, *applicationinsights.ListConfigurationHistoryInput, func(*applicationinsights.ListConfigurationHistoryOutput, bool) bool, ...request.Option) error

	ListLogPatternSets(*applicationinsights.ListLogPatternSetsInput) (*applicationinsights.ListLogPatternSetsOutput, error)
	ListLogPatternSetsWithContext(aws.Context, *applicationinsights.ListLogPatternSetsInput, ...request.Option) (*applicationinsights.ListLogPatternSetsOutput, error)
	ListLogPatternSetsRequest(*applicationinsights.ListLogPatternSetsInput) (*request.Request, *applicationinsights.ListLogPatternSetsOutput)

	ListLogPatternSetsPages(*applicationinsights.ListLogPatternSetsInput, func(*applicationinsights.ListLogPatternSetsOutput, bool) bool) error
	ListLogPatternSetsPagesWithContext(aws.Context, *applicationinsights.ListLogPatternSetsInput, func(*applicationinsights.ListLogPatternSetsOutput, bool) bool, ...request.Option) error

	ListLogPatterns(*applicationinsights.ListLogPatternsInput) (*applicationinsights.ListLogPatternsOutput, error)
	ListLogPatternsWithContext(aws.Context, *applicationinsights.ListLogPatternsInput, ...request.Option) (*applicationinsights.ListLogPatternsOutput, error)
	ListLogPatternsRequest(*applicationinsights.ListLogPatternsInput) (*request.Request, *applicationinsights.ListLogPatternsOutput)

	ListLogPatternsPages(*applicationinsights.ListLogPatternsInput, func(*applicationinsights.ListLogPatternsOutput, bool) bool) error
	ListLogPatternsPagesWithContext(aws.Context, *applicationinsights.ListLogPatternsInput, func(*applicationinsights.ListLogPatternsOutput, bool) bool, ...request.Option) error

	ListProblems(*applicationinsights.ListProblemsInput) (*applicationinsights.ListProblemsOutput, error)
	ListProblemsWithContext(aws.Context, *applicationinsights.ListProblemsInput, ...request.Option) (*applicationinsights.ListProblemsOutput, error)
	ListProblemsRequest(*applicationinsights.ListProblemsInput) (*request.Request, *applicationinsights.ListProblemsOutput)

	ListProblemsPages(*applicationinsights.ListProblemsInput, func(*applicationinsights.ListProblemsOutput, bool) bool) error
	ListProblemsPagesWithContext(aws.Context, *applicationinsights.ListProblemsInput, func(*applicationinsights.ListProblemsOutput, bool) bool, ...request.Option) error

	ListTagsForResource(*applicationinsights.ListTagsForResourceInput) (*applicationinsights.ListTagsForResourceOutput, error)
	ListTagsForResourceWithContext(aws.Context, *applicationinsights.ListTagsForResourceInput, ...request.Option) (*applicationinsights.ListTagsForResourceOutput, error)
	ListTagsForResourceRequest(*applicationinsights.ListTagsForResourceInput) (*request.Request, *applicationinsights.ListTagsForResourceOutput)

	ListWorkloads(*applicationinsights.ListWorkloadsInput) (*applicationinsights.ListWorkloadsOutput, error)
	ListWorkloadsWithContext(aws.Context, *applicationinsights.ListWorkloadsInput, ...request.Option) (*applicationinsights.ListWorkloadsOutput, error)
	ListWorkloadsRequest(*applicationinsights.ListWorkloadsInput) (*request.Request, *applicationinsights.ListWorkloadsOutput)

	ListWorkloadsPages(*applicationinsights.ListWorkloadsInput, func(*applicationinsights.ListWorkloadsOutput, bool) bool) error
	ListWorkloadsPagesWithContext(aws.Context, *applicationinsights.ListWorkloadsInput, func(*applicationinsights.ListWorkloadsOutput, bool) bool, ...request.Option) error

	RemoveWorkload(*applicationinsights.RemoveWorkloadInput) (*applicationinsights.RemoveWorkloadOutput, error)
	RemoveWorkloadWithContext(aws.Context, *applicationinsights.RemoveWorkloadInput, ...request.Option) (*applicationinsights.RemoveWorkloadOutput, error)
	RemoveWorkloadRequest(*applicationinsights.RemoveWorkloadInput) (*request.Request, *applicationinsights.RemoveWorkloadOutput)

	TagResource(*applicationinsights.TagResourceInput) (*applicationinsights.TagResourceOutput, error)
	TagResourceWithContext(aws.Context, *applicationinsights.TagResourceInput, ...request.Option) (*applicationinsights.TagResourceOutput, error)
	TagResourceRequest(*applicationinsights.TagResourceInput) (*request.Request, *applicationinsights.TagResourceOutput)

	UntagResource(*applicationinsights.UntagResourceInput) (*applicationinsights.UntagResourceOutput, error)
	UntagResourceWithContext(aws.Context, *applicationinsights.UntagResourceInput, ...request.Option) (*applicationinsights.UntagResourceOutput, error)
	UntagResourceRequest(*applicationinsights.UntagResourceInput) (*request.Request, *applicationinsights.UntagResourceOutput)

	UpdateApplication(*applicationinsights.UpdateApplicationInput) (*applicationinsights.UpdateApplicationOutput, error)
	UpdateApplicationWithContext(aws.Context, *applicationinsights.UpdateApplicationInput, ...request.Option) (*applicationinsights.UpdateApplicationOutput, error)
	UpdateApplicationRequest(*applicationinsights.UpdateApplicationInput) (*request.Request, *applicationinsights.UpdateApplicationOutput)

	UpdateComponent(*applicationinsights.UpdateComponentInput) (*applicationinsights.UpdateComponentOutput, error)
	UpdateComponentWithContext(aws.Context, *applicationinsights.UpdateComponentInput, ...request.Option) (*applicationinsights.UpdateComponentOutput, error)
	UpdateComponentRequest(*applicationinsights.UpdateComponentInput) (*request.Request, *applicationinsights.UpdateComponentOutput)

	UpdateComponentConfiguration(*applicationinsights.UpdateComponentConfigurationInput) (*applicationinsights.UpdateComponentConfigurationOutput, error)
	UpdateComponentConfigurationWithContext(aws.Context, *applicationinsights.UpdateComponentConfigurationInput, ...request.Option) (*applicationinsights.UpdateComponentConfigurationOutput, error)
	UpdateComponentConfigurationRequest(*applicationinsights.UpdateComponentConfigurationInput) (*request.Request, *applicationinsights.UpdateComponentConfigurationOutput)

	UpdateLogPattern(*applicationinsights.UpdateLogPatternInput) (*applicationinsights.UpdateLogPatternOutput, error)
	UpdateLogPatternWithContext(aws.Context, *applicationinsights.UpdateLogPatternInput, ...request.Option) (*applicationinsights.UpdateLogPatternOutput, error)
	UpdateLogPatternRequest(*applicationinsights.UpdateLogPatternInput) (*request.Request, *applicationinsights.UpdateLogPatternOutput)

	UpdateProblem(*applicationinsights.UpdateProblemInput) (*applicationinsights.UpdateProblemOutput, error)
	UpdateProblemWithContext(aws.Context, *applicationinsights.UpdateProblemInput, ...request.Option) (*applicationinsights.UpdateProblemOutput, error)
	UpdateProblemRequest(*applicationinsights.UpdateProblemInput) (*request.Request, *applicationinsights.UpdateProblemOutput)

	UpdateWorkload(*applicationinsights.UpdateWorkloadInput) (*applicationinsights.UpdateWorkloadOutput, error)
	UpdateWorkloadWithContext(aws.Context, *applicationinsights.UpdateWorkloadInput, ...request.Option) (*applicationinsights.UpdateWorkloadOutput, error)
	UpdateWorkloadRequest(*applicationinsights.UpdateWorkloadInput) (*request.Request, *applicationinsights.UpdateWorkloadOutput)
}

ApplicationInsightsAPI provides an interface to enable mocking the applicationinsights.ApplicationInsights 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 CloudWatch Application Insights.
func myFunc(svc applicationinsightsiface.ApplicationInsightsAPI) bool {
    // Make svc.AddWorkload request
}

func main() {
    sess := session.New()
    svc := applicationinsights.New(sess)

    myFunc(svc)
}

In your _test.go file:

// Define a mock struct to be used in your unit tests of myFunc.
type mockApplicationInsightsClient struct {
    applicationinsightsiface.ApplicationInsightsAPI
}
func (m *mockApplicationInsightsClient) AddWorkload(input *applicationinsights.AddWorkloadInput) (*applicationinsights.AddWorkloadOutput, error) {
    // mock response/functionality
}

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

    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