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

package datazone

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

// Gets an asset filter.
//
// Prerequisites:
//
//   - Domain ( --domain-identifier ), asset ( --asset-identifier ), and filter (
//     --identifier ) must all exist.
//
//   - The asset filter should not have been deleted.
//
//   - The asset must still exist (since the filter is linked to it).
func (c *Client) GetAssetFilter(ctx context.Context, params *GetAssetFilterInput, optFns ...func(*Options)) (*GetAssetFilterOutput, error) {
	if params == nil {
		params = &GetAssetFilterInput{}
	}

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

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

type GetAssetFilterInput struct {

	// The ID of the data asset.
	//
	// This member is required.
	AssetIdentifier *string

	// The ID of the domain where you want to get an asset filter.
	//
	// This member is required.
	DomainIdentifier *string

	// The ID of the asset filter.
	//
	// This member is required.
	Identifier *string

	noSmithyDocumentSerde
}

type GetAssetFilterOutput struct {

	// The ID of the data asset.
	//
	// This member is required.
	AssetId *string

	// The configuration of the asset filter.
	//
	// This member is required.
	Configuration types.AssetFilterConfiguration

	// The ID of the domain where you want to get an asset filter.
	//
	// This member is required.
	DomainId *string

	// The ID of the asset filter.
	//
	// This member is required.
	Id *string

	// The name of the asset filter.
	//
	// This member is required.
	Name *string

	// The timestamp at which the asset filter was created.
	CreatedAt *time.Time

	// The description of the asset filter.
	Description *string

	// The column names of the asset filter.
	EffectiveColumnNames []string

	// The row filter of the asset filter.
	EffectiveRowFilter *string

	// The error message that is displayed if the action does not complete
	// successfully.
	ErrorMessage *string

	// The status of the asset filter.
	Status types.FilterStatus

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

	noSmithyDocumentSerde
}

func (c *Client) addOperationGetAssetFilterMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsRestjson1_serializeOpGetAssetFilter{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetAssetFilter{}, 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 = addOpGetAssetFilterValidationMiddleware(stack); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "GetAssetFilter"), 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
}
