...
AWS SDK for Go API Reference
import "github.com/aws/aws-sdk-go/service/kendra/kendraiface"
Overview
Index

Overview ▾

Package kendraiface provides an interface to enable mocking the AWSKendraFrontendService 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 ▾

Package files

interface.go

type KendraAPI

type KendraAPI interface {
    BatchDeleteDocument(*kendra.BatchDeleteDocumentInput) (*kendra.BatchDeleteDocumentOutput, error)
    BatchDeleteDocumentWithContext(aws.Context, *kendra.BatchDeleteDocumentInput, ...request.Option) (*kendra.BatchDeleteDocumentOutput, error)
    BatchDeleteDocumentRequest(*kendra.BatchDeleteDocumentInput) (*request.Request, *kendra.BatchDeleteDocumentOutput)

    BatchPutDocument(*kendra.BatchPutDocumentInput) (*kendra.BatchPutDocumentOutput, error)
    BatchPutDocumentWithContext(aws.Context, *kendra.BatchPutDocumentInput, ...request.Option) (*kendra.BatchPutDocumentOutput, error)
    BatchPutDocumentRequest(*kendra.BatchPutDocumentInput) (*request.Request, *kendra.BatchPutDocumentOutput)

    CreateDataSource(*kendra.CreateDataSourceInput) (*kendra.CreateDataSourceOutput, error)
    CreateDataSourceWithContext(aws.Context, *kendra.CreateDataSourceInput, ...request.Option) (*kendra.CreateDataSourceOutput, error)
    CreateDataSourceRequest(*kendra.CreateDataSourceInput) (*request.Request, *kendra.CreateDataSourceOutput)

    CreateFaq(*kendra.CreateFaqInput) (*kendra.CreateFaqOutput, error)
    CreateFaqWithContext(aws.Context, *kendra.CreateFaqInput, ...request.Option) (*kendra.CreateFaqOutput, error)
    CreateFaqRequest(*kendra.CreateFaqInput) (*request.Request, *kendra.CreateFaqOutput)

    CreateIndex(*kendra.CreateIndexInput) (*kendra.CreateIndexOutput, error)
    CreateIndexWithContext(aws.Context, *kendra.CreateIndexInput, ...request.Option) (*kendra.CreateIndexOutput, error)
    CreateIndexRequest(*kendra.CreateIndexInput) (*request.Request, *kendra.CreateIndexOutput)

    DeleteDataSource(*kendra.DeleteDataSourceInput) (*kendra.DeleteDataSourceOutput, error)
    DeleteDataSourceWithContext(aws.Context, *kendra.DeleteDataSourceInput, ...request.Option) (*kendra.DeleteDataSourceOutput, error)
    DeleteDataSourceRequest(*kendra.DeleteDataSourceInput) (*request.Request, *kendra.DeleteDataSourceOutput)

    DeleteFaq(*kendra.DeleteFaqInput) (*kendra.DeleteFaqOutput, error)
    DeleteFaqWithContext(aws.Context, *kendra.DeleteFaqInput, ...request.Option) (*kendra.DeleteFaqOutput, error)
    DeleteFaqRequest(*kendra.DeleteFaqInput) (*request.Request, *kendra.DeleteFaqOutput)

    DeleteIndex(*kendra.DeleteIndexInput) (*kendra.DeleteIndexOutput, error)
    DeleteIndexWithContext(aws.Context, *kendra.DeleteIndexInput, ...request.Option) (*kendra.DeleteIndexOutput, error)
    DeleteIndexRequest(*kendra.DeleteIndexInput) (*request.Request, *kendra.DeleteIndexOutput)

    DescribeDataSource(*kendra.DescribeDataSourceInput) (*kendra.DescribeDataSourceOutput, error)
    DescribeDataSourceWithContext(aws.Context, *kendra.DescribeDataSourceInput, ...request.Option) (*kendra.DescribeDataSourceOutput, error)
    DescribeDataSourceRequest(*kendra.DescribeDataSourceInput) (*request.Request, *kendra.DescribeDataSourceOutput)

    DescribeFaq(*kendra.DescribeFaqInput) (*kendra.DescribeFaqOutput, error)
    DescribeFaqWithContext(aws.Context, *kendra.DescribeFaqInput, ...request.Option) (*kendra.DescribeFaqOutput, error)
    DescribeFaqRequest(*kendra.DescribeFaqInput) (*request.Request, *kendra.DescribeFaqOutput)

    DescribeIndex(*kendra.DescribeIndexInput) (*kendra.DescribeIndexOutput, error)
    DescribeIndexWithContext(aws.Context, *kendra.DescribeIndexInput, ...request.Option) (*kendra.DescribeIndexOutput, error)
    DescribeIndexRequest(*kendra.DescribeIndexInput) (*request.Request, *kendra.DescribeIndexOutput)

    ListDataSourceSyncJobs(*kendra.ListDataSourceSyncJobsInput) (*kendra.ListDataSourceSyncJobsOutput, error)
    ListDataSourceSyncJobsWithContext(aws.Context, *kendra.ListDataSourceSyncJobsInput, ...request.Option) (*kendra.ListDataSourceSyncJobsOutput, error)
    ListDataSourceSyncJobsRequest(*kendra.ListDataSourceSyncJobsInput) (*request.Request, *kendra.ListDataSourceSyncJobsOutput)

    ListDataSourceSyncJobsPages(*kendra.ListDataSourceSyncJobsInput, func(*kendra.ListDataSourceSyncJobsOutput, bool) bool) error
    ListDataSourceSyncJobsPagesWithContext(aws.Context, *kendra.ListDataSourceSyncJobsInput, func(*kendra.ListDataSourceSyncJobsOutput, bool) bool, ...request.Option) error

    ListDataSources(*kendra.ListDataSourcesInput) (*kendra.ListDataSourcesOutput, error)
    ListDataSourcesWithContext(aws.Context, *kendra.ListDataSourcesInput, ...request.Option) (*kendra.ListDataSourcesOutput, error)
    ListDataSourcesRequest(*kendra.ListDataSourcesInput) (*request.Request, *kendra.ListDataSourcesOutput)

    ListDataSourcesPages(*kendra.ListDataSourcesInput, func(*kendra.ListDataSourcesOutput, bool) bool) error
    ListDataSourcesPagesWithContext(aws.Context, *kendra.ListDataSourcesInput, func(*kendra.ListDataSourcesOutput, bool) bool, ...request.Option) error

    ListFaqs(*kendra.ListFaqsInput) (*kendra.ListFaqsOutput, error)
    ListFaqsWithContext(aws.Context, *kendra.ListFaqsInput, ...request.Option) (*kendra.ListFaqsOutput, error)
    ListFaqsRequest(*kendra.ListFaqsInput) (*request.Request, *kendra.ListFaqsOutput)

    ListIndices(*kendra.ListIndicesInput) (*kendra.ListIndicesOutput, error)
    ListIndicesWithContext(aws.Context, *kendra.ListIndicesInput, ...request.Option) (*kendra.ListIndicesOutput, error)
    ListIndicesRequest(*kendra.ListIndicesInput) (*request.Request, *kendra.ListIndicesOutput)

    ListIndicesPages(*kendra.ListIndicesInput, func(*kendra.ListIndicesOutput, bool) bool) error
    ListIndicesPagesWithContext(aws.Context, *kendra.ListIndicesInput, func(*kendra.ListIndicesOutput, bool) bool, ...request.Option) error

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

    Query(*kendra.QueryInput) (*kendra.QueryOutput, error)
    QueryWithContext(aws.Context, *kendra.QueryInput, ...request.Option) (*kendra.QueryOutput, error)
    QueryRequest(*kendra.QueryInput) (*request.Request, *kendra.QueryOutput)

    StartDataSourceSyncJob(*kendra.StartDataSourceSyncJobInput) (*kendra.StartDataSourceSyncJobOutput, error)
    StartDataSourceSyncJobWithContext(aws.Context, *kendra.StartDataSourceSyncJobInput, ...request.Option) (*kendra.StartDataSourceSyncJobOutput, error)
    StartDataSourceSyncJobRequest(*kendra.StartDataSourceSyncJobInput) (*request.Request, *kendra.StartDataSourceSyncJobOutput)

    StopDataSourceSyncJob(*kendra.StopDataSourceSyncJobInput) (*kendra.StopDataSourceSyncJobOutput, error)
    StopDataSourceSyncJobWithContext(aws.Context, *kendra.StopDataSourceSyncJobInput, ...request.Option) (*kendra.StopDataSourceSyncJobOutput, error)
    StopDataSourceSyncJobRequest(*kendra.StopDataSourceSyncJobInput) (*request.Request, *kendra.StopDataSourceSyncJobOutput)

    SubmitFeedback(*kendra.SubmitFeedbackInput) (*kendra.SubmitFeedbackOutput, error)
    SubmitFeedbackWithContext(aws.Context, *kendra.SubmitFeedbackInput, ...request.Option) (*kendra.SubmitFeedbackOutput, error)
    SubmitFeedbackRequest(*kendra.SubmitFeedbackInput) (*request.Request, *kendra.SubmitFeedbackOutput)

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

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

    UpdateDataSource(*kendra.UpdateDataSourceInput) (*kendra.UpdateDataSourceOutput, error)
    UpdateDataSourceWithContext(aws.Context, *kendra.UpdateDataSourceInput, ...request.Option) (*kendra.UpdateDataSourceOutput, error)
    UpdateDataSourceRequest(*kendra.UpdateDataSourceInput) (*request.Request, *kendra.UpdateDataSourceOutput)

    UpdateIndex(*kendra.UpdateIndexInput) (*kendra.UpdateIndexOutput, error)
    UpdateIndexWithContext(aws.Context, *kendra.UpdateIndexInput, ...request.Option) (*kendra.UpdateIndexOutput, error)
    UpdateIndexRequest(*kendra.UpdateIndexInput) (*request.Request, *kendra.UpdateIndexOutput)
}

KendraAPI provides an interface to enable mocking the kendra.Kendra 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
// AWSKendraFrontendService.
func myFunc(svc kendraiface.KendraAPI) bool {
    // Make svc.BatchDeleteDocument request
}

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

    myFunc(svc)
}

In your _test.go file:

// Define a mock struct to be used in your unit tests of myFunc.
type mockKendraClient struct {
    kendraiface.KendraAPI
}
func (m *mockKendraClient) BatchDeleteDocument(input *kendra.BatchDeleteDocumentInput) (*kendra.BatchDeleteDocumentOutput, error) {
    // mock response/functionality
}

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

    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.