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

package codecatalyst

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

// Stops a session for a specified Dev Environment.
func (c *Client) StopDevEnvironmentSession(ctx context.Context, params *StopDevEnvironmentSessionInput, optFns ...func(*Options)) (*StopDevEnvironmentSessionOutput, error) {
	if params == nil {
		params = &StopDevEnvironmentSessionInput{}
	}

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

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

type StopDevEnvironmentSessionInput struct {

	// The system-generated unique ID of the Dev Environment. To obtain this ID, use ListDevEnvironments.
	//
	// This member is required.
	Id *string

	// The name of the project in the space.
	//
	// This member is required.
	ProjectName *string

	// The system-generated unique ID of the Dev Environment session. This ID is
	// returned by StartDevEnvironmentSession.
	//
	// This member is required.
	SessionId *string

	// The name of the space.
	//
	// This member is required.
	SpaceName *string

	noSmithyDocumentSerde
}

type StopDevEnvironmentSessionOutput struct {

	// The system-generated unique ID of the Dev Environment.
	//
	// This member is required.
	Id *string

	// The name of the project in the space.
	//
	// This member is required.
	ProjectName *string

	// The system-generated unique ID of the Dev Environment session.
	//
	// This member is required.
	SessionId *string

	// The name of the space.
	//
	// This member is required.
	SpaceName *string

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

	noSmithyDocumentSerde
}

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