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

package backup

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

// Returns information about a saved resource, including the last time it was
// backed up, its Amazon Resource Name (ARN), and the Amazon Web Services service
// type of the saved resource.
func (c *Client) DescribeProtectedResource(ctx context.Context, params *DescribeProtectedResourceInput, optFns ...func(*Options)) (*DescribeProtectedResourceOutput, error) {
	if params == nil {
		params = &DescribeProtectedResourceInput{}
	}

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

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

type DescribeProtectedResourceInput struct {

	// An Amazon Resource Name (ARN) that uniquely identifies a resource. The format
	// of the ARN depends on the resource type.
	//
	// This member is required.
	ResourceArn *string

	noSmithyDocumentSerde
}

type DescribeProtectedResourceOutput struct {

	// The date and time that a resource was last backed up, in Unix format and
	// Coordinated Universal Time (UTC). The value of LastBackupTime is accurate to
	// milliseconds. For example, the value 1516925490.087 represents Friday, January
	// 26, 2018 12:11:30.087 AM.
	LastBackupTime *time.Time

	// The ARN (Amazon Resource Name) of the backup vault that contains the most
	// recent backup recovery point.
	LastBackupVaultArn *string

	// The ARN (Amazon Resource Name) of the most recent recovery point.
	LastRecoveryPointArn *string

	// The time, in minutes, that the most recent restore job took to complete.
	LatestRestoreExecutionTimeMinutes *int64

	// The creation date of the most recent restore job.
	LatestRestoreJobCreationDate *time.Time

	// The date the most recent recovery point was created.
	LatestRestoreRecoveryPointCreationDate *time.Time

	// An ARN that uniquely identifies a resource. The format of the ARN depends on
	// the resource type.
	ResourceArn *string

	// The name of the resource that belongs to the specified backup.
	ResourceName *string

	// The type of Amazon Web Services resource saved as a recovery point; for
	// example, an Amazon EBS volume or an Amazon RDS database.
	ResourceType *string

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

	noSmithyDocumentSerde
}

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