1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package sagemaker 4 5import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 9 "github.com/aws/aws-sdk-go-v2/service/sagemaker/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Create a machine learning algorithm that you can use in Amazon SageMaker and 15// list in the AWS Marketplace. 16func (c *Client) CreateAlgorithm(ctx context.Context, params *CreateAlgorithmInput, optFns ...func(*Options)) (*CreateAlgorithmOutput, error) { 17 if params == nil { 18 params = &CreateAlgorithmInput{} 19 } 20 21 result, metadata, err := c.invokeOperation(ctx, "CreateAlgorithm", params, optFns, addOperationCreateAlgorithmMiddlewares) 22 if err != nil { 23 return nil, err 24 } 25 26 out := result.(*CreateAlgorithmOutput) 27 out.ResultMetadata = metadata 28 return out, nil 29} 30 31type CreateAlgorithmInput struct { 32 33 // The name of the algorithm. 34 // 35 // This member is required. 36 AlgorithmName *string 37 38 // Specifies details about training jobs run by this algorithm, including the 39 // following: 40 // 41 // * The Amazon ECR path of the container and the version digest of the 42 // algorithm. 43 // 44 // * The hyperparameters that the algorithm supports. 45 // 46 // * The instance 47 // types that the algorithm supports for training. 48 // 49 // * Whether the algorithm 50 // supports distributed training. 51 // 52 // * The metrics that the algorithm emits to Amazon 53 // CloudWatch. 54 // 55 // * Which metrics that the algorithm emits can be used as the 56 // objective metric for hyperparameter tuning jobs. 57 // 58 // * The input channels that the 59 // algorithm supports for training data. For example, an algorithm might support 60 // train, validation, and test channels. 61 // 62 // This member is required. 63 TrainingSpecification *types.TrainingSpecification 64 65 // A description of the algorithm. 66 AlgorithmDescription *string 67 68 // Whether to certify the algorithm so that it can be listed in AWS Marketplace. 69 CertifyForMarketplace bool 70 71 // Specifies details about inference jobs that the algorithm runs, including the 72 // following: 73 // 74 // * The Amazon ECR paths of containers that contain the inference code 75 // and model artifacts. 76 // 77 // * The instance types that the algorithm supports for 78 // transform jobs and real-time endpoints used for inference. 79 // 80 // * The input and 81 // output content formats that the algorithm supports for inference. 82 InferenceSpecification *types.InferenceSpecification 83 84 // An array of key-value pairs. You can use tags to categorize your AWS resources 85 // in different ways, for example, by purpose, owner, or environment. For more 86 // information, see Tagging AWS Resources 87 // (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html). 88 Tags []types.Tag 89 90 // Specifies configurations for one or more training jobs and that Amazon SageMaker 91 // runs to test the algorithm's training code and, optionally, one or more batch 92 // transform jobs that Amazon SageMaker runs to test the algorithm's inference 93 // code. 94 ValidationSpecification *types.AlgorithmValidationSpecification 95} 96 97type CreateAlgorithmOutput struct { 98 99 // The Amazon Resource Name (ARN) of the new algorithm. 100 // 101 // This member is required. 102 AlgorithmArn *string 103 104 // Metadata pertaining to the operation's result. 105 ResultMetadata middleware.Metadata 106} 107 108func addOperationCreateAlgorithmMiddlewares(stack *middleware.Stack, options Options) (err error) { 109 err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateAlgorithm{}, middleware.After) 110 if err != nil { 111 return err 112 } 113 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateAlgorithm{}, middleware.After) 114 if err != nil { 115 return err 116 } 117 if err = addSetLoggerMiddleware(stack, options); err != nil { 118 return err 119 } 120 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 121 return err 122 } 123 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 124 return err 125 } 126 if err = addResolveEndpointMiddleware(stack, options); err != nil { 127 return err 128 } 129 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 130 return err 131 } 132 if err = addRetryMiddlewares(stack, options); err != nil { 133 return err 134 } 135 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 136 return err 137 } 138 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 139 return err 140 } 141 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 142 return err 143 } 144 if err = addClientUserAgent(stack); err != nil { 145 return err 146 } 147 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 148 return err 149 } 150 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 151 return err 152 } 153 if err = addOpCreateAlgorithmValidationMiddleware(stack); err != nil { 154 return err 155 } 156 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAlgorithm(options.Region), middleware.Before); err != nil { 157 return err 158 } 159 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 160 return err 161 } 162 if err = addResponseErrorMiddleware(stack); err != nil { 163 return err 164 } 165 if err = addRequestResponseLogging(stack, options); err != nil { 166 return err 167 } 168 return nil 169} 170 171func newServiceMetadataMiddleware_opCreateAlgorithm(region string) *awsmiddleware.RegisterServiceMetadata { 172 return &awsmiddleware.RegisterServiceMetadata{ 173 Region: region, 174 ServiceID: ServiceID, 175 SigningName: "sagemaker", 176 OperationName: "CreateAlgorithm", 177 } 178} 179