// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package machinelearning import ( "context" "fmt" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/internal/awsutil" ) type AddTagsInput struct { _ struct{} `type:"structure"` // The ID of the ML object to tag. For example, exampleModelId. // // ResourceId is a required field ResourceId *string `min:"1" type:"string" required:"true"` // The type of the ML object to tag. // // ResourceType is a required field ResourceType TaggableResourceType `type:"string" required:"true" enum:"true"` // The key-value pairs to use to create tags. If you specify a key without specifying // a value, Amazon ML creates a tag with the specified key and a value of null. // // Tags is a required field Tags []Tag `type:"list" required:"true"` } // String returns the string representation func (s AddTagsInput) String() string { return awsutil.Prettify(s) } // Validate inspects the fields of the type to determine if they are valid. func (s *AddTagsInput) Validate() error { invalidParams := aws.ErrInvalidParams{Context: "AddTagsInput"} if s.ResourceId == nil { invalidParams.Add(aws.NewErrParamRequired("ResourceId")) } if s.ResourceId != nil && len(*s.ResourceId) < 1 { invalidParams.Add(aws.NewErrParamMinLen("ResourceId", 1)) } if len(s.ResourceType) == 0 { invalidParams.Add(aws.NewErrParamRequired("ResourceType")) } if s.Tags == nil { invalidParams.Add(aws.NewErrParamRequired("Tags")) } if s.Tags != nil { for i, v := range s.Tags { if err := v.Validate(); err != nil { invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(aws.ErrInvalidParams)) } } } if invalidParams.Len() > 0 { return invalidParams } return nil } // Amazon ML returns the following elements. type AddTagsOutput struct { _ struct{} `type:"structure"` // The ID of the ML object that was tagged. ResourceId *string `min:"1" type:"string"` // The type of the ML object that was tagged. ResourceType TaggableResourceType `type:"string" enum:"true"` } // String returns the string representation func (s AddTagsOutput) String() string { return awsutil.Prettify(s) } const opAddTags = "AddTags" // AddTagsRequest returns a request value for making API operation for // Amazon Machine Learning. // // Adds one or more tags to an object, up to a limit of 10. Each tag consists // of a key and an optional value. If you add a tag using a key that is already // associated with the ML object, AddTags updates the tag's value. // // // Example sending a request using AddTagsRequest. // req := client.AddTagsRequest(params) // resp, err := req.Send(context.TODO()) // if err == nil { // fmt.Println(resp) // } func (c *Client) AddTagsRequest(input *AddTagsInput) AddTagsRequest { op := &aws.Operation{ Name: opAddTags, HTTPMethod: "POST", HTTPPath: "/", } if input == nil { input = &AddTagsInput{} } req := c.newRequest(op, input, &AddTagsOutput{}) return AddTagsRequest{Request: req, Input: input, Copy: c.AddTagsRequest} } // AddTagsRequest is the request type for the // AddTags API operation. type AddTagsRequest struct { *aws.Request Input *AddTagsInput Copy func(*AddTagsInput) AddTagsRequest } // Send marshals and sends the AddTags API request. func (r AddTagsRequest) Send(ctx context.Context) (*AddTagsResponse, error) { r.Request.SetContext(ctx) err := r.Request.Send() if err != nil { return nil, err } resp := &AddTagsResponse{ AddTagsOutput: r.Request.Data.(*AddTagsOutput), response: &aws.Response{Request: r.Request}, } return resp, nil } // AddTagsResponse is the response type for the // AddTags API operation. type AddTagsResponse struct { *AddTagsOutput response *aws.Response } // SDKResponseMetdata returns the response metadata for the // AddTags request. func (r *AddTagsResponse) SDKResponseMetdata() *aws.Response { return r.response }