// Code generated by smithy-go-codegen DO NOT EDIT.

package applicationdiscoveryservice

import (
	"context"
	"github.com/aws/aws-sdk-go-v2/service/applicationdiscoveryservice/types"
	"github.com/aws/smithy-go/middleware"
	smithyhttp "github.com/aws/smithy-go/transport/http"
)

// Deletes one or more import tasks, each identified by their import ID. Each
// import task has a number of records that can identify servers or applications.
//
// Amazon Web Services Application Discovery Service has built-in matching logic
// that will identify when discovered servers match existing entries that you've
// previously discovered, the information for the already-existing discovered
// server is updated. When you delete an import task that contains records that
// were used to match, the information in those matched records that comes from the
// deleted records will also be deleted.
func (c *Client) BatchDeleteImportData(ctx context.Context, params *BatchDeleteImportDataInput, optFns ...func(*Options)) (*BatchDeleteImportDataOutput, error) {
	if params == nil {
		params = &BatchDeleteImportDataInput{}
	}

	result, metadata, err := c.invokeOperation(ctx, "BatchDeleteImportData", params, optFns, c.addOperationBatchDeleteImportDataMiddlewares)
	if err != nil {
		return nil, err
	}

	out := result.(*BatchDeleteImportDataOutput)
	out.ResultMetadata = metadata
	return out, nil
}

type BatchDeleteImportDataInput struct {

	// The IDs for the import tasks that you want to delete.
	//
	// This member is required.
	ImportTaskIds []string

	//  Set to true to remove the deleted import task from DescribeImportTasks.
	DeleteHistory bool

	noSmithyDocumentSerde
}

type BatchDeleteImportDataOutput struct {

	// Error messages returned for each import task that you deleted as a response for
	// this command.
	Errors []types.BatchDeleteImportDataError

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

func (c *Client) addOperationBatchDeleteImportDataMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsAwsjson11_serializeOpBatchDeleteImportData{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpBatchDeleteImportData{}, middleware.After)
	if err != nil {
		return err
	}

	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
		return err
	}
	if err = addComputeContentLength(stack); err != nil {
		return err
	}
	if err = addResolveEndpointMiddleware(stack, options); err != nil {
		return err
	}
	if err = addComputePayloadSHA256(stack); err != nil {
		return err
	}
	if err = addRecordResponseTiming(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = addCredentialSource(stack, options); err != nil {
		return err
	}
	if err = addOpBatchDeleteImportDataValidationMiddleware(stack); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "BatchDeleteImportData"), middleware.Before); err != nil {
		return err
	}
	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
		return err
	}
	if err = addResponseErrorMiddleware(stack); err != nil {
		return err
	}
	if err = addRequestResponseLogging(stack, options); err != nil {
		return err
	}
	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
		return err
	}
	if err = addInterceptors(stack, options); err != nil {
		return err
	}
	return nil
}
