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

package cleanroomsml

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

// Returns information about a trained model.
func (c *Client) GetTrainedModel(ctx context.Context, params *GetTrainedModelInput, optFns ...func(*Options)) (*GetTrainedModelOutput, error) {
	if params == nil {
		params = &GetTrainedModelInput{}
	}

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

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

type GetTrainedModelInput struct {

	// The membership ID of the member that created the trained model that you are
	// interested in.
	//
	// This member is required.
	MembershipIdentifier *string

	// The Amazon Resource Name (ARN) of the trained model that you are interested in.
	//
	// This member is required.
	TrainedModelArn *string

	// The version identifier of the trained model to retrieve. If not specified, the
	// operation returns information about the latest version of the trained model.
	VersionIdentifier *string

	noSmithyDocumentSerde
}

type GetTrainedModelOutput struct {

	// The collaboration ID of the collaboration that contains the trained model.
	//
	// This member is required.
	CollaborationIdentifier *string

	// The Amazon Resource Name (ARN) of the configured model algorithm association
	// that was used to create the trained model.
	//
	// This member is required.
	ConfiguredModelAlgorithmAssociationArn *string

	// The time at which the trained model was created.
	//
	// This member is required.
	CreateTime *time.Time

	// The data channels that were used for the trained model.
	//
	// This member is required.
	DataChannels []types.ModelTrainingDataChannel

	// The membership ID of the member that created the trained model.
	//
	// This member is required.
	MembershipIdentifier *string

	// The name of the trained model.
	//
	// This member is required.
	Name *string

	// The status of the trained model.
	//
	// This member is required.
	Status types.TrainedModelStatus

	// The Amazon Resource Name (ARN) of the trained model.
	//
	// This member is required.
	TrainedModelArn *string

	// The most recent time at which the trained model was updated.
	//
	// This member is required.
	UpdateTime *time.Time

	// The description of the trained model.
	Description *string

	// The EC2 environment that was used to create the trained model.
	Environment map[string]string

	// The hyperparameters that were used to create the trained model.
	Hyperparameters map[string]string

	// Information about the incremental training data channels used to create this
	// version of the trained model. This includes details about the base model that
	// was used for incremental training and the channel configuration.
	IncrementalTrainingDataChannels []types.IncrementalTrainingDataChannelOutput

	// The Amazon Resource Name (ARN) of the KMS key. This key is used to encrypt and
	// decrypt customer-owned data in the trained ML model and associated data.
	KmsKeyArn *string

	// The logs status for the trained model.
	LogsStatus types.LogsStatus

	// Details about the logs status for the trained model.
	LogsStatusDetails *string

	// The status of the model metrics.
	MetricsStatus types.MetricsStatus

	// Details about the metrics status for the trained model.
	MetricsStatusDetails *string

	// The EC2 resource configuration that was used to create the trained model.
	ResourceConfig *types.ResourceConfig

	// Details about the status of a resource.
	StatusDetails *types.StatusDetails

	// The stopping condition that was used to terminate model training.
	StoppingCondition *types.StoppingCondition

	// The optional metadata that you applied to the resource to help you categorize
	// and organize them. Each tag consists of a key and an optional value, both of
	// which you define.
	//
	// The following basic restrictions apply to tags:
	//
	//   - Maximum number of tags per resource - 50.
	//
	//   - For each resource, each tag key must be unique, and each tag key can have
	//   only one value.
	//
	//   - Maximum key length - 128 Unicode characters in UTF-8.
	//
	//   - Maximum value length - 256 Unicode characters in UTF-8.
	//
	//   - If your tagging schema is used across multiple services and resources,
	//   remember that other services may have restrictions on allowed characters.
	//   Generally allowed characters are: letters, numbers, and spaces representable in
	//   UTF-8, and the following characters: + - = . _ : / @.
	//
	//   - Tag keys and values are case sensitive.
	//
	//   - Do not use aws:, AWS:, or any upper or lowercase combination of such as a
	//   prefix for keys as it is reserved for AWS use. You cannot edit or delete tag
	//   keys with this prefix. Values can have this prefix. If a tag value has aws as
	//   its prefix but the key does not, then Clean Rooms ML considers it to be a user
	//   tag and will count against the limit of 50 tags. Tags with only the key prefix
	//   of aws do not count against your tags per resource limit.
	Tags map[string]string

	// Information about the training image container.
	TrainingContainerImageDigest *string

	// The input mode that was used for accessing the training data when this trained
	// model was created. This indicates how the training data was made available to
	// the training algorithm.
	TrainingInputMode types.TrainingInputMode

	// The version identifier of the trained model. This unique identifier
	// distinguishes this version from other versions of the same trained model.
	VersionIdentifier *string

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

	noSmithyDocumentSerde
}

func (c *Client) addOperationGetTrainedModelMiddlewares(stack *middleware.Stack, options Options) (err error) {
	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
		return err
	}
	err = stack.Serialize.Add(&awsRestjson1_serializeOpGetTrainedModel{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetTrainedModel{}, middleware.After)
	if err != nil {
		return err
	}
	if err := addProtocolFinalizerMiddlewares(stack, options, "GetTrainedModel"); err != nil {
		return fmt.Errorf("add protocol finalizers: %v", err)
	}

	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
		return err
	}
	if err = addSetLoggerMiddleware(stack, options); err != nil {
		return err
	}
	if err = addClientRequestID(stack); 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 = addRetry(stack, options); err != nil {
		return err
	}
	if err = addRawResponseToMetadata(stack); err != nil {
		return err
	}
	if err = addRecordResponseTiming(stack); err != nil {
		return err
	}
	if err = addSpanRetryLoop(stack, options); err != nil {
		return err
	}
	if err = addClientUserAgent(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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
		return err
	}
	if err = addTimeOffsetBuild(stack, c); err != nil {
		return err
	}
	if err = addUserAgentRetryMode(stack, options); err != nil {
		return err
	}
	if err = addCredentialSource(stack, options); err != nil {
		return err
	}
	if err = addOpGetTrainedModelValidationMiddleware(stack); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetTrainedModel(options.Region), middleware.Before); err != nil {
		return err
	}
	if err = addRecursionDetection(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 = addInterceptBeforeRetryLoop(stack, options); err != nil {
		return err
	}
	if err = addInterceptAttempt(stack, options); err != nil {
		return err
	}
	if err = addInterceptors(stack, options); err != nil {
		return err
	}
	return nil
}

func newServiceMetadataMiddleware_opGetTrainedModel(region string) *awsmiddleware.RegisterServiceMetadata {
	return &awsmiddleware.RegisterServiceMetadata{
		Region:        region,
		ServiceID:     ServiceID,
		OperationName: "GetTrainedModel",
	}
}
