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

package acm

import (
	"context"
	"github.com/aws/aws-sdk-go-v2/service/acm/types"
	"github.com/aws/smithy-go/middleware"
	"github.com/aws/smithy-go/ptr"
)

// Updates a certificate. You can use this function to specify whether to export
// your certificate. Certificate transparency logging opt-out is no longer
// available. For more information, see [Certificate Transparency Logging]and [Certificate Manager Exportable Managed Certificates].
//
// [Certificate Manager Exportable Managed Certificates]: https://docs.aws.amazon.com/acm/latest/userguide/acm-exportable-certificates.html
// [Certificate Transparency Logging]: https://docs.aws.amazon.com/acm/latest/userguide/acm-concepts.html#concept-transparency
func (c *Client) UpdateCertificateOptions(ctx context.Context, params *UpdateCertificateOptionsInput, optFns ...func(*Options)) (*UpdateCertificateOptionsOutput, error) {
	if params == nil {
		params = &UpdateCertificateOptionsInput{}
	}

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

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

type UpdateCertificateOptionsInput struct {

	// ARN of the requested certificate to update. This must be of the form:
	//
	//     arn:aws:acm:us-east-1:account:certificate/12345678-1234-1234-1234-123456789012
	//
	// This member is required.
	CertificateArn *string

	// Use to update the options for your certificate. Currently, you can specify
	// whether to export your certificate. Certificate transparency logging opt-out is
	// no longer available. All public certificates are recorded in a certificate
	// transparency log. For more information, see [Certificate Transparency Logging].
	//
	// [Certificate Transparency Logging]: https://docs.aws.amazon.com/acm/latest/userguide/acm-concepts.html#concept-transparency
	//
	// This member is required.
	Options *types.CertificateOptions

	noSmithyDocumentSerde
}

func (in *UpdateCertificateOptionsInput) bindEndpointParams(p *EndpointParameters) {

	p.ServiceType = ptr.String("ACM")
}

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

	noSmithyDocumentSerde
}

func (c *Client) addOperationUpdateCertificateOptionsMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateCertificateOptions{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateCertificateOptions{}, middleware.After)
	if 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 = addCredentialSource(stack, options); err != nil {
		return err
	}
	if err = addOpUpdateCertificateOptionsValidationMiddleware(stack); 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
}
