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

package codedeploy

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

// Gets information about an application revision.
func (c *Client) GetApplicationRevision(ctx context.Context, params *GetApplicationRevisionInput, optFns ...func(*Options)) (*GetApplicationRevisionOutput, error) {
	if params == nil {
		params = &GetApplicationRevisionInput{}
	}

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

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

// Represents the input of a GetApplicationRevision operation.
type GetApplicationRevisionInput struct {

	// The name of the application that corresponds to the revision.
	//
	// This member is required.
	ApplicationName *string

	// Information about the application revision to get, including type and location.
	//
	// This member is required.
	Revision *types.RevisionLocation

	noSmithyDocumentSerde
}

// Represents the output of a GetApplicationRevision operation.
type GetApplicationRevisionOutput struct {

	// The name of the application that corresponds to the revision.
	ApplicationName *string

	// Additional information about the revision, including type and location.
	Revision *types.RevisionLocation

	// General information about the revision.
	RevisionInfo *types.GenericRevisionInfo

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

	noSmithyDocumentSerde
}

func (c *Client) addOperationGetApplicationRevisionMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetApplicationRevision{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetApplicationRevision{}, 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, 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 = addCredentialSource(stack, options); err != nil {
		return err
	}
	if err = addOpGetApplicationRevisionValidationMiddleware(stack); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "GetApplicationRevision"), 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
}
