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

package cleanrooms

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

// Invalidates a specific intermediate table that references the caller's base
// table. The data provider (base table owner) calls this operation, not the
// intermediate table owner. By default, invalidation cascades to descendant
// intermediate tables.
func (c *Client) DisallowIntermediateTable(ctx context.Context, params *DisallowIntermediateTableInput, optFns ...func(*Options)) (*DisallowIntermediateTableOutput, error) {
	if params == nil {
		params = &DisallowIntermediateTableInput{}
	}

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

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

type DisallowIntermediateTableInput struct {

	// The name of the intermediate table to disallow.
	//
	// This member is required.
	IntermediateTableName *string

	// The unique identifier of the membership that contains the intermediate table to
	// disallow.
	//
	// This member is required.
	MembershipIdentifier *string

	// Specifies whether to cascade the disallow action to descendant intermediate
	// tables. Default is true .
	IncludeDescendants *bool

	noSmithyDocumentSerde
}

type DisallowIntermediateTableOutput struct {
	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

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