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

package cloudformation

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

// Returns information about a CloudFormation extension publisher.
//
// If you don't supply a PublisherId , and you have registered as an extension
// publisher, DescribePublisher returns information about your own publisher
// account.
//
// For more information about registering as a publisher, see:
//
// [RegisterPublisher]
//
// [Publishing extensions to make them available for public use]
//   - in the CloudFormation Command Line Interface (CLI) User Guide
//
// [Publishing extensions to make them available for public use]: https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/publish-extension.html
// [RegisterPublisher]: https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_RegisterPublisher.html
func (c *Client) DescribePublisher(ctx context.Context, params *DescribePublisherInput, optFns ...func(*Options)) (*DescribePublisherOutput, error) {
	if params == nil {
		params = &DescribePublisherInput{}
	}

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

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

type DescribePublisherInput struct {

	// The ID of the extension publisher.
	//
	// If you don't supply a PublisherId , and you have registered as an extension
	// publisher, DescribePublisher returns information about your own publisher
	// account.
	PublisherId *string

	noSmithyDocumentSerde
}

type DescribePublisherOutput struct {

	// The type of account used as the identity provider when registering this
	// publisher with CloudFormation.
	IdentityProvider types.IdentityProvider

	// The ID of the extension publisher.
	PublisherId *string

	// The URL to the publisher's profile with the identity provider.
	PublisherProfile *string

	// Whether the publisher is verified. Currently, all registered publishers are
	// verified.
	PublisherStatus types.PublisherStatus

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

	noSmithyDocumentSerde
}

func (c *Client) addOperationDescribePublisherMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribePublisher{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribePublisher{}, 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, "DescribePublisher"), 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
}
