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

package ec2

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

// Disables the block public access for snapshots setting at the account level for
// the specified Amazon Web Services Region. After you disable block public access
// for snapshots in a Region, users can publicly share snapshots in that Region.
//
// Enabling block public access for snapshots in block-all-sharing mode does not
// change the permissions for snapshots that are already publicly shared. Instead,
// it prevents these snapshots from be publicly visible and publicly accessible.
// Therefore, the attributes for these snapshots still indicate that they are
// publicly shared, even though they are not publicly available.
//
// If you disable block public access , these snapshots will become publicly
// available again.
//
// For more information, see [Block public access for snapshots] in the Amazon EBS User Guide .
//
// [Block public access for snapshots]: https://docs.aws.amazon.com/ebs/latest/userguide/block-public-access-snapshots.html
func (c *Client) DisableSnapshotBlockPublicAccess(ctx context.Context, params *DisableSnapshotBlockPublicAccessInput, optFns ...func(*Options)) (*DisableSnapshotBlockPublicAccessOutput, error) {
	if params == nil {
		params = &DisableSnapshotBlockPublicAccessInput{}
	}

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

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

type DisableSnapshotBlockPublicAccessInput struct {

	// Checks whether you have the required permissions for the action, without
	// actually making the request, and provides an error response. If you have the
	// required permissions, the error response is DryRunOperation . Otherwise, it is
	// UnauthorizedOperation .
	DryRun *bool

	noSmithyDocumentSerde
}

type DisableSnapshotBlockPublicAccessOutput struct {

	// Returns unblocked if the request succeeds.
	State types.SnapshotBlockPublicAccessState

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

	noSmithyDocumentSerde
}

func (c *Client) addOperationDisableSnapshotBlockPublicAccessMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsEc2query_serializeOpDisableSnapshotBlockPublicAccess{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsEc2query_deserializeOpDisableSnapshotBlockPublicAccess{}, 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 = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "DisableSnapshotBlockPublicAccess"), 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
}
