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

package cloudwatchlogs

import (
	"context"
	"github.com/aws/smithy-go/middleware"
	smithyhttp "github.com/aws/smithy-go/transport/http"
)

// Retrieves the full content of a lookup table, including the CSV data.
func (c *Client) GetLookupTable(ctx context.Context, params *GetLookupTableInput, optFns ...func(*Options)) (*GetLookupTableOutput, error) {
	if params == nil {
		params = &GetLookupTableInput{}
	}

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

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

type GetLookupTableInput struct {

	// The ARN of the lookup table to retrieve.
	//
	// This member is required.
	LookupTableArn *string

	noSmithyDocumentSerde
}

type GetLookupTableOutput struct {

	// The description of the lookup table.
	Description *string

	// The ARN of the KMS key used to encrypt the lookup table data, if applicable.
	KmsKeyId *string

	// The time when the lookup table was last updated, expressed as the number of
	// milliseconds after Jan 1, 1970 00:00:00 UTC .
	LastUpdatedTime *int64

	// The ARN of the lookup table.
	LookupTableArn *string

	// The name of the lookup table.
	LookupTableName *string

	// The size of the lookup table in bytes.
	SizeBytes *int64

	// The full CSV content of the lookup table.
	TableBody *string

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

	noSmithyDocumentSerde
}

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